More aggressive saving of changes to the connections. Also remove connection
now removes the connection from the file.
This commit is contained in:
parent
ea30dd9c0e
commit
163bb1d513
11 changed files with 258 additions and 8 deletions
|
|
@ -38,14 +38,19 @@ void ConnectionManagerWindow::on_actionAdd_Connection_triggered()
|
|||
ConnectionConfig c;
|
||||
c.setName("new");
|
||||
m_listModel->add(c);
|
||||
|
||||
// Select the new row
|
||||
auto idx = m_listModel->index(m_listModel->rowCount() - 1, 0);
|
||||
ui->listView->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::Select);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_currentChanged(const QModelIndex ¤t,
|
||||
const QModelIndex &previous)
|
||||
{
|
||||
int currow = current.row();
|
||||
|
||||
m_listModel->save(prevSelection);
|
||||
m_mapper->setCurrentIndex(currow);
|
||||
prevSelection = currow;
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionDelete_connection_triggered()
|
||||
|
|
@ -75,6 +80,7 @@ void ConnectionManagerWindow::on_actionConnect_triggered()
|
|||
// Open a window for this connection, maybe we should first check the connection?
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
auto cc = m_listModel->get(ci.row());
|
||||
m_listModel->save(ci.row());
|
||||
if (cc.valid()) {
|
||||
auto w = new MainWindow;
|
||||
w->setAttribute( Qt::WA_DeleteOnClose );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue