diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index eec6abfc..cda54c09 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -29,8 +29,6 @@ #include "model/zonelistmodel.h" #include "stat/quotamanager.h" #include "stat/statmanager.h" -#include "task/taskinfo.h" -#include "task/taskinfoupdatechecker.h" #include "task/taskinfozonedownloader.h" #include "task/taskmanager.h" #include "translationmanager.h" @@ -43,7 +41,6 @@ #include "util/logger.h" #include "util/nativeeventfilter.h" #include "util/net/hostinfocache.h" -#include "util/net/netutil.h" #include "util/osutil.h" #include "util/startuputil.h" #include "util/stringutil.h" @@ -609,10 +606,7 @@ bool FortManager::checkPassword() return true; if (g_passwordDialogOpened) { - auto dialog = qApp->activeModalWidget(); - if (dialog) { - dialog->activateWindow(); - } + activateModalWidget(); return false; } @@ -790,3 +784,11 @@ QWidget *FortManager::focusWidget() const auto w = QApplication::focusWidget(); return w ? w : m_mainWindow; } + +void FortManager::activateModalWidget() +{ + auto w = qApp->activeModalWidget(); + if (w) { + w->activateWindow(); + } +} diff --git a/src/ui/fortmanager.h b/src/ui/fortmanager.h index 90b411c5..1ec0eb10 100644 --- a/src/ui/fortmanager.h +++ b/src/ui/fortmanager.h @@ -170,6 +170,7 @@ private: void onTrayMessageClicked(); QWidget *focusWidget() const; + static void activateModalWidget(); private: bool m_initialized : 1;