This commit is contained in:
DavidXanatos 2022-05-15 13:26:22 +02:00
parent 102d13da15
commit f76929f035
3 changed files with 46 additions and 2 deletions

View File

@ -1716,9 +1716,16 @@ void CSandMan::OnMaintenance()
Status = CSbieUtils::Uninstall(CSbieUtils::eService); Status = CSbieUtils::Uninstall(CSbieUtils::eService);
// uninstall // uninstall
else if (sender() == m_pUninstallAll) else if (sender() == m_pUninstallAll) {
Status = StopSbie(true); Status = StopSbie(true);
AutorunEnable(false);
CSettingsWindow__RemoveContextMenu();
CSbieUtils::RemoveContextMenu2();
}
HandleMaintenance(Status); HandleMaintenance(Status);
} }

View File

@ -215,6 +215,12 @@ void CSettingsWindow::closeEvent(QCloseEvent *e)
Qt::CheckState CSettingsWindow__IsContextMenu() Qt::CheckState CSettingsWindow__IsContextMenu()
{ {
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package", QSettings::NativeFormat);
foreach(const QString & Key, settings.childGroups()) {
if (Key.indexOf("SandboxieShell") == 0)
return Qt::Checked;
}
QString cmd = CSbieUtils::GetContextMenuStartCmd(); QString cmd = CSbieUtils::GetContextMenuStartCmd();
if (cmd.contains("SandMan.exe", Qt::CaseInsensitive)) if (cmd.contains("SandMan.exe", Qt::CaseInsensitive))
return Qt::Checked; // set up and sandman return Qt::Checked; // set up and sandman
@ -225,11 +231,40 @@ Qt::CheckState CSettingsWindow__IsContextMenu()
void CSettingsWindow__AddContextMenu() void CSettingsWindow__AddContextMenu()
{ {
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
if (settings.value("CurrentBuild") >= 22000) // Windows 11
{
QProcess Proc;
Proc.execute("rundll32.exe", QStringList() << QCoreApplication::applicationDirPath().replace("/", "\\") + "\\SbieShellExt.dll,RegisterPackage");
Proc.waitForFinished();
return;
}
CSbieUtils::AddContextMenu(QApplication::applicationDirPath().replace("/", "\\") + "\\SandMan.exe", CSbieUtils::AddContextMenu(QApplication::applicationDirPath().replace("/", "\\") + "\\SandMan.exe",
CSettingsWindow::tr("Run &Sandboxed"), //CSettingsWindow::tr("Explore &Sandboxed"), CSettingsWindow::tr("Run &Sandboxed"), //CSettingsWindow::tr("Explore &Sandboxed"),
QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe"); QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe");
} }
void CSettingsWindow__RemoveContextMenu()
{
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
if (settings.value("CurrentBuild") >= 22000) // Windows 11
{
QProcess Proc;
Proc.execute("rundll32.exe", QStringList() << QCoreApplication::applicationDirPath().replace("/", "\\") + "\\SbieShellExt.dll,RemovePackage");
Proc.waitForFinished();
}
CSbieUtils::RemoveContextMenu();
}
void CSettingsWindow__AddBrowserIcon()
{
QString Path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).replace("/", "\\");
Path += "\\" + CSettingsWindow::tr("Sandboxed Web Browser") + ".lnk";
CSbieUtils::CreateShortcut(theAPI, Path, "", "", "default_browser");
}
void CSettingsWindow::LoadSettings() void CSettingsWindow::LoadSettings()
{ {
ui.uiLang->setCurrentIndex(ui.uiLang->findData(theConf->GetString("Options/UiLanguage"))); ui.uiLang->setCurrentIndex(ui.uiLang->findData(theConf->GetString("Options/UiLanguage")));
@ -398,7 +433,7 @@ void CSettingsWindow::SaveSettings()
if (ui.chkShellMenu->isChecked()) if (ui.chkShellMenu->isChecked())
CSettingsWindow__AddContextMenu(); CSettingsWindow__AddContextMenu();
else else
CSbieUtils::RemoveContextMenu(); CSettingsWindow__RemoveContextMenu();
} }
if (ui.chkShellMenu2->isChecked() != CSbieUtils::HasContextMenu2()) { if (ui.chkShellMenu2->isChecked() != CSbieUtils::HasContextMenu2()) {

View File

@ -88,6 +88,8 @@ private:
}; };
void CSettingsWindow__AddContextMenu(); void CSettingsWindow__AddContextMenu();
void CSettingsWindow__RemoveContextMenu();
void CSettingsWindow__AddBrowserIcon();
void WindowsMoveFile(const QString& from, const QString& to); void WindowsMoveFile(const QString& from, const QString& to);