From 3cf1a16398a92712f6a97b36692598bc5daa6057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Nie=C3=9Fen?= Date: Thu, 8 Oct 2015 19:25:42 +0200 Subject: [PATCH] Minimize-On-Startup: add function to minimize mainwindow if all four tray settings are true --- src/gui/MainWindow.cpp | 11 +++++++++++ src/gui/MainWindow.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index dabc56da6..01d4c08b8 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -307,6 +307,17 @@ void MainWindow::openDatabase(const QString& fileName, const QString& pw, const m_ui->tabWidget->openDatabase(fileName, pw, keyFile); } +void MainWindow::configuredMinimizeWindow() +{ + bool minimize = isTrayIconEnabled() && + config()->get("GUI/MinimizeToTray").toBool() && + config()->get("GUI/MinimizeOnClose").toBool() && + config()->get("GUI/MinimizeOnStartup").toBool(); + if (minimize) { + hide(); + } +} + void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) { bool inDatabaseTabWidget = (m_ui->stackedWidget->currentIndex() == 0); diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 0bdb1b828..4d2ebb8cd 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -38,6 +38,7 @@ class MainWindow : public QMainWindow public: MainWindow(); ~MainWindow(); + void configuredMinimizeWindow(); public Q_SLOTS: void openDatabase(const QString& fileName, const QString& pw = QString(),