summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-06-23 16:56:43 +0200
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-06-24 10:10:01 +0000
commit1d0d566f15487d62db1632b3f663856e25c79f6c (patch)
tree0e33244e4d0257136946833f59a15ce903c89263 /src/libs/kdtools
parent1e589e37a991b29076e9a661f92dfa178421c208 (diff)
Add getter and setter for package manager.
Change-Id: Iff8ac5fc97f73939e0cbfea21370bb63e94b7782 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r--src/libs/kdtools/kdupdaterupdateoperation.cpp13
-rw-r--r--src/libs/kdtools/kdupdaterupdateoperation.h7
-rw-r--r--src/libs/kdtools/kdupdaterupdateoperationfactory.cpp2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/libs/kdtools/kdupdaterupdateoperation.cpp b/src/libs/kdtools/kdupdaterupdateoperation.cpp
index 8940609e1..0c6621271 100644
--- a/src/libs/kdtools/kdupdaterupdateoperation.cpp
+++ b/src/libs/kdtools/kdupdaterupdateoperation.cpp
@@ -98,8 +98,7 @@ UpdateOperation::UpdateOperation()
*/
UpdateOperation::~UpdateOperation()
{
- using namespace QInstaller;
- if (auto *core = value(QLatin1String("installer")).value<PackageManagerCore*>())
+ if (auto *core = packageManager())
core->addFilesForDelayedDeletion(filesForDelayedDeletion());
}
@@ -313,6 +312,16 @@ QStringList UpdateOperation::filesForDelayedDeletion() const
return m_delayedDeletionFiles;
}
+QInstaller::PackageManagerCore *UpdateOperation::packageManager() const
+{
+ return value(QLatin1String("installer")).value<QInstaller::PackageManagerCore*>();
+}
+
+void UpdateOperation::setPackageManager(QInstaller::PackageManagerCore *core)
+{
+ setValue(QLatin1String("installer"), QVariant::fromValue(core));
+}
+
/*!
Registers a list of \a files to be deleted later once the application was restarted and the
file or files are not used anymore.
diff --git a/src/libs/kdtools/kdupdaterupdateoperation.h b/src/libs/kdtools/kdupdaterupdateoperation.h
index 7707a2d62..3f2901b80 100644
--- a/src/libs/kdtools/kdupdaterupdateoperation.h
+++ b/src/libs/kdtools/kdupdaterupdateoperation.h
@@ -42,6 +42,10 @@
#include <QVariant>
#include <QtXml/QDomDocument>
+namespace QInstaller {
+ class PackageManagerCore;
+}
+
namespace KDUpdater {
class KDTOOLS_EXPORT UpdateOperation
@@ -74,6 +78,9 @@ public:
int error() const;
QStringList filesForDelayedDeletion() const;
+ QInstaller::PackageManagerCore *packageManager() const;
+ void setPackageManager(QInstaller::PackageManagerCore *core);
+
virtual void backup() = 0;
virtual bool performOperation() = 0;
virtual bool undoOperation() = 0;
diff --git a/src/libs/kdtools/kdupdaterupdateoperationfactory.cpp b/src/libs/kdtools/kdupdaterupdateoperationfactory.cpp
index 2671a405d..3268facbe 100644
--- a/src/libs/kdtools/kdupdaterupdateoperationfactory.cpp
+++ b/src/libs/kdtools/kdupdaterupdateoperationfactory.cpp
@@ -98,6 +98,6 @@ UpdateOperation *UpdateOperationFactory::create(const QString &name, PackageMana
{
UpdateOperation *operation = KDGenericFactory<UpdateOperation>::create(name);
if (operation)
- operation->setValue(QLatin1String("installer"), QVariant::fromValue(core));
+ operation->setPackageManager(core);
return operation;
}