diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-05 11:27:36 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-06 12:21:10 +0000 |
commit | e74530079252ca128be020911f2575caed9f7f28 (patch) | |
tree | a116edfb303dcb17be2e5aab844decb6a01f91af /src/libs/installer/packagemanagercore_p.cpp | |
parent | dbdf186ac50e42068c71821ae157a43df3438d55 (diff) |
Replace UpdateSourcesInfo and UpdateSourceInfo classes.
Introduce a new struct PackageInfo, which is similar to the removed
UpdateSourceInfo struct. The new struct name reflects the actual use
better, as we deal with package here (either packages to install or
updates to apply) and not updates only. Also remove the container
class UpdateSourcesInfo, we can simple reuse a existing Qt container
here. Adjust all occurrences that use/ used the classes.
Change-Id: I526e24cbf1664f0ab0ad18153f60c2c10b6909d8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/packagemanagercore_p.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 34378fb7a..0b51be1c8 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -57,7 +57,6 @@ #include "kdselfrestarter.h" #include "kdupdaterfiledownloaderfactory.h" -#include "kdupdaterupdatesourcesinfo.h" #include "kdupdaterupdateoperationfactory.h" #include <productkeycheck.h> @@ -571,11 +570,8 @@ void PackageManagerCorePrivate::initialize(const QHash<QString, QString> ¶ms if (isInstaller() || m_packagesInfo->applicationVersion().isEmpty()) m_packagesInfo->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION))); - if (isInstaller()) { - // TODO: this seems to be wrong, we should ask for ProductName defaulting to applicationName... - m_updateSourcesInfo.addUpdateSource(m_data.settings().applicationName(), m_data.settings() - .applicationName(), QString(), QUrl(QLatin1String("resource://metadata/")), 0); - } + if (isInstaller()) + m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 0)); m_metadataJob.disconnect(); m_metadataJob.setAutoDelete(false); @@ -2096,7 +2092,7 @@ PackagesList PackageManagerCorePrivate::remotePackages() m_updateFinder = new KDUpdater::UpdateFinder; m_updateFinder->setAutoDelete(false); m_updateFinder->setPackagesInfo(m_packagesInfo); - m_updateFinder->setUpdateSourcesInfo(m_updateSourcesInfo); + m_updateFinder->setPackageSources(m_packageSources); m_updateFinder->run(); if (m_updateFinder->updates().isEmpty()) { @@ -2189,16 +2185,13 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe return m_updateSourcesAdded; } - m_updateSourcesInfo.clear(); - if (isInstaller()) { - m_updateSourcesInfo.addUpdateSource(m_data.settings().applicationName(), m_data.settings() - .applicationName(), QString(), QUrl(QLatin1String("resource://metadata/")), 0); - } + m_packageSources.clear(); + if (isInstaller()) + m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 0)); m_updates = false; m_updateSourcesAdded = false; - const QString &appName = m_data.settings().applicationName(); foreach (const Metadata &data, metadata) { if (statusCanceledOrFailed()) return false; @@ -2232,12 +2225,11 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe if (!checksum.isNull()) m_core->setTestChecksum(checksum.toElement().text().toLower() == scTrue); } - m_updateSourcesInfo.addUpdateSource(appName, appName, QString(), QUrl::fromLocalFile(data - .directory), 1); + m_packageSources.insert(PackageSource(QUrl::fromLocalFile(data.directory), 1)); ProductKeyCheck::instance()->addPackagesFromXml(data.directory + QLatin1String("/Updates.xml")); } - if (m_updateSourcesInfo.updateSourceInfoCount() == 0) { + if (m_packageSources.count() == 0) { setStatus(PackageManagerCore::Failure, tr("Could not find any update source information.")); return false; } |