Minimize-On-Startup: call configuredMinimizeWindow() function of MainWindow to hide it after database is unlocked

This commit is contained in:
Frank Nießen 2015-10-08 20:30:03 +02:00
parent 3cf1a16398
commit 9484af5329

View File

@ -21,6 +21,7 @@
#include "core/Config.h" #include "core/Config.h"
#include "core/Database.h" #include "core/Database.h"
#include "core/FilePath.h" #include "core/FilePath.h"
#include "gui/MainWindow.h"
#include "gui/FileDialog.h" #include "gui/FileDialog.h"
#include "gui/MessageBox.h" #include "gui/MessageBox.h"
#include "format/KeePass2Reader.h" #include "format/KeePass2Reader.h"
@ -117,6 +118,12 @@ void DatabaseOpenWidget::openDatabase()
if (m_db) { if (m_db) {
Q_EMIT editFinished(true); 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<MainWindow*>(widget)->configuredMinimizeWindow();
}
} }
else { else {
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n") MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")