From 9484af53299cc86488bcde7c659e78250c7a3d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Nie=C3=9Fen?= Date: Thu, 8 Oct 2015 20:30:03 +0200 Subject: [PATCH] Minimize-On-Startup: call configuredMinimizeWindow() function of MainWindow to hide it after database is unlocked --- src/gui/DatabaseOpenWidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 717326a98..e15c3c97c 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -21,6 +21,7 @@ #include "core/Config.h" #include "core/Database.h" #include "core/FilePath.h" +#include "gui/MainWindow.h" #include "gui/FileDialog.h" #include "gui/MessageBox.h" #include "format/KeePass2Reader.h" @@ -117,6 +118,12 @@ void DatabaseOpenWidget::openDatabase() if (m_db) { Q_EMIT editFinished(true); + // this is a c++11 equivalent foreach construct + // if c++11 is not available another iteration loop style is needed! + for (auto widget : qApp->topLevelWidgets()) { + if(widget->inherits("QMainWindow")) + static_cast(widget)->configuredMinimizeWindow(); + } } else { MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")