Most of functionality for connections in tree works now. Old list largely removed.
This commit is contained in:
parent
8840d3bcbb
commit
b3a98f6dc0
10 changed files with 399 additions and 158 deletions
|
|
@ -17,7 +17,6 @@ ConnectionManagerWindow::ConnectionManagerWindow(MasterController *master, QWidg
|
|||
, m_connectionController(master->connectionController())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->listView->setModel(m_connectionController->getConnectionListModel());
|
||||
ui->treeView->setModel(m_connectionController->getConnectionTreeModel());
|
||||
}
|
||||
|
||||
|
|
@ -34,23 +33,25 @@ void ConnectionManagerWindow::on_actionAdd_Connection_triggered()
|
|||
|
||||
void ConnectionManagerWindow::on_actionDelete_connection_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
if (ci.isValid()) {
|
||||
auto res = QMessageBox::question(this, "pglab",
|
||||
tr("Are you sure you want to remove this connection?"), QMessageBox::Yes, QMessageBox::No);
|
||||
if (res == QMessageBox::Yes) {
|
||||
auto clm = m_connectionController->getConnectionListModel();
|
||||
clm->removeRow(ci.row());
|
||||
auto node = static_cast<ConnectionNode*>(ci.internalPointer());
|
||||
auto cc = dynamic_cast<ConnectionConfig*>(node);
|
||||
if (cc) {
|
||||
auto res = QMessageBox::question(this, "pglab",
|
||||
tr("Are you sure you want to remove this connection?"), QMessageBox::Yes, QMessageBox::No);
|
||||
if (res == QMessageBox::Yes) {
|
||||
auto cm = m_connectionController->getConnectionTreeModel();
|
||||
cm->removeRow(ci.row(), ci.parent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionConnect_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
if (ci.isValid()) {
|
||||
m_connectionController->openSqlWindowForConnection(ci.row());
|
||||
}
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
m_connectionController->openSqlWindowForConnection(ci);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionQuit_application_triggered()
|
||||
|
|
@ -64,25 +65,25 @@ void ConnectionManagerWindow::on_actionQuit_application_triggered()
|
|||
|
||||
void ConnectionManagerWindow::on_actionBackup_database_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
m_connectionController->openBackupDlgForConnection(ci.row());
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
m_connectionController->openBackupDlgForConnection(ci);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionManage_server_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
m_connectionController->openServerWindowForConnection(ci.row());
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
m_connectionController->openServerWindowForConnection(ci);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_listView_activated(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
m_connectionController->openSqlWindowForConnection(index.row());
|
||||
m_connectionController->openSqlWindowForConnection(index);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionConfigure_connection_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
m_connectionController->editConnection(ci.row());
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
m_connectionController->editConnection(ci);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue