UI: FortManager: Extract activateModalWidget().

This commit is contained in:
Nodir Temirkhodjaev 2021-04-17 16:50:32 +03:00
parent feb671ab7f
commit 4b8dfd2dc9
2 changed files with 10 additions and 7 deletions

View File

@ -29,8 +29,6 @@
#include "model/zonelistmodel.h" #include "model/zonelistmodel.h"
#include "stat/quotamanager.h" #include "stat/quotamanager.h"
#include "stat/statmanager.h" #include "stat/statmanager.h"
#include "task/taskinfo.h"
#include "task/taskinfoupdatechecker.h"
#include "task/taskinfozonedownloader.h" #include "task/taskinfozonedownloader.h"
#include "task/taskmanager.h" #include "task/taskmanager.h"
#include "translationmanager.h" #include "translationmanager.h"
@ -43,7 +41,6 @@
#include "util/logger.h" #include "util/logger.h"
#include "util/nativeeventfilter.h" #include "util/nativeeventfilter.h"
#include "util/net/hostinfocache.h" #include "util/net/hostinfocache.h"
#include "util/net/netutil.h"
#include "util/osutil.h" #include "util/osutil.h"
#include "util/startuputil.h" #include "util/startuputil.h"
#include "util/stringutil.h" #include "util/stringutil.h"
@ -609,10 +606,7 @@ bool FortManager::checkPassword()
return true; return true;
if (g_passwordDialogOpened) { if (g_passwordDialogOpened) {
auto dialog = qApp->activeModalWidget(); activateModalWidget();
if (dialog) {
dialog->activateWindow();
}
return false; return false;
} }
@ -790,3 +784,11 @@ QWidget *FortManager::focusWidget() const
auto w = QApplication::focusWidget(); auto w = QApplication::focusWidget();
return w ? w : m_mainWindow; return w ? w : m_mainWindow;
} }
void FortManager::activateModalWidget()
{
auto w = qApp->activeModalWidget();
if (w) {
w->activateWindow();
}
}

View File

@ -170,6 +170,7 @@ private:
void onTrayMessageClicked(); void onTrayMessageClicked();
QWidget *focusWidget() const; QWidget *focusWidget() const;
static void activateModalWidget();
private: private:
bool m_initialized : 1; bool m_initialized : 1;