完善‘移除链接’操作

This commit is contained in:
duanshengchao 2025-05-19 15:11:54 +08:00
parent ce2e12962e
commit 719fd134b1
1 changed files with 5 additions and 3 deletions

View File

@ -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<DBStructureModel*>(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();