diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ef81a4..6af66fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,18 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - added update warning when updating with an expired personal certificate +- added an option to terminate the UI by clicking close button [#3253](https://github.com/sandboxie-plus/Sandboxie/issues/3253) +- added an option to restore Sandboxie that is minimized to the System Tray with a single click [#3251](https://github.com/sandboxie-plus/Sandboxie/issues/3251) +- added an option to minimize Sandboxie to the System Tray by clicking minimize button [3252](https://github.com/sandboxie-plus/Sandboxie/issues/3252) + +### Changed +- moved tray option to an own tab ### Fixed - fixed subscription certificate recognition issue + ## [1.11.1 / 5.66.1] - 2023-08-31 ### Added diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index 952eea4a..8622586a 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -406,118 +406,33 @@ - - + + + + + - Show boxes in tray list: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true + Add 'Run Sandboxed' to the explorer context menu - - - - - + + - 75 true true - Start Menu Integration + Start Sandbox Manager - - + + - Show a tray notification when automatic box operations are started - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Use Compact Box List - - - false - - - - - - - - 75 - true - true - - - - Systray options - - - - - - - Always use DefaultBox - - - - - - - - 75 - true - true - - - - Run Sandboxed - Actions - - - - - - - Scan shell folders and offer links in run menu + Start UI when a sandboxed process is started @@ -528,23 +443,24 @@ - - + + - Add 'Run Sandboxed' to the explorer context menu + Always use DefaultBox - - + + - Integrate with Host Start Menu + Start UI with Windows - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true + + + + + + Scan shell folders and offer links in run menu @@ -561,52 +477,6 @@ - - - - - - - - 75 - true - true - - - - Start Sandbox Manager - - - - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - Show Icon in Systray: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - @@ -620,17 +490,204 @@ - - + + + + + true + true + + - Start UI with Windows + Run Sandboxed - Actions - - + + + + + true + true + + - Start UI when a sandboxed process is started + Start Menu Integration + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Integrate with Host Start Menu + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + + + System Tray + + + + + + + + Show boxes in tray list: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + Show Icon in Systray: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + + + + + true + true + + + + Systray options + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Use Compact Box List + + + false + + + + + + + + + + + + + Show a tray notification when automatic box operations are started + + + + + + + On main window close: + + + + + + + Open/Close from/to tray with a single click + + + + + + + Minimize to tray diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index d9d7d313..2df7e9e0 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1295,7 +1295,8 @@ void CSandMan::closeEvent(QCloseEvent *e) { if (!m_bExit)// && !theAPI->IsConnected()) { - if (m_pTrayIcon->isVisible()) + QString OnClose = theConf->GetString("Options/OnClose", "ToTray"); + if (m_pTrayIcon->isVisible() && OnClose.compare("ToTray", Qt::CaseInsensitive) == 0) { StoreState(); hide(); @@ -1306,7 +1307,7 @@ void CSandMan::closeEvent(QCloseEvent *e) e->ignore(); return; } - else + else if(OnClose.compare("Prompt", Qt::CaseInsensitive) == 0) { CExitDialog ExitDialog(tr("Do you want to close Sandboxie Manager?")); if (!ExitDialog.exec()) @@ -1349,6 +1350,28 @@ void CSandMan::closeEvent(QCloseEvent *e) QApplication::quit(); } +void CSandMan::changeEvent(QEvent* e) +{ + if (e->type() == QEvent::WindowStateChange) + { + if (isMinimized()) + { + if (m_pTrayIcon->isVisible() && theConf->GetBool("Options/MinimizeToTray", false)) + { + StoreState(); + hide(); + + if (theAPI->GetGlobalSettings()->GetBool("ForgetPassword", false)) + theAPI->ClearPassword(); + + e->ignore(); + return; + } + } + } + QMainWindow::changeEvent(e); +} + void CSandMan::commitData(QSessionManager& manager) { //if (manager.allowsInteraction()) diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 0e4d59b4..20e90f93 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -135,6 +135,7 @@ protected: void CheckSupport(); void closeEvent(QCloseEvent* e); + void changeEvent(QEvent* e); void dragEnterEvent(QDragEnterEvent* e); void dropEvent(QDropEvent* e); diff --git a/SandboxiePlus/SandMan/SandManTray.cpp b/SandboxiePlus/SandMan/SandManTray.cpp index c6865dd9..98e4bcc8 100644 --- a/SandboxiePlus/SandMan/SandManTray.cpp +++ b/SandboxiePlus/SandMan/SandManTray.cpp @@ -341,6 +341,10 @@ void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason) { static bool TriggerSet = false; static bool NullifyTrigger = false; + + if (theConf->GetBool("Options/TraySingleClick", false) && Reason == QSystemTrayIcon::Trigger) + Reason = QSystemTrayIcon::DoubleClick; + switch(Reason) { case QSystemTrayIcon::Context: diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index 3e30e822..5ccc40d5 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -134,7 +134,8 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.tabsShell->setCurrentIndex(0); ui.tabsShell->setTabIcon(0, CSandMan::GetIcon("Windows")); - ui.tabsShell->setTabIcon(1, CSandMan::GetIcon("Run")); + ui.tabsShell->setTabIcon(1, CSandMan::GetIcon("TaskBar")); + ui.tabsShell->setTabIcon(2, CSandMan::GetIcon("Run")); ui.tabsGUI->setCurrentIndex(0); ui.tabsGUI->setTabIcon(0, CSandMan::GetIcon("Interface")); @@ -234,6 +235,10 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.cmbTrayBoxes->addItem(tr("Active + Pinned")); ui.cmbTrayBoxes->addItem(tr("Pinned Only")); + ui.cmbOnClose->addItem(tr("Close to Tray"), "ToTray"); + ui.cmbOnClose->addItem(tr("Prompt before Close"), "Prompt"); + ui.cmbOnClose->addItem(tr("Close"), "Close"); + ui.cmbDPI->addItem(tr("None"), 0); ui.cmbDPI->addItem(tr("Native"), 1); ui.cmbDPI->addItem(tr("Qt"), 2); @@ -315,7 +320,10 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.cmbSysTray, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); connect(ui.cmbTrayBoxes, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); connect(ui.chkCompactTray, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI())); + connect(ui.cmbOnClose, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); connect(ui.chkBoxOpsNotify, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); + connect(ui.chkMinimize, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); + connect(ui.chkSingleShow, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); // // Interface Config @@ -899,6 +907,9 @@ void CSettingsWindow::LoadSettings() ui.cmbTrayBoxes->setCurrentIndex(theConf->GetInt("Options/SysTrayFilter", 0)); ui.chkCompactTray->setChecked(theConf->GetBool("Options/CompactTray", false)); ui.chkBoxOpsNotify->setChecked(theConf->GetBool("Options/AutoBoxOpsNotify", false)); + ui.cmbOnClose->setCurrentIndex(ui.cmbOnClose->findData(theConf->GetString("Options/OnClose", "ToTray"))); + ui.chkMinimize->setChecked(theConf->GetBool("Options/MinimizeToTray", false)); + ui.chkSingleShow->setChecked(theConf->GetBool("Options/TraySingleClick", false)); OnLoadAddon(); @@ -1410,6 +1421,9 @@ void CSettingsWindow::SaveSettings() theConf->SetValue("Options/SysTrayFilter", ui.cmbTrayBoxes->currentIndex()); theConf->SetValue("Options/CompactTray", ui.chkCompactTray->isChecked()); theConf->SetValue("Options/AutoBoxOpsNotify", ui.chkBoxOpsNotify->isChecked()); + theConf->SetValue("Options/OnClose", ui.cmbOnClose->currentData()); + theConf->SetValue("Options/MinimizeToTray", ui.chkMinimize->isChecked()); + theConf->SetValue("Options/TraySingleClick", ui.chkSingleShow->isChecked()); if (theAPI->IsConnected()) { @@ -1676,6 +1690,10 @@ void CSettingsWindow::reject() void CSettingsWindow::OnOptChanged() { + QStandardItemModel *model = qobject_cast(ui.cmbOnClose->model()); + QStandardItem *item = model->item(0); + item->setFlags((ui.cmbSysTray->currentIndex() == 0) ? item->flags() & ~Qt::ItemIsEnabled : item->flags() | Qt::ItemIsEnabled); + if (m_HoldChange) return; ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);