From ebb9009838d723b216c05665379d91e989873b3e Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Tue, 6 Dec 2022 13:48:18 +0100 Subject: [PATCH] 1.6.1a --- CHANGELOG.md | 3 +++ SandboxiePlus/SandMan/SandMan.cpp | 15 +++++++++++---- SandboxiePlus/SandMan/SandMan.h | 3 ++- SandboxiePlus/version.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1475e90f..deb6c7e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [1.6.1a / 5.61.1] - 2022-12-?? +### Added +- added run boxed command to the sandbox menu + ### Fixed - improved fix for [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495) diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 46484cd5..95e89f52 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -455,7 +455,9 @@ void CSandMan::CreateMenus(bool bAdvanced) m_pNewGroup = m_pMenuFile->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnSandBoxAction())); m_pImportBox = m_pMenuFile->addAction(CSandMan::GetIcon("UnPackBox"), tr("Import Box"), this, SLOT(OnSandBoxAction())); m_pMenuFile->addSeparator(); + m_pRunBoxed = m_pMenuFile->addAction(CSandMan::GetIcon("Run"), tr("Run Sandboxed"), this, SLOT(OnSandBoxAction())); m_pEmptyAll = m_pMenuFile->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Processes"), this, SLOT(OnEmptyAll())); + m_pMenuFile->addSeparator(); m_pDisableForce = m_pMenuFile->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce())); m_pDisableForce->setCheckable(true); if(bAdvanced) { @@ -1254,7 +1256,7 @@ void CSandMan::OnMessage(const QString& MsgData) } else if (Message.left(4) == "Run:") { - QString BoxName = "DefaultBox"; + QString BoxName; QString CmdLine = Message.mid(4); if (CmdLine.contains("\\start.exe", Qt::CaseInsensitive)) { @@ -1309,8 +1311,10 @@ void CSandMan::dragEnterEvent(QDragEnterEvent* e) } } -bool CSandMan::RunSandboxed(const QStringList& Commands, const QString& BoxName, const QString& WrkDir) +bool CSandMan::RunSandboxed(const QStringList& Commands, QString BoxName, const QString& WrkDir) { + if (BoxName.isEmpty()) + BoxName = "DefaultBox"; CSelectBoxWindow* pSelectBoxWindow = new CSelectBoxWindow(Commands, BoxName, WrkDir); //pSelectBoxWindow->show(); return SafeExec(pSelectBoxWindow) == 1; @@ -1324,7 +1328,7 @@ void CSandMan::dropEvent(QDropEvent* e) Commands.append(url.toLocalFile().replace("/", "\\")); } - RunSandboxed(Commands, "DefaultBox"); + RunSandboxed(Commands); } void CSandMan::timerEvent(QTimerEvent* pEvent) @@ -1822,6 +1826,7 @@ void CSandMan::OnStatusChanged() m_bIconDisabled = false; m_bIconBusy = false; + m_pRunBoxed->setEnabled(isConnected); m_pNewBox->setEnabled(isConnected); m_pNewGroup->setEnabled(isConnected); m_pEmptyAll->setEnabled(isConnected); @@ -2187,6 +2192,8 @@ void CSandMan::OnSandBoxAction() else CSandMan::CheckResults(QList() << Status); } + else if (pAction == m_pRunBoxed) + RunSandboxed(QStringList() << "run_dialog"); } void CSandMan::OnEmptyAll() @@ -2914,7 +2921,7 @@ void CSandMan::OpenUrl(const QUrl& url) if(bCheck) theConf->SetValue("Options/OpenUrlsSandboxed", iSandboxed); } - if (iSandboxed) RunSandboxed(QStringList(url.toString()), "DefaultBox"); + if (iSandboxed) RunSandboxed(QStringList(url.toString())); else ShellExecute(MainWndHandle, NULL, url.toString().toStdWString().c_str(), NULL, NULL, SW_SHOWNORMAL); } diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 95ff4169..34d35609 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -61,7 +61,7 @@ public: CSbieView* GetBoxView() { return m_pBoxView; } CFileView* GetFileView() { return m_pFileView; } - bool RunSandboxed(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString()); + bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString()); QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false); QRgb GetBoxColor(int boxType) { return m_BoxColors[boxType]; } @@ -281,6 +281,7 @@ private: QHBoxLayout* m_pMenuLayout; QMenu* m_pMenuFile; + QAction* m_pRunBoxed; QAction* m_pNewBox; QAction* m_pNewGroup; QAction* m_pImportBox; diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 6e28ab05..1effc9ee 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -3,7 +3,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 6 #define VERSION_REV 1 -#define VERSION_UPD 0 +#define VERSION_UPD 1 #ifndef STR #define STR2(X) #X