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/>.
|
|
|
|
*/
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
#include "ApplicationSettingsWidget.h"
|
|
|
|
#include "ui_ApplicationSettingsWidgetGeneral.h"
|
|
|
|
#include "ui_ApplicationSettingsWidgetSecurity.h"
|
2021-11-07 17:41:17 -05:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QDir>
|
2012-05-27 05:09:52 -04:00
|
|
|
|
2018-03-31 16:01:30 -04:00
|
|
|
#include "config-keepassx.h"
|
2018-10-01 10:26:24 -04:00
|
|
|
|
|
|
|
#include "autotype/AutoType.h"
|
2018-03-31 16:01:30 -04:00
|
|
|
#include "core/Translator.h"
|
2020-10-05 20:41:00 -04:00
|
|
|
#include "gui/Icons.h"
|
2020-07-14 23:55:23 -04:00
|
|
|
#include "gui/MainWindow.h"
|
2020-04-29 11:47:25 -04:00
|
|
|
#include "gui/osutils/OSUtils.h"
|
2012-05-27 14:10:41 -04:00
|
|
|
|
2021-11-07 17:41:17 -05:00
|
|
|
#include "FileDialog.h"
|
2019-08-30 20:18:41 -04:00
|
|
|
#include "MessageBox.h"
|
2021-07-11 22:10:29 -04:00
|
|
|
#ifdef Q_OS_MACOS
|
2018-04-04 11:39:26 -04:00
|
|
|
#include "touchid/TouchID.h"
|
2021-07-11 22:10:29 -04:00
|
|
|
#endif
|
2022-02-21 20:40:01 -05:00
|
|
|
#ifdef Q_CC_MSVC
|
|
|
|
#include "winhello/WindowsHello.h"
|
|
|
|
#endif
|
2018-04-04 11:39:26 -04:00
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
class ApplicationSettingsWidget::ExtraPage
|
2015-01-30 03:04:27 -05:00
|
|
|
{
|
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
|
|
|
};
|
|
|
|
|
2019-08-30 20:18:41 -04:00
|
|
|
/**
|
|
|
|
* Helper class to ignore mouse wheel events on non-focused widgets
|
|
|
|
* NOTE: The widget must NOT have a focus policy of "WHEEL"
|
|
|
|
*/
|
|
|
|
class MouseWheelEventFilter : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit MouseWheelEventFilter(QObject* parent)
|
|
|
|
: QObject(parent){};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject* obj, QEvent* event) override
|
|
|
|
{
|
|
|
|
const auto* widget = qobject_cast<QWidget*>(obj);
|
|
|
|
if (event->type() == QEvent::Wheel && widget && !widget->hasFocus()) {
|
|
|
|
event->ignore();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return QObject::eventFilter(obj, event);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
2012-05-27 05:09:52 -04:00
|
|
|
: EditWidget(parent)
|
|
|
|
, m_secWidget(new QWidget())
|
2012-05-27 18:09:54 -04:00
|
|
|
, m_generalWidget(new QWidget())
|
2018-05-13 17:21:43 -04:00
|
|
|
, m_secUi(new Ui::ApplicationSettingsWidgetSecurity())
|
|
|
|
, m_generalUi(new Ui::ApplicationSettingsWidgetGeneral())
|
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"));
|
2019-04-16 20:18:18 -04:00
|
|
|
showApplyButton(false);
|
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);
|
2020-10-05 20:41:00 -04:00
|
|
|
addPage(tr("General"), icons()->icon("preferences-other"), m_generalWidget);
|
|
|
|
addPage(tr("Security"), icons()->icon("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()));
|
2012-05-27 14:29:15 -04:00
|
|
|
connect(this, SIGNAL(rejected()), SLOT(reject()));
|
2012-05-27 05:09:52 -04:00
|
|
|
|
2018-12-19 17:52:12 -05:00
|
|
|
// clang-format off
|
2019-01-25 07:20:39 -05:00
|
|
|
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), SLOT(autoSaveToggled(bool)));
|
2019-06-09 14:15:02 -04:00
|
|
|
connect(m_generalUi->hideWindowOnCopyCheckBox, SIGNAL(toggled(bool)), SLOT(hideWindowOnCopyCheckBoxToggled(bool)));
|
2019-01-25 07:20:39 -05:00
|
|
|
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), SLOT(systrayToggled(bool)));
|
2019-03-21 17:39:02 -04:00
|
|
|
connect(m_generalUi->rememberLastDatabasesCheckBox, SIGNAL(toggled(bool)), SLOT(rememberDatabasesToggled(bool)));
|
2019-08-30 20:18:41 -04:00
|
|
|
connect(m_generalUi->resetSettingsButton, SIGNAL(clicked()), SLOT(resetSettings()));
|
2021-10-01 16:56:49 -04:00
|
|
|
connect(m_generalUi->useAlternativeSaveCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_generalUi->alternativeSaveComboBox, SLOT(setEnabled(bool)));
|
2012-06-10 15:54:58 -04:00
|
|
|
|
2021-11-07 17:41:17 -05:00
|
|
|
connect(m_generalUi->backupBeforeSaveCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_generalUi->backupFilePath, SLOT(setEnabled(bool)));
|
|
|
|
connect(m_generalUi->backupBeforeSaveCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_generalUi->backupFilePathPicker, SLOT(setEnabled(bool)));
|
|
|
|
connect(m_generalUi->backupFilePathPicker, SIGNAL(pressed()), SLOT(selectBackupDirectory()));
|
2022-01-22 13:20:41 -05:00
|
|
|
connect(m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
SLOT(showExpiredEntriesOnDatabaseUnlockToggled(bool)));
|
2021-11-07 17:41:17 -05:00
|
|
|
|
2018-12-19 17:52:12 -05:00
|
|
|
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
|
2019-07-30 23:44:34 -04:00
|
|
|
connect(m_secUi->clearSearchCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_secUi->clearSearchSpinBox, SLOT(setEnabled(bool)));
|
2018-12-19 17:52:12 -05:00
|
|
|
connect(m_secUi->lockDatabaseIdleCheckBox, SIGNAL(toggled(bool)),
|
|
|
|
m_secUi->lockDatabaseIdleSpinBox, SLOT(setEnabled(bool)));
|
|
|
|
// clang-format on
|
2018-04-04 11:39:26 -04:00
|
|
|
|
2022-06-27 23:21:40 -04:00
|
|
|
connect(m_generalUi->minimizeAfterUnlockCheckBox, &QCheckBox::toggled, this, [this](bool state) {
|
|
|
|
if (state) {
|
|
|
|
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(false);
|
|
|
|
}
|
|
|
|
m_secUi->lockDatabaseMinimizeCheckBox->setToolTip(
|
|
|
|
state ? tr("This setting cannot be enabled when minimize on unlock is enabled.") : "");
|
|
|
|
m_secUi->lockDatabaseMinimizeCheckBox->setEnabled(!state);
|
|
|
|
});
|
|
|
|
|
2019-08-30 20:18:41 -04:00
|
|
|
// Disable mouse wheel grab when scrolling
|
|
|
|
// This prevents combo box and spinner values from changing without explicit focus
|
|
|
|
auto mouseWheelFilter = new MouseWheelEventFilter(this);
|
|
|
|
m_generalUi->faviconTimeoutSpinBox->installEventFilter(mouseWheelFilter);
|
|
|
|
m_generalUi->toolButtonStyleComboBox->installEventFilter(mouseWheelFilter);
|
|
|
|
m_generalUi->languageComboBox->installEventFilter(mouseWheelFilter);
|
2020-07-14 18:34:14 -04:00
|
|
|
m_generalUi->trayIconAppearance->installEventFilter(mouseWheelFilter);
|
2019-08-30 20:18:41 -04:00
|
|
|
|
2019-04-09 21:06:13 -04:00
|
|
|
#ifdef WITH_XC_UPDATECHECK
|
|
|
|
connect(m_generalUi->checkForUpdatesOnStartupCheckBox, SIGNAL(toggled(bool)), SLOT(checkUpdatesToggled(bool)));
|
|
|
|
#else
|
2019-01-30 09:11:50 -05:00
|
|
|
m_generalUi->checkForUpdatesOnStartupCheckBox->setVisible(false);
|
2019-04-09 21:06:13 -04:00
|
|
|
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setVisible(false);
|
2019-05-12 17:42:55 -04:00
|
|
|
m_generalUi->checkUpdatesSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
2019-04-09 21:06:13 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WITH_XC_NETWORKING
|
2017-06-28 18:32:47 -04:00
|
|
|
m_secUi->privacy->setVisible(false);
|
2019-07-07 15:29:11 -04:00
|
|
|
m_generalUi->faviconTimeoutLabel->setVisible(false);
|
|
|
|
m_generalUi->faviconTimeoutSpinBox->setVisible(false);
|
2017-06-28 18:32:47 -04:00
|
|
|
#endif
|
2018-04-04 11:39:26 -04:00
|
|
|
|
2022-02-21 20:40:01 -05:00
|
|
|
bool showQuickUnlock = false;
|
|
|
|
#if defined(Q_OS_MACOS)
|
|
|
|
showQuickUnlock = TouchID::getInstance().isAvailable();
|
|
|
|
#elif defined(Q_CC_MSVC)
|
|
|
|
showQuickUnlock = getWindowsHello()->isAvailable();
|
|
|
|
connect(getWindowsHello(), &WindowsHello::availableChanged, m_secUi->quickUnlockCheckBox, &QCheckBox::setVisible);
|
2018-04-04 11:39:26 -04:00
|
|
|
#endif
|
2022-02-21 20:40:01 -05:00
|
|
|
m_secUi->quickUnlockCheckBox->setVisible(showQuickUnlock);
|
2012-05-27 05:09:52 -04:00
|
|
|
}
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
ApplicationSettingsWidget::~ApplicationSettingsWidget()
|
2012-05-27 05:09:52 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
void ApplicationSettingsWidget::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
|
|
|
}
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
void ApplicationSettingsWidget::loadSettings()
|
2012-05-27 05:09:52 -04:00
|
|
|
{
|
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);
|
2020-04-29 11:47:25 -04:00
|
|
|
m_generalUi->launchAtStartup->setEnabled(false);
|
2017-07-18 13:17:14 -04:00
|
|
|
#endif
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->singleInstanceCheckBox->setChecked(config()->get(Config::SingleInstance).toBool());
|
2020-04-29 11:47:25 -04:00
|
|
|
m_generalUi->launchAtStartup->setChecked(osUtils->isLaunchAtStartupEnabled());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->rememberLastDatabasesCheckBox->setChecked(config()->get(Config::RememberLastDatabases).toBool());
|
2022-07-04 15:59:41 -04:00
|
|
|
m_generalUi->rememberLastDatabasesSpinbox->setValue(config()->get(Config::NumberOfRememberedLastDatabases).toInt());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->rememberLastKeyFilesCheckBox->setChecked(config()->get(Config::RememberLastKeyFiles).toBool());
|
2013-10-13 12:08:50 -04:00
|
|
|
m_generalUi->openPreviousDatabasesOnStartupCheckBox->setChecked(
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->get(Config::OpenPreviousDatabasesOnStartup).toBool());
|
|
|
|
m_generalUi->autoSaveAfterEveryChangeCheckBox->setChecked(config()->get(Config::AutoSaveAfterEveryChange).toBool());
|
|
|
|
m_generalUi->autoSaveOnExitCheckBox->setChecked(config()->get(Config::AutoSaveOnExit).toBool());
|
2020-08-01 18:00:47 -04:00
|
|
|
m_generalUi->autoSaveNonDataChangesCheckBox->setChecked(config()->get(Config::AutoSaveNonDataChanges).toBool());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->backupBeforeSaveCheckBox->setChecked(config()->get(Config::BackupBeforeSave).toBool());
|
2021-11-07 17:41:17 -05:00
|
|
|
|
|
|
|
m_generalUi->backupFilePath->setText(config()->get(Config::BackupFilePathPattern).toString());
|
|
|
|
|
2021-10-01 16:56:49 -04:00
|
|
|
m_generalUi->useAlternativeSaveCheckBox->setChecked(!config()->get(Config::UseAtomicSaves).toBool());
|
|
|
|
m_generalUi->alternativeSaveComboBox->setCurrentIndex(config()->get(Config::UseDirectWriteSaves).toBool() ? 1 : 0);
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get(Config::AutoReloadOnChange).toBool());
|
|
|
|
m_generalUi->minimizeAfterUnlockCheckBox->setChecked(config()->get(Config::MinimizeAfterUnlock).toBool());
|
|
|
|
m_generalUi->minimizeOnOpenUrlCheckBox->setChecked(config()->get(Config::MinimizeOnOpenUrl).toBool());
|
|
|
|
m_generalUi->hideWindowOnCopyCheckBox->setChecked(config()->get(Config::HideWindowOnCopy).toBool());
|
2020-05-26 11:58:52 -04:00
|
|
|
hideWindowOnCopyCheckBoxToggled(m_generalUi->hideWindowOnCopyCheckBox->isChecked());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->minimizeOnCopyRadioButton->setChecked(config()->get(Config::MinimizeOnCopy).toBool());
|
|
|
|
m_generalUi->dropToBackgroundOnCopyRadioButton->setChecked(config()->get(Config::DropToBackgroundOnCopy).toBool());
|
|
|
|
m_generalUi->useGroupIconOnEntryCreationCheckBox->setChecked(
|
|
|
|
config()->get(Config::UseGroupIconOnEntryCreation).toBool());
|
|
|
|
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).toBool());
|
|
|
|
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryURLMatch).toBool());
|
2020-08-29 08:44:50 -04:00
|
|
|
m_generalUi->autoTypeHideExpiredEntryCheckBox->setChecked(config()->get(Config::AutoTypeHideExpiredEntry).toBool());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->faviconTimeoutSpinBox->setValue(config()->get(Config::FaviconDownloadTimeout).toInt());
|
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();
|
2018-10-27 17:54:57 -04:00
|
|
|
for (const auto& language : languages) {
|
|
|
|
m_generalUi->languageComboBox->addItem(language.second, language.first);
|
2014-05-17 19:33:22 -04:00
|
|
|
}
|
2020-04-25 19:31:38 -04:00
|
|
|
int defaultIndex = m_generalUi->languageComboBox->findData(config()->get(Config::GUI_Language));
|
2014-05-17 19:33:22 -04:00
|
|
|
if (defaultIndex > 0) {
|
|
|
|
m_generalUi->languageComboBox->setCurrentIndex(defaultIndex);
|
|
|
|
}
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->toolbarMovableCheckBox->setChecked(config()->get(Config::GUI_MovableToolbar).toBool());
|
|
|
|
m_generalUi->monospaceNotesCheckBox->setChecked(config()->get(Config::GUI_MonospaceNotes).toBool());
|
2019-01-16 11:04:32 -05:00
|
|
|
|
|
|
|
m_generalUi->toolButtonStyleComboBox->clear();
|
|
|
|
m_generalUi->toolButtonStyleComboBox->addItem(tr("Icon only"), Qt::ToolButtonIconOnly);
|
|
|
|
m_generalUi->toolButtonStyleComboBox->addItem(tr("Text only"), Qt::ToolButtonTextOnly);
|
|
|
|
m_generalUi->toolButtonStyleComboBox->addItem(tr("Text beside icon"), Qt::ToolButtonTextBesideIcon);
|
|
|
|
m_generalUi->toolButtonStyleComboBox->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon);
|
|
|
|
m_generalUi->toolButtonStyleComboBox->addItem(tr("Follow style"), Qt::ToolButtonFollowStyle);
|
2020-04-25 19:31:38 -04:00
|
|
|
int toolButtonStyleIndex =
|
|
|
|
m_generalUi->toolButtonStyleComboBox->findData(config()->get(Config::GUI_ToolButtonStyle));
|
2019-01-16 11:04:32 -05:00
|
|
|
if (toolButtonStyleIndex > 0) {
|
|
|
|
m_generalUi->toolButtonStyleComboBox->setCurrentIndex(toolButtonStyleIndex);
|
|
|
|
}
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->systrayShowCheckBox->setChecked(config()->get(Config::GUI_ShowTrayIcon).toBool());
|
2020-05-26 11:58:52 -04:00
|
|
|
systrayToggled(m_generalUi->systrayShowCheckBox->isChecked());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get(Config::GUI_MinimizeToTray).toBool());
|
|
|
|
m_generalUi->minimizeOnCloseCheckBox->setChecked(config()->get(Config::GUI_MinimizeOnClose).toBool());
|
|
|
|
m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get(Config::GUI_MinimizeOnStartup).toBool());
|
|
|
|
m_generalUi->checkForUpdatesOnStartupCheckBox->setChecked(config()->get(Config::GUI_CheckForUpdates).toBool());
|
2020-05-26 11:58:52 -04:00
|
|
|
checkUpdatesToggled(m_generalUi->checkForUpdatesOnStartupCheckBox->isChecked());
|
2019-03-19 14:48:33 -04:00
|
|
|
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setChecked(
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->get(Config::GUI_CheckForUpdatesIncludeBetas).toBool());
|
2020-05-26 11:58:52 -04:00
|
|
|
|
2022-01-22 13:20:41 -05:00
|
|
|
m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox->setChecked(
|
|
|
|
config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlock).toBool());
|
|
|
|
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->setValue(
|
|
|
|
config()->get(Config::GUI_ShowExpiredEntriesOnDatabaseUnlockOffsetDays).toInt());
|
|
|
|
showExpiredEntriesOnDatabaseUnlockToggled(m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox->isChecked());
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get(Config::Security_AutoTypeAsk).toBool());
|
2022-02-19 15:40:59 -05:00
|
|
|
m_generalUi->autoTypeRelockDatabaseCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
|
2014-11-02 04:15:44 -05:00
|
|
|
|
2013-12-01 06:20:05 -05:00
|
|
|
if (autoType()->isAvailable()) {
|
2020-04-25 19:31:38 -04:00
|
|
|
m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get(Config::GlobalAutoTypeKey).toInt());
|
2018-03-31 16:01:30 -04:00
|
|
|
m_globalAutoTypeModifiers =
|
2020-04-25 19:31:38 -04:00
|
|
|
static_cast<Qt::KeyboardModifiers>(config()->get(Config::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);
|
|
|
|
}
|
2022-02-19 15:40:59 -05:00
|
|
|
m_generalUi->autoTypeRetypeTimeSpinBox->setValue(config()->get(Config::GlobalAutoTypeRetypeTime).toInt());
|
2018-02-23 04:43:43 -05:00
|
|
|
m_generalUi->autoTypeShortcutWidget->setAttribute(Qt::WA_MacShowFocusRect, true);
|
2020-04-25 19:31:38 -04:00
|
|
|
m_generalUi->autoTypeDelaySpinBox->setValue(config()->get(Config::AutoTypeDelay).toInt());
|
|
|
|
m_generalUi->autoTypeStartDelaySpinBox->setValue(config()->get(Config::AutoTypeStartDelay).toInt());
|
2012-07-14 13:09:28 -04:00
|
|
|
}
|
|
|
|
|
2020-05-30 16:46:06 -04:00
|
|
|
m_generalUi->trayIconAppearance->clear();
|
2020-12-23 18:09:51 -05:00
|
|
|
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
2020-12-18 18:20:24 -05:00
|
|
|
m_generalUi->trayIconAppearance->addItem(tr("Monochrome"), "monochrome");
|
|
|
|
#else
|
2020-06-01 17:37:02 -04:00
|
|
|
m_generalUi->trayIconAppearance->addItem(tr("Monochrome (light)"), "monochrome-light");
|
|
|
|
m_generalUi->trayIconAppearance->addItem(tr("Monochrome (dark)"), "monochrome-dark");
|
2020-12-18 18:20:24 -05:00
|
|
|
#endif
|
2020-06-01 17:37:02 -04:00
|
|
|
m_generalUi->trayIconAppearance->addItem(tr("Colorful"), "colorful");
|
2020-10-05 20:41:00 -04:00
|
|
|
int trayIconIndex = m_generalUi->trayIconAppearance->findData(icons()->trayIconAppearance());
|
2020-05-30 16:46:06 -04:00
|
|
|
if (trayIconIndex > 0) {
|
|
|
|
m_generalUi->trayIconAppearance->setCurrentIndex(trayIconIndex);
|
|
|
|
}
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->clearClipboardCheckBox->setChecked(config()->get(Config::Security_ClearClipboard).toBool());
|
|
|
|
m_secUi->clearClipboardSpinBox->setValue(config()->get(Config::Security_ClearClipboardTimeout).toInt());
|
2012-05-27 14:10:41 -04:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->clearSearchCheckBox->setChecked(config()->get(Config::Security_ClearSearch).toBool());
|
|
|
|
m_secUi->clearSearchSpinBox->setValue(config()->get(Config::Security_ClearSearchTimeout).toInt());
|
2019-07-30 23:44:34 -04:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get(Config::Security_LockDatabaseIdle).toBool());
|
|
|
|
m_secUi->lockDatabaseIdleSpinBox->setValue(config()->get(Config::Security_LockDatabaseIdleSeconds).toInt());
|
2022-06-27 23:21:40 -04:00
|
|
|
m_secUi->lockDatabaseMinimizeCheckBox->setChecked(m_secUi->lockDatabaseMinimizeCheckBox->isEnabled()
|
|
|
|
&& config()->get(Config::Security_LockDatabaseMinimize).toBool());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->lockDatabaseOnScreenLockCheckBox->setChecked(
|
|
|
|
config()->get(Config::Security_LockDatabaseScreenLock).toBool());
|
|
|
|
m_secUi->fallbackToSearch->setChecked(config()->get(Config::Security_IconDownloadFallback).toBool());
|
2014-01-07 15:56:58 -05:00
|
|
|
|
2020-05-10 21:35:08 -04:00
|
|
|
m_secUi->passwordsHiddenCheckBox->setChecked(config()->get(Config::Security_PasswordsHidden).toBool());
|
|
|
|
m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyPlaceholder).toBool());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->passwordPreviewCleartextCheckBox->setChecked(
|
|
|
|
config()->get(Config::Security_HidePasswordPreviewPanel).toBool());
|
2020-05-10 21:35:08 -04:00
|
|
|
m_secUi->passwordsRepeatVisibleCheckBox->setChecked(
|
|
|
|
config()->get(Config::Security_PasswordsRepeatVisible).toBool());
|
2020-04-25 19:31:38 -04:00
|
|
|
m_secUi->hideNotesCheckBox->setChecked(config()->get(Config::Security_HideNotes).toBool());
|
2020-12-12 12:14:18 -05:00
|
|
|
m_secUi->NoConfirmMoveEntryToRecycleBinCheckBox->setChecked(
|
|
|
|
config()->get(Config::Security_NoConfirmMoveEntryToRecycleBin).toBool());
|
2021-04-24 11:35:01 -04:00
|
|
|
m_secUi->EnableCopyOnDoubleClickCheckBox->setChecked(
|
|
|
|
config()->get(Config::Security_EnableCopyOnDoubleClick).toBool());
|
2014-01-12 11:23:47 -05:00
|
|
|
|
2022-02-21 20:40:01 -05:00
|
|
|
m_secUi->quickUnlockCheckBox->setChecked(config()->get(Config::Security_QuickUnlock).toBool());
|
2018-04-04 11:39:26 -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.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
|
|
|
}
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
void ApplicationSettingsWidget::saveSettings()
|
2012-05-27 05:09:52 -04:00
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
2020-04-29 11:47:25 -04:00
|
|
|
#ifndef QT_DEBUG
|
|
|
|
osUtils->setLaunchAtStartup(m_generalUi->launchAtStartup->isChecked());
|
|
|
|
#endif
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::SingleInstance, m_generalUi->singleInstanceCheckBox->isChecked());
|
|
|
|
config()->set(Config::RememberLastDatabases, m_generalUi->rememberLastDatabasesCheckBox->isChecked());
|
2022-07-04 15:59:41 -04:00
|
|
|
config()->set(Config::NumberOfRememberedLastDatabases, m_generalUi->rememberLastDatabasesSpinbox->value());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::RememberLastKeyFiles, m_generalUi->rememberLastKeyFilesCheckBox->isChecked());
|
|
|
|
config()->set(Config::OpenPreviousDatabasesOnStartup,
|
|
|
|
m_generalUi->openPreviousDatabasesOnStartupCheckBox->isChecked());
|
|
|
|
config()->set(Config::AutoSaveAfterEveryChange, m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked());
|
|
|
|
config()->set(Config::AutoSaveOnExit, m_generalUi->autoSaveOnExitCheckBox->isChecked());
|
2020-08-01 18:00:47 -04:00
|
|
|
config()->set(Config::AutoSaveNonDataChanges, m_generalUi->autoSaveNonDataChangesCheckBox->isChecked());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::BackupBeforeSave, m_generalUi->backupBeforeSaveCheckBox->isChecked());
|
2021-11-07 17:41:17 -05:00
|
|
|
|
|
|
|
config()->set(Config::BackupFilePathPattern, m_generalUi->backupFilePath->text());
|
|
|
|
|
2021-10-01 16:56:49 -04:00
|
|
|
config()->set(Config::UseAtomicSaves, !m_generalUi->useAlternativeSaveCheckBox->isChecked());
|
|
|
|
config()->set(Config::UseDirectWriteSaves, m_generalUi->alternativeSaveComboBox->currentIndex() == 1);
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::AutoReloadOnChange, m_generalUi->autoReloadOnChangeCheckBox->isChecked());
|
|
|
|
config()->set(Config::MinimizeAfterUnlock, m_generalUi->minimizeAfterUnlockCheckBox->isChecked());
|
|
|
|
config()->set(Config::MinimizeOnOpenUrl, m_generalUi->minimizeOnOpenUrlCheckBox->isChecked());
|
|
|
|
config()->set(Config::HideWindowOnCopy, m_generalUi->hideWindowOnCopyCheckBox->isChecked());
|
|
|
|
config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked());
|
|
|
|
config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked());
|
|
|
|
config()->set(Config::UseGroupIconOnEntryCreation, m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
|
|
|
|
config()->set(Config::AutoTypeEntryTitleMatch, m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
|
|
|
|
config()->set(Config::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
|
2020-08-29 08:44:50 -04:00
|
|
|
config()->set(Config::AutoTypeHideExpiredEntry, m_generalUi->autoTypeHideExpiredEntryCheckBox->isChecked());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value());
|
|
|
|
|
2020-07-14 23:55:23 -04:00
|
|
|
auto language = m_generalUi->languageComboBox->currentData().toString();
|
|
|
|
if (config()->get(Config::GUI_Language) != language) {
|
|
|
|
QTimer::singleShot(200, [] {
|
|
|
|
getMainWindow()->restartApp(
|
|
|
|
tr("You must restart the application to set the new language. Would you like to restart now?"));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
config()->set(Config::GUI_Language, language);
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::GUI_MovableToolbar, m_generalUi->toolbarMovableCheckBox->isChecked());
|
|
|
|
config()->set(Config::GUI_MonospaceNotes, m_generalUi->monospaceNotesCheckBox->isChecked());
|
2019-01-16 11:04:32 -05:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::GUI_ToolButtonStyle, m_generalUi->toolButtonStyleComboBox->currentData().toString());
|
2019-01-16 11:04:32 -05:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::GUI_ShowTrayIcon, m_generalUi->systrayShowCheckBox->isChecked());
|
2020-05-30 16:46:06 -04:00
|
|
|
config()->set(Config::GUI_TrayIconAppearance, m_generalUi->trayIconAppearance->currentData().toString());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::GUI_MinimizeToTray, m_generalUi->systrayMinimizeToTrayCheckBox->isChecked());
|
|
|
|
config()->set(Config::GUI_MinimizeOnClose, m_generalUi->minimizeOnCloseCheckBox->isChecked());
|
|
|
|
config()->set(Config::GUI_MinimizeOnStartup, m_generalUi->systrayMinimizeOnStartup->isChecked());
|
|
|
|
config()->set(Config::GUI_CheckForUpdates, m_generalUi->checkForUpdatesOnStartupCheckBox->isChecked());
|
|
|
|
config()->set(Config::GUI_CheckForUpdatesIncludeBetas,
|
|
|
|
m_generalUi->checkForUpdatesIncludeBetasCheckBox->isChecked());
|
2014-11-02 04:15:44 -05:00
|
|
|
|
2022-01-22 13:20:41 -05:00
|
|
|
config()->set(Config::GUI_ShowExpiredEntriesOnDatabaseUnlock,
|
|
|
|
m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox->isChecked());
|
|
|
|
config()->set(Config::GUI_ShowExpiredEntriesOnDatabaseUnlockOffsetDays,
|
|
|
|
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->value());
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_AutoTypeAsk, m_generalUi->autoTypeAskCheckBox->isChecked());
|
2022-02-19 15:40:59 -05:00
|
|
|
config()->set(Config::Security_RelockAutoType, m_generalUi->autoTypeRelockDatabaseCheckBox->isChecked());
|
2017-02-22 10:08:06 -05:00
|
|
|
|
2013-12-01 06:20:05 -05:00
|
|
|
if (autoType()->isAvailable()) {
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::GlobalAutoTypeKey, m_generalUi->autoTypeShortcutWidget->key());
|
|
|
|
config()->set(Config::GlobalAutoTypeModifiers,
|
|
|
|
static_cast<int>(m_generalUi->autoTypeShortcutWidget->modifiers()));
|
2022-02-19 15:40:59 -05:00
|
|
|
config()->set(Config::GlobalAutoTypeRetypeTime, m_generalUi->autoTypeRetypeTimeSpinBox->value());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::AutoTypeDelay, m_generalUi->autoTypeDelaySpinBox->value());
|
|
|
|
config()->set(Config::AutoTypeStartDelay, m_generalUi->autoTypeStartDelaySpinBox->value());
|
2013-12-01 06:20:05 -05:00
|
|
|
}
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_ClearClipboard, m_secUi->clearClipboardCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_ClearClipboardTimeout, m_secUi->clearClipboardSpinBox->value());
|
2012-05-27 14:29:15 -04:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_ClearSearch, m_secUi->clearSearchCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_ClearSearchTimeout, m_secUi->clearSearchSpinBox->value());
|
2019-07-30 23:44:34 -04:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_LockDatabaseIdle, m_secUi->lockDatabaseIdleCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_LockDatabaseIdleSeconds, m_secUi->lockDatabaseIdleSpinBox->value());
|
|
|
|
config()->set(Config::Security_LockDatabaseMinimize, m_secUi->lockDatabaseMinimizeCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_LockDatabaseScreenLock, m_secUi->lockDatabaseOnScreenLockCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_IconDownloadFallback, m_secUi->fallbackToSearch->isChecked());
|
2014-01-07 15:56:58 -05:00
|
|
|
|
2020-05-10 21:35:08 -04:00
|
|
|
config()->set(Config::Security_PasswordsHidden, m_secUi->passwordsHiddenCheckBox->isChecked());
|
|
|
|
config()->set(Config::Security_PasswordEmptyPlaceholder, m_secUi->passwordShowDotsCheckBox->isChecked());
|
2018-09-29 07:44:23 -04:00
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_HidePasswordPreviewPanel, m_secUi->passwordPreviewCleartextCheckBox->isChecked());
|
2020-05-10 21:35:08 -04:00
|
|
|
config()->set(Config::Security_PasswordsRepeatVisible, m_secUi->passwordsRepeatVisibleCheckBox->isChecked());
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->set(Config::Security_HideNotes, m_secUi->hideNotesCheckBox->isChecked());
|
2020-12-12 12:14:18 -05:00
|
|
|
config()->set(Config::Security_NoConfirmMoveEntryToRecycleBin,
|
|
|
|
m_secUi->NoConfirmMoveEntryToRecycleBinCheckBox->isChecked());
|
2021-04-24 11:35:01 -04:00
|
|
|
config()->set(Config::Security_EnableCopyOnDoubleClick, m_secUi->EnableCopyOnDoubleClickCheckBox->isChecked());
|
2014-01-12 11:23:47 -05:00
|
|
|
|
2022-02-21 20:40:01 -05:00
|
|
|
config()->set(Config::Security_QuickUnlock, m_secUi->quickUnlockCheckBox->isChecked());
|
2018-04-04 11:39:26 -04:00
|
|
|
|
2017-09-27 18:28:42 -04:00
|
|
|
// Security: clear storage if related settings are disabled
|
2020-04-25 19:31:38 -04:00
|
|
|
if (!config()->get(Config::RememberLastDatabases).toBool()) {
|
2021-07-05 17:00:38 -04:00
|
|
|
config()->remove(Config::LastDir);
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->remove(Config::LastDatabases);
|
|
|
|
config()->remove(Config::LastActiveDatabase);
|
2017-09-27 18:28:42 -04:00
|
|
|
}
|
|
|
|
|
2020-04-25 19:31:38 -04:00
|
|
|
if (!config()->get(Config::RememberLastKeyFiles).toBool()) {
|
2021-07-05 17:00:38 -04:00
|
|
|
config()->remove(Config::LastDir);
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->remove(Config::LastKeyFiles);
|
2020-04-06 08:42:20 -04:00
|
|
|
config()->remove(Config::LastChallengeResponse);
|
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
|
|
|
}
|
|
|
|
|
2019-08-30 20:18:41 -04:00
|
|
|
void ApplicationSettingsWidget::resetSettings()
|
|
|
|
{
|
|
|
|
// Confirm reset
|
|
|
|
auto ans = MessageBox::question(this,
|
|
|
|
tr("Reset Settings?"),
|
|
|
|
tr("Are you sure you want to reset all general and security settings to default?"),
|
|
|
|
MessageBox::Reset | MessageBox::Cancel,
|
|
|
|
MessageBox::Cancel);
|
|
|
|
if (ans == MessageBox::Cancel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config()->hasAccessError()) {
|
|
|
|
showMessage(tr("Access error for config file %1").arg(config()->getFileName()), MessageWidget::Error);
|
|
|
|
// We prevent closing the settings page if we could not write to
|
|
|
|
// the config file.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset general and security settings to default
|
|
|
|
config()->resetToDefaults();
|
|
|
|
|
|
|
|
// Clear recently used data
|
2020-04-25 19:31:38 -04:00
|
|
|
config()->remove(Config::LastDatabases);
|
|
|
|
config()->remove(Config::LastActiveDatabase);
|
|
|
|
config()->remove(Config::LastKeyFiles);
|
|
|
|
config()->remove(Config::LastDir);
|
2019-08-30 20:18:41 -04:00
|
|
|
|
|
|
|
// Save the Extra Pages (these are NOT reset)
|
|
|
|
for (const ExtraPage& page : asConst(m_extraPages)) {
|
|
|
|
page.saveSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
config()->sync();
|
|
|
|
|
|
|
|
// Refresh the settings widget and notify listeners
|
|
|
|
loadSettings();
|
|
|
|
emit settingsReset();
|
|
|
|
}
|
|
|
|
|
2018-05-13 17:21:43 -04:00
|
|
|
void ApplicationSettingsWidget::reject()
|
2012-05-27 14:29:15 -04:00
|
|
|
{
|
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
|
|
|
|
2019-01-25 07:20:39 -05:00
|
|
|
void ApplicationSettingsWidget::autoSaveToggled(bool checked)
|
2012-06-10 15:54:58 -04:00
|
|
|
{
|
2020-08-01 18:00:47 -04:00
|
|
|
// Explicitly enable other auto-save options
|
|
|
|
if (checked) {
|
2019-01-25 07:20:39 -05:00
|
|
|
m_generalUi->autoSaveOnExitCheckBox->setChecked(true);
|
2020-08-01 18:00:47 -04:00
|
|
|
m_generalUi->autoSaveNonDataChangesCheckBox->setChecked(true);
|
2019-01-25 07:20:39 -05:00
|
|
|
}
|
2012-06-12 04:11:13 -04:00
|
|
|
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
|
2020-08-01 18:00:47 -04:00
|
|
|
m_generalUi->autoSaveNonDataChangesCheckBox->setEnabled(!checked);
|
2012-06-10 15:54:58 -04:00
|
|
|
}
|
2015-10-06 15:12:59 -04:00
|
|
|
|
2019-06-09 14:15:02 -04:00
|
|
|
void ApplicationSettingsWidget::hideWindowOnCopyCheckBoxToggled(bool checked)
|
|
|
|
{
|
|
|
|
m_generalUi->minimizeOnCopyRadioButton->setEnabled(checked);
|
|
|
|
m_generalUi->dropToBackgroundOnCopyRadioButton->setEnabled(checked);
|
|
|
|
}
|
|
|
|
|
2019-01-25 07:20:39 -05:00
|
|
|
void ApplicationSettingsWidget::systrayToggled(bool checked)
|
2015-10-06 15:12:59 -04:00
|
|
|
{
|
2020-05-30 16:46:06 -04:00
|
|
|
m_generalUi->trayIconAppearance->setEnabled(checked);
|
|
|
|
m_generalUi->trayIconAppearanceLabel->setEnabled(checked);
|
2015-10-06 15:12:59 -04:00
|
|
|
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);
|
|
|
|
}
|
2019-01-16 11:04:32 -05:00
|
|
|
|
2019-03-21 17:39:02 -04:00
|
|
|
void ApplicationSettingsWidget::rememberDatabasesToggled(bool checked)
|
|
|
|
{
|
|
|
|
if (!checked) {
|
|
|
|
m_generalUi->rememberLastKeyFilesCheckBox->setChecked(false);
|
|
|
|
m_generalUi->openPreviousDatabasesOnStartupCheckBox->setChecked(false);
|
|
|
|
}
|
|
|
|
|
2022-07-04 15:59:41 -04:00
|
|
|
m_generalUi->rememberLastDatabasesSpinbox->setEnabled(checked);
|
2019-03-21 17:39:02 -04:00
|
|
|
m_generalUi->rememberLastKeyFilesCheckBox->setEnabled(checked);
|
|
|
|
m_generalUi->openPreviousDatabasesOnStartupCheckBox->setEnabled(checked);
|
|
|
|
}
|
2019-04-09 21:06:13 -04:00
|
|
|
|
|
|
|
void ApplicationSettingsWidget::checkUpdatesToggled(bool checked)
|
|
|
|
{
|
|
|
|
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setEnabled(checked);
|
|
|
|
}
|
2021-11-07 17:41:17 -05:00
|
|
|
|
2022-01-22 13:20:41 -05:00
|
|
|
void ApplicationSettingsWidget::showExpiredEntriesOnDatabaseUnlockToggled(bool checked)
|
|
|
|
{
|
|
|
|
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->setEnabled(checked);
|
|
|
|
}
|
|
|
|
|
2021-11-07 17:41:17 -05:00
|
|
|
void ApplicationSettingsWidget::selectBackupDirectory()
|
|
|
|
{
|
|
|
|
auto backupDirectory =
|
|
|
|
FileDialog::instance()->getExistingDirectory(this, tr("Select backup storage directory"), QDir::homePath());
|
|
|
|
if (!backupDirectory.isEmpty()) {
|
|
|
|
m_generalUi->backupFilePath->setText(
|
|
|
|
QDir(backupDirectory).filePath(config()->getDefault(Config::BackupFilePathPattern).toString()));
|
|
|
|
}
|
|
|
|
}
|