From 69bc841c4bbf80ebb8d7fee7cd25321f8f53ff41 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 26 Oct 2022 10:37:30 +0200 Subject: [PATCH] 1.5.1 --- CHANGELOG.md | 2 + .../SandMan/Windows/OptionsGrouping.cpp | 47 ------------------- .../SandMan/Windows/OptionsStart.cpp | 26 ++++++++-- .../SandMan/Windows/OptionsWindow.cpp | 13 ++++- SandboxiePlus/SandMan/Windows/OptionsWindow.h | 2 - 5 files changed, 36 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9791123c..0ce8f4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed issue with boxed object directory initialization [#2342](https://github.com/sandboxie-plus/Sandboxie/issues/2342) - Sandboxie no longer leaves behind permanent directory objects - FIXED SECURITY ISSUE ID-21 AlpcConnectPortEx was not filtered by the driver [#2396](https://github.com/sandboxie-plus/Sandboxie/issues/2396) +- fixed issues with program controll options [#2395](https://github.com/sandboxie-plus/Sandboxie/issues/2395) + ## [1.5.0 / 5.60.0] - 2022-10-19 diff --git a/SandboxiePlus/SandMan/Windows/OptionsGrouping.cpp b/SandboxiePlus/SandMan/Windows/OptionsGrouping.cpp index 247564b5..cd3a2764 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsGrouping.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsGrouping.cpp @@ -158,53 +158,6 @@ void COptionsWindow::OnAddGroup() OnOptChanged(); } -void COptionsWindow::AddProgToGroup(QTreeWidget* pTree, const QString& Groupe, bool disabled) -{ - QString Value = SelectProgram(); - if (Value.isEmpty()) - return; - - QTreeWidgetItem* pItem = new QTreeWidgetItem(); - pItem->setCheckState(0, disabled ? Qt::Unchecked : Qt::Checked); - SetProgramItem(Value, pItem, 0); - pItem->setFlags(pItem->flags() | Qt::ItemIsEditable); - pTree->addTopLevelItem(pItem); - - AddProgramToGroup(Value, Groupe); -} - -void COptionsWindow::DelProgFromGroup(QTreeWidget* pTree, const QString& Groupe) -{ - QTreeWidgetItem* pItem = pTree->currentItem(); - if (!pItem) - return; - - QString Value = pItem->data(0, Qt::UserRole).toString(); - - delete pItem; - - for (int i = 0; i < ui.treeGroups->topLevelItemCount(); i++) - { - QTreeWidgetItem* pGroupItem = ui.treeGroups->topLevelItem(i); - if (pGroupItem->data(0, Qt::UserRole).toString().compare(Groupe, Qt::CaseInsensitive) == 0) - { - for (int j = 0; j < pGroupItem->childCount(); j++) - { - QTreeWidgetItem* pProgItem = pGroupItem->child(j); - if (pProgItem->data(0, Qt::UserRole).toString().compare(Value, Qt::CaseInsensitive) == 0) - { - delete pProgItem; - m_GroupsChanged = true; - OnOptChanged(); - break; - } - } - break; - } - } -} - - void COptionsWindow::AddProgramToGroup(const QString& Program, const QString& Group) { QTreeWidgetItem* pItem = FindGroupByName(Group, true); diff --git a/SandboxiePlus/SandMan/Windows/OptionsStart.cpp b/SandboxiePlus/SandMan/Windows/OptionsStart.cpp index 7197e717..8fd36d66 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsStart.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsStart.cpp @@ -46,15 +46,35 @@ void COptionsWindow::OnRestrictStart() void COptionsWindow::OnAddStartProg() { - AddProgToGroup(ui.treeStart, ""); + QString Value = SelectProgram(); + if (Value.isEmpty()) + return; + + QTreeWidgetItem* pItem = new QTreeWidgetItem(); + pItem->setCheckState(0, Qt::Checked); + SetProgramItem(Value, pItem, 0); + pItem->setFlags(pItem->flags() | Qt::ItemIsEditable); + ui.treeStart->addTopLevelItem(pItem); + + AddProgramToGroup(Value, ""); + //m_StartChanged = true; //OnOptChanged(); } void COptionsWindow::OnDelStartProg() { - DelProgFromGroup(ui.treeStart, ""); - DelProgFromGroup(ui.treeStart, ""); + QTreeWidgetItem* pItem = ui.treeStart->currentItem(); + if (!pItem) + return; + + QString Value = pItem->data(0, Qt::UserRole).toString(); + + delete pItem; + + DelProgramFromGroup(Value, ""); + DelProgramFromGroup(Value, ""); + //m_StartChanged = true; //OnOptChanged(); } diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 79d14f57..f4515f59 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -58,6 +58,15 @@ public: }*/ pBox->setProperty("value", text); }); + connect(pBox->lineEdit(), &QLineEdit::returnPressed, [pBox](){ + /*if (pBox->currentIndex() != -1) { + int pos = pBox->lineEdit()->cursorPosition(); + pBox->setCurrentIndex(-1); + pBox->setCurrentText(text); + pBox->lineEdit()->setCursorPosition(pos); + }*/ + pBox->setProperty("value", pBox->lineEdit()->text()); + }); connect(pBox, qOverload(&QComboBox::currentIndexChanged), [pBox](int index){ if (index != -1) @@ -391,7 +400,7 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.chkShowForceTmpl, SIGNAL(clicked(bool)), this, SLOT(OnShowForceTmpl())); //ui.treeForced->setEditTriggers(QAbstractItemView::DoubleClicked); ui.treeForced->setItemDelegateForColumn(0, new NoEditDelegate(this)); - ui.treeForced->setItemDelegateForColumn(1, new ProgramsDelegate(this, ui.treeForced, 0, this)); + ui.treeForced->setItemDelegateForColumn(1, new ProgramsDelegate(this, ui.treeForced, -1, this)); connect(ui.treeForced, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnForcedChanged(QTreeWidgetItem *, int))); connect(ui.btnBreakoutProg, SIGNAL(clicked(bool)), this, SLOT(OnBreakoutProg())); @@ -404,7 +413,7 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.chkShowBreakoutTmpl, SIGNAL(clicked(bool)), this, SLOT(OnShowBreakoutTmpl())); //ui.treeBreakout->setEditTriggers(QAbstractItemView::DoubleClicked); ui.treeBreakout->setItemDelegateForColumn(0, new NoEditDelegate(this)); - ui.treeBreakout->setItemDelegateForColumn(1, new ProgramsDelegate(this, ui.treeBreakout, 0, this)); + ui.treeBreakout->setItemDelegateForColumn(1, new ProgramsDelegate(this, ui.treeBreakout, -1, this)); connect(ui.treeBreakout, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(OnForcedChanged(QTreeWidgetItem *, int))); // diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.h b/SandboxiePlus/SandMan/Windows/OptionsWindow.h index 52b0822a..28760448 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.h +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.h @@ -312,8 +312,6 @@ protected: QTreeWidgetItem* GetAccessEntry(EAccessType Type, const QString& Program, EAccessMode Mode, const QString& Path); void SetAccessEntry(EAccessType Type, const QString& Program, EAccessMode Mode, const QString& Path); void DelAccessEntry(EAccessType Type, const QString& Program, EAccessMode Mode, const QString& Path); - void AddProgToGroup(QTreeWidget* pTree, const QString& Groupe, bool disabled = false); - void DelProgFromGroup(QTreeWidget* pTree, const QString& Groupe); void LoadConfig(); void SaveConfig();