Skip to content

Commit

Permalink
Refactor Database Settings (keepassxreboot#9485)
Browse files Browse the repository at this point in the history
Includes following changes:

* Encryption Settings now has a similar key with the new database wizard for switching between Advanced and Simple Settings
* The extra UI layer DatabaseSettingsDialog.ui has been removed. DatabaseSettingsDialog class now inherits EditWidget instead of DialogyWidget (just like Application Settings).
* Extra classes for separate page settings (DatabaseSettingsPageFdoSecrets, DatabaseSettingsPageKeeShare) have been removed. Instead the widgets are used directly in DatabaseSettingsDialog. Same could be done later to Application 

---------

Co-authored-by: Jonathan White <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jun 23, 2024
1 parent 6b8b906 commit 266c025
Show file tree
Hide file tree
Showing 36 changed files with 152 additions and 391 deletions.
24 changes: 16 additions & 8 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1599,14 +1599,6 @@ To prevent this error from appearing, you must go to &quot;Database Settings / S
<source>&lt;p&gt;In addition to a password, you can use a secret file to enhance the security of your database. This file can be generated in your database&apos;s security settings.&lt;/p&gt;&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; your *.kdbx database file!&lt;/p&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to add a key file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot; style=&quot;text-decoration: underline&quot;&gt;I have a key file&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use hardware key [Serial: %1]</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -1639,6 +1631,14 @@ Are you sure you want to continue with this file?.</source>
<source>Refresh Hardware Keys</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to add a key file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot; style=&quot;text-decoration: underline&quot;&gt;I have a key file&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DatabaseSettingWidgetMetaData</name>
Expand Down Expand Up @@ -1673,6 +1673,14 @@ Are you sure you want to continue with this file?.</source>
<source>Maintenance</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeeShare</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Secret Service Integration</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remote Sync</source>
<translation type="unfinished"></translation>
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ set(keepassx_SOURCES
gui/ApplicationSettingsWidget.cpp
gui/Icons.cpp
gui/SearchWidget.cpp
gui/SettingsWidget.cpp
gui/SortFilterHideProxyModel.cpp
gui/SquareSvgWidget.cpp
gui/ShortcutSettingsPage.cpp
Expand Down Expand Up @@ -167,7 +168,6 @@ set(keepassx_SOURCES
gui/osutils/OSUtilsBase.cpp
gui/osutils/ScreenLockListener.cpp
gui/osutils/ScreenLockListenerPrivate.cpp
gui/settings/SettingsWidget.cpp
gui/widgets/ElidedLabel.cpp
gui/widgets/KPToolBar.cpp
gui/widgets/PopupHelpWidget.cpp
Expand Down
1 change: 0 additions & 1 deletion src/fdosecrets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if(WITH_XC_FDOSECRETS)
widgets/RowButtonHelper.cpp

# per database settings page
DatabaseSettingsPageFdoSecrets.cpp
widgets/DatabaseSettingsWidgetFdoSecrets.cpp

# prompt dialog
Expand Down
49 changes: 0 additions & 49 deletions src/fdosecrets/DatabaseSettingsPageFdoSecrets.cpp

This file was deleted.

36 changes: 0 additions & 36 deletions src/fdosecrets/DatabaseSettingsPageFdoSecrets.h

This file was deleted.

6 changes: 6 additions & 0 deletions src/gui/ApplicationSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

#include "FileDialog.h"
#include "MessageBox.h"
#ifdef WITH_XC_BROWSER
#include "browser/BrowserSettingsPage.h"
#endif

class ApplicationSettingsWidget::ExtraPage
{
Expand Down Expand Up @@ -97,6 +100,9 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->setupUi(m_generalWidget);
addPage(tr("General"), icons()->icon("preferences-other"), m_generalWidget);
addPage(tr("Security"), icons()->icon("security-high"), m_secWidget);
#ifdef WITH_XC_BROWSER
addSettingsPage(new BrowserSettingsPage());
#endif

if (!autoType()->isAvailable()) {
m_generalUi->generalSettingsTabWidget->removeTab(1);
Expand Down
2 changes: 0 additions & 2 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@

#ifdef WITH_XC_BROWSER
#include "browser/BrowserService.h"
#include "browser/BrowserSettingsPage.h"
#endif

#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && !defined(QT_NO_DBUS)
Expand Down Expand Up @@ -222,7 +221,6 @@ MainWindow::MainWindow()
m_ui->settingsWidget->addSettingsPage(new ShortcutSettingsPage());

#ifdef WITH_XC_BROWSER
m_ui->settingsWidget->addSettingsPage(new BrowserSettingsPage());
connect(
browserService(), &BrowserService::requestUnlock, m_ui->tabWidget, &DatabaseTabWidget::performBrowserUnlock);
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 KeePassXC Team <[email protected]>
* Copyright (C) 2023 KeePassXC Team <[email protected]>
*
* 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
Expand All @@ -22,8 +22,6 @@ SettingsWidget::SettingsWidget(QWidget* parent)
{
}

SettingsWidget::~SettingsWidget() = default;

void SettingsWidget::discard()
{
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 KeePassXC Team <[email protected]>
* Copyright (C) 2023 KeePassXC Team <[email protected]>
*
* 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
Expand Down Expand Up @@ -31,8 +31,7 @@ class SettingsWidget : public QWidget

public:
explicit SettingsWidget(QWidget* parent = nullptr);
Q_DISABLE_COPY(SettingsWidget);
~SettingsWidget() override;
~SettingsWidget() override = default;

public slots:
/**
Expand All @@ -50,7 +49,7 @@ public slots:
*
* @return true on success, false on failure
*/
virtual bool save() = 0;
virtual bool saveSettings() = 0;

/**
* Discard settings.
Expand All @@ -62,6 +61,8 @@ public slots:

private:
bool m_advancedMode = false;

Q_DISABLE_COPY(SettingsWidget);
};

#endif // KEEPASSXC_SETTINGSWIDGET_H
Loading

0 comments on commit 266c025

Please sign in to comment.