diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-06-10 16:44:10 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-06-23 10:12:09 +0000 |
commit | 24671447746a15a4d3c09b30f91b3251ac40b4e8 (patch) | |
tree | 4a26f371361f83f1d1078ddc1b3e2a71f20619a5 /src/libs | |
parent | d198b18ca8d3643628c2447eaa8aa78598945937 (diff) |
Fix missing operation 'installer' value and update documentation.
Commit 478a8a1db3eed2 was done under the assumption that after
UpdateOperation::fromXml(...) existing values are still set.
That is wrong and we have to set the 'installer' value again.
The same commit was trying to fix the empty 'installer' value
in the operations destructor, though the value got removed in
PackageManagerCore::writeMaintenanceToolBinaryData() already.
We now skip it once we write out the XML.
Change-Id: Ia029ae4583862f4cbc6feb1c757604bf7b042a8f
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 4 | ||||
-rw-r--r-- | src/libs/kdtools/kdupdaterupdateoperation.cpp | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index a8da31405..ceb1e2f60 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -244,6 +244,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q qWarning() << "Failed to load XML for operation:" << operation.name; continue; } + op->setValue(QLatin1String("installer"), QVariant::fromValue(core)); m_performedOperationsOld.append(op.take()); } @@ -1085,9 +1086,6 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinaryData(QFileDevice *outp const qint64 operationsStart = output->pos(); QInstaller::appendInt64(output, performedOperations.count()); foreach (Operation *operation, performedOperations) { - // the installer can't be put into XML, remove it first - operation->clearValue(QLatin1String("installer")); - QInstaller::appendString(output, operation->name()); QInstaller::appendString(output, operation->toXml().toString()); diff --git a/src/libs/kdtools/kdupdaterupdateoperation.cpp b/src/libs/kdtools/kdupdaterupdateoperation.cpp index fed0f2cc9..8ecf6d3a5 100644 --- a/src/libs/kdtools/kdupdaterupdateoperation.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperation.cpp @@ -408,6 +408,10 @@ QDomDocument UpdateOperation::toXml() const // append all values set with setValue QDomElement values = doc.createElement(QLatin1String("values")); for (QVariantMap::const_iterator it = m_values.begin(); it != m_values.end(); ++it) { + // the installer can't be put into XML, ignore + if (it.key() == QLatin1String("installer")) + continue; + QDomElement value = doc.createElement(QLatin1String("value")); const QVariant& variant = it.value(); value.setAttribute(QLatin1String("name"), it.key()); @@ -432,7 +436,7 @@ QDomDocument UpdateOperation::toXml() const /*! Restores operation arguments and values from the XML document \a doc. Returns \c true on - success, otherwise \c false. + success, otherwise \c false. \note: Clears all previously set values and arguments. */ bool UpdateOperation::fromXml(const QDomDocument &doc) { |