This commit is contained in:
DavidXanatos 2022-11-29 18:26:51 +01:00
parent b84b5c5aa2
commit 213d9fbbb9
5 changed files with 639 additions and 454 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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%");

View File

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