mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Add setting for search results timeout (#3411)
* Fix #3400 * Allow enabling/disabling search timeout * Allow setting search timeout in minutes
This commit is contained in:
parent
6ae27fa47b
commit
726dbc004d
@ -197,6 +197,8 @@ void Config::init(const QString& fileName)
|
||||
m_defaults.insert("FaviconDownloadTimeout", 10);
|
||||
m_defaults.insert("security/clearclipboard", true);
|
||||
m_defaults.insert("security/clearclipboardtimeout", 10);
|
||||
m_defaults.insert("security/clearsearch", true);
|
||||
m_defaults.insert("security/clearsearchtimeout", 5);
|
||||
m_defaults.insert("security/lockdatabaseidle", false);
|
||||
m_defaults.insert("security/lockdatabaseidlesec", 240);
|
||||
m_defaults.insert("security/lockdatabaseminimize", false);
|
||||
|
@ -87,6 +87,8 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
||||
|
||||
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
|
||||
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
|
||||
connect(m_secUi->clearSearchCheckBox, SIGNAL(toggled(bool)),
|
||||
m_secUi->clearSearchSpinBox, SLOT(setEnabled(bool)));
|
||||
connect(m_secUi->lockDatabaseIdleCheckBox, SIGNAL(toggled(bool)),
|
||||
m_secUi->lockDatabaseIdleSpinBox, SLOT(setEnabled(bool)));
|
||||
connect(m_secUi->touchIDResetCheckBox, SIGNAL(toggled(bool)),
|
||||
@ -215,6 +217,9 @@ void ApplicationSettingsWidget::loadSettings()
|
||||
m_secUi->clearClipboardCheckBox->setChecked(config()->get("security/clearclipboard").toBool());
|
||||
m_secUi->clearClipboardSpinBox->setValue(config()->get("security/clearclipboardtimeout").toInt());
|
||||
|
||||
m_secUi->clearSearchCheckBox->setChecked(config()->get("security/clearsearch").toBool());
|
||||
m_secUi->clearSearchSpinBox->setValue(config()->get("security/clearsearchtimeout").toInt());
|
||||
|
||||
m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get("security/lockdatabaseidle").toBool());
|
||||
m_secUi->lockDatabaseIdleSpinBox->setValue(config()->get("security/lockdatabaseidlesec").toInt());
|
||||
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(config()->get("security/lockdatabaseminimize").toBool());
|
||||
@ -299,6 +304,9 @@ void ApplicationSettingsWidget::saveSettings()
|
||||
config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked());
|
||||
config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value());
|
||||
|
||||
config()->set("security/clearsearch", m_secUi->clearSearchCheckBox->isChecked());
|
||||
config()->set("security/clearsearchtimeout", m_secUi->clearSearchSpinBox->value());
|
||||
|
||||
config()->set("security/lockdatabaseidle", m_secUi->lockDatabaseIdleCheckBox->isChecked());
|
||||
config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());
|
||||
config()->set("security/lockdatabaseminimize", m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>595</width>
|
||||
<height>478</height>
|
||||
<height>541</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -61,6 +61,41 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="clearSearchCheckBox">
|
||||
<property name="text">
|
||||
<string>Clear search query after</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="clearSearchSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string comment="Minutes"> min</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1440</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="lockDatabaseIdleCheckBox">
|
||||
<property name="sizePolicy">
|
||||
@ -99,6 +134,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="touchIDResetCheckBox">
|
||||
<property name="text">
|
||||
<string>Forget TouchID after inactivity of</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="touchIDResetSpinBox">
|
||||
<property name="enabled">
|
||||
@ -121,13 +163,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="touchIDResetCheckBox">
|
||||
<property name="text">
|
||||
<string>Forget TouchID after inactivity of</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -116,8 +116,13 @@ bool SearchWidget::eventFilter(QObject* obj, QEvent* event)
|
||||
}
|
||||
}
|
||||
} else if (event->type() == QEvent::FocusOut) {
|
||||
// Auto-clear search after 5 minutes
|
||||
m_clearSearchTimer->start(300000);
|
||||
if (config()->get("security/clearsearch").toBool()) {
|
||||
int timeout = config()->get("security/clearsearchtimeout").toInt();
|
||||
if (timeout > 0) {
|
||||
// Auto-clear search after set timeout (5 minutes by default)
|
||||
m_clearSearchTimer->start(timeout * 60000); // 60 sec * 1000 ms
|
||||
}
|
||||
}
|
||||
} else if (event->type() == QEvent::FocusIn) {
|
||||
m_clearSearchTimer->stop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user