From 9546d97d0f10940e4dca014151b9732af4f6d687 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Thu, 25 May 2023 18:33:24 +0200 Subject: [PATCH] 1.9.5 --- SandboxiePlus/MiscHelpers/Common/Common.cpp | 4 ---- SandboxiePlus/MiscHelpers/Common/Common.h | 1 - SandboxiePlus/SandMan/SandMan.cpp | 12 ++++++++++++ SandboxiePlus/SandMan/SandMan.h | 2 ++ SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp | 2 +- SandboxiePlus/SandMan/Wizards/SetupWizard.cpp | 2 +- SandboxiePlus/SandMan/Wizards/TemplateWizard.cpp | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/SandboxiePlus/MiscHelpers/Common/Common.cpp b/SandboxiePlus/MiscHelpers/Common/Common.cpp index 7166600f..630cac48 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Common.cpp @@ -623,7 +623,3 @@ void SafeShow(QWidget* pWidget) { pWidget->setProperty("windowOpacity", 1.0); } -int SafeExec(QDialog* pDialog){ - SafeShow(pDialog); - return pDialog->exec(); -} diff --git a/SandboxiePlus/MiscHelpers/Common/Common.h b/SandboxiePlus/MiscHelpers/Common/Common.h index 772629f8..fdfb86ec 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.h +++ b/SandboxiePlus/MiscHelpers/Common/Common.h @@ -115,7 +115,6 @@ MISCHELPERS_EXPORT bool InitConsole(bool bCreateIfNeeded = true); #endif MISCHELPERS_EXPORT void SafeShow(QWidget* pWidget); -MISCHELPERS_EXPORT int SafeExec(QDialog* pDialog); template QSet ListToSet(const QList& qList) { return QSet(qList.begin(), qList.end()); } diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 9c6ba1f6..f11dcf19 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1284,6 +1284,18 @@ bool CSandMan::IsSilentMode() return IsFullScreenMode(); } +QWidget* g_GUIParent = NULL; + +int CSandMan::SafeExec(QDialog* pDialog) +{ + QWidget* pPrevParent = g_GUIParent; + g_GUIParent = pDialog; + SafeShow(pDialog); + int ret = pDialog->exec(); + g_GUIParent = pPrevParent; + return ret; +} + void CSandMan::OnMessage(const QString& MsgData) { QStringList Messages = MsgData.split("\n"); diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 4f8290c9..b5b8fa24 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -65,6 +65,8 @@ public: CSbieView* GetBoxView() { return m_pBoxView; } CFileView* GetFileView() { return m_pFileView; } + int SafeExec(QDialog* pDialog); + bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString()); QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false); diff --git a/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp b/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp index 218eccd5..9d7d3e52 100644 --- a/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp +++ b/SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp @@ -38,7 +38,7 @@ void CNewBoxWizard::showHelp() QString CNewBoxWizard::CreateNewBox(bool bAlowTemp, QWidget* pParent) { CNewBoxWizard wizard(bAlowTemp, pParent); - if (!wizard.exec()) + if (!theGUI->SafeExec(&wizard)) return QString(); QString BoxName = wizard.field("boxName").toString(); diff --git a/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp b/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp index b125c1b4..f503ee79 100644 --- a/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp +++ b/SandboxiePlus/SandMan/Wizards/SetupWizard.cpp @@ -54,7 +54,7 @@ void CSetupWizard::showHelp() bool CSetupWizard::ShowWizard() { CSetupWizard wizard; - if (!wizard.exec()) + if (!theGUI->SafeExec(&wizard)) return false; //bool useBusiness = wizard.field("useBusiness").toBool(); diff --git a/SandboxiePlus/SandMan/Wizards/TemplateWizard.cpp b/SandboxiePlus/SandMan/Wizards/TemplateWizard.cpp index 6ac990ea..c632df4d 100644 --- a/SandboxiePlus/SandMan/Wizards/TemplateWizard.cpp +++ b/SandboxiePlus/SandMan/Wizards/TemplateWizard.cpp @@ -54,7 +54,7 @@ QString CTemplateWizard::GetTemplateLabel(ETemplateType Type) bool CTemplateWizard::CreateNewTemplate(CSandBox* pBox, ETemplateType Type, QWidget* pParent) { CTemplateWizard wizard(Type, pParent); - if (!wizard.exec()) + if (!theGUI->SafeExec(&wizard)) return false; if (Type == TmplCustom)