mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge pull request #57 from JosefVitu/lock-on-minimize
Implement automatic locking when minimizing
This commit is contained in:
commit
82ace81974
@ -101,6 +101,7 @@ void Config::init(const QString& fileName)
|
||||
m_defaults.insert("security/clearclipboardtimeout", 10);
|
||||
m_defaults.insert("security/lockdatabaseidle", false);
|
||||
m_defaults.insert("security/lockdatabaseidlesec", 10);
|
||||
m_defaults.insert("security/lockdatabaseminimize", false);
|
||||
m_defaults.insert("security/passwordscleartext", false);
|
||||
m_defaults.insert("security/autotypeask", true);
|
||||
m_defaults.insert("GUI/Language", "system");
|
||||
|
@ -516,6 +516,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
event->ignore();
|
||||
hide();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -534,12 +539,17 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
|
||||
void MainWindow::changeEvent(QEvent* event)
|
||||
{
|
||||
if ((event->type() == QEvent::WindowStateChange) && isMinimized()
|
||||
&& isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
||||
&& config()->get("GUI/MinimizeToTray").toBool())
|
||||
{
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
if ((event->type() == QEvent::WindowStateChange) && isMinimized()) {
|
||||
if (isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
||||
&& config()->get("GUI/MinimizeToTray").toBool())
|
||||
{
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
}
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMainWindow::changeEvent(event);
|
||||
@ -674,6 +684,10 @@ void MainWindow::toggleWindow()
|
||||
{
|
||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||
hide();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ensurePolished();
|
||||
|
@ -138,6 +138,7 @@ void SettingsWidget::loadSettings()
|
||||
|
||||
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());
|
||||
|
||||
m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool());
|
||||
|
||||
@ -181,6 +182,7 @@ void SettingsWidget::saveSettings()
|
||||
|
||||
config()->set("security/lockdatabaseidle", m_secUi->lockDatabaseIdleCheckBox->isChecked());
|
||||
config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());
|
||||
config()->set("security/lockdatabaseminimize", m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
||||
|
||||
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
|
||||
|
||||
|
@ -58,13 +58,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="lockDatabaseMinimizeCheckBox">
|
||||
<property name="text">
|
||||
<string>Lock databases after minimizing the window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="passwordCleartextCheckBox">
|
||||
<property name="text">
|
||||
<string>Show passwords in cleartext by default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="autoTypeAskCheckBox">
|
||||
<property name="text">
|
||||
<string>Always ask before performing auto-type</string>
|
||||
|
Loading…
Reference in New Issue
Block a user