tray improvements
This commit is contained in:
DavidXanatos 2023-09-02 10:50:25 +02:00
parent 6302082442
commit 7b964e2d9a
6 changed files with 273 additions and 163 deletions

View File

@ -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

View File

@ -406,118 +406,33 @@
<layout class="QGridLayout" name="gridLayout_30">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<item row="12" column="0">
<widget class="QLabel" name="label_21">
<item row="9" column="2">
<widget class="QComboBox" name="cmbIntegrateMenu"/>
</item>
<item row="4" column="1" colspan="3">
<widget class="QCheckBox" name="chkShellMenu">
<property name="text">
<string>Show boxes in tray list:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<string>Add 'Run Sandboxed' to the explorer context menu</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="2">
<widget class="QComboBox" name="cmbTrayBoxes"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lblStartMenu">
<item row="0" column="0">
<widget class="QLabel" name="lblStartUp">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Start Menu Integration</string>
<string>Start Sandbox Manager</string>
</property>
</widget>
</item>
<item row="13" column="1" colspan="3">
<widget class="QCheckBox" name="chkBoxOpsNotify">
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="chkSvcStart">
<property name="text">
<string>Show a tray notification when automatic box operations are started</string>
</property>
</widget>
</item>
<item row="14" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="3">
<widget class="QCheckBox" name="chkCompactTray">
<property name="text">
<string>Use Compact Box List</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="lblSysTray">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Systray options</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QCheckBox" name="chkAlwaysDefault">
<property name="text">
<string>Always use DefaultBox</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblRunBoxed">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Run Sandboxed - Actions</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="chkScanMenu">
<property name="text">
<string>Scan shell folders and offer links in run menu</string>
<string>Start UI when a sandboxed process is started</string>
</property>
</widget>
</item>
@ -528,23 +443,24 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QCheckBox" name="chkShellMenu">
<item row="5" column="2" colspan="3">
<widget class="QCheckBox" name="chkAlwaysDefault">
<property name="text">
<string>Add 'Run Sandboxed' to the explorer context menu</string>
<string>Always use DefaultBox</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QLabel" name="label_22">
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="chkAutoStart">
<property name="text">
<string>Integrate with Host Start Menu</string>
<string>Start UI with Windows</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QCheckBox" name="chkScanMenu">
<property name="text">
<string>Scan shell folders and offer links in run menu</string>
</property>
</widget>
</item>
@ -561,52 +477,6 @@
</property>
</spacer>
</item>
<item row="9" column="2">
<widget class="QComboBox" name="cmbIntegrateMenu"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblStartUp">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Start Sandbox Manager</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QComboBox" name="cmbSysTray"/>
</item>
<item row="14" column="3" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Show Icon in Systray:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_37">
<property name="maximumSize">
@ -620,17 +490,204 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="chkAutoStart">
<item row="3" column="0">
<widget class="QLabel" name="lblRunBoxed">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Start UI with Windows</string>
<string>Run Sandboxed - Actions</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="chkSvcStart">
<item row="7" column="0">
<widget class="QLabel" name="lblStartMenu">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Start UI when a sandboxed process is started</string>
<string>Start Menu Integration</string>
</property>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Integrate with Host Start Menu</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="3" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTray">
<attribute name="title">
<string>System Tray</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_42">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_41">
<item row="2" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Show boxes in tray list:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Show Icon in Systray:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmbSysTray"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblSysTray">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Systray options</string>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_14">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="chkCompactTray">
<property name="text">
<string>Use Compact Box List</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="cmbOnClose"/>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cmbTrayBoxes"/>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkBoxOpsNotify">
<property name="text">
<string>Show a tray notification when automatic box operations are started</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_28">
<property name="text">
<string>On main window close:</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="chkSingleShow">
<property name="text">
<string>Open/Close from/to tray with a single click</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="chkMinimize">
<property name="text">
<string>Minimize to tray</string>
</property>
</widget>
</item>

View File

@ -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())

View File

@ -135,6 +135,7 @@ protected:
void CheckSupport();
void closeEvent(QCloseEvent* e);
void changeEvent(QEvent* e);
void dragEnterEvent(QDragEnterEvent* e);
void dropEvent(QDropEvent* e);

View File

@ -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:

View File

@ -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<QStandardItemModel *>(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);