From af15b0100196305d053295164fd8bf620a389edc Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sat, 5 Nov 2022 14:42:23 +0100 Subject: [PATCH] 1.5.3 --- CHANGELOG.md | 8 +++--- SandboxiePlus/SandMan/SbiePlusAPI.cpp | 11 ++++++++ SandboxiePlus/SandMan/SbiePlusAPI.h | 1 + SandboxiePlus/SandMan/Views/FileView.cpp | 35 +++++++++++++----------- SandboxiePlus/SandMan/Views/FileView.h | 6 ++-- SandboxiePlus/SandMan/Views/SbieView.cpp | 20 +++++++++----- SandboxiePlus/SandMan/Views/SbieView.h | 1 + 7 files changed, 52 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15ec136..893c709d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,19 @@ This project adheres to [Semantic Versioning](http://semver.org/). -## [1.5.3 / 5.60.3] - 2022-10-?? +## [1.5.3 / 5.60.3] - 2022-11-?? ### Fixed - fixed issue with box options [#2400](https://github.com/sandboxie-plus/Sandboxie/issues/2400) - fixed issue with Smart App Control [#2341](https://github.com/sandboxie-plus/Sandboxie/issues/2341) - fixed issue with snapshots when using privacy boxes [#2427](https://github.com/sandboxie-plus/Sandboxie/issues/2427) - fixed issue with m_pColorslider changed not applied. [#2433](https://github.com/sandboxie-plus/Sandboxie/pull/2433) +- fixed issue with switching snapshots when the file panel is open +- fixed issue with file panel when an empty box is sellected [#2419](https://github.com/sandboxie-plus/Sandboxie/issues/2419) -## [1.5.2 / 5.60.2] - 2022-10-?? +## [1.5.2 / 5.60.2] - 2022-10-28 ### Changed - utility groups are now cleaned up automatically @@ -27,8 +29,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). - - ## [1.5.1 / 5.60.1] - 2022-10-26 ### Added diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp index 547ba701..3cd300fa 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.cpp +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -399,6 +399,17 @@ SB_PROGRESS CSandBoxPlus::CleanBox() return Status; } +SB_PROGRESS CSandBoxPlus::SelectSnapshot(const QString& ID) +{ + ((CSbiePlusAPI*)theAPI)->m_BoxMonitor->RemoveBox(this); + + emit AboutToBeCleaned(); + + SB_PROGRESS Status = CSandBox::SelectSnapshot(ID); + + return Status; +} + bool CSandBoxPlus::CheckUnsecureConfig() const { //if (GetBool("UnsafeTemplate", false, true, true)) return true; diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h index 974647a9..66c68a6b 100644 --- a/SandboxiePlus/SandMan/SbiePlusAPI.h +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -66,6 +66,7 @@ public: virtual void CloseBox(); virtual SB_PROGRESS CleanBox(); + virtual SB_PROGRESS SelectSnapshot(const QString& ID); virtual QString GetStatusStr() const; diff --git a/SandboxiePlus/SandMan/Views/FileView.cpp b/SandboxiePlus/SandMan/Views/FileView.cpp index 9484e6b4..63aa6c9d 100644 --- a/SandboxiePlus/SandMan/Views/FileView.cpp +++ b/SandboxiePlus/SandMan/Views/FileView.cpp @@ -17,9 +17,8 @@ CFileView::CFileView(QWidget *parent) m_pTreeView->setAlternatingRowColors(theConf->GetBool("Options/AltRowColors", false)); m_pMainLayout->addWidget(m_pTreeView, 0, 0); - m_pFileModel = new QFileSystemModel(this); - m_pFileModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::System); - m_pTreeView->setModel(m_pFileModel); + m_pFileModel = NULL; + m_pTreeView->setSortingEnabled(true); m_pTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -56,26 +55,30 @@ void CFileView::SetBox(const CSandBoxPtr& pBox) if (!m_pBox.isNull()) connect(m_pBox.data(), SIGNAL(AboutToBeCleaned()), this, SLOT(OnAboutToBeCleaned())); - if (!m_pFileModel) return; - QString Root; if (!pBox.isNull() && !pBox->IsEmpty()) Root = pBox->GetFileRoot(); - if (Root.isEmpty()) { - Root = theAPI->GetSbiePath(); - m_pTreeView->setEnabled(false); - } - else - m_pTreeView->setEnabled(true); + //if (Root.isEmpty()) { + // //Root = theAPI->GetSbiePath(); + // m_pTreeView->setEnabled(false); + //} + //else + // m_pTreeView->setEnabled(true); - m_pFileModel->deleteLater(); - m_pFileModel = new QFileSystemModel(this); - m_pFileModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::System); + if (m_pFileModel) { + m_pFileModel->deleteLater(); + m_pFileModel = NULL; + } + if (!Root.isEmpty()) { + m_pFileModel = new QFileSystemModel(this); + m_pFileModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::System); + } m_pTreeView->setModel(m_pFileModel); - m_pTreeView->setRootIndex(m_pFileModel->setRootPath(Root)); + if (!Root.isEmpty()) + { + m_pTreeView->setRootIndex(m_pFileModel->setRootPath(Root)); - if (m_pTreeView->isEnabled()) { m_pTreeView->expand(m_pFileModel->index(Root + "/drive")); m_pTreeView->expand(m_pFileModel->index(Root + "/share")); m_pTreeView->expand(m_pFileModel->index(Root + "/user")); diff --git a/SandboxiePlus/SandMan/Views/FileView.h b/SandboxiePlus/SandMan/Views/FileView.h index 20f18886..b848da58 100644 --- a/SandboxiePlus/SandMan/Views/FileView.h +++ b/SandboxiePlus/SandMan/Views/FileView.h @@ -31,9 +31,9 @@ protected: CSandBoxPtr m_pBox; private: - QGridLayout* m_pMainLayout; - QTreeView* m_pTreeView; - QFileSystemModel* m_pFileModel; + QGridLayout* m_pMainLayout; + QTreeView* m_pTreeView; + QFileSystemModel* m_pFileModel; }; diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index f92d652a..c90d4f57 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -68,6 +68,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) m_pSbieTree->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_pSbieTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint &))); + connect(m_pSbieTree, SIGNAL(pressed(const QModelIndex&)), this, SLOT(OnClicked(const QModelIndex&))); connect(m_pSbieTree, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(OnDoubleClicked(const QModelIndex&))); connect(m_pSbieTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(ProcessSelection(QItemSelection, QItemSelection))); connect(m_pSbieTree, SIGNAL(expanded(const QModelIndex &)), this, SLOT(OnExpanded(const QModelIndex &))); @@ -1538,12 +1539,14 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index) if (pBox.isNull()) return; - if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) == 0) { + if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0) { + ShowOptions(pBox); + return; + } - if (index.column() == CSbieModel::ePath) { - OnSandBoxAction(m_pMenuExplore, QList() << pBox); - return; - } + if (index.column() == CSbieModel::ePath) { + OnSandBoxAction(m_pMenuExplore, QList() << pBox); + return; } //if (index.column() != CSbieModel::eName) @@ -1574,6 +1577,11 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index) ShowOptions(pBox); } +void CSbieView::OnClicked(const QModelIndex& index) +{ + emit BoxSelected(); +} + void CSbieView::ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected) { if (selected.empty()) @@ -1607,8 +1615,6 @@ 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 033dfd46..0f713126 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -51,6 +51,7 @@ private slots: void OnCustomSortByColumn(int column); void OnDoubleClicked(const QModelIndex& index); + void OnClicked(const QModelIndex& index); void ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected); void OnGroupAction();