Remember opened databases on quit.

Refs #36
This commit is contained in:
Florian Geyer 2013-03-24 23:21:59 +01:00
parent ba3baf3595
commit f0985ff9d9
5 changed files with 22 additions and 0 deletions

View file

@ -397,12 +397,18 @@ void MainWindow::databaseTabChanged(int tabIndex)
void MainWindow::closeEvent(QCloseEvent* event)
{
openDatabases.clear();
connect(m_ui->tabWidget, SIGNAL(databaseWithFileClosed(QString)), this, SLOT(rememberOpenDatabases(QString)));
if (!m_ui->tabWidget->closeAllDatabases()) {
event->ignore();
}
else {
event->accept();
}
disconnect(m_ui->tabWidget, SIGNAL(databaseWithFileClosed(QString)), this, SLOT(rememberOpenDatabases(QString)));
if (config()->get("OpenPreviousDatabasesOnStartup").toBool()) {
config()->set("OpenDatabasesOnExit", openDatabases);
}
}
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
@ -429,3 +435,8 @@ void MainWindow::setShortcut(QAction* action, QKeySequence::StandardKey standard
action->setShortcut(QKeySequence(fallback));
}
}
void MainWindow::rememberOpenDatabases(QString filePath)
{
openDatabases.append(filePath);
}