mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 22:17:39 +03:00
Improve auto save handling.
This commit is contained in:
parent
b0ad864fe0
commit
204822b66f
11 changed files with 52 additions and 54 deletions
|
@ -503,7 +503,6 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
|
|||
updateTabName(db);
|
||||
int index = databaseIndex(db);
|
||||
setCurrentIndex(index);
|
||||
|
||||
connect(db, SIGNAL(nameTextChanged()), SLOT(updateTabNameFromSender()));
|
||||
connect(dbStruct.dbWidget->entryView(), SIGNAL(entrySelectionChanged()),
|
||||
SLOT(emitEntrySelectionChanged()));
|
||||
|
@ -511,7 +510,7 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
|
|||
connect(db, SIGNAL(modified()), SLOT(modified()));
|
||||
connect(dbStruct.dbWidget, SIGNAL(currentModeChanged(DatabaseWidget::Mode)),
|
||||
SIGNAL(currentWidgetModeChanged(DatabaseWidget::Mode)));
|
||||
connect(dbStruct.dbWidget, SIGNAL(editFinished()), SLOT(autoSave()));
|
||||
db->setEmitModified(true);
|
||||
}
|
||||
|
||||
DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget()
|
||||
|
@ -532,25 +531,17 @@ void DatabaseTabWidget::modified()
|
|||
Database* db = static_cast<Database*>(sender());
|
||||
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
||||
|
||||
if (config()->get("AutoSaveAfterEveryChange").toBool() && dbStruct.file) {
|
||||
saveDatabase(db);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dbStruct.modified) {
|
||||
dbStruct.modified = true;
|
||||
updateTabName(db);
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseTabWidget::autoSave()
|
||||
{
|
||||
Q_ASSERT(qobject_cast<DatabaseWidget*>(sender()));
|
||||
|
||||
DatabaseWidget* dbWidget = static_cast<DatabaseWidget*>(sender());
|
||||
Database* db = databaseFromDatabaseWidget(dbWidget);
|
||||
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
||||
|
||||
if (dbStruct.modified && config()->get("AutoSaveAfterEveryChange").toBool() && dbStruct.file) {
|
||||
saveDatabase(db);
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseTabWidget::updateLastDatabases(const QString& filename)
|
||||
{
|
||||
if (!config()->get("RememberLastDatabases").toBool()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue