Skip to content

Commit

Permalink
Fix styling of database tag view in main window
Browse files Browse the repository at this point in the history
* Also allow collapsing the entire left splitter instead of a dedicated option to hide the group view.
  • Loading branch information
droidmonkey committed Feb 20, 2022
1 parent d10c5a4 commit 0701d1d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 33 deletions.
4 changes: 0 additions & 4 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5313,10 +5313,6 @@ Are you sure you want to continue with this file?</source>
<source>Show Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show Groups Panel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show Preview Panel</source>
<translation type="unfinished"></translation>
Expand Down
2 changes: 1 addition & 1 deletion src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ static const QHash<Config::ConfigKey, ConfigDirective> 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}},
Expand Down Expand Up @@ -365,6 +364,7 @@ static const QHash<QString, Config::ConfigKey> 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},
Expand Down
1 change: 0 additions & 1 deletion src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class Config : public QObject
GUI_Language,
GUI_HideToolbar,
GUI_MovableToolbar,
GUI_HideGroupsPanel,
GUI_HidePreviewPanel,
GUI_AlwaysOnTop,
GUI_ToolButtonStyle,
Expand Down
7 changes: 6 additions & 1 deletion src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> 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);
Expand All @@ -111,9 +112,11 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> 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);
Expand All @@ -133,7 +136,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> 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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 0 additions & 12 deletions src/gui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@
<addaction name="menuTheme"/>
<addaction name="actionCompactMode"/>
<addaction name="actionAlwaysOnTop"/>
<addaction name="actionShowGroupsPanel"/>
<addaction name="actionShowPreviewPanel"/>
<addaction name="actionShowToolbar"/>
<addaction name="actionHideUsernames"/>
Expand Down Expand Up @@ -1005,17 +1004,6 @@
<string>Show Toolbar</string>
</property>
</action>
<action name="actionShowGroupsPanel">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Show Groups Panel</string>
</property>
</action>
<action name="actionShowPreviewPanel">
<property name="checkable">
<bool>true</bool>
Expand Down
7 changes: 0 additions & 7 deletions src/gui/group/GroupView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions src/gui/styles/base/basestyle.qss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0701d1d

Please sign in to comment.