2012-05-27 05:09:52 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
|
2017-06-09 17:40:36 -04:00
|
|
|
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
2012-05-27 05:09:52 -04:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
* version 3 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SettingsWidget.h"
|
2012-05-27 18:09:54 -04:00
|
|
|
#include "ui_SettingsWidgetGeneral.h"
|
2012-05-27 05:09:52 -04:00
|
|
|
#include "ui_SettingsWidgetSecurity.h"
|
|
|
|
|
2012-07-14 13:09:28 -04:00
|
|
|
#include "autotype/AutoType.h"
|
2018-03-31 16:01:30 -04:00
|
|
|
#include "config-keepassx.h"
|
2012-05-27 14:10:41 -04:00
|
|
|
#include "core/Config.h"
|
2017-02-21 19:05:24 -05:00
|
|
|
#include "core/FilePath.h"
|
2017-03-10 09:45:00 -05:00
|
|
|
#include "core/Global.h"
|
2018-03-31 16:01:30 -04:00
|
|
|
#include "core/Translator.h"
|
2012-05-27 14:10:41 -04:00
|
|
|
|
2018-04-04 11:39:26 -04:00
|
|
|
#include "touchid/TouchID.h"
|
|
|
|
|
2015-01-30 03:04:27 -05:00
|
|
|
class SettingsWidget::ExtraPage
|
|
|
|
{
|
2018-03-31 16:01:30 -04:00
|
|
|
public:
|
|
|
|
ExtraPage(ISettingsPage* page, QWidget* widget)
|
|
|
|
: settingsPage(page)
|
|
|
|
, widget(widget)
|
|
|
|
{
|
|
|
|
}
|
2015-01-30 03:04:27 -05:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
void loadSettings() const
|
|
|
|
{
|
|
|
|
settingsPage->loadSettings(widget);
|
|
|
|
}
|
2015-01-30 03:04:27 -05:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
void saveSettings() const
|
|
|
|
{
|
|
|
|
settingsPage->saveSettings(widget);
|
|
|
|
}
|
2015-01-30 03:04:27 -05:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
private:
|
|
|
|
QSharedPointer<ISettingsPage> settingsPage;
|
|
|
|
QWidget* widget;
|
2015-01-30 03:04:27 -05:00
|
|
|
};
|
|
|
|
|
2012-05-27 05:09:52 -04:00
|
|
|
SettingsWidget::SettingsWidget(QWidget* parent)
|
|
|
|
: EditWidget(parent)
|
|
|
|
, m_secWidget(new QWidget())
|
2012-05-27 18:09:54 -04:00
|
|
|
, m_generalWidget(new QWidget())
|
2012-05-27 05:09:52 -04:00
|
|
|
, m_secUi(new Ui::SettingsWidgetSecurity())
|
2012-05-27 18:09:54 -04:00
|
|
|
, m_generalUi(new Ui::SettingsWidgetGeneral())
|
2014-03-22 07:07:06 -04:00
|
|
|
, m_globalAutoTypeKey(static_cast<Qt::Key>(0))
|
|
|
|
, m_globalAutoTypeModifiers(Qt::NoModifier)
|
2012-05-27 05:09:52 -04:00
|
|
|
{
|
2012-05-27 05:12:12 -04:00
|
|
|
setHeadline(tr("Application Settings"));
|
2012-05-27 05:09:52 -04:00
|
|
|
|
|
|
|
m_secUi->setupUi(m_secWidget);
|
2012-05-27 18:09:54 -04:00
|
|
|
m_generalUi->setupUi(m_generalWidget);
|
2017-02-22 08:05:59 -05:00
|
|
|
addPage(tr("General"), FilePath::instance()->icon("categories", "preferences-other"), m_generalWidget);
|
|
|
|
addPage(tr("Security"), FilePath::instance()->icon("status", "security-high"), m_secWidget);
|
2012-05-27 05:09:52 -04:00
|
|
|
|
2017-02-22 09:30:27 -05:00
|
|
|
if (!autoType()->isAvailable()) {
|
|
|
|
m_generalUi->generalSettingsTabWidget->removeTab(1);
|
|
|
|
}
|
|
|
|
|
2012-05-27 05:09:52 -04:00
|
|
|
connect(this, SIGNAL(accepted()), SLOT(saveSettings()));
|
2017-06-28 16:09:32 -04:00
|
|
|
connect(this, SIGNAL(apply()), SLOT(saveSettings()));
|
2012-05-27 14:29:15 -04:00
|
|
|
connect(this, SIGNAL(rejected()), SLOT(reject()));
|
2012-05-27 05:09:52 -04:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
connect(
|
|
|
|
m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), this, SLOT(enableAutoSaveOnExit(bool)));
|
|
|
|
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), this, SLOT(enableSystray(bool)));
|
2012-06-10 15:54:58 -04:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
connect(
|
|
|
|
m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)), m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
|
|
|
|
connect(m_secUi->lockDatabaseIdleCheckBox,
|
|
|
|
SIGNAL(toggled(bool)),
|
|
|
|
m_secUi->lockDatabaseIdleSpinBox,
|
|
|
|
SLOT(setEnabled(bool)));
|
2017-06-28 18:32:47 -04:00
|
|
|
|
2018-04-04 11:39:26 -04:00
|
|
|
connect(m_secUi->touchIDResetCheckBox,
|
|
|
|
SIGNAL(toggled(bool)),
|
|
|
|
m_secUi->touchIDResetSpinBox,
|
|
|
|
SLOT(setEnabled(bool)));
|
|
|
|
|
2018-01-16 18:56:47 -05:00
|
|
|
#ifndef WITH_XC_NETWORKING
|
2017-06-28 18:32:47 -04:00
|
|
|
m_secUi->privacy->setVisible(false);
|
|
|
|
#endif
|
2018-04-04 11:39:26 -04:00
|
|
|
|
|
|
|
#ifndef WITH_XC_TOUCHID
|
|
|
|
bool hideTouchID = true;
|
|
|
|
#else
|
|
|
|
bool hideTouchID = !TouchID::getInstance().isAvailable();
|
|
|
|
#endif
|
|
|
|
if (hideTouchID) {
|
|
|
|
m_secUi->touchIDResetCheckBox->setVisible(false);
|
|
|
|
m_secUi->touchIDResetSpinBox->setVisible(false);
|
|
|
|
m_secUi->touchIDResetOnScreenLockCheckBox->setVisible(false);
|
|
|
|
}
|
2012-05-27 05:09:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SettingsWidget::~SettingsWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-02-22 08:05:59 -05:00
|
|
|
void SettingsWidget::addSettingsPage(ISettingsPage* page)
|
2015-01-30 03:04:27 -05:00
|
|
|
{
|
2017-02-22 08:05:59 -05:00
|
|
|
QWidget* widget = page->createWidget();
|
2015-01-30 03:04:27 -05:00
|
|
|
widget->setParent(this);
|
|
|
|
m_extraPages.append(ExtraPage(page, widget));
|
2017-02-22 08:05:59 -05:00
|
|
|
addPage(page->name(), page->icon(), widget);
|
2015-01-30 03:04:27 -05:00
|
|
|
}
|
|
|
|
|
2012-05-27 05:09:52 -04:00
|
|
|
void SettingsWidget::loadSettings()
|
|
|
|
{
|
2017-03-18 14:00:31 -04:00
|
|
|
|
|
|
|
if (config()->hasAccessError()) {
|
2018-03-31 16:01:30 -04:00
|
|
|
showMessage(tr("Access error for config file %1").arg(config()->getFileName()), MessageWidget::Error);
|
2017-03-18 14:00:31 -04:00
|
|
|
}
|
|
|
|
|
2017-07-18 13:17:14 -04:00
|
|
|
#ifdef QT_DEBUG
|
|
|
|
m_generalUi->singleInstanceCheckBox->setEnabled(false);
|
|
|
|
#endif
|
|
|
|
m_generalUi->singleInstanceCheckBox->setChecked(config()->get("SingleInstance").toBool());
|
2012-05-27 18:09:54 -04:00
|
|
|
m_generalUi->rememberLastDatabasesCheckBox->setChecked(config()->get("RememberLastDatabases").toBool());
|
2015-03-14 23:06:53 -04:00
|
|
|
m_generalUi->rememberLastKeyFilesCheckBox->setChecked(config()->get("RememberLastKeyFiles").toBool());
|
2013-10-13 12:08:50 -04:00
|
|
|
m_generalUi->openPreviousDatabasesOnStartupCheckBox->setChecked(
|
|
|
|
config()->get("OpenPreviousDatabasesOnStartup").toBool());
|
2012-06-10 10:28:46 -04:00
|
|
|
m_generalUi->autoSaveAfterEveryChangeCheckBox->setChecked(config()->get("AutoSaveAfterEveryChange").toBool());
|
2012-06-10 15:54:58 -04:00
|
|
|
m_generalUi->autoSaveOnExitCheckBox->setChecked(config()->get("AutoSaveOnExit").toBool());
|
2018-01-14 18:04:33 -05:00
|
|
|
m_generalUi->backupBeforeSaveCheckBox->setChecked(config()->get("BackupBeforeSave").toBool());
|
2018-01-17 20:13:13 -05:00
|
|
|
m_generalUi->useAtomicSavesCheckBox->setChecked(config()->get("UseAtomicSaves").toBool());
|
2014-06-09 04:51:24 -04:00
|
|
|
m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get("AutoReloadOnChange").toBool());
|
2013-10-29 15:54:56 -04:00
|
|
|
m_generalUi->minimizeOnCopyCheckBox->setChecked(config()->get("MinimizeOnCopy").toBool());
|
2017-02-22 10:08:06 -05:00
|
|
|
m_generalUi->useGroupIconOnEntryCreationCheckBox->setChecked(config()->get("UseGroupIconOnEntryCreation").toBool());
|
2014-05-15 12:26:01 -04:00
|
|
|
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get("AutoTypeEntryTitleMatch").toBool());
|
2017-06-28 12:22:59 -04:00
|
|
|
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get("AutoTypeEntryURLMatch").toBool());
|
2017-04-04 10:21:45 -04:00
|
|
|
m_generalUi->ignoreGroupExpansionCheckBox->setChecked(config()->get("IgnoreGroupExpansion").toBool());
|
2012-07-14 13:09:28 -04:00
|
|
|
|
2014-09-05 04:04:02 -04:00
|
|
|
m_generalUi->languageComboBox->clear();
|
2018-03-31 16:01:30 -04:00
|
|
|
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
|
2014-05-17 19:33:22 -04:00
|
|
|
for (int i = 0; i < languages.size(); i++) {
|
|
|
|
m_generalUi->languageComboBox->addItem(languages[i].second, languages[i].first);
|
|
|
|
}
|
|
|
|
int defaultIndex = m_generalUi->languageComboBox->findData(config()->get("GUI/Language"));
|
|
|
|
if (defaultIndex > 0) {
|
|
|
|
m_generalUi->languageComboBox->setCurrentIndex(defaultIndex);
|
|
|
|
}
|
|
|
|
|
2017-08-17 15:02:21 -04:00
|
|
|
m_generalUi->detailsHideCheckBox->setChecked(config()->get("GUI/HideDetailsView").toBool());
|
2018-04-09 14:09:31 -04:00
|
|
|
m_generalUi->toolbarHideCheckBox->setChecked(config()->get("GUI/HideToolbar").toBool());
|
2014-11-02 04:15:44 -05:00
|
|
|
m_generalUi->systrayShowCheckBox->setChecked(config()->get("GUI/ShowTrayIcon").toBool());
|
2017-10-21 08:16:52 -04:00
|
|
|
m_generalUi->systrayDarkIconCheckBox->setChecked(config()->get("GUI/DarkTrayIcon").toBool());
|
2014-11-02 04:15:44 -05:00
|
|
|
m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool());
|
2015-06-18 09:23:41 -04:00
|
|
|
m_generalUi->systrayMinimizeOnCloseCheckBox->setChecked(config()->get("GUI/MinimizeOnClose").toBool());
|
2015-10-08 13:07:52 -04:00
|
|
|
m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get("GUI/MinimizeOnStartup").toBool());
|
2017-02-22 10:08:06 -05:00
|
|
|
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool());
|
2014-11-02 04:15:44 -05:00
|
|
|
|
2013-12-01 06:20:05 -05:00
|
|
|
if (autoType()->isAvailable()) {
|
|
|
|
m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt());
|
2018-03-31 16:01:30 -04:00
|
|
|
m_globalAutoTypeModifiers =
|
|
|
|
static_cast<Qt::KeyboardModifiers>(config()->get("GlobalAutoTypeModifiers").toInt());
|
2013-12-01 06:20:05 -05:00
|
|
|
if (m_globalAutoTypeKey > 0 && m_globalAutoTypeModifiers > 0) {
|
|
|
|
m_generalUi->autoTypeShortcutWidget->setShortcut(m_globalAutoTypeKey, m_globalAutoTypeModifiers);
|
|
|
|
}
|
2018-02-23 04:43:43 -05:00
|
|
|
m_generalUi->autoTypeShortcutWidget->setAttribute(Qt::WA_MacShowFocusRect, true);
|
2017-06-28 11:37:16 -04:00
|
|
|
m_generalUi->autoTypeDelaySpinBox->setValue(config()->get("AutoTypeDelay").toInt());
|
2018-05-05 23:29:25 -04:00
|
|
|
m_generalUi->autoTypeStartDelaySpinBox->setValue(config()->get("AutoTypeStartDelay").toInt());
|
2012-07-14 13:09:28 -04:00
|
|
|
}
|
|
|
|
|
2012-05-27 14:10:41 -04:00
|
|
|
m_secUi->clearClipboardCheckBox->setChecked(config()->get("security/clearclipboard").toBool());
|
|
|
|
m_secUi->clearClipboardSpinBox->setValue(config()->get("security/clearclipboardtimeout").toInt());
|
|
|
|
|
2014-01-07 15:56:58 -05:00
|
|
|
m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get("security/lockdatabaseidle").toBool());
|
|
|
|
m_secUi->lockDatabaseIdleSpinBox->setValue(config()->get("security/lockdatabaseidlesec").toInt());
|
2016-10-25 09:17:50 -04:00
|
|
|
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(config()->get("security/lockdatabaseminimize").toBool());
|
2017-01-01 08:08:14 -05:00
|
|
|
m_secUi->lockDatabaseOnScreenLockCheckBox->setChecked(config()->get("security/lockdatabasescreenlock").toBool());
|
2018-02-05 07:25:16 -05:00
|
|
|
m_secUi->relockDatabaseAutoTypeCheckBox->setChecked(config()->get("security/relockautotype").toBool());
|
2018-09-20 21:52:51 -04:00
|
|
|
m_secUi->fallbackToSearch->setChecked(config()->get("security/IconDownloadFallback").toBool());
|
2014-01-07 15:56:58 -05:00
|
|
|
|
2014-01-12 11:23:47 -05:00
|
|
|
m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool());
|
2017-08-17 15:02:21 -04:00
|
|
|
m_secUi->passwordDetailsCleartextCheckBox->setChecked(config()->get("security/hidepassworddetails").toBool());
|
2016-11-23 21:59:24 -05:00
|
|
|
m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool());
|
2017-10-25 10:40:14 -04:00
|
|
|
m_secUi->hideNotesCheckBox->setChecked(config()->get("security/hidenotes").toBool());
|
2014-01-12 11:23:47 -05:00
|
|
|
|
2018-04-04 11:39:26 -04:00
|
|
|
m_secUi->touchIDResetCheckBox->setChecked(config()->get("security/resettouchid").toBool());
|
|
|
|
m_secUi->touchIDResetSpinBox->setValue(config()->get("security/resettouchidtimeout").toInt());
|
|
|
|
m_secUi->touchIDResetOnScreenLockCheckBox->setChecked(config()->get("security/resettouchidscreenlock").toBool());
|
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
for (const ExtraPage& page : asConst(m_extraPages)) {
|
2015-01-30 03:04:27 -05:00
|
|
|
page.loadSettings();
|
2017-03-10 09:45:00 -05:00
|
|
|
}
|
2015-01-30 03:04:27 -05:00
|
|
|
|
2017-02-21 19:05:24 -05:00
|
|
|
setCurrentPage(0);
|
2012-05-27 05:09:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWidget::saveSettings()
|
|
|
|
{
|
2017-03-18 14:00:31 -04:00
|
|
|
|
|
|
|
if (config()->hasAccessError()) {
|
2018-03-31 16:01:30 -04:00
|
|
|
showMessage(tr("Access error for config file %1").arg(config()->getFileName()), MessageWidget::Error);
|
2017-03-18 14:00:31 -04:00
|
|
|
// We prevent closing the settings page if we could not write to
|
|
|
|
// the config file.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-18 13:17:14 -04:00
|
|
|
config()->set("SingleInstance", m_generalUi->singleInstanceCheckBox->isChecked());
|
2012-05-27 18:09:54 -04:00
|
|
|
config()->set("RememberLastDatabases", m_generalUi->rememberLastDatabasesCheckBox->isChecked());
|
2015-03-14 23:06:53 -04:00
|
|
|
config()->set("RememberLastKeyFiles", m_generalUi->rememberLastKeyFilesCheckBox->isChecked());
|
2018-03-31 16:01:30 -04:00
|
|
|
config()->set("OpenPreviousDatabasesOnStartup", m_generalUi->openPreviousDatabasesOnStartupCheckBox->isChecked());
|
|
|
|
config()->set("AutoSaveAfterEveryChange", m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked());
|
2012-06-10 15:54:58 -04:00
|
|
|
config()->set("AutoSaveOnExit", m_generalUi->autoSaveOnExitCheckBox->isChecked());
|
2018-01-14 18:04:33 -05:00
|
|
|
config()->set("BackupBeforeSave", m_generalUi->backupBeforeSaveCheckBox->isChecked());
|
2018-01-17 20:13:13 -05:00
|
|
|
config()->set("UseAtomicSaves", m_generalUi->useAtomicSavesCheckBox->isChecked());
|
2014-06-09 04:51:24 -04:00
|
|
|
config()->set("AutoReloadOnChange", m_generalUi->autoReloadOnChangeCheckBox->isChecked());
|
2013-10-29 15:54:56 -04:00
|
|
|
config()->set("MinimizeOnCopy", m_generalUi->minimizeOnCopyCheckBox->isChecked());
|
2018-03-31 16:01:30 -04:00
|
|
|
config()->set("UseGroupIconOnEntryCreation", m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
|
|
|
|
config()->set("IgnoreGroupExpansion", m_generalUi->ignoreGroupExpansionCheckBox->isChecked());
|
|
|
|
config()->set("AutoTypeEntryTitleMatch", m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
|
|
|
|
config()->set("AutoTypeEntryURLMatch", m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
|
2014-05-17 19:33:22 -04:00
|
|
|
int currentLangIndex = m_generalUi->languageComboBox->currentIndex();
|
2016-12-23 19:04:43 -05:00
|
|
|
|
2014-05-17 19:33:22 -04:00
|
|
|
config()->set("GUI/Language", m_generalUi->languageComboBox->itemData(currentLangIndex).toString());
|
2014-11-02 04:15:44 -05:00
|
|
|
|
2017-08-17 15:02:21 -04:00
|
|
|
config()->set("GUI/HideDetailsView", m_generalUi->detailsHideCheckBox->isChecked());
|
2018-04-09 14:09:31 -04:00
|
|
|
config()->set("GUI/HideToolbar", m_generalUi->toolbarHideCheckBox->isChecked());
|
2014-11-02 04:15:44 -05:00
|
|
|
config()->set("GUI/ShowTrayIcon", m_generalUi->systrayShowCheckBox->isChecked());
|
2017-10-21 08:16:52 -04:00
|
|
|
config()->set("GUI/DarkTrayIcon", m_generalUi->systrayDarkIconCheckBox->isChecked());
|
2014-11-02 04:15:44 -05:00
|
|
|
config()->set("GUI/MinimizeToTray", m_generalUi->systrayMinimizeToTrayCheckBox->isChecked());
|
2015-06-18 09:23:41 -04:00
|
|
|
config()->set("GUI/MinimizeOnClose", m_generalUi->systrayMinimizeOnCloseCheckBox->isChecked());
|
2015-10-08 13:07:52 -04:00
|
|
|
config()->set("GUI/MinimizeOnStartup", m_generalUi->systrayMinimizeOnStartup->isChecked());
|
2014-11-02 04:15:44 -05:00
|
|
|
|
2017-02-22 10:08:06 -05:00
|
|
|
config()->set("security/autotypeask", m_generalUi->autoTypeAskCheckBox->isChecked());
|
|
|
|
|
2013-12-01 06:20:05 -05:00
|
|
|
if (autoType()->isAvailable()) {
|
|
|
|
config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key());
|
2018-03-31 16:01:30 -04:00
|
|
|
config()->set("GlobalAutoTypeModifiers", static_cast<int>(m_generalUi->autoTypeShortcutWidget->modifiers()));
|
2017-06-28 11:37:16 -04:00
|
|
|
config()->set("AutoTypeDelay", m_generalUi->autoTypeDelaySpinBox->value());
|
2018-05-05 23:29:25 -04:00
|
|
|
config()->set("AutoTypeStartDelay", m_generalUi->autoTypeStartDelaySpinBox->value());
|
2013-12-01 06:20:05 -05:00
|
|
|
}
|
2012-05-27 14:10:41 -04:00
|
|
|
config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked());
|
|
|
|
config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value());
|
2012-05-27 14:29:15 -04:00
|
|
|
|
2014-01-07 15:56:58 -05:00
|
|
|
config()->set("security/lockdatabaseidle", m_secUi->lockDatabaseIdleCheckBox->isChecked());
|
|
|
|
config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());
|
2016-10-25 09:17:50 -04:00
|
|
|
config()->set("security/lockdatabaseminimize", m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
2017-01-01 08:08:14 -05:00
|
|
|
config()->set("security/lockdatabasescreenlock", m_secUi->lockDatabaseOnScreenLockCheckBox->isChecked());
|
2018-02-05 07:25:16 -05:00
|
|
|
config()->set("security/relockautotype", m_secUi->relockDatabaseAutoTypeCheckBox->isChecked());
|
2018-09-20 21:52:51 -04:00
|
|
|
config()->set("security/IconDownloadFallback", m_secUi->fallbackToSearch->isChecked());
|
2014-01-07 15:56:58 -05:00
|
|
|
|
2014-01-12 11:23:47 -05:00
|
|
|
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
|
2017-08-17 15:02:21 -04:00
|
|
|
config()->set("security/hidepassworddetails", m_secUi->passwordDetailsCleartextCheckBox->isChecked());
|
2016-11-23 21:59:24 -05:00
|
|
|
config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked());
|
2017-10-25 10:40:14 -04:00
|
|
|
config()->set("security/hidenotes", m_secUi->hideNotesCheckBox->isChecked());
|
2014-01-12 11:23:47 -05:00
|
|
|
|
2018-04-04 11:39:26 -04:00
|
|
|
config()->set("security/resettouchid", m_secUi->touchIDResetCheckBox->isChecked());
|
|
|
|
config()->set("security/resettouchidtimeout", m_secUi->touchIDResetSpinBox->value());
|
|
|
|
config()->set("security/resettouchidscreenlock", m_secUi->touchIDResetOnScreenLockCheckBox->isChecked());
|
|
|
|
|
2017-09-27 18:28:42 -04:00
|
|
|
// Security: clear storage if related settings are disabled
|
|
|
|
if (!config()->get("RememberLastDatabases").toBool()) {
|
|
|
|
config()->set("LastDatabases", QVariant());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!config()->get("RememberLastKeyFiles").toBool()) {
|
|
|
|
config()->set("LastKeyFiles", QVariant());
|
2017-11-16 10:04:30 -05:00
|
|
|
config()->set("LastDir", "");
|
2017-09-27 18:28:42 -04:00
|
|
|
}
|
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
for (const ExtraPage& page : asConst(m_extraPages)) {
|
2015-01-30 03:04:27 -05:00
|
|
|
page.saveSettings();
|
2017-03-10 09:45:00 -05:00
|
|
|
}
|
2012-05-27 14:29:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWidget::reject()
|
|
|
|
{
|
2012-07-14 13:09:28 -04:00
|
|
|
// register the old key again as it might have changed
|
|
|
|
if (m_globalAutoTypeKey > 0 && m_globalAutoTypeModifiers > 0) {
|
|
|
|
autoType()->registerGlobalShortcut(m_globalAutoTypeKey, m_globalAutoTypeModifiers);
|
|
|
|
}
|
2012-05-27 05:09:52 -04:00
|
|
|
}
|
2012-06-10 15:54:58 -04:00
|
|
|
|
|
|
|
void SettingsWidget::enableAutoSaveOnExit(bool checked)
|
|
|
|
{
|
2012-06-12 04:11:13 -04:00
|
|
|
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
|
2012-06-10 15:54:58 -04:00
|
|
|
}
|
2015-10-06 15:12:59 -04:00
|
|
|
|
2016-11-23 18:15:51 -05:00
|
|
|
void SettingsWidget::enableSystray(bool checked)
|
2015-10-06 15:12:59 -04:00
|
|
|
{
|
2017-10-21 08:16:52 -04:00
|
|
|
m_generalUi->systrayDarkIconCheckBox->setEnabled(checked);
|
2015-10-06 15:12:59 -04:00
|
|
|
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);
|
2015-10-08 13:07:52 -04:00
|
|
|
m_generalUi->systrayMinimizeOnCloseCheckBox->setEnabled(checked);
|
2015-10-06 15:12:59 -04:00
|
|
|
}
|