From 0701d1d6cd4d01596b2586a5e02b9a2877c5320c Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 6 Feb 2022 11:10:00 -0500 Subject: [PATCH] Fix styling of database tag view in main window * Also allow collapsing the entire left splitter instead of a dedicated option to hide the group view. --- share/translations/keepassxc_en.ts | 4 ---- src/core/Config.cpp | 2 +- src/core/Config.h | 1 - src/gui/DatabaseWidget.cpp | 7 ++++++- src/gui/MainWindow.cpp | 5 ----- src/gui/MainWindow.ui | 12 ------------ src/gui/group/GroupView.cpp | 7 ------- src/gui/styles/base/basestyle.qss | 6 ++++-- 8 files changed, 11 insertions(+), 33 deletions(-) diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index f9f746ffb..7991c5c57 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -5313,10 +5313,6 @@ Are you sure you want to continue with this file? Show Toolbar - - Show Groups Panel - - Show Preview Panel diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 0b7d67e67..66803d0dd 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -93,7 +93,6 @@ 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_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, @@ -365,6 +364,7 @@ static const QHash deprecationMap = { {QS("GUI/DarkTrayIcon"), Config::Deleted}, // 2.7.0 + {QS("GUI/HideGroupsPanel"), Config::Deleted}, {QS("LastAttachmentDir"), Config::Deleted}, {QS("KeeShare/LastDir"), Config::Deleted}, {QS("KeeShare/LastKeyDir"), Config::Deleted}, diff --git a/src/core/Config.h b/src/core/Config.h index 24da06bad..df003924f 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -74,7 +74,6 @@ public: GUI_Language, GUI_HideToolbar, GUI_MovableToolbar, - GUI_HideGroupsPanel, GUI_HidePreviewPanel, GUI_AlwaysOnTop, GUI_ToolButtonStyle, diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index c974c1c9b..118713872 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -99,6 +99,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) // Setup tags view and place under groups auto tagModel = new TagModel(m_db); + m_tagView->setObjectName("tagView"); m_tagView->setModel(tagModel); m_tagView->setFrameStyle(QFrame::NoFrame); m_tagView->setSelectionMode(QListView::SingleSelection); @@ -111,9 +112,11 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) auto tagsLayout = new QVBoxLayout(); auto tagsTitle = new QLabel(tr("Database Tags")); tagsTitle->setProperty("title", true); + tagsWidget->setObjectName("tagWidget"); tagsWidget->setLayout(tagsLayout); tagsLayout->addWidget(tagsTitle); tagsLayout->addWidget(m_tagView); + tagsLayout->setMargin(0); m_groupSplitter->setOrientation(Qt::Vertical); m_groupSplitter->setChildrenCollapsible(true); @@ -133,7 +136,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer db, QWidget* parent) rightHandSideWidget->setLayout(rightHandSideVBox); m_entryView = new EntryView(rightHandSideWidget); - m_mainSplitter->setChildrenCollapsible(false); + m_mainSplitter->setChildrenCollapsible(true); m_mainSplitter->addWidget(m_groupSplitter); m_mainSplitter->addWidget(rightHandSideWidget); m_mainSplitter->setStretchFactor(0, 30); @@ -1728,6 +1731,7 @@ void DatabaseWidget::reloadDatabaseFile() // Lock out interactions m_entryView->setDisabled(true); m_groupView->setDisabled(true); + m_tagView->setDisabled(true); QApplication::processEvents(); QString error; @@ -1773,6 +1777,7 @@ void DatabaseWidget::reloadDatabaseFile() // Return control m_entryView->setDisabled(false); m_groupView->setDisabled(false); + m_tagView->setDisabled(false); } int DatabaseWidget::numberOfSelectedEntries() const diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 3a7af1751..441dcd513 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1910,11 +1910,6 @@ 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 c877313b9..248f0b4d4 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -377,7 +377,6 @@ - @@ -1005,17 +1004,6 @@ Show Toolbar - - - true - - - true - - - Show Groups Panel - - true diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp index 6024de5f1..5ffcc5d94 100644 --- a/src/gui/group/GroupView.cpp +++ b/src/gui/group/GroupView.cpp @@ -58,13 +58,6 @@ 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() diff --git a/src/gui/styles/base/basestyle.qss b/src/gui/styles/base/basestyle.qss index 8aee33b81..545980f8d 100644 --- a/src/gui/styles/base/basestyle.qss +++ b/src/gui/styles/base/basestyle.qss @@ -25,12 +25,14 @@ QCheckBox, QRadioButton { spacing: 10px; } -DatabaseWidget, GroupView { +DatabaseWidget, DatabaseWidget #groupView, DatabaseWidget #tagView { background-color: palette(window); border: none; } -EntryPreviewWidget QLineEdit, EntryPreviewWidget QTextEdit { +EntryPreviewWidget QLineEdit, EntryPreviewWidget QTextEdit, +EntryPreviewWidget TagsEdit +{ background-color: palette(window); border: none; }