From 777d43d19ab247e90b4a324238e7448630ae90a3 Mon Sep 17 00:00:00 2001 From: nephros Date: Fri, 26 May 2023 09:23:28 +0200 Subject: [PATCH] if auto applying succeded, save a known good state --- .../patchmanager-daemon/patchmanagerobject.cpp | 15 +++++++++++++++ src/bin/patchmanager-daemon/patchmanagerobject.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/bin/patchmanager-daemon/patchmanagerobject.cpp b/src/bin/patchmanager-daemon/patchmanagerobject.cpp index 2b420bbaf..8039944db 100644 --- a/src/bin/patchmanager-daemon/patchmanagerobject.cpp +++ b/src/bin/patchmanager-daemon/patchmanagerobject.cpp @@ -313,6 +313,17 @@ void PatchManagerObject::setAppliedPatches(const QSet &patches) putSettings(QStringLiteral("applied"), QStringList(patches.toList())); } + +QSet PatchManagerObject::getLastGoodPatches() const +{ + return getSettings(QStringLiteral("lastknowngood"), QStringList()).toStringList().toSet(); +} + +void PatchManagerObject::setLastGoodPatches(const QSet &patches) +{ + putSettings(QStringLiteral("lastknowngood"), QStringList(patches.toList())); +} + QStringList PatchManagerObject::getMangleCandidates() { if (m_mangleCandidates.empty()) { @@ -540,6 +551,10 @@ void PatchManagerObject::doPrepareCacheRoot() emit m_adaptor->autoApplyingFinished(success); } + if (success) { + setLastGoodPatches(m_appliedPatches); + } + if (!success) { setAppliedPatches(m_appliedPatches); refreshPatchList(); diff --git a/src/bin/patchmanager-daemon/patchmanagerobject.h b/src/bin/patchmanager-daemon/patchmanagerobject.h index 272a550b7..7876d320b 100644 --- a/src/bin/patchmanager-daemon/patchmanagerobject.h +++ b/src/bin/patchmanager-daemon/patchmanagerobject.h @@ -216,6 +216,9 @@ private slots: QSet getAppliedPatches() const; void setAppliedPatches(const QSet &patches); + QSet getLastGoodPatches() const; + void setLastGoodPatches(const QSet &patches); + void getVersion(); void lateInitialize();