diff --git a/source/dbStructureView.cpp b/source/dbStructureView.cpp index 74f1f4a..2895cd1 100644 --- a/source/dbStructureView.cpp +++ b/source/dbStructureView.cpp @@ -266,20 +266,22 @@ void DBStructureView::showContextMenu(const QPoint& pos) if(model && index.isValid()) expand(index); })->setEnabled(!isConnected); - menu.addAction(QString::fromWCharArray(L"断开链接"), [this, &connName]{disconnectCurConnection();})->setEnabled(isConnected); + menu.addAction(QString::fromWCharArray(L"断开链接"), [this]{disconnectCurConnection();})->setEnabled(isConnected); menu.addAction(QString::fromWCharArray(L"刷新"), [this, &connName]{ DBStructureModel* model = dynamic_cast(this->model()); if(model) model->refreshStructure_Connection(connName); })->setEnabled(isConnected); - menu.addAction(QString::fromWCharArray(L"移除链接"), [this, &connName, node]{ + menu.addAction(QString::fromWCharArray(L"移除链接"), [this, &connName, node, isConnected]{ if(m_pMainWindow) { m_pMainWindow->showMessageDialog(type_question, QString::fromWCharArray(L"提示"), - QString::fromWCharArray(L"确认删除链接 '%1' 吗").arg(connName)); + QString::fromWCharArray(L"确认移除链接 '%1' 吗").arg(connName)); if(g_msgDlgBtn == btn_No) return; } + if(isConnected) + disconnectCurConnection(); removeNode(node); }); menu.addSeparator();