mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 08:49:42 -05:00
parent
ba3baf3595
commit
f0985ff9d9
@ -88,6 +88,7 @@ void Config::init(const QString& fileName)
|
||||
m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
|
||||
m_defaults.insert("RememberLastDatabases", true);
|
||||
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
||||
m_defaults.insert("ModifiedOnExpandedStateChanges", true);
|
||||
m_defaults.insert("AutoSaveAfterEveryChange", false);
|
||||
m_defaults.insert("AutoSaveOnExit", false);
|
||||
|
@ -226,6 +226,9 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
|
||||
void DatabaseTabWidget::deleteDatabase(Database* db)
|
||||
{
|
||||
const DatabaseManagerStruct dbStruct = m_dbList.value(db);
|
||||
bool emitDatabaseWithFileClosed = dbStruct.saveToFilename;
|
||||
QString filePath = dbStruct.filePath;
|
||||
|
||||
int index = databaseIndex(db);
|
||||
|
||||
removeTab(index);
|
||||
@ -233,6 +236,10 @@ void DatabaseTabWidget::deleteDatabase(Database* db)
|
||||
m_dbList.remove(db);
|
||||
delete dbStruct.dbWidget;
|
||||
delete db;
|
||||
|
||||
if (emitDatabaseWithFileClosed) {
|
||||
Q_EMIT databaseWithFileClosed(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseTabWidget::closeAllDatabases()
|
||||
|
@ -74,6 +74,7 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
void tabNameChanged();
|
||||
void databaseWithFileClosed(QString filePath);
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateTabName(Database* db);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ private Q_SLOTS:
|
||||
void showEntryContextMenu(const QPoint& globalPos);
|
||||
void showGroupContextMenu(const QPoint& globalPos);
|
||||
void saveToolbarState(bool value);
|
||||
void rememberOpenDatabases(QString filePath);
|
||||
|
||||
private:
|
||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||
@ -68,6 +69,7 @@ private:
|
||||
QAction* m_clearHistoryAction;
|
||||
QActionGroup* m_lastDatabasesActions;
|
||||
QActionGroup* m_copyAdditionalAttributeActions;
|
||||
QStringList openDatabases;
|
||||
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user