summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-05-04 14:26:32 +0200
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-05-05 14:17:27 +0000
commitb8a7052ac9dffd477e424b34d5cb8d93cce6a6be (patch)
tree6ade73ceb7adf24f5d6dcc6ac7b8db02ad1f5c03 /src
parente0c6df4cecf30626d27e25c8682e3c431eb4dccf (diff)
Move the PackagesInfo handling out of {KDUpdater}Application.
Do not hide the class behind {KDUpdater}Application, we can use it directly. Also remove unused code from the PackagesInfo class itself. Change-Id: I6876a5887c498aa20fb54e016159223e336d9362 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp11
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp70
-rw-r--r--src/libs/installer/packagemanagercore_p.h1
-rw-r--r--src/libs/kdtools/kdupdaterapplication.cpp57
-rw-r--r--src/libs/kdtools/kdupdaterapplication.h9
-rw-r--r--src/libs/kdtools/kdupdaterpackagesinfo.cpp25
-rw-r--r--src/libs/kdtools/kdupdaterpackagesinfo.h19
-rw-r--r--src/libs/kdtools/kdupdaterupdatefinder.cpp26
-rw-r--r--src/libs/kdtools/kdupdaterupdatefinder.h8
9 files changed, 71 insertions, 155 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 45bb9baf8..b349bd00a 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -361,7 +361,7 @@ void PackageManagerCore::writeMaintenanceTool()
gainAdminRights();
gainedAdminRights = true;
}
- d->m_updaterApplication.packagesInfo()->writeToDisk();
+ d->m_packagesInfo->writeToDisk();
if (gainedAdminRights)
dropAdminRights();
d->m_needToWriteMaintenanceTool = false;
@@ -631,7 +631,6 @@ void PackageManagerCore::rollBackInstallation()
}
}
- KDUpdater::PackagesInfo &packages = *d->m_updaterApplication.packagesInfo();
while (!d->m_performedOperationsCurrentSession.isEmpty()) {
try {
Operation *const operation = d->m_performedOperationsCurrentSession.takeLast();
@@ -658,14 +657,14 @@ void PackageManagerCore::rollBackInstallation()
component = d->componentsToReplace().value(componentName).second;
if (component) {
component->setUninstalled();
- packages.removePackage(component->name());
+ d->m_packagesInfo->removePackage(component->name());
}
}
- packages.writeToDisk();
+ d->m_packagesInfo->writeToDisk();
if (isInstaller()) {
- if (packages.packageInfoCount() == 0) {
- QFile file(packages.fileName());
+ if (d->m_packagesInfo->packageInfoCount() == 0) {
+ QFile file(d->m_packagesInfo->fileName());
file.remove();
}
}
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index b41404307..3c86600dd 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -187,6 +187,7 @@ static void deferredRename(const QString &oldName, const QString &newName, bool
PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
: m_updateFinder(0)
, m_updaterApplication(new DummyConfigurationInterface)
+ , m_packagesInfo(std::make_shared<PackagesInfo>())
, m_core(core)
, m_updates(false)
, m_repoFetched(false)
@@ -208,6 +209,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
const QList<OperationBlob> &performedOperations)
: m_updateFinder(0)
, m_updaterApplication(new DummyConfigurationInterface)
+ , m_packagesInfo(std::make_shared<PackagesInfo>())
, m_status(PackageManagerCore::Unfinished)
, m_needsHardRestart(false)
, m_testChecksum(false)
@@ -558,20 +560,20 @@ void PackageManagerCorePrivate::initialize(const QHash<QString, QString> &params
disconnect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset()));
connect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset()));
- KDUpdater::PackagesInfo &packagesInfo = *m_updaterApplication.packagesInfo();
- packagesInfo.setFileName(componentsXmlPath());
+ // TODO: We should avoid this in case of installer.
+ m_packagesInfo->setFileName(componentsXmlPath());
- // Note: force overwriting the application name and version in case we run as installer. Both will be
- // set to wrong initial values if we install into an already existing installation. This can happen
- // if the components.xml path has not been changed, but name or version of the new installer.
- if (isInstaller() || packagesInfo.applicationName().isEmpty()) {
+ // Note: force overwriting the application name and version in case we run as installer.
+ // Both will be set to wrong initial values if we install into an already existing
+ // installation. This can happen if the components.xml path has not been changed,
+ // but name or version of the new installer.
+ if (isInstaller() || m_packagesInfo->applicationName().isEmpty()) {
// TODO: this seems to be wrong, we should ask for ProductName defaulting to applicationName...
- packagesInfo.setApplicationName(m_data.settings().applicationName());
+ m_packagesInfo->setApplicationName(m_data.settings().applicationName());
}
- if (isInstaller() || packagesInfo.applicationVersion().isEmpty()) {
- packagesInfo.setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
- }
+ 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...
@@ -1481,14 +1483,13 @@ bool PackageManagerCorePrivate::runInstaller()
componentsInstallPartProgressSize = double(1);
// Force an update on the components xml as the install dir might have changed.
- KDUpdater::PackagesInfo &info = *m_updaterApplication.packagesInfo();
- info.setFileName(componentsXmlPath());
+ m_packagesInfo->setFileName(componentsXmlPath());
// Clear the packages as we might install into an already existing installation folder.
- info.clearPackageInfoList();
+ m_packagesInfo->clearPackageInfoList();
// also update the application name, might be set from a script as well
- info.setApplicationName(m_data.value(QLatin1String("ProductName"),
+ m_packagesInfo->setApplicationName(m_data.value(QLatin1String("ProductName"),
m_data.settings().applicationName()).toString());
- info.setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
+ m_packagesInfo->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
const int progressOperationCount = countProgressOperations(componentsToInstall)
// add one more operation as we support progress
@@ -1904,12 +1905,12 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr
}
// now mark the component as installed
- KDUpdater::PackagesInfo &packages = *m_updaterApplication.packagesInfo();
- packages.installPackage(component->name(), component->value(scVersion), component->value(scDisplayName),
+ m_packagesInfo->installPackage(component->name(), component->value(scVersion),
+ component->value(scDisplayName),
component->value(scDescription), component->dependencies(), component->forcedInstallation(),
component->isVirtual(), component->value(scUncompressedSize).toULongLong(),
component->value(scInheritVersion));
- packages.writeToDisk();
+ m_packagesInfo->writeToDisk();
component->setInstalled();
component->markAsPerformedInstallation();
@@ -2030,7 +2031,6 @@ void PackageManagerCorePrivate::unregisterMaintenanceTool()
void PackageManagerCorePrivate::runUndoOperations(const OperationList &undoOperations, double progressSize,
bool adminRightsGained, bool deleteOperation)
{
- KDUpdater::PackagesInfo &packages = *m_updaterApplication.packagesInfo();
try {
foreach (Operation *undoOperation, undoOperations) {
if (statusCanceledOrFailed())
@@ -2066,7 +2066,7 @@ void PackageManagerCorePrivate::runUndoOperations(const OperationList &undoOpera
component = componentsToReplace().value(componentName).second;
if (component) {
component->setUninstalled();
- packages.removePackage(component->name());
+ m_packagesInfo->removePackage(component->name());
}
}
@@ -2077,13 +2077,13 @@ void PackageManagerCorePrivate::runUndoOperations(const OperationList &undoOpera
delete undoOperation;
}
} catch (const Error &error) {
- packages.writeToDisk();
+ m_packagesInfo->writeToDisk();
throw Error(error.message());
} catch (...) {
- packages.writeToDisk();
+ m_packagesInfo->writeToDisk();
throw Error(tr("Unknown error"));
}
- packages.writeToDisk();
+ m_packagesInfo->writeToDisk();
}
PackagesList PackageManagerCorePrivate::remotePackages()
@@ -2094,8 +2094,9 @@ PackagesList PackageManagerCorePrivate::remotePackages()
m_updates = false;
delete m_updateFinder;
- m_updateFinder = new KDUpdater::UpdateFinder(&m_updaterApplication);
+ m_updateFinder = new KDUpdater::UpdateFinder;
m_updateFinder->setAutoDelete(false);
+ m_updateFinder->setPackagesInfo(m_packagesInfo);
m_updateFinder->setUpdateSourcesInfo(m_updateSourcesInfo);
m_updateFinder->run();
@@ -2119,19 +2120,20 @@ LocalPackagesHash PackageManagerCorePrivate::localInstalledPackages()
LocalPackagesHash installedPackages;
if (!isInstaller()) {
- KDUpdater::PackagesInfo &packagesInfo = *m_updaterApplication.packagesInfo();
- if (!packagesInfo.isValid()) {
- packagesInfo.setFileName(componentsXmlPath());
- if (packagesInfo.applicationName().isEmpty())
- packagesInfo.setApplicationName(m_data.settings().applicationName());
- if (packagesInfo.applicationVersion().isEmpty())
- packagesInfo.setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
+ if (!m_packagesInfo->isValid()) {
+ m_packagesInfo->setFileName(componentsXmlPath());
+ if (m_packagesInfo->applicationName().isEmpty())
+ m_packagesInfo->setApplicationName(m_data.settings().applicationName());
+ if (m_packagesInfo->applicationVersion().isEmpty())
+ m_packagesInfo->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
}
- if (packagesInfo.error() != KDUpdater::PackagesInfo::NoError)
- setStatus(PackageManagerCore::Failure, tr("Failure to read packages from: %1.").arg(componentsXmlPath()));
+ if (m_packagesInfo->error() != KDUpdater::PackagesInfo::NoError) {
+ setStatus(PackageManagerCore::Failure, tr("Failure to read packages from: %1.")
+ .arg(componentsXmlPath()));
+ }
- foreach (const LocalPackage &package, packagesInfo.packageInfos()) {
+ foreach (const LocalPackage &package, m_packagesInfo->packageInfos()) {
if (statusCanceledOrFailed())
break;
installedPackages.insert(package.name, package);
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index eb4ec70bc..d9609408c 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -200,6 +200,7 @@ public:
UpdateFinder *m_updateFinder;
Application m_updaterApplication;
UpdateSourcesInfo m_updateSourcesInfo;
+ std::shared_ptr<PackagesInfo> m_packagesInfo;
int m_status;
QString m_error;
diff --git a/src/libs/kdtools/kdupdaterapplication.cpp b/src/libs/kdtools/kdupdaterapplication.cpp
index 2621aec96..e2001904c 100644
--- a/src/libs/kdtools/kdupdaterapplication.cpp
+++ b/src/libs/kdtools/kdupdaterapplication.cpp
@@ -34,7 +34,6 @@
****************************************************************************/
#include "kdupdaterapplication.h"
-#include "kdupdaterpackagesinfo.h"
#include <QCoreApplication>
#include <QDebug>
@@ -98,7 +97,6 @@ using namespace KDUpdater;
struct Application::ApplicationData
{
explicit ApplicationData(ConfigurationInterface *config) :
- packagesInfo(0),
configurationInterface(config ? config : new ConfigurationInterface)
{
const QStringList oldFiles = configurationInterface->value(QLatin1String("FilesForDelayedDeletion")).toStringList();
@@ -114,14 +112,12 @@ struct Application::ApplicationData
~ApplicationData()
{
- delete packagesInfo;
delete configurationInterface;
}
static Application *instance;
QString applicationDirectory;
- PackagesInfo *packagesInfo;
QStringList filesForDelayedDeletion;
ConfigurationInterface *configurationInterface;
};
@@ -134,8 +130,6 @@ Application *Application::ApplicationData::instance = 0;
Application::Application(ConfigurationInterface* config, QObject* p) : QObject(p)
{
d = new Application::ApplicationData( config );
- d->packagesInfo = new PackagesInfo(this);
-
setApplicationDirectory( QCoreApplication::applicationDirPath() );
ApplicationData::instance = this;
@@ -172,7 +166,6 @@ void Application::setApplicationDirectory(const QString &dir)
// FIXME: Perhaps we should check whether dir exists on the local file system or not
d->applicationDirectory = dirObj.absolutePath();
- setPackagesXMLFileName(QString::fromLatin1("%1/Packages.xml").arg(dir));
}
/*!
@@ -184,56 +177,6 @@ QString Application::applicationDirectory() const
}
/*!
- Returns the application name. By default, QCoreApplication::applicationName() is returned.
-*/
-QString Application::applicationName() const
-{
- if (d->packagesInfo->isValid())
- return d->packagesInfo->applicationName();
-
- return QCoreApplication::applicationName();
-}
-
-/*!
- Returns the application version.
-*/
-QString Application::applicationVersion() const
-{
- if (d->packagesInfo->isValid())
- return d->packagesInfo->applicationVersion();
-
- return QString();
-}
-
-
-/*!
- Sets the file name of the installation information XML file for this application to \a fileName.
- By default, this is assumed to be Packages.xml in the application directory.
-
- \sa KDUpdater::PackagesInfo::setFileName()
-*/
-void Application::setPackagesXMLFileName(const QString &fileName)
-{
- d->packagesInfo->setFileName(fileName);
-}
-
-/*!
- Returns the installation information XML file name.
-*/
-QString Application::packagesXMLFileName() const
-{
- return d->packagesInfo->fileName();
-}
-
-/*!
- Returns the KDUpdater::PackagesInfo object associated with this application.
-*/
-PackagesInfo* Application::packagesInfo() const
-{
- return d->packagesInfo;
-}
-
-/*!
Prints the error code \a errorCode and error message specified by \a error.
*/
void Application::printError(int errorCode, const QString &error)
diff --git a/src/libs/kdtools/kdupdaterapplication.h b/src/libs/kdtools/kdupdaterapplication.h
index 72ce69688..996987673 100644
--- a/src/libs/kdtools/kdupdaterapplication.h
+++ b/src/libs/kdtools/kdupdaterapplication.h
@@ -42,8 +42,6 @@
namespace KDUpdater {
-class PackagesInfo;
-
class ConfigurationInterface
{
public:
@@ -76,13 +74,6 @@ public:
void setApplicationDirectory(const QString &dir);
QString applicationDirectory() const;
- QString applicationName() const;
- QString applicationVersion() const;
-
- void setPackagesXMLFileName(const QString &fileName);
- QString packagesXMLFileName() const;
- PackagesInfo *packagesInfo() const;
-
QStringList filesForDelayedDeletion() const;
void addFilesForDelayedDeletion(const QStringList &files);
diff --git a/src/libs/kdtools/kdupdaterpackagesinfo.cpp b/src/libs/kdtools/kdupdaterpackagesinfo.cpp
index 53b975b67..453db1a94 100644
--- a/src/libs/kdtools/kdupdaterpackagesinfo.cpp
+++ b/src/libs/kdtools/kdupdaterpackagesinfo.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
+** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -56,10 +57,6 @@ using namespace KDUpdater;
\li Get information about the number of packages installed and their meta-data via the
packageInfoCount() and packageInfo() methods.
\endlist
-
- Instances of this class cannot be created. Each instance of KDUpdater::Application has one
- instance of this class associated with it. You can fetch a pointer to an instance of this class
- for an application via the KDUpdater::Application::packagesInfo() method.
*/
/*!
@@ -105,9 +102,8 @@ void PackagesInfo::PackagesInfoData::setInvalidContentError(const QString &detai
/*!
\internal
*/
-PackagesInfo::PackagesInfo(QObject *parent)
- : QObject(parent),
- d(new PackagesInfoData())
+PackagesInfo::PackagesInfo()
+ : d(new PackagesInfoData())
{
}
@@ -151,8 +147,6 @@ PackagesInfo::Error PackagesInfo::error() const
/*!
Sets the complete file name of the installation information XML file to \a fileName. The function
also issues a call to refresh() to reload installation information from the XML file.
-
- \sa KDUpdater::Application::setPackagesXMLFileName()
*/
void PackagesInfo::setFileName(const QString &fileName)
{
@@ -266,7 +260,6 @@ void PackagesInfo::refresh()
if (!file.exists()) {
d->error = NotYetReadError;
d->errorMessage = tr("The file %1 does not exist.").arg(d->fileName);
- emit reset();
return;
}
@@ -274,7 +267,6 @@ void PackagesInfo::refresh()
if (!file.open(QFile::ReadOnly)) {
d->error = CouldNotReadPackageFileError;
d->errorMessage = tr("Could not open %1.").arg(d->fileName);
- emit reset();
return;
}
@@ -290,7 +282,6 @@ void PackagesInfo::refresh()
QString::number(parseErrorLine),
QString::number(parseErrorColumn),
parseErrorMessage);
- emit reset();
return;
}
file.close();
@@ -299,7 +290,6 @@ void PackagesInfo::refresh()
QDomElement rootE = doc.documentElement();
if (rootE.tagName() != QLatin1String("Packages")) {
d->setInvalidContentError(tr("Root element %1 unexpected, should be 'Packages'.").arg(rootE.tagName()));
- emit reset();
return;
}
@@ -320,7 +310,6 @@ void PackagesInfo::refresh()
d->error = NoError;
d->errorMessage.clear();
- emit reset();
}
/*!
@@ -516,17 +505,9 @@ void PackagesInfo::clearPackageInfoList()
{
d->packageInfoList.clear();
d->modified = true;
- emit reset();
}
/*!
- \fn void KDUpdater::PackagesInfo::reset()
-
- This signal is emitted whenever the contents of this class are refreshed, usually from within
- the refresh() slot.
-*/
-
-/*!
\inmodule kdupdater
\class KDUpdater::PackageInfo
\brief The PackageInfo class describes a single installed package in the application.
diff --git a/src/libs/kdtools/kdupdaterpackagesinfo.h b/src/libs/kdtools/kdupdaterpackagesinfo.h
index 1301d0b81..bd5a5fcc4 100644
--- a/src/libs/kdtools/kdupdaterpackagesinfo.h
+++ b/src/libs/kdtools/kdupdaterpackagesinfo.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
+** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -37,10 +38,8 @@
#include "kdupdater.h"
-#include <QObject>
+#include <QCoreApplication>
#include <QDate>
-#include <QString>
-#include <QStringList>
#include <QVariant>
namespace KDUpdater {
@@ -62,11 +61,13 @@ struct KDTOOLS_EXPORT PackageInfo
quint64 uncompressedSize;
};
-class KDTOOLS_EXPORT PackagesInfo : public QObject
+class KDTOOLS_EXPORT PackagesInfo
{
- Q_OBJECT
+ Q_DISABLE_COPY(PackagesInfo)
+ Q_DECLARE_TR_FUNCTIONS(PackagesInfo)
public:
+ PackagesInfo();
~PackagesInfo();
enum Error
@@ -106,16 +107,8 @@ public:
bool updatePackage(const QString &pkgName, const QString &version, const QDate &date);
bool removePackage(const QString &pkgName);
-public Q_SLOTS:
void refresh();
-Q_SIGNALS:
- void reset();
-
-protected:
- friend class Application;
- explicit PackagesInfo(QObject *parent = 0);
-
private:
struct PackagesInfoData;
PackagesInfoData *d;
diff --git a/src/libs/kdtools/kdupdaterupdatefinder.cpp b/src/libs/kdtools/kdupdaterupdatefinder.cpp
index 778195646..68555483a 100644
--- a/src/libs/kdtools/kdupdaterupdatefinder.cpp
+++ b/src/libs/kdtools/kdupdaterupdatefinder.cpp
@@ -34,7 +34,6 @@
****************************************************************************/
#include "kdupdaterupdatefinder.h"
-#include "kdupdaterapplication.h"
#include "kdupdaterupdatesourcesinfo.h"
#include "kdupdaterpackagesinfo.h"
#include "kdupdaterupdate.h"
@@ -75,7 +74,6 @@ public:
Private(UpdateFinder *qq)
: q(qq)
- , application(0)
, downloadCompleteCount(0)
, m_downloadsToComplete(0)
{}
@@ -95,7 +93,6 @@ public:
FileDownloader *downloader;
};
UpdateFinder *q;
- Application *application;
QHash<QString, Update *> updates;
// Temporary structure that notes down information about updates.
@@ -116,6 +113,7 @@ public:
void slotDownloadDone();
UpdateSourcesInfo m_updateSourcesInfo;
+ std::weak_ptr<PackagesInfo> m_packagesInfo;
};
@@ -180,11 +178,12 @@ void UpdateFinder::Private::computeUpdates()
cancel = false;
// First do some quick sanity checks on the packages info
- PackagesInfo *packages = application->packagesInfo();
+ std::shared_ptr<PackagesInfo> packages = m_packagesInfo.lock();
if (!packages) {
q->reportError(tr("Could not access the package information of this application."));
return;
}
+
if (!packages->isValid()) {
q->reportError(packages->errorString());
return;
@@ -245,9 +244,6 @@ void UpdateFinder::Private::cancelComputeUpdates()
*/
bool UpdateFinder::Private::downloadUpdateXMLFiles()
{
- if (!application)
- return false;
-
if (m_updateSourcesInfo.updateSourceInfoCount() <= 0)
return false;
@@ -373,7 +369,7 @@ QList<UpdateInfo> UpdateFinder::Private::applicableUpdates(UpdatesInfo *updatesI
if (!updatesInfo || updatesInfo->updateInfoCount() == 0)
return dummy;
- PackagesInfo *packages = this->application->packagesInfo();
+ std::shared_ptr<PackagesInfo> packages = m_packagesInfo.lock();
if (!packages)
return dummy;
@@ -388,8 +384,10 @@ QList<UpdateInfo> UpdateFinder::Private::applicableUpdates(UpdatesInfo *updatesI
// Catch hold of app names contained updatesInfo->applicationName()
// If the application appName isn't one of the app names, then the updates are not applicable.
const QStringList apps = appName.split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
- if (apps.indexOf(this->application->applicationName()) < 0)
+ if (apps.indexOf([&packages] { return packages->isValid() ? packages->applicationName()
+ : QCoreApplication::applicationName(); } ()) < 0) {
return dummy;
+ }
}
return updatesInfo->updatesInfo();
}
@@ -460,11 +458,10 @@ UpdateFinder::Private::Resolution UpdateFinder::Private::checkPriorityAndVersion
Constructs an update finder for the KDUpdater::Application specified by
\a application.
*/
-UpdateFinder::UpdateFinder(Application *application)
- : Task(QLatin1String("UpdateFinder"), Stoppable, application),
+UpdateFinder::UpdateFinder()
+ : Task(QLatin1String("UpdateFinder"), Stoppable),
d(new Private(this))
{
- d->application = application;
}
/*!
@@ -484,6 +481,11 @@ QList<Update *> UpdateFinder::updates() const
return d->updates.values();
}
+void UpdateFinder::setPackagesInfo(std::weak_ptr<PackagesInfo> info)
+{
+ d->m_packagesInfo = std::move(info);
+}
+
/*!
Sets the update sources information to use when searching for updates.
*/
diff --git a/src/libs/kdtools/kdupdaterupdatefinder.h b/src/libs/kdtools/kdupdaterupdatefinder.h
index 77b055394..f437d2311 100644
--- a/src/libs/kdtools/kdupdaterupdatefinder.h
+++ b/src/libs/kdtools/kdupdaterupdatefinder.h
@@ -38,9 +38,11 @@
#include "kdupdatertask.h"
+#include <memory>
+
namespace KDUpdater {
-class Application;
+class PackagesInfo;
class Update;
class UpdateSourcesInfo;
@@ -50,10 +52,12 @@ class KDTOOLS_EXPORT UpdateFinder : public Task
class Private;
public:
- explicit UpdateFinder(Application *application);
+ UpdateFinder();
~UpdateFinder();
QList<Update *> updates() const;
+
+ void setPackagesInfo(std::weak_ptr<PackagesInfo> info);
void setUpdateSourcesInfo(const UpdateSourcesInfo &sources);
private: