mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add editFinished signal which can be used to auto save the database.
This commit is contained in:
parent
27794021d9
commit
056447fad9
@ -511,6 +511,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()));
|
||||
}
|
||||
|
||||
DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget()
|
||||
@ -531,17 +532,25 @@ 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()) {
|
||||
|
@ -82,6 +82,7 @@ Q_SIGNALS:
|
||||
void tabNameChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void autoSave();
|
||||
void updateTabName(Database* db);
|
||||
void updateTabNameFromSender();
|
||||
void openDatabaseDialog(const QString& pw = QString(), const QString& keyFile = QString());
|
||||
|
@ -147,6 +147,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), SLOT(updateGroupActions(Group*)));
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
|
||||
connect(m_groupView, SIGNAL(editFinished()), this, SIGNAL(editFinished()));
|
||||
connect(m_entryView, SIGNAL(entryActivated(Entry*)), SLOT(switchToEntryEdit(Entry*)));
|
||||
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
||||
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
|
||||
@ -258,6 +259,8 @@ void DatabaseWidget::cloneEntry()
|
||||
entry->setGroup(currentEntry->group());
|
||||
m_entryView->setFocus();
|
||||
m_entryView->setCurrentEntry(entry);
|
||||
|
||||
Q_EMIT editFinished();
|
||||
}
|
||||
|
||||
void DatabaseWidget::deleteEntry()
|
||||
@ -282,6 +285,8 @@ void DatabaseWidget::deleteEntry()
|
||||
else {
|
||||
m_db->recycleEntry(currentEntry);
|
||||
}
|
||||
|
||||
Q_EMIT editFinished();
|
||||
}
|
||||
|
||||
void DatabaseWidget::copyUsername()
|
||||
@ -341,6 +346,8 @@ void DatabaseWidget::deleteGroup()
|
||||
else {
|
||||
m_db->recycleGroup(currentGroup);
|
||||
}
|
||||
|
||||
Q_EMIT editFinished();
|
||||
}
|
||||
|
||||
int DatabaseWidget::addWidget(QWidget* w)
|
||||
@ -398,6 +405,8 @@ void DatabaseWidget::switchToView(bool accepted)
|
||||
m_newParent = 0;
|
||||
}
|
||||
|
||||
Q_EMIT editFinished();
|
||||
|
||||
setCurrentIndex(0);
|
||||
}
|
||||
|
||||
@ -446,6 +455,8 @@ void DatabaseWidget::updateMasterKey(bool accepted)
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT editFinished();
|
||||
|
||||
setCurrentIndex(0);
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
Q_SIGNALS:
|
||||
void closeRequest();
|
||||
void currentModeChanged(DatabaseWidget::Mode mode);
|
||||
void editFinished();
|
||||
|
||||
public Q_SLOTS:
|
||||
void createEntry();
|
||||
|
@ -74,6 +74,7 @@ void GroupView::expandedChanged(const QModelIndex& index)
|
||||
{
|
||||
Group* group = m_model->groupFromIndex(index);
|
||||
group->setExpanded(isExpanded(index));
|
||||
Q_EMIT editFinished();
|
||||
}
|
||||
|
||||
void GroupView::recInitExpanded(Group* group)
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void groupChanged(Group* group);
|
||||
void editFinished();
|
||||
|
||||
private Q_SLOTS:
|
||||
void expandedChanged(const QModelIndex& index);
|
||||
|
Loading…
Reference in New Issue
Block a user