mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Truncate history of all items when history limits are changed.
This commit is contained in:
parent
8cd5b1f582
commit
459cf051bf
@ -288,8 +288,12 @@ void DatabaseWidget::updateSettings(bool accepted)
|
||||
m_db->metadata()->setDefaultUserName(m_databaseSettingsWidget->defaultUsername());
|
||||
m_db->metadata()->setRecycleBinEnabled(m_databaseSettingsWidget->recylceBinEnabled());
|
||||
m_db->metadata()->setName(m_databaseSettingsWidget->dbName());
|
||||
m_db->metadata()->setHistoryMaxItems(m_databaseSettingsWidget->historyMaxItems());
|
||||
m_db->metadata()->setHistoryMaxSize(m_databaseSettingsWidget->historyMaxSize());
|
||||
if (m_db->metadata()->historyMaxItems() != m_databaseSettingsWidget->historyMaxItems() ||
|
||||
m_db->metadata()->historyMaxSize() != m_databaseSettingsWidget->historyMaxSize()) {
|
||||
m_db->metadata()->setHistoryMaxItems(m_databaseSettingsWidget->historyMaxItems());
|
||||
m_db->metadata()->setHistoryMaxSize(m_databaseSettingsWidget->historyMaxSize());
|
||||
truncateHistories();
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentIndex(0);
|
||||
@ -343,3 +347,13 @@ bool DatabaseWidget::canDeleteCurrentGoup()
|
||||
bool isRecycleBin = m_db->metadata()->recycleBin() == m_groupView->currentGroup();
|
||||
return !isRootGroup && !isRecycleBin;
|
||||
}
|
||||
|
||||
void DatabaseWidget::truncateHistories()
|
||||
{
|
||||
QList<Entry*> allEntries = m_db->rootGroup()->entriesRecursive(false);
|
||||
QListIterator<Entry*> i(allEntries);
|
||||
while (i.hasNext()) {
|
||||
Entry* entry = i.next();
|
||||
entry->truncateHistory();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
void setCurrentIndex(int index);
|
||||
DatabaseWidget::Mode currentMode();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void closeRequest();
|
||||
void currentModeChanged(DatabaseWidget::Mode mode);
|
||||
@ -90,6 +91,8 @@ private:
|
||||
Entry* m_newEntry;
|
||||
Group* m_newParent;
|
||||
QLineEdit* m_searchEdit;
|
||||
|
||||
void truncateHistories();
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_DATABASEWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user