This commit is contained in:
DavidXanatos 2022-12-06 13:48:18 +01:00
parent b852eb16b7
commit ebb9009838
4 changed files with 17 additions and 6 deletions

View File

@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.6.1a / 5.61.1] - 2022-12-?? ## [1.6.1a / 5.61.1] - 2022-12-??
### Added
- added run boxed command to the sandbox menu
### Fixed ### Fixed
- improved fix for [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495) - improved fix for [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495)

View File

@ -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_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_pImportBox = m_pMenuFile->addAction(CSandMan::GetIcon("UnPackBox"), tr("Import Box"), this, SLOT(OnSandBoxAction()));
m_pMenuFile->addSeparator(); 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_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 = m_pMenuFile->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce()));
m_pDisableForce->setCheckable(true); m_pDisableForce->setCheckable(true);
if(bAdvanced) { if(bAdvanced) {
@ -1254,7 +1256,7 @@ void CSandMan::OnMessage(const QString& MsgData)
} }
else if (Message.left(4) == "Run:") else if (Message.left(4) == "Run:")
{ {
QString BoxName = "DefaultBox"; QString BoxName;
QString CmdLine = Message.mid(4); QString CmdLine = Message.mid(4);
if (CmdLine.contains("\\start.exe", Qt::CaseInsensitive)) { 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); CSelectBoxWindow* pSelectBoxWindow = new CSelectBoxWindow(Commands, BoxName, WrkDir);
//pSelectBoxWindow->show(); //pSelectBoxWindow->show();
return SafeExec(pSelectBoxWindow) == 1; return SafeExec(pSelectBoxWindow) == 1;
@ -1324,7 +1328,7 @@ void CSandMan::dropEvent(QDropEvent* e)
Commands.append(url.toLocalFile().replace("/", "\\")); Commands.append(url.toLocalFile().replace("/", "\\"));
} }
RunSandboxed(Commands, "DefaultBox"); RunSandboxed(Commands);
} }
void CSandMan::timerEvent(QTimerEvent* pEvent) void CSandMan::timerEvent(QTimerEvent* pEvent)
@ -1822,6 +1826,7 @@ void CSandMan::OnStatusChanged()
m_bIconDisabled = false; m_bIconDisabled = false;
m_bIconBusy = false; m_bIconBusy = false;
m_pRunBoxed->setEnabled(isConnected);
m_pNewBox->setEnabled(isConnected); m_pNewBox->setEnabled(isConnected);
m_pNewGroup->setEnabled(isConnected); m_pNewGroup->setEnabled(isConnected);
m_pEmptyAll->setEnabled(isConnected); m_pEmptyAll->setEnabled(isConnected);
@ -2187,6 +2192,8 @@ void CSandMan::OnSandBoxAction()
else else
CSandMan::CheckResults(QList<SB_STATUS>() << Status); CSandMan::CheckResults(QList<SB_STATUS>() << Status);
} }
else if (pAction == m_pRunBoxed)
RunSandboxed(QStringList() << "run_dialog");
} }
void CSandMan::OnEmptyAll() void CSandMan::OnEmptyAll()
@ -2914,7 +2921,7 @@ void CSandMan::OpenUrl(const QUrl& url)
if(bCheck) theConf->SetValue("Options/OpenUrlsSandboxed", iSandboxed); 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); else ShellExecute(MainWndHandle, NULL, url.toString().toStdWString().c_str(), NULL, NULL, SW_SHOWNORMAL);
} }

View File

@ -61,7 +61,7 @@ public:
CSbieView* GetBoxView() { return m_pBoxView; } CSbieView* GetBoxView() { return m_pBoxView; }
CFileView* GetFileView() { return m_pFileView; } 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); QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false);
QRgb GetBoxColor(int boxType) { return m_BoxColors[boxType]; } QRgb GetBoxColor(int boxType) { return m_BoxColors[boxType]; }
@ -281,6 +281,7 @@ private:
QHBoxLayout* m_pMenuLayout; QHBoxLayout* m_pMenuLayout;
QMenu* m_pMenuFile; QMenu* m_pMenuFile;
QAction* m_pRunBoxed;
QAction* m_pNewBox; QAction* m_pNewBox;
QAction* m_pNewGroup; QAction* m_pNewGroup;
QAction* m_pImportBox; QAction* m_pImportBox;

View File

@ -3,7 +3,7 @@
#define VERSION_MJR 1 #define VERSION_MJR 1
#define VERSION_MIN 6 #define VERSION_MIN 6
#define VERSION_REV 1 #define VERSION_REV 1
#define VERSION_UPD 0 #define VERSION_UPD 1
#ifndef STR #ifndef STR
#define STR2(X) #X #define STR2(X) #X