mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-05 05:27:39 +03:00
Truncate history of all items when history limits are changed.
This commit is contained in:
parent
8cd5b1f582
commit
459cf051bf
2 changed files with 19 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue