Skip to content

Commit

Permalink
Improve database encryption settings UX
Browse files Browse the repository at this point in the history
Fixes #6190

Remove the advanced settings checkbox and replace with a dedicated tab widget interface to toggle between basic and advanced encryption settings.
  • Loading branch information
droidmonkey committed Jul 9, 2023
1 parent 190a1fa commit 3cf1497
Show file tree
Hide file tree
Showing 21 changed files with 539 additions and 614 deletions.
37 changes: 12 additions & 25 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1581,10 +1581,6 @@ If you do not have a key file, please leave the field empty.</source>
</context>
<context>
<name>DatabaseSettingsDialog</name>
<message>
<source>Advanced Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>General</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -1778,14 +1774,6 @@ Are you sure you want to continue without a password?</source>
<source>Decryption Time:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Change existing decryption time</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Change</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Decryption time in seconds</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -1866,11 +1854,6 @@ Are you sure you want to continue without a password?</source>
<source>KDBX 3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>unchanged</source>
<comment>Database decryption time is unchanged</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Number of rounds too high</source>
<comment>Key transformation rounds</comment>
Expand Down Expand Up @@ -1925,6 +1908,18 @@ If you keep this number, your database will not be protected from brute force at
<numerusform></numerusform>
</translation>
</message>
<message>
<source>Encryption Settings:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Basic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Advanced</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DatabaseSettingsWidgetFdoSecrets</name>
Expand Down Expand Up @@ -5592,14 +5587,6 @@ We recommend you use the AppImage available on our downloads page.</source>
<source>Here you can adjust the database encryption settings. Don&apos;t worry, you can change them later in the database settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Advanced Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Simple Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewDatabaseWizardPageDatabaseKey</name>
Expand Down
6 changes: 4 additions & 2 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::GUI_MinimizeOnClose, {QS("GUI/MinimizeOnClose"), Roaming, false}},
{Config::GUI_HideUsernames, {QS("GUI/HideUsernames"), Roaming, false}},
{Config::GUI_HidePasswords, {QS("GUI/HidePasswords"), Roaming, true}},
{Config::GUI_AdvancedSettings, {QS("GUI/AdvancedSettings"), Roaming, false}},
{Config::GUI_ColorPasswords, {QS("GUI/ColorPasswords"), Roaming, false}},
{Config::GUI_MonospaceNotes, {QS("GUI/MonospaceNotes"), Roaming, false}},
{Config::GUI_ApplicationTheme, {QS("GUI/ApplicationTheme"), Roaming, QS("auto")}},
Expand Down Expand Up @@ -371,7 +370,10 @@ static const QHash<QString, Config::ConfigKey> deprecationMap = {
{QS("UseTouchID"), Config::Deleted},
{QS("Security/ResetTouchId"), Config::Deleted},
{QS("Security/ResetTouchIdTimeout"), Config::Deleted},
{QS("Security/ResetTouchIdScreenlock"), Config::Deleted}};
{QS("Security/ResetTouchIdScreenlock"), Config::Deleted},

// 2.8.0
{QS("GUI/AdvancedSettings"), Config::Deleted}};

/**
* Migrate settings from previous versions.
Expand Down
1 change: 0 additions & 1 deletion src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class Config : public QObject
GUI_MinimizeOnClose,
GUI_HideUsernames,
GUI_HidePasswords,
GUI_AdvancedSettings,
GUI_ColorPasswords,
GUI_MonospaceNotes,
GUI_ApplicationTheme,
Expand Down
32 changes: 1 addition & 31 deletions src/gui/dbsettings/DatabaseSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "fdosecrets/DatabaseSettingsPageFdoSecrets.h"
#endif

#include "core/Config.h"
#include "core/Database.h"
#include "core/Global.h"
#include "gui/Icons.h"
Expand Down Expand Up @@ -109,7 +108,6 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)

connect(m_securityTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged()));
connect(m_ui->categoryList, SIGNAL(categoryChanged(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_ui->advancedSettingsToggle, SIGNAL(toggled(bool)), SLOT(toggleAdvancedMode(bool)));

#ifdef WITH_XC_BROWSER
m_ui->categoryList->addCategory(tr("Browser Integration"), icons()->icon("internet-web-browser"));
Expand Down Expand Up @@ -137,7 +135,6 @@ void DatabaseSettingsDialog::load(const QSharedPointer<Database>& db)
for (const ExtraPage& page : asConst(m_extraPages)) {
page.loadSettings(db);
}
m_ui->advancedSettingsToggle->setChecked(config()->get(Config::GUI_AdvancedSettings).toBool());
m_db = db;
}

Expand Down Expand Up @@ -189,32 +186,5 @@ void DatabaseSettingsDialog::reject()

void DatabaseSettingsDialog::pageChanged()
{
int pageIndex = m_ui->stackedWidget->currentIndex();

bool enabled = (pageIndex == Page::General && m_generalWidget->hasAdvancedMode());

if (Page::Security == pageIndex) {
int tabIndex = m_securityTabWidget->currentIndex();
enabled = (tabIndex == 0 && m_databaseKeyWidget->hasAdvancedMode());
enabled |= (tabIndex == 1 && m_encryptionWidget->hasAdvancedMode());
}

m_ui->advancedSettingsToggle->setEnabled(enabled);
}

void DatabaseSettingsDialog::toggleAdvancedMode(bool advanced)
{
if (m_generalWidget->hasAdvancedMode()) {
m_generalWidget->setAdvancedMode(advanced);
}

if (m_databaseKeyWidget->hasAdvancedMode()) {
m_databaseKeyWidget->setAdvancedMode(advanced);
}

if (m_encryptionWidget->hasAdvancedMode()) {
m_encryptionWidget->setAdvancedMode(advanced);
}

config()->set(Config::GUI_AdvancedSettings, advanced);
m_ui->stackedWidget->currentIndex();
}
1 change: 0 additions & 1 deletion src/gui/dbsettings/DatabaseSettingsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private slots:
void save();
void reject();
void pageChanged();
void toggleAdvancedMode(bool advanced);

private:
enum Page
Expand Down
21 changes: 5 additions & 16 deletions src/gui/dbsettings/DatabaseSettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="advancedSettingsToggle">
<property name="text">
<string>Advanced Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
Expand Down
4 changes: 0 additions & 4 deletions src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ class DatabaseSettingsWidgetBrowser : public DatabaseSettingsWidget
~DatabaseSettingsWidgetBrowser() override;

CustomData* customData() const;
inline bool hasAdvancedMode() const override
{
return false;
}

public slots:
void initialize() override;
Expand Down
5 changes: 0 additions & 5 deletions src/gui/dbsettings/DatabaseSettingsWidgetDatabaseKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ class DatabaseSettingsWidgetDatabaseKey : public DatabaseSettingsWidget

void load(QSharedPointer<Database> db) override;

inline bool hasAdvancedMode() const override
{
return false;
}

public slots:
void initialize() override;
void uninitialize() override;
Expand Down
Loading

0 comments on commit 3cf1497

Please sign in to comment.