Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show / Hide toolbar from KeePassXC Settings #1819

Merged
merged 10 commits into from
Jul 3, 2018
1 change: 1 addition & 0 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ void Config::init(const QString& fileName)
m_defaults.insert("security/autotypeask", true);
m_defaults.insert("security/IconDownloadFallbackToGoogle", false);
m_defaults.insert("GUI/Language", "system");
m_defaults.insert("GUI/HideToolbar", false);
m_defaults.insert("GUI/ShowTrayIcon", false);
m_defaults.insert("GUI/DarkTrayIcon", false);
m_defaults.insert("GUI/MinimizeToTray", false);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ MainWindow::MainWindow()

setAcceptDrops(true);

m_ui->toolBar->setContextMenuPolicy(Qt::PreventContextMenu);

// Setup the search widget in the toolbar
SearchWidget* search = new SearchWidget();
search->connectSignals(m_actionMultiplexer);
Expand Down Expand Up @@ -841,6 +839,8 @@ void MainWindow::applySettingsChanges()
m_inactivityTimer->deactivate();
}

m_ui->toolBar->setHidden(config()->get("GUI/HideToolbar").toBool());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a second parameter to the get function of "false" or add it to the default config entries in config.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


updateTrayIcon();
}

Expand Down
14 changes: 14 additions & 0 deletions src/gui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>30</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;Database</string>
Expand Down Expand Up @@ -277,6 +288,9 @@
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<property name="movable">
<bool>false</bool>
</property>
Expand Down
2 changes: 2 additions & 0 deletions src/gui/SettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void SettingsWidget::loadSettings()
}

m_generalUi->detailsHideCheckBox->setChecked(config()->get("GUI/HideDetailsView").toBool());
m_generalUi->toolbarHideCheckBox->setChecked(config()->get("GUI/HideToolbar").toBool());
m_generalUi->systrayShowCheckBox->setChecked(config()->get("GUI/ShowTrayIcon").toBool());
m_generalUi->systrayDarkIconCheckBox->setChecked(config()->get("GUI/DarkTrayIcon").toBool());
m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool());
Expand Down Expand Up @@ -210,6 +211,7 @@ void SettingsWidget::saveSettings()
config()->set("GUI/Language", m_generalUi->languageComboBox->itemData(currentLangIndex).toString());

config()->set("GUI/HideDetailsView", m_generalUi->detailsHideCheckBox->isChecked());
config()->set("GUI/HideToolbar", m_generalUi->toolbarHideCheckBox->isChecked());
config()->set("GUI/ShowTrayIcon", m_generalUi->systrayShowCheckBox->isChecked());
config()->set("GUI/DarkTrayIcon", m_generalUi->systrayDarkIconCheckBox->isChecked());
config()->set("GUI/MinimizeToTray", m_generalUi->systrayMinimizeToTrayCheckBox->isChecked());
Expand Down
9 changes: 8 additions & 1 deletion src/gui/SettingsWidgetGeneral.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>684</width>
<height>732</height>
<height>794</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -179,6 +179,13 @@
<string>General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QCheckBox" name="toolbarHideCheckBox">
<property name="text">
<string>Hide toolbar (icons)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="systrayShowCheckBox">
<property name="text">
Expand Down