diff --git a/COPYING b/COPYING index 23dd1d168..9a801fe90 100644 --- a/COPYING +++ b/COPYING @@ -141,6 +141,7 @@ Copyright: 2022 KeePassXC Team License: MIT Files: share/icons/application/scalable/actions/application-exit.svg + share/icons/application/scalable/actions/arrow-collapse-down.svg share/icons/application/scalable/actions/attributes-copy.svg share/icons/application/scalable/actions/auto-type.svg share/icons/application/scalable/actions/bitwarden.svg diff --git a/share/icons/application/scalable/actions/arrow-collapse-down.svg b/share/icons/application/scalable/actions/arrow-collapse-down.svg new file mode 100644 index 000000000..27cfc42f2 --- /dev/null +++ b/share/icons/application/scalable/actions/arrow-collapse-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/share/icons/icons.qrc b/share/icons/icons.qrc index 4e86186d6..87b8b05b8 100644 --- a/share/icons/icons.qrc +++ b/share/icons/icons.qrc @@ -6,6 +6,7 @@ application/256x256/apps/keepassxc.png application/scalable/actions/application-exit.svg + application/scalable/actions/arrow-collapse-down.svg application/scalable/actions/attributes-copy.svg application/scalable/actions/auto-type.svg application/scalable/actions/bitwarden.svg diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index 373358fb8..e874a1fd0 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -6179,6 +6179,14 @@ Expect some bugs and minor issues, this version is meant for testing purposes.Setup Remote Sync… + + Show Group Panel + + + + Toggle Show Group Panel + + ManageDatabase diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 108bbe88c..84b4a35c2 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -96,6 +96,7 @@ static const QHash configStrings = { {Config::GUI_HideMenubar, {QS("GUI/HideMenubar"), Roaming, false}}, {Config::GUI_HideToolbar, {QS("GUI/HideToolbar"), Roaming, false}}, {Config::GUI_MovableToolbar, {QS("GUI/MovableToolbar"), Roaming, false}}, + {Config::GUI_HideGroupPanel, {QS("GUI/HideGroupPanel"), Roaming, false}}, {Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}}, {Config::GUI_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, diff --git a/src/core/Config.h b/src/core/Config.h index 5179b49d7..8131bc9af 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -78,6 +78,7 @@ public: GUI_HideMenubar, GUI_HideToolbar, GUI_MovableToolbar, + GUI_HideGroupPanel, GUI_HidePreviewPanel, GUI_AlwaysOnTop, GUI_ToolButtonStyle, diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 8a18adade..fba27d5a8 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -128,6 +128,8 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) m_groupSplitter->setStretchFactor(0, 100); m_groupSplitter->setStretchFactor(1, 0); m_groupSplitter->setSizes({1, 1}); + // Initial visibility based on config value + m_groupSplitter->setVisible(!config()->get(Config::GUI_HideGroupPanel).toBool()); auto rightHandSideWidget = new QWidget(m_mainSplitter); auto rightHandSideVBox = new QVBoxLayout(); @@ -140,12 +142,11 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) rightHandSideWidget->setLayout(rightHandSideVBox); m_entryView = new EntryView(rightHandSideWidget); - m_mainSplitter->setChildrenCollapsible(true); + m_mainSplitter->setChildrenCollapsible(false); m_mainSplitter->addWidget(m_groupSplitter); m_mainSplitter->addWidget(rightHandSideWidget); m_mainSplitter->setStretchFactor(0, 0); m_mainSplitter->setStretchFactor(1, 100); - m_mainSplitter->setCollapsible(1, false); m_mainSplitter->setSizes({1, 1}); m_previewSplitter->setOrientation(Qt::Vertical); @@ -217,6 +218,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) connect(m_databaseOpenWidget, SIGNAL(dialogFinished(bool)), SLOT(loadDatabase(bool))); connect(this, SIGNAL(currentChanged(int)), SLOT(emitCurrentModeChanged())); connect(this, SIGNAL(requestGlobalAutoType(const QString&)), parent, SLOT(performGlobalAutoType(const QString&))); + connect(config(), &Config::changed, this, &DatabaseWidget::onConfigChanged); // clang-format on connectDatabaseSignals(); @@ -408,6 +410,15 @@ void DatabaseWidget::setSplitterSizes(const QHash> } } +void DatabaseWidget::onConfigChanged(Config::ConfigKey key) +{ + if (key == Config::GUI_HideGroupPanel) { + // Toggle the group splitter visibility and reset the size + m_groupSplitter->setVisible(!config()->get(Config::GUI_HideGroupPanel).toBool()); + setSplitterSizes({{Config::GUI_SplitterState, QList({})}}); + } +} + void DatabaseWidget::setSearchStringForAutoType(const QString& search) { m_searchStringForAutoType = search; diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 3b1b475b5..5ef870925 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -288,6 +288,7 @@ private slots: // Database autoreload slots void reloadDatabaseFile(); void restoreGroupEntryFocus(const QUuid& groupUuid, const QUuid& EntryUuid); + void onConfigChanged(Config::ConfigKey key); private: int addChildWidget(QWidget* w); diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 0e948e4b6..0151c0c1e 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -50,7 +50,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) // Entry m_ui->entryTotpButton->setIcon(icons()->icon("totp")); - m_ui->entryCloseButton->setIcon(icons()->icon("dialog-close")); + m_ui->entryCloseButton->setIcon(icons()->icon("arrow-collapse-down")); m_ui->toggleUsernameButton->setIcon(icons()->onOffIcon("password-show", true)); m_ui->togglePasswordButton->setIcon(icons()->onOffIcon("password-show", true)); m_ui->toggleEntryNotesButton->setIcon(icons()->onOffIcon("password-show", true)); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 06e86b313..1d9c9ba32 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1968,6 +1968,11 @@ void MainWindow::initViewMenu() applySettingsChanges(); }); + m_ui->actionShowGroupPanel->setChecked(!config()->get(Config::GUI_HideGroupPanel).toBool()); + connect(m_ui->actionShowGroupPanel, &QAction::toggled, this, [](bool checked) { + config()->set(Config::GUI_HideGroupPanel, !checked); + }); + m_ui->actionShowPreviewPanel->setChecked(!config()->get(Config::GUI_HidePreviewPanel).toBool()); connect(m_ui->actionShowPreviewPanel, &QAction::toggled, this, [](bool checked) { config()->set(Config::GUI_HidePreviewPanel, !checked); @@ -2071,6 +2076,7 @@ void MainWindow::initActionCollection() m_ui->actionShowMenubar, #endif m_ui->actionShowToolbar, + m_ui->actionShowGroupPanel, m_ui->actionShowPreviewPanel, m_ui->actionAllowScreenCapture, m_ui->actionAlwaysOnTop, diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui index de3946c88..1110b6426 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -387,9 +387,13 @@ + + + + @@ -1285,6 +1289,20 @@ Import… + + + true + + + true + + + Show Group Panel + + + Toggle Show Group Panel + +