0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-20 04:12:15 +02:00

Persist Always on Top setting

This commit is contained in:
mantlabs 2021-03-06 20:29:08 +02:00 committed by Jonathan White
parent bc08913c61
commit d6b69204a6
3 changed files with 5 additions and 0 deletions

View File

@ -94,6 +94,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{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"), Roaming, false}},
{Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}},
{Config::GUI_ShowTrayIcon, {QS("GUI/ShowTrayIcon"), Roaming, false}},
{Config::GUI_TrayIconAppearance, {QS("GUI/TrayIconAppearance"), Roaming, {}}},

View File

@ -76,6 +76,7 @@ public:
GUI_MovableToolbar,
GUI_HideGroupsPanel,
GUI_HidePreviewPanel,
GUI_AlwaysOnTop,
GUI_ToolButtonStyle,
GUI_ShowTrayIcon,
GUI_TrayIconAppearance,

View File

@ -1831,6 +1831,7 @@ void MainWindow::initViewMenu()
});
connect(m_ui->actionAlwaysOnTop, &QAction::toggled, this, [this](bool checked) {
config()->set(Config::GUI_AlwaysOnTop, checked);
if (checked) {
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
} else {
@ -1838,6 +1839,8 @@ void MainWindow::initViewMenu()
}
show();
});
// Set checked after connecting to act on a toggle in state (default state is unchecked)
m_ui->actionAlwaysOnTop->setChecked(config()->get(Config::GUI_AlwaysOnTop).toBool());
m_ui->actionHideUsernames->setChecked(config()->get(Config::GUI_HideUsernames).toBool());
connect(m_ui->actionHideUsernames, &QAction::toggled, this, [](bool checked) {