diff --git a/CHANGELOG.md b/CHANGELOG.md index d43c6b9b..91c3c406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,19 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [1.6.0a / 5.61.0] - 2022-??-?? -#changed +### Added +- added global option to add run menu entries to all boxes + +### Changed - reorganized cmd entried [#2451](https://github.com/sandboxie-plus/Sandboxie/issues/2451) -#fixed +### Fixed - fixed issue with support setting drop down menu multiplying [2502#](https://github.com/sandboxie-plus/Sandboxie/pull/2502) (okrc) - Add translations folder to deprecated [#2500](https://github.com/sandboxie-plus/Sandboxie/pull/2500) (lufog) - fixed issue with boolean settings which can also be set per process [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495) + ## [1.6.0 / 5.61.0] - 2022-11-26 ### Added diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index 3000b89b..6ef42889 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -45,7 +45,7 @@ QTabWidget::North - 8 + 0 @@ -439,183 +439,282 @@ Interface Config - - - - - - Font Scaling - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - - - - (Restart required) - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Use Dark Theme - - - true - - - - - - - Show "Pizza" Background in box list * - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Use a Page Tree in the Box Options instead of Nested Tabs * - - - true - - - - - - - - true - true - - - - Interface Options - - - - - - - * a partially checked checkbox will leave the behavior to be determined by the view mode. - - - - - - - Use large icons in box list * - - - true - - - - - - - High DPI Scaling - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Use Fusion Theme - - - true - - - - - - - % - - - - - - - Alternate row background in lists - - - - - - - Make Box Icons match the Border Color - - - - - - - Don't show icons in menus * - - - true - - - - - - - Use new config dialog layout * - - - true - - - - + + + + 0 + + + + User Interface + + + + + + + + Font Scaling + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + + + + (Restart required) + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Use Dark Theme + + + true + + + + + + + Show "Pizza" Background in box list * + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Use a Page Tree in the Box Options instead of Nested Tabs * + + + true + + + + + + + + true + true + + + + Interface Options + + + + + + + * a partially checked checkbox will leave the behavior to be determined by the view mode. + + + + + + + Use large icons in box list * + + + true + + + + + + + High DPI Scaling + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Use Fusion Theme + + + true + + + + + + + % + + + + + + + Alternate row background in lists + + + + + + + Make Box Icons match the Border Color + + + + + + + Don't show icons in menus * + + + true + + + + + + + Use new config dialog layout * + + + true + + + + + + + + + + Run Menu + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + Add program + + + + + + + You can configure custom entries for all sandboxes run menus. + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + Remove + + + + + + + true + + + + Name + + + + + Command Line + + + + + + + @@ -624,190 +723,279 @@ Advanced Config + + + - - - - - - - - Separate user folders - - - - - - - Hook selected Win32k system calls to enable GPU acceleration (experimental) - - - - - - - Portable root folder - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Sandbox <a href="sbie://docs/keyrootpath">registry root</a>: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - true - true - - - - Sandboxing features - - - - - - - - 23 - 16777215 - - - - ... - - - - - - - - true - true - - - - Sandbox default - - - - - - - Sandbox <a href="sbie://docs/filerootpath">file system root</a>: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Activate Kernel Mode Object Filtering - - - - - - - Use Windows Filtering Platform to restrict network access - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Sandbox <a href="sbie://docs/ipcrootpath">ipc root</a>: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Use a Sandboxie login instead of an anonymous token (experimental) - - - - + + + 0 + + + + Sandbox Config + + + + + + + + Portable root folder + + + + + + + Sandbox <a href="sbie://docs/ipcrootpath">ipc root</a>: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + + 23 + 16777215 + + + + ... + + + + + + + + + + Use Windows Filtering Platform to restrict network access + + + + + + + Sandbox <a href="sbie://docs/filerootpath">file system root</a>: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Use a Sandboxie login instead of an anonymous token (experimental) + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + true + true + + + + Sandbox default + + + + + + + + + + Sandbox <a href="sbie://docs/keyrootpath">registry root</a>: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + Hook selected Win32k system calls to enable GPU acceleration (experimental) + + + + + + + Activate Kernel Mode Object Filtering + + + + + + + + + + Separate user folders + + + + + + + + true + true + + + + Sandboxing features + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Config Protection + + + + + + + + + true + true + + + + Config protection + + + + + + + Clear password when main window becomes hidden + + + + + + + Only Administrator user accounts can make changes + + + + + + + Only Administrator user accounts can use Pause Forcing Programs command + + + + + + + Password must be entered in order to make changes + + + + + + + Change Password + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + @@ -901,78 +1089,6 @@ - - - Config Protection - - - - - - - - - true - true - - - - Config protection - - - - - - - Clear password when main window becomes hidden - - - - - - - Only Administrator user accounts can make changes - - - - - - - Only Administrator user accounts can use Pause Forcing Programs command - - - - - - - Password must be entered in order to make changes - - - - - - - Change Password - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Compatibility diff --git a/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp b/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp index a80b5a79..e4cd80b4 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsGeneral.cpp @@ -154,7 +154,7 @@ void COptionsWindow::CreateGeneral() connect(ui.chkRawDiskNotify, SIGNAL(clicked(bool)), this, SLOT(OnGeneralChanged())); connect(ui.btnAddCmd, SIGNAL(clicked(bool)), this, SLOT(OnAddCommand())); - QMenu* pRunBtnMenu = new QMenu(ui.btnAddFile); + QMenu* pRunBtnMenu = new QMenu(ui.btnAddCmd); pRunBtnMenu->addAction(tr("Browse for Program"), this, SLOT(OnBrowsePath())); ui.btnAddCmd->setPopupMode(QToolButton::MenuButtonPopup); ui.btnAddCmd->setMenu(pRunBtnMenu); diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index 3ff64ad4..cacf026f 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -141,7 +141,7 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.tabs->setTabIcon(0, CSandMan::GetIcon("Config")); ui.tabs->setTabIcon(1, CSandMan::GetIcon("Shell")); - ui.tabs->setTabIcon(2, CSandMan::GetIcon("GUI")); + ui.tabs->setTabIcon(2, CSandMan::GetIcon("Design")); ui.tabs->setTabIcon(3, CSandMan::GetIcon("Advanced")); ui.tabs->setTabIcon(4, CSandMan::GetIcon("Alarm")); ui.tabs->setTabIcon(5, CSandMan::GetIcon("Lock")); @@ -149,6 +149,12 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.tabs->setTabIcon(7, CSandMan::GetIcon("EditIni")); ui.tabs->setTabIcon(8, CSandMan::GetIcon("Support")); + ui.tabsGUI->setTabIcon(0, CSandMan::GetIcon("Design")); + ui.tabsGUI->setTabIcon(1, CSandMan::GetIcon("Run")); + + ui.tabsAdvanced->setTabIcon(0, CSandMan::GetIcon("Options")); + ui.tabsAdvanced->setTabIcon(1, CSandMan::GetIcon("Lock")); + int size = 16.0; #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) size *= (QApplication::desktop()->logicalDpiX() / 96.0); // todo Qt6 @@ -170,23 +176,7 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) AddIconToLabel(ui.lblUpdates, CSandMan::GetIcon("Update").pixmap(size,size)); - int iViewMode = theConf->GetInt("Options/ViewMode", 1); - int iOptionLayout = theConf->GetInt("Options/NewConfigLayout", 2); - if (iOptionLayout == 2) - iOptionLayout = 1; // iViewMode != 2 ? 1 : 0; - - // re structure the UI a bit - if (iOptionLayout == 1) - { - QWidget* pWidget = new QWidget(this); - QGridLayout* pLayout = new QGridLayout(pWidget); - QTabWidget* pTabs = new QTabWidget(); - pLayout->addWidget(pTabs, 0, 0); - ui.tabs->insertTab(3, pWidget, CSandMan::GetIcon("Advanced"), tr("Advanced Config")); - pTabs->addTab(ui.tabAdvanced, CSandMan::GetIcon("Options"), tr("Sandbox Config")); - pTabs->addTab(ui.tabLock, CSandMan::GetIcon("Lock"), tr("Config Protection")); - } /*if (iViewMode == 0) { @@ -282,6 +272,16 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.cmbTrayBoxes, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange())); connect(ui.chkCompactTray, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI())); + + connect(ui.btnAddCmd, SIGNAL(clicked(bool)), this, SLOT(OnAddCommand())); + QMenu* pRunBtnMenu = new QMenu(ui.btnAddCmd); + pRunBtnMenu->addAction(tr("Browse for Program"), this, SLOT(OnBrowsePath())); + ui.btnAddCmd->setPopupMode(QToolButton::MenuButtonPopup); + ui.btnAddCmd->setMenu(pRunBtnMenu); + connect(ui.btnDelCmd, SIGNAL(clicked(bool)), this, SLOT(OnDelCommand())); + connect(ui.treeRun, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnRunChanged())); + + m_FeaturesChanged = false; connect(ui.chkWFP, SIGNAL(stateChanged(int)), this, SLOT(OnFeaturesChanged())); connect(ui.chkObjCb, SIGNAL(stateChanged(int)), this, SLOT(OnFeaturesChanged())); @@ -405,7 +405,7 @@ void CSettingsWindow::showTab(int Tab, bool bExclusive) case eOptions: pWidget = ui.tabGeneral; break; case eShell: pWidget = ui.tabShell; break; case eGuiConfig: pWidget = ui.tabGUI; break; - case eAdvanced: pWidget = ui.tabAdvanced; break; + case eAdvanced: pWidget = ui.tabSandbox; break; case eProgCtrl: pWidget = ui.tabAlerts; break; case eConfigLock: pWidget = ui.tabLock; break; case eSoftCompat: pWidget = ui.tabCompat; break; @@ -458,6 +458,50 @@ bool CSettingsWindow::eventFilter(QObject *source, QEvent *event) return QDialog::eventFilter(source, event); } +void CSettingsWindow::OnBrowsePath() +{ + QString Value = QFileDialog::getOpenFileName(this, tr("Select Program"), "", tr("Executables (*.exe *.cmd)")).replace("/", "\\"); + if (Value.isEmpty()) + return; + + QString Name = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a menu title"), QLineEdit::Normal); + if (Name.isEmpty()) + return; + + AddRunItem(Name, Value); +} + +void CSettingsWindow::OnAddCommand() +{ + QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a command"), QLineEdit::Normal); + if (Value.isEmpty()) + return; + + QString Name = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a menu title"), QLineEdit::Normal); + if (Name.isEmpty()) + return; + + AddRunItem(Name, Value); +} + +void CSettingsWindow::AddRunItem(const QString& Name, const QString& Command) +{ + QTreeWidgetItem* pItem = new QTreeWidgetItem(); + pItem->setText(0, Name); + pItem->setText(1, Command); + pItem->setFlags(pItem->flags() | Qt::ItemIsEditable); + ui.treeRun->addTopLevelItem(pItem); +} + +void CSettingsWindow::OnDelCommand() +{ + QTreeWidgetItem* pItem = ui.treeRun->currentItem(); + if (!pItem) + return; + + delete pItem; +} + Qt::CheckState CSettingsWindow__IsContextMenu() { //QSettings Package("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package", QSettings::NativeFormat); @@ -582,6 +626,14 @@ void CSettingsWindow::LoadSettings() if (theAPI->IsConnected()) { + ui.treeRun->clear(); + foreach(const QString& Value, theAPI->GetGlobalSettings()->GetTextList("RunCommand", false)) + { + StrPair NameCmd = Split2(Value, "|"); + QTreeWidgetItem* pItem = new QTreeWidgetItem(); + AddRunItem(NameCmd.first, NameCmd.second); + } + QString FileRootPath_Default = "\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%"; QString KeyRootPath_Default = "\\REGISTRY\\USER\\Sandbox_%USER%_%SANDBOX%"; QString IpcRootPath_Default = "\\Sandbox\\%USER%\\%SANDBOX%\\Session_%SESSION%"; @@ -883,6 +935,13 @@ void CSettingsWindow::SaveSettings() { try { + QStringList RunCommands; + for (int i = 0; i < ui.treeRun->topLevelItemCount(); i++) { + QTreeWidgetItem* pItem = ui.treeRun->topLevelItem(i); + RunCommands.append(pItem->text(0) + "|" + pItem->text(1)); + } + WriteTextList("RunCommand", RunCommands); + WriteText("FileRootPath", ui.fileRoot->text()); //ui.fileRoot->setText("\\??\\%SystemDrive%\\Sandbox\\%USER%\\%SANDBOX%"); WriteAdvancedCheck(ui.chkSeparateUserFolders, "SeparateUserFolders", "", "n"); WriteText("KeyRootPath", ui.regRoot->text()); //ui.regRoot->setText("\\REGISTRY\\USER\\Sandbox_%USER%_%SANDBOX%"); diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.h b/SandboxiePlus/SandMan/Windows/SettingsWindow.h index f277dc7c..d993b71f 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.h +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.h @@ -86,6 +86,10 @@ private slots: void OnTab(); + void OnBrowsePath(); + void OnAddCommand(); + void OnDelCommand(); + void OnChangeGUI() { m_bRebuildUI = true; } void OnFeaturesChanged() { m_FeaturesChanged = true; } @@ -126,6 +130,8 @@ protected: void OnTab(QWidget* pTab); + void AddRunItem(const QString& Name, const QString& Command); + void AddWarnEntry(const QString& Name, int type); void LoadSettings();