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/clearclipboardtimeout", 10);
|
||||||
m_defaults.insert("security/lockdatabaseidle", false);
|
m_defaults.insert("security/lockdatabaseidle", false);
|
||||||
m_defaults.insert("security/lockdatabaseidlesec", 10);
|
m_defaults.insert("security/lockdatabaseidlesec", 10);
|
||||||
|
m_defaults.insert("security/lockdatabaseminimize", false);
|
||||||
m_defaults.insert("security/passwordscleartext", false);
|
m_defaults.insert("security/passwordscleartext", false);
|
||||||
m_defaults.insert("security/autotypeask", true);
|
m_defaults.insert("security/autotypeask", true);
|
||||||
m_defaults.insert("GUI/Language", "system");
|
m_defaults.insert("GUI/Language", "system");
|
||||||
|
@ -516,6 +516,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
|
m_ui->tabWidget->lockDatabases();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,13 +539,18 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||||||
|
|
||||||
void MainWindow::changeEvent(QEvent* event)
|
void MainWindow::changeEvent(QEvent* event)
|
||||||
{
|
{
|
||||||
if ((event->type() == QEvent::WindowStateChange) && isMinimized()
|
if ((event->type() == QEvent::WindowStateChange) && isMinimized()) {
|
||||||
&& isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
if (isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
||||||
&& config()->get("GUI/MinimizeToTray").toBool())
|
&& config()->get("GUI/MinimizeToTray").toBool())
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
|
m_ui->tabWidget->lockDatabases();
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
QMainWindow::changeEvent(event);
|
QMainWindow::changeEvent(event);
|
||||||
}
|
}
|
||||||
@ -674,6 +684,10 @@ void MainWindow::toggleWindow()
|
|||||||
{
|
{
|
||||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
|
m_ui->tabWidget->lockDatabases();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
|
@ -138,6 +138,7 @@ void SettingsWidget::loadSettings()
|
|||||||
|
|
||||||
m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get("security/lockdatabaseidle").toBool());
|
m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get("security/lockdatabaseidle").toBool());
|
||||||
m_secUi->lockDatabaseIdleSpinBox->setValue(config()->get("security/lockdatabaseidlesec").toInt());
|
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());
|
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/lockdatabaseidle", m_secUi->lockDatabaseIdleCheckBox->isChecked());
|
||||||
config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());
|
config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());
|
||||||
|
config()->set("security/lockdatabaseminimize", m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
||||||
|
|
||||||
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
|
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
|
||||||
|
|
||||||
|
@ -58,13 +58,20 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<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">
|
<widget class="QCheckBox" name="passwordCleartextCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show passwords in cleartext by default</string>
|
<string>Show passwords in cleartext by default</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="autoTypeAskCheckBox">
|
<widget class="QCheckBox" name="autoTypeAskCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Always ask before performing auto-type</string>
|
<string>Always ask before performing auto-type</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user