mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 08:55:31 -05:00
Re-add truncation of history entries.
This commit is contained in:
parent
21302782e1
commit
21e257e64d
@ -19,6 +19,7 @@
|
|||||||
#include "ui_DatabaseSettingsWidget.h"
|
#include "ui_DatabaseSettingsWidget.h"
|
||||||
|
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "keys/CompositeKey.h"
|
#include "keys/CompositeKey.h"
|
||||||
|
|
||||||
@ -84,17 +85,34 @@ void DatabaseSettingsWidget::save()
|
|||||||
meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked());
|
meta->setRecycleBinEnabled(m_ui->recycleBinEnabledCheckBox->isChecked());
|
||||||
m_db->setTransformRounds(m_ui->transformRoundsSpinBox->value());
|
m_db->setTransformRounds(m_ui->transformRoundsSpinBox->value());
|
||||||
|
|
||||||
|
bool truncate = false;
|
||||||
|
|
||||||
|
int historyMaxItems;
|
||||||
if (m_ui->historyMaxItemsCheckBox->isChecked()) {
|
if (m_ui->historyMaxItemsCheckBox->isChecked()) {
|
||||||
meta->setHistoryMaxItems(m_ui->historyMaxItemsSpinBox->value());
|
historyMaxItems = m_ui->historyMaxItemsSpinBox->value();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
meta->setHistoryMaxItems(-1);
|
historyMaxItems = -1;
|
||||||
}
|
}
|
||||||
|
if (historyMaxItems != meta->historyMaxItems()) {
|
||||||
|
meta->setHistoryMaxItems(historyMaxItems);
|
||||||
|
truncate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int historyMaxSize;
|
||||||
if (m_ui->historyMaxSizeCheckBox->isChecked()) {
|
if (m_ui->historyMaxSizeCheckBox->isChecked()) {
|
||||||
meta->setHistoryMaxSize(m_ui->historyMaxSizeSpinBox->value() * 1048576);
|
historyMaxSize = m_ui->historyMaxSizeSpinBox->value() * 1048576;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
meta->setHistoryMaxSize(-1);
|
historyMaxSize = -1;
|
||||||
|
}
|
||||||
|
if (historyMaxSize != meta->historyMaxSize()) {
|
||||||
|
meta->setHistoryMaxSize(historyMaxSize);
|
||||||
|
truncate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (truncate) {
|
||||||
|
truncateHistories();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT editFinished(true);
|
Q_EMIT editFinished(true);
|
||||||
@ -111,3 +129,11 @@ void DatabaseSettingsWidget::transformRoundsBenchmark()
|
|||||||
m_ui->transformRoundsSpinBox->setValue(CompositeKey::transformKeyBenchmark(1000));
|
m_ui->transformRoundsSpinBox->setValue(CompositeKey::transformKeyBenchmark(1000));
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseSettingsWidget::truncateHistories()
|
||||||
|
{
|
||||||
|
QList<Entry*> allEntries = m_db->rootGroup()->entriesRecursive(false);
|
||||||
|
Q_FOREACH (Entry* entry, allEntries) {
|
||||||
|
entry->truncateHistory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -47,6 +47,8 @@ private Q_SLOTS:
|
|||||||
void transformRoundsBenchmark();
|
void transformRoundsBenchmark();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void truncateHistories();
|
||||||
|
|
||||||
const QScopedPointer<Ui::DatabaseSettingsWidget> m_ui;
|
const QScopedPointer<Ui::DatabaseSettingsWidget> m_ui;
|
||||||
Database* m_db;
|
Database* m_db;
|
||||||
|
|
||||||
|
@ -581,14 +581,6 @@ bool DatabaseWidget::canDeleteCurrentGoup()
|
|||||||
return !isRootGroup && !isRecycleBin;
|
return !isRootGroup && !isRecycleBin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseWidget::truncateHistories()
|
|
||||||
{
|
|
||||||
QList<Entry*> allEntries = m_db->rootGroup()->entriesRecursive(false);
|
|
||||||
Q_FOREACH (Entry* entry, allEntries) {
|
|
||||||
entry->truncateHistory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DatabaseWidget::clearLastGroup(Group* group)
|
void DatabaseWidget::clearLastGroup(Group* group)
|
||||||
{
|
{
|
||||||
if (group) {
|
if (group) {
|
||||||
|
@ -110,8 +110,6 @@ private Q_SLOTS:
|
|||||||
void showEntryContextMenu(const QPoint& pos);
|
void showEntryContextMenu(const QPoint& pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void truncateHistories();
|
|
||||||
|
|
||||||
Database* const m_db;
|
Database* const m_db;
|
||||||
const QScopedPointer<Ui::SearchWidget> m_searchUi;
|
const QScopedPointer<Ui::SearchWidget> m_searchUi;
|
||||||
QWidget* const m_searchWidget;
|
QWidget* const m_searchWidget;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user