From 42560dbe2cdd4bbb9bed9a375795ba32c26ba0b2 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 1 Sep 2022 19:29:07 +0200 Subject: [PATCH] 1.3.3 --- CHANGELOG.md | 10 ++++ Sandboxie/install/Templates.ini | 4 ++ SandboxiePlus/SandMan/SandMan.cpp | 75 +++++++++++++----------- SandboxiePlus/SandMan/SandMan.h | 14 +++-- SandboxiePlus/SandMan/Views/SbieView.cpp | 23 ++++++-- SandboxiePlus/SandMan/Views/SbieView.h | 3 + 6 files changed, 83 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99562967..b5c2c65e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ This project adheres to [Semantic Versioning](http://semver.org/). + +## [1.3.3 / 5.58.3] - 2022-08-?? + +### Fixed +- fixed issues with group moving drag and drop +- approved more requied sys calls +- fixed issues when deleting box content and the view files panel is open + + + ## [1.3.2 / 5.58.2] - 2022-08-30 ### Added diff --git a/Sandboxie/install/Templates.ini b/Sandboxie/install/Templates.ini index 6299b9a4..28c60b0c 100644 --- a/Sandboxie/install/Templates.ini +++ b/Sandboxie/install/Templates.ini @@ -3652,6 +3652,10 @@ ApproveWinNtSysCall=DeviceIoControlFile ApproveWinNtSysCall=QueryAttributesFile ApproveWinNtSysCall=QueryFullAttributesFile +# Windows Notification Facility +ApproveWinNtSysCall=SubscribeWnfStateChange +ApproveWinNtSysCall=UnsubscribeWnfStateChange + # token stuff ApproveWinNtSysCall=DuplicateToken diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index d2c4a4a6..89876e20 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -197,10 +197,10 @@ CSandMan::CSandMan(QWidget *parent) connect(m_pHotkeyManager, SIGNAL(activated(size_t)), SLOT(OnHotKey(size_t))); SetupHotKeys(); - for (int i = 0; i < eMaxColor; i++) { - m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i)); - m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i)); - } + //for (int i = 0; i < eMaxColor; i++) { + // m_BoxIcons[i].Empty = QIcon(QString(":/Boxes/Empty%1").arg(i)); + // m_BoxIcons[i].InUse = QIcon(QString(":/Boxes/Full%1").arg(i)); + //} m_BoxColors[CSandBoxPlus::eHardenedPlus] = qRgb(238,35,4); m_BoxColors[CSandBoxPlus::eHardened] = qRgb(247,125,2); @@ -850,6 +850,7 @@ void CSandMan::UpdateLabel() void CSandMan::CreateView(int iViewMode) { m_pBoxView = new CSbieView(); + connect(m_pBoxView, SIGNAL(BoxSelected()), this, SLOT(OnBoxSelected())); m_pFileView = new CFileView(); if (iViewMode != 1) @@ -869,6 +870,7 @@ void CSandMan::CreateView(int iViewMode) pFileLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0, 1, 1); m_pBoxCombo = new QComboBox(); + connect(m_pBoxCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBoxSelected())); pFileLayout->addWidget(m_pBoxCombo, 0, 1); pFileLayout->addWidget(m_pFileView, 1, 0, 1, 2); @@ -1046,11 +1048,11 @@ void CSandMan::closeEvent(QCloseEvent *e) QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy) { - EBoxColors color = eYellow; + //EBoxColors color = eYellow; int iViewMode = theConf->GetInt("Options/ViewMode", 1); if (iViewMode != 2) { - //return GetColorIcon(m_BoxColors[boxType], inUse); - switch (boxType) { + return GetColorIcon(m_BoxColors[boxType], inUse); + /*switch (boxType) { case CSandBoxPlus::eHardenedPlus: color = eRed; break; case CSandBoxPlus::eHardened: color = eOrang; break; case CSandBoxPlus::eDefaultPlus: color = eBlue; break; @@ -1059,13 +1061,14 @@ QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy) case CSandBoxPlus::eAppBox: color = eGreen; break; case CSandBoxPlus::eInsecure: color = eMagenta; break; case CSandBoxPlus::eOpen: color = eWhite; break; - } + }*/ } //if (inBusy) // return m_BoxIcons[color].Busy; - if (inUse) + /*if (inUse) return m_BoxIcons[color].InUse; - return m_BoxIcons[color].Empty; + return m_BoxIcons[color].Empty;*/ + return GetColorIcon(m_BoxColors[CSandBoxPlus::eDefault], inUse); } QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse) @@ -1107,6 +1110,7 @@ QIcon CSandMan::GetColorIcon(QColor boxColor, bool inUse) if (hsv.h < 0) hsv.h += 360; else if (hsv.h >= 360) hsv.h -= 360; + hsv.s = 1; // make the content always fully saturated my_rgb rgb2 = hsv2rgb(hsv); rgb = qRgb(rgb2.r, rgb2.g, rgb2.b); @@ -1288,30 +1292,6 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) m_pTraceView->setEnabled(bIsMonitoring); } - CSandBoxPtr pBox; - if (m_pPanelSplitter) { - QList boxes = m_pBoxView->GetSelectedBoxes(); - if (m_pPanelSplitter->sizes().at(1) > 0 && m_pFileView->isVisible() && boxes.count() == 1) - pBox = boxes.first(); - } - - // for old menu - if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) { - QString Name = m_pBoxCombo->currentData().toString(); - if (Name.isEmpty()) - Name = "DefaultBox"; - pBox = theAPI->GetBoxByName(Name); - } - - if (!pBox.isNull()) { - if (!m_pFileView->isEnabled()) m_pFileView->setEnabled(true); - if (pBox != m_pFileView->GetBox()) m_pFileView->SetBox(pBox); - } - else if (m_pFileView->isEnabled()) { - m_pFileView->setEnabled(false); - m_pFileView->SetBox(CSandBoxPtr()); - } - QMap Processes = theAPI->GetAllProcesses(); int ActiveProcesses = 0; if (KeepTerminated()) { @@ -1417,6 +1397,33 @@ void CSandMan::timerEvent(QTimerEvent* pEvent) } } +void CSandMan::OnBoxSelected() +{ + CSandBoxPtr pBox; + if (m_pPanelSplitter) { + QList boxes = m_pBoxView->GetSelectedBoxes(); + if (m_pPanelSplitter->sizes().at(1) > 0 && m_pFileView->isVisible() && boxes.count() == 1) + pBox = boxes.first(); + } + + // for vintage mode + if (m_pBoxCombo && m_pViewStack->currentIndex() == 1) { + QString Name = m_pBoxCombo->currentData().toString(); + if (Name.isEmpty()) + Name = "DefaultBox"; + pBox = theAPI->GetBoxByName(Name); + } + + if (!pBox.isNull()) { + if (!m_pFileView->isEnabled()) m_pFileView->setEnabled(true); + if (pBox != m_pFileView->GetBox()) m_pFileView->SetBox(pBox); + } + else if (m_pFileView->isEnabled()) { + m_pFileView->setEnabled(false); + m_pFileView->SetBox(CSandBoxPtr()); + } +} + SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, bool DeleteShapshots) { SB_STATUS Ret = SB_OK; diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 3378dd6e..10f1a55e 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -122,16 +122,18 @@ protected: QMap m_BoxColors; - struct SBoxIcon { - QIcon Empty; - QIcon InUse; - //QIcon Busy; - }; - QMap m_BoxIcons; + //struct SBoxIcon { + // QIcon Empty; + // QIcon InUse; + // //QIcon Busy; + //}; + //QMap m_BoxIcons; class UGlobalHotkeys* m_pHotkeyManager; public slots: + void OnBoxSelected(); + void OnMessage(const QString& MsgData); void OnStatusChanged(); diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 6bb64ea9..08cf2c34 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -773,7 +773,7 @@ void CSbieView::OnGroupAction(QAction* Action) if (List.isEmpty()) return; - + m_Groups[""].removeAll(Name); m_Groups[List.first()].append(Name); } else if (Action == m_pRenGroupe) @@ -841,11 +841,13 @@ void CSbieView::OnGroupAction(QAction* Action) for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) { int pos = I->indexOf(Name); if (pos != -1) { - if ((Offset < 0 && pos > Offset + 1) ||(Offset > 0 && pos < I->count() - Offset)){ - QString Temp = I.value()[pos+Offset]; - I.value()[pos+Offset] = I.value()[pos]; + if ((Offset < 0 && pos > Offset + 1) || (Offset > 0 && pos < I->count() - Offset)) { + QString Temp = I.value()[pos + Offset]; + I.value()[pos + Offset] = I.value()[pos]; I.value()[pos] = Temp; } + else // out of bounds + QApplication::beep(); bFound = true; break; } @@ -896,8 +898,15 @@ bool CSbieView::MoveItem(const QString& Name, const QString& To, int pos) // remove from old for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) { - if (I.value().removeAll(Name)) - From = I.key(); + for (int i = 0; i < I.value().count(); i++) { + if (I.value().at(i) == Name) { + I.value().removeAt(i); + From = I.key(); + if(From == To && i < pos) + pos--; + break; + } + } } // add to new @@ -1534,6 +1543,8 @@ void CSbieView::ProcessSelection(const QItemSelection& selected, const QItemSele } selectionModel->select(invalid, QItemSelectionModel::Deselect); + + emit BoxSelected(); } QList CSbieView::GetSelectedBoxes() diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index bc1f7047..efab22ae 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -33,6 +33,9 @@ public: QMap GetGroups() { return m_Groups; } +signals: + void BoxSelected(); + public slots: void Clear(); void Refresh();