From 63c4503a70bfe4bac91b6334ad2f0e252269df06 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Fri, 7 Oct 2022 12:53:45 +0200 Subject: [PATCH] 1.4.2 --- CHANGELOG.md | 2 +- SandboxiePlus/SandMan/SandMan.cpp | 16 ++++++++++++++++ SandboxiePlus/SandMan/SandMan.h | 2 ++ SandboxiePlus/SandMan/Views/FileView.cpp | 5 +++++ SandboxiePlus/SandMan/Views/FileView.h | 2 ++ SandboxiePlus/SandMan/Views/SbieView.cpp | 5 +++++ SandboxiePlus/SandMan/Views/SbieView.h | 2 ++ 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 962d4662..a7866cd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed issue with saving box recovery options - fixed the display problem of Sandman [#2306](https://github.com/sandboxie-plus/Sandboxie/pull/2306) (thanks okrc) - fixed theme not auto changing [#2307](https://github.com/sandboxie-plus/Sandboxie/pull/2307) - +- fixed issue with saving sandman window state on windows shutdown diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 42336ce7..9bb5652b 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -248,6 +248,8 @@ CSandMan::CSandMan(QWidget *parent) connect(theAPI, SIGNAL(FileToRecover(const QString&, const QString&, const QString&, quint32)), this, SLOT(OnFileToRecover(const QString&, const QString&, const QString&, quint32)), Qt::QueuedConnection); connect(theAPI, SIGNAL(ConfigReloaded()), this, SLOT(OnIniReloaded())); + connect(qApp, &QGuiApplication::commitDataRequest, this, &CSandMan::commitData); + m_uTimerID = startTimer(1000); bool bAutoRun = QApplication::arguments().contains("-autorun"); @@ -1057,6 +1059,20 @@ void CSandMan::closeEvent(QCloseEvent *e) QApplication::quit(); } +void CSandMan::commitData(QSessionManager& manager) +{ + //if (manager.allowsInteraction()) + //{ + // manager.cancel(); + // return; + //} + + m_pBoxView->SaveState(); + m_pFileView->SaveState(); + StoreState(); + theConf->Sync(); +} + QIcon CSandMan::GetBoxIcon(int boxType, bool inUse)// , int iBusy) { //EBoxColors color = eYellow; diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 1a5e1c40..f28aefde 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -227,6 +227,8 @@ private slots: void AddLogMessage(const QString& Message); void AddFileRecovered(const QString& BoxName, const QString& FilePath); + void commitData(QSessionManager& manager); + private: void CreateUI(); diff --git a/SandboxiePlus/SandMan/Views/FileView.cpp b/SandboxiePlus/SandMan/Views/FileView.cpp index ded6d9af..9484e6b4 100644 --- a/SandboxiePlus/SandMan/Views/FileView.cpp +++ b/SandboxiePlus/SandMan/Views/FileView.cpp @@ -39,6 +39,11 @@ CFileView::CFileView(QWidget *parent) } CFileView::~CFileView() +{ + SaveState(); +} + +void CFileView::SaveState() { theConf->SetBlob("MainWindow/FileTree_Columns", m_pTreeView->header()->saveState()); } diff --git a/SandboxiePlus/SandMan/Views/FileView.h b/SandboxiePlus/SandMan/Views/FileView.h index 922987a0..20f18886 100644 --- a/SandboxiePlus/SandMan/Views/FileView.h +++ b/SandboxiePlus/SandMan/Views/FileView.h @@ -14,6 +14,8 @@ public: CFileView(QWidget *parent = Q_NULLPTR); ~CFileView(); + virtual void SaveState(); + void SetBox(const CSandBoxPtr& pBox); const CSandBoxPtr& GetBox() const { return m_pBox; } diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 5fa1742f..4ae9c243 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -123,6 +123,11 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent) } CSbieView::~CSbieView() +{ + SaveState(); +} + +void CSbieView::SaveState() { theConf->SetBlob("MainWindow/BoxTree_Columns", m_pSbieTree->saveState()); //theConf->SetValue("MainWindow/BoxTree_UseOrder", m_pSortProxy->sortRole() == Qt::InitialSortOrderRole); diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index a8920207..033dfd46 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -12,6 +12,8 @@ public: CSbieView(QWidget* parent = 0); virtual ~CSbieView(); + virtual void SaveState(); + virtual QTreeViewEx* GetTree() { return m_pSbieTree; } virtual QList GetSelectedBoxes();