diff --git a/CHANGELOG.md b/CHANGELOG.md index bf0f7bf9..420e5339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - 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) +- added an independent desktop integration setting [#3246](https://github.com/sandboxie-plus/Sandboxie/issues/3246) ### Changed - moved tray option to an own tab diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 2df7e9e0..707fd0ab 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1967,9 +1967,9 @@ void CSandMan::OnBoxAdded(const CSandBoxPtr& pBox) void CSandMan::EnumBoxLinks(QMap > &BoxLinks, const QString& Prefix, const QString& Folder, bool bWithSubDirs) { - QRegularExpression exp("/\\[[0-9Sa-zA-Z_]+\\] "); + QRegularExpression exp("(^|/)\\[[0-9Sa-zA-Z_]+\\] "); - QStringList Files = ListDir(Folder, QStringList() << "*.lnk" << "*.url" << "*.pif", bWithSubDirs); + QStringList Files = ListDir(Folder, QStringList() << "*.lnk" << "*.url", bWithSubDirs); foreach(QString File, Files) { auto result = exp.match(File); @@ -2050,8 +2050,9 @@ void CSandMan::SyncStartMenu() { m_StartMenuUpdatePending = false; - int Mode = theConf->GetInt("Options/IntegrateStartMenu", 0); - if (Mode == 0) + int MenuMode = theConf->GetInt("Options/IntegrateStartMenu", 0); + int DeskMode = theConf->GetInt("Options/IntegrateDesktop", 0); + if (MenuMode == 0 && DeskMode == 0) return; QMap > BoxLinks; @@ -2070,6 +2071,15 @@ void CSandMan::SyncStartMenu() QString Location; QString Prefix; StrPair LocPath = Split2(Link.Folder, "/"); + + int Mode = 0; + if (LocPath.first == "Programs") + Mode = MenuMode; + else if (LocPath.first == "Desktop") + Mode = DeskMode; + if (!Mode) + continue; + if (Mode == 2) // deep integration { if (LocPath.first == "Programs") diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index 5ccc40d5..27952de4 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -227,6 +227,10 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.cmbIntegrateMenu->addItem(tr("As sub group")); ui.cmbIntegrateMenu->addItem(tr("Fully integrate")); + ui.cmbIntegrateDesk->addItem(tr("Don't integrate links")); + ui.cmbIntegrateDesk->addItem(tr("As sub group")); + ui.cmbIntegrateDesk->addItem(tr("Fully integrate")); + ui.cmbSysTray->addItem(tr("Don't show any icon")); ui.cmbSysTray->addItem(tr("Show Plus icon")); ui.cmbSysTray->addItem(tr("Show Classic icon")); @@ -314,8 +318,9 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.chkAlwaysDefault, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); connect(ui.chkShellMenu2, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); - connect(ui.chkScanMenu, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI())); - connect(ui.cmbIntegrateMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI())); + connect(ui.chkScanMenu, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged())); + connect(ui.cmbIntegrateMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); + connect(ui.cmbIntegrateDesk, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); connect(ui.cmbSysTray, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); connect(ui.cmbTrayBoxes, SIGNAL(currentIndexChanged(int)), this, SLOT(OnOptChanged())); @@ -902,6 +907,7 @@ void CSettingsWindow::LoadSettings() ui.chkScanMenu->setChecked(theConf->GetBool("Options/ScanStartMenu", true)); ui.cmbIntegrateMenu->setCurrentIndex(theConf->GetInt("Options/IntegrateStartMenu", 0)); + ui.cmbIntegrateDesk->setCurrentIndex(theConf->GetInt("Options/IntegrateDesktop", 0)); ui.cmbSysTray->setCurrentIndex(theConf->GetInt("Options/SysTrayIcon", 1)); ui.cmbTrayBoxes->setCurrentIndex(theConf->GetInt("Options/SysTrayFilter", 0)); @@ -1410,11 +1416,11 @@ void CSettingsWindow::SaveSettings() theConf->SetValue("Options/ScanStartMenu", ui.chkScanMenu->isChecked()); int OldIntegrateStartMenu = theConf->GetInt("Options/IntegrateStartMenu", 0); theConf->SetValue("Options/IntegrateStartMenu", ui.cmbIntegrateMenu->currentIndex()); - if (ui.cmbIntegrateMenu->currentIndex() != OldIntegrateStartMenu) { - if (ui.cmbIntegrateMenu->currentIndex() == 0) - theGUI->ClearStartMenu(); - else - theGUI->SyncStartMenu(); + int OldIntegrateDesktop = theConf->GetInt("Options/IntegrateDesktop", 0); + theConf->SetValue("Options/IntegrateDesktop", ui.cmbIntegrateDesk->currentIndex()); + if (ui.cmbIntegrateDesk->currentIndex() != OldIntegrateDesktop || ui.cmbIntegrateMenu->currentIndex() != OldIntegrateStartMenu) { + theGUI->ClearStartMenu(); + theGUI->SyncStartMenu(); } theConf->SetValue("Options/SysTrayIcon", ui.cmbSysTray->currentIndex());