From fa546c440e6522e80b71938161de80f84a4a73ba Mon Sep 17 00:00:00 2001 From: "Carlos E. Salazar" Date: Fri, 9 Oct 2020 04:52:30 +0200 Subject: [PATCH] Feature/toggle groups panel option (#5247) * Closes #5243 --- docs/topics/UserInterface.adoc | 2 +- share/translations/keepassx_en.ts | 4 ++++ src/core/Config.cpp | 1 + src/core/Config.h | 1 + src/gui/MainWindow.cpp | 5 +++++ src/gui/MainWindow.ui | 12 ++++++++++++ src/gui/group/GroupView.cpp | 8 ++++++++ 7 files changed, 32 insertions(+), 1 deletion(-) diff --git a/docs/topics/UserInterface.adoc b/docs/topics/UserInterface.adoc index 1f0ca9cf..cc284a52 100644 --- a/docs/topics/UserInterface.adoc +++ b/docs/topics/UserInterface.adoc @@ -10,7 +10,7 @@ The KeePassXC interface is designed for simplicity and easy access to your infor .Main database interface image::main_interface.png[] -*(A) Groups* - Organize your entries into discrete groups to bring order to all of your sensitive information. Groups can be nested under each other to create a hierarchy. Settings from parent groups get applied to their children. +*(A) Groups* - Organize your entries into discrete groups to bring order to all of your sensitive information. Groups can be nested under each other to create a hierarchy. Settings from parent groups get applied to their children. You can hide this panel on the View menu. *(B) Entries* - Entries contain all the information for each website or application you are storing in KeePassXC. This view shows all the entries in the selected group. Each column can be resized, reordered, and shown or hidden based on your preference. Right click the header row to see all available options. diff --git a/share/translations/keepassx_en.ts b/share/translations/keepassx_en.ts index 1fb02eab..75ca7a9c 100644 --- a/share/translations/keepassx_en.ts +++ b/share/translations/keepassx_en.ts @@ -4879,6 +4879,10 @@ Expect some bugs and minor issues, this version is not meant for production use. Show Toolbar + + Show Groups Panel + + Show Preview Panel diff --git a/src/core/Config.cpp b/src/core/Config.cpp index e9f5f1a7..382e0434 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -92,6 +92,7 @@ static const QHash configStrings = { {Config::GUI_Language, {QS("GUI/Language"), Roaming, QS("system")}}, {Config::GUI_HideToolbar, {QS("GUI/HideToolbar"), Roaming, false}}, {Config::GUI_MovableToolbar, {QS("GUI/MovableToolbar"), Roaming, false}}, + {Config::GUI_HideGroupsPanel, {QS("GUI/HideGroupsPanel"), Roaming, false}}, {Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, {Config::GUI_ShowTrayIcon, {QS("GUI/ShowTrayIcon"), Roaming, false}}, diff --git a/src/core/Config.h b/src/core/Config.h index 1c3f1e94..63bfb00c 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -74,6 +74,7 @@ public: GUI_Language, GUI_HideToolbar, GUI_MovableToolbar, + GUI_HideGroupsPanel, GUI_HidePreviewPanel, GUI_ToolButtonStyle, GUI_ShowTrayIcon, diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index e87cebce..f9d3cf40 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1792,6 +1792,11 @@ void MainWindow::initViewMenu() applySettingsChanges(); }); + m_ui->actionShowGroupsPanel->setChecked(!config()->get(Config::GUI_HideGroupsPanel).toBool()); + connect(m_ui->actionShowGroupsPanel, &QAction::toggled, this, [](bool checked) { + config()->set(Config::GUI_HideGroupsPanel, !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); diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui index 93488dc0..40efd3fa 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -381,6 +381,7 @@ + @@ -961,6 +962,17 @@ Show Toolbar + + + true + + + true + + + Show Groups Panel + + true diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp index 056015ca..b9c885d0 100644 --- a/src/gui/group/GroupView.cpp +++ b/src/gui/group/GroupView.cpp @@ -22,6 +22,7 @@ #include #include +#include "core/Config.h" #include "core/Database.h" #include "core/Group.h" #include "gui/group/GroupModel.h" @@ -52,6 +53,13 @@ GroupView::GroupView(Database* db, QWidget* parent) viewport()->setAcceptDrops(true); setDropIndicatorShown(true); setDefaultDropAction(Qt::MoveAction); + setVisible(!config()->get(Config::GUI_HideGroupsPanel).toBool()); + + connect(config(), &Config::changed, this, [this](Config::ConfigKey key) { + if (key == Config::GUI_HideGroupsPanel) { + setVisible(!config()->get(Config::GUI_HideGroupsPanel).toBool()); + } + }); } void GroupView::contextMenuShortcutPressed()