summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/packagemanagercore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r--src/libs/installer/packagemanagercore.cpp624
1 files changed, 293 insertions, 331 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 2b83dc54f..3c809ded5 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2012-2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
@@ -16,24 +16,17 @@
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
**
** $QT_END_LICENSE$
**
@@ -42,20 +35,22 @@
#include "packagemanagercore_p.h"
#include "adminauthorization.h"
-#include "binaryformat.h"
+#include "binarycontent.h"
#include "component.h"
#include "componentmodel.h"
#include "downloadarchivesjob.h"
#include "errors.h"
-#include "fsengineclient.h"
#include "globals.h"
#include "messageboxhandler.h"
#include "packagemanagerproxyfactory.h"
#include "progresscoordinator.h"
#include "qprocesswrapper.h"
#include "qsettingswrapper.h"
+#include "remoteclient.h"
#include "settings.h"
#include "utils.h"
+#include "installercalculator.h"
+#include "uninstallercalculator.h"
#include <productkeycheck.h>
@@ -77,77 +72,49 @@
# include "qt_windows.h"
#endif
-#if QT_VERSION >= 0x050000
-# include <QStandardPaths>
-#endif
+#include <QStandardPaths>
/*!
- \qmltype QInstaller
- \inqmlmodule scripting
-
- \brief Provides access to the installer from Qt Script.
-
- Use the \c installer object in the global namespace to access functionality of the installer.
-
- \section2 Wizard Pages
-
- The installer has various pre-defined pages that can be used to for example insert pages
- in a certain place:
- \list
- \li QInstaller.Introduction
- \li QInstaller.TargetDirectory
- \li QInstaller.ComponentSelection
- \li QInstaller.LicenseCheck
- \li QInstaller.StartMenuSelection
- \li QInstaller.ReadyForInstallation
- \li QInstaller.PerformInstallation
- \li QInstaller.InstallationFinished
- \li QInstaller.End
- \endlist
+ \namespace QInstaller
*/
-
/*!
- \qmlproperty enumeration QInstaller::status
+ \qmltype installer
+ \inqmlmodule scripting
- Status of the installer.
+ \brief The installer type provides access to core functionality of the Qt Installer Framework.
+*/
- Possible values are:
- \list
- \li QInstaller.Success (deprecated: QInstaller.InstallerSucceeded)
- \li QInstaller.Failure (deprecated: QInstaller.InstallerFailed)
- \li QInstaller.Running (deprecated: QInstaller.InstallerFailed)
- \li QInstaller.Canceled (deprecated: QInstaller.CanceledByUser)
- \li deprecated: QInstaller.InstallerUnfinished
- \endlist
+/*!
+ \qmlproperty array installer::components
*/
/*!
- \qmlsignal QInstaller::aboutCalculateComponentsToInstall()
+ \qmlsignal installer::aboutCalculateComponentsToInstall()
Emitted before the ordered list of components to install is calculated.
*/
/*!
- \qmlsignal QInstaller::finishedCalculateComponentsToInstall()
+ \qmlsignal installer::finishedCalculateComponentsToInstall()
Emitted after the ordered list of components to install was calculated.
*/
/*!
- \qmlsignal QInstaller::aboutCalculateComponentsToUninstall()
+ \qmlsignal installer::aboutCalculateComponentsToUninstall()
Emitted before the ordered list of components to uninstall is calculated.
*/
/*!
- \qmlsignal QInstaller::finishedCalculateComponentsToUninstall()
+ \qmlsignal installer::finishedCalculateComponentsToUninstall()
Emitted after the ordered list of components to uninstall was calculated.
*/
/*!
- \qmlsignal QInstaller::componentAdded(Component component)
+ \qmlsignal installer::componentAdded(Component component)
Emitted when a new root component has been added.
@@ -155,7 +122,7 @@
*/
/*!
- \qmlsignal QInstaller::rootComponentsAdded(list<Component> components)
+ \qmlsignal installer::rootComponentsAdded(list<Component> components)
Emitted when a new list of root components has been added.
@@ -163,20 +130,14 @@
*/
/*!
- \qmlsignal QInstaller::updaterComponentsAdded(list<Component> components)
+ \qmlsignal installer::updaterComponentsAdded(list<Component> components)
Emitted when a new list of updater components has been added.
\sa componentAdded, rootComponentsAdded
*/
/*!
- \qmlsignal QInstaller::componentsAboutToBeCleared()
-
- Deprecated, and not emitted any more.
-*/
-
-/*!
- \qmlsignal QInstaller::valueChanged(string key, string value)
+ \qmlsignal installer::valueChanged(string key, string value)
Emitted whenever a value changes.
@@ -184,38 +145,38 @@
*/
/*!
- \qmlsignal QInstaller::statusChanged(Status status)
+ \qmlsignal installer::statusChanged(Status status)
Emitted whenever the installer status changes.
*/
/*!
- \qmlsignal QInstaller::currentPageChanged(int page)
+ \qmlsignal installer::currentPageChanged(int page)
Emitted whenever the current page changes.
*/
/*!
- \qmlsignal QInstaller::finishButtonClicked()
+ \qmlsignal installer::finishButtonClicked()
Emitted when the user clicks the \uicontrol Finish button of the installer.
*/
/*!
- \qmlsignal QInstaller::metaJobProgress(int progress)
+ \qmlsignal installer::metaJobProgress(int progress)
Triggered with progress updates of the while communicating with a remote repository. Progress
ranges from 0 to 100.
*/
/*!
- \qmlsignal QInstaller::metaJobInfoMessage(string message)
+ \qmlsignal installer::metaJobInfoMessage(string message)
Triggered with informative updates of the communication with a remote repository.
*/
/*!
- \qmlsignal QInstaller::startAllComponentsReset()
+ \qmlsignal installer::startAllComponentsReset()
Triggered when the list of components starts to get updated.
@@ -223,7 +184,7 @@
*/
/*!
- \qmlsignal QInstaller::finishAllComponentsReset(list<Component> rootComponents)
+ \qmlsignal installer::finishAllComponentsReset(list<Component> rootComponents)
Triggered when the list of new root components has been updated.
@@ -231,19 +192,19 @@
*/
/*!
- \qmlsignal QInstaller::startUpdaterComponentsReset()
+ \qmlsignal installer::startUpdaterComponentsReset()
Triggered when components start to get updated during a remote update.
*/
/*!
- \qmlsignal QInstaller::finishUpdaterComponentsReset(list<Component> componentsWithUpdates)
+ \qmlsignal installer::finishUpdaterComponentsReset(list<Component> componentsWithUpdates)
Triggered when the list of available remote updates has been updated.
*/
/*!
- \qmlsignal QInstaller::installationStarted()
+ \qmlsignal installer::installationStarted()
Triggered when installation has started.
@@ -251,7 +212,7 @@
*/
/*!
- \qmlsignal QInstaller::installationInterrupted()
+ \qmlsignal installer::installationInterrupted()
Triggered when installation has been interrupted (cancelled).
@@ -259,7 +220,7 @@
*/
/*!
- \qmlsignal QInstaller::installationFinished()
+ \qmlsignal installer::installationFinished()
Triggered when installation has been finished.
@@ -267,13 +228,13 @@
*/
/*!
- \qmlsignal QInstaller::updateFinished()
+ \qmlsignal installer::updateFinished()
Triggered when an update has been finished.
*/
/*!
- \qmlsignal QInstaller::uninstallationStarted()
+ \qmlsignal installer::uninstallationStarted()
Triggered when uninstallation has started.
@@ -281,7 +242,7 @@
*/
/*!
- \qmlsignal QInstaller::uninstallationFinished()
+ \qmlsignal installer::uninstallationFinished()
Triggered when uninstallation has been finished.
@@ -289,38 +250,38 @@
*/
/*!
- \qmlsignal QInstaller::titleMessageChanged(string title)
+ \qmlsignal installer::titleMessageChanged(string title)
Emitted when the text of the installer status (on the PerformInstallation page) changes to
\a title.
*/
/*!
- \qmlsignal QInstaller::wizardPageInsertionRequested(Widget widget, WizardPage page)
+ \qmlsignal installer::wizardPageInsertionRequested(Widget widget, WizardPage page)
Emitted when a custom \a widget is about to be inserted into \a page by addWizardPage.
*/
/*!
- \qmlsignal QInstaller::wizardPageRemovalRequested(Widget widget)
+ \qmlsignal installer::wizardPageRemovalRequested(Widget widget)
Emitted when a \a widget is removed by removeWizardPage.
*/
/*!
- \qmlsignal QInstaller::wizardWidgetInsertionRequested(Widget widget, WizardPage page)
+ \qmlsignal installer::wizardWidgetInsertionRequested(Widget widget, WizardPage page)
Emitted when a \a widget is inserted into \a page by addWizardPageItem.
*/
/*!
- \qmlsignal QInstaller::wizardWidgetRemovalRequested(Widget widget)
+ \qmlsignal installer::wizardWidgetRemovalRequested(Widget widget)
Emitted when a \a widget is removed by removeWizardPageItem.
*/
/*!
- \qmlsignal QInstaller::wizardPageVisibilityChangeRequested(bool visible, int page)
+ \qmlsignal installer::wizardPageVisibilityChangeRequested(bool visible, int page)
Emitted when the visibility of the page with id \a page changes to \a visible.
@@ -328,14 +289,14 @@
*/
/*!
- \qmlsignal QInstaller::setValidatorForCustomPageRequested(Componentcomponent, string name,
+ \qmlsignal installer::setValidatorForCustomPageRequested(Component component, string name,
string callbackName)
Triggered when setValidatorForCustomPage is called.
*/
/*!
- \qmlsignal QInstaller::setAutomatedPageSwitchEnabled(bool request)
+ \qmlsignal installer::setAutomatedPageSwitchEnabled(bool request)
Triggered when the automatic switching from PerformInstallation to InstallationFinished page
is enabled (\a request = \c true) or disabled (\a request = \c false).
@@ -345,19 +306,21 @@
*/
/*!
- \qmlsignal QInstaller::coreNetworkSettingsChanged()
+ \qmlsignal installer::coreNetworkSettingsChanged()
Emitted when the network settings are changed.
*/
-/*!
- \qmlmethod list<Component> QInstaller::components()
-
- Returns the list of all components.
-*/
using namespace QInstaller;
+/*!
+ \class QInstaller::PackageManagerCore
+ \inmodule QtInstallerFramework
+ \brief The PackageManagerCore class provides the core functionality of the Qt Installer
+ Framework.
+*/
+
Q_GLOBAL_STATIC(QMutex, globalModelMutex);
static QFont *sVirtualComponentsFont = 0;
Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex);
@@ -379,43 +342,11 @@ static bool componentMatches(const Component *component, const QString &name,
return PackageManagerCore::versionMatches(component->value(scVersion), version);
}
-Component *PackageManagerCore::subComponentByName(const QInstaller::PackageManagerCore *installer,
- const QString &name, const QString &version, Component *check)
-{
- if (name.isEmpty())
- return 0;
-
- if (check != 0 && componentMatches(check, name, version))
- return check;
-
- if (!installer->isUpdater()) {
- QList<Component*> rootComponents;
- if (check == 0)
- rootComponents = installer->rootComponents();
- else
- rootComponents = check->childComponents(Component::DirectChildrenOnly);
-
- foreach (QInstaller::Component *component, rootComponents) {
- Component *const result = subComponentByName(installer, name, version, component);
- if (result != 0)
- return result;
- }
- } else {
- const QList<Component*> updaterComponents = installer->updaterComponents()
- + installer->d->m_updaterComponentsDeps;
- foreach (QInstaller::Component *component, updaterComponents) {
- if (componentMatches(component, name, version))
- return component;
- }
- }
- return 0;
-}
-
-void PackageManagerCore::writeUninstaller()
+void PackageManagerCore::writeMaintenanceTool()
{
- if (d->m_needToWriteUninstaller) {
+ if (d->m_needToWriteMaintenanceTool) {
try {
- d->writeUninstaller(d->m_performedOperationsOld + d->m_performedOperationsCurrentSession);
+ d->writeMaintenanceTool(d->m_performedOperationsOld + d->m_performedOperationsCurrentSession);
bool gainedAdminRights = false;
QTemporaryFile tempAdminFile(d->targetDir()
@@ -427,10 +358,10 @@ void PackageManagerCore::writeUninstaller()
d->m_updaterApplication.packagesInfo()->writeToDisk();
if (gainedAdminRights)
dropAdminRights();
- d->m_needToWriteUninstaller = false;
+ d->m_needToWriteMaintenanceTool = false;
} catch (const Error &error) {
MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(),
- QLatin1String("WriteError"), tr("Error writing Uninstaller"), error.message(),
+ QLatin1String("WriteError"), tr("Error writing Maintenance Tool"), error.message(),
QMessageBox::Ok, QMessageBox::Ok);
}
}
@@ -465,7 +396,7 @@ QObject *PackageManagerCore::guiObject() const
}
/*!
- \qmlmethod void QInstaller::setCompleteUninstallation(bool complete)
+ \qmlmethod void installer::setCompleteUninstallation(bool complete)
Sets the uninstallation to be \a complete. If \a complete is false, only components deselected
by the user will be uninstalled. This option applies only on uninstallation.
@@ -476,7 +407,7 @@ void PackageManagerCore::setCompleteUninstallation(bool complete)
}
/*!
- \qmlmethod void QInstaller::cancelMetaInfoJob()
+ \qmlmethod void installer::cancelMetaInfoJob()
Cancels the retrieval of meta information from a remote repository.
*/
@@ -486,7 +417,7 @@ void PackageManagerCore::cancelMetaInfoJob()
}
/*!
- \qmlmethod void QInstaller::componentsToInstallNeedsRecalculation()
+ \qmlmethod void installer::componentsToInstallNeedsRecalculation()
Ensures that component dependencies are re-calculated.
*/
@@ -496,7 +427,7 @@ void PackageManagerCore::componentsToInstallNeedsRecalculation()
}
/*!
- \qmlmethod void QInstaller::autoAcceptMessageBoxes()
+ \qmlmethod void installer::autoAcceptMessageBoxes()
Automatically accept all user message boxes.
@@ -508,7 +439,7 @@ void PackageManagerCore::autoAcceptMessageBoxes()
}
/*!
- \qmlmethod void QInstaller::autoRejectMessageBoxes()
+ \qmlmethod void installer::autoRejectMessageBoxes()
Automatically reject all user message boxes.
@@ -520,7 +451,7 @@ void PackageManagerCore::autoRejectMessageBoxes()
}
/*!
- \qmlmethod void QInstaller::setMessageBoxAutomaticAnswer(string identifier, int button)
+ \qmlmethod void installer::setMessageBoxAutomaticAnswer(string identifier, int button)
Automatically close the message box with ID \a identifier as if the user had pressed \a button.
@@ -542,7 +473,7 @@ quint64 size(QInstaller::Component *component, const QString &value)
}
/*!
- \qmlmethod float QInstaller::requiredDiskSpace()
+ \qmlmethod float installer::requiredDiskSpace()
Returns the estimated amount of disk space in bytes required after installation.
@@ -559,7 +490,7 @@ quint64 PackageManagerCore::requiredDiskSpace() const
}
/*!
- \qmlmethod float QInstaller::requiredTemporaryDiskSpace()
+ \qmlmethod float installer::requiredTemporaryDiskSpace()
Returns the estimated required disk space during installation in bytes.
@@ -668,7 +599,7 @@ void PackageManagerCore::rollBackInstallation()
while (!d->m_performedOperationsCurrentSession.isEmpty()) {
try {
Operation *const operation = d->m_performedOperationsCurrentSession.takeLast();
- const bool becameAdmin = !d->m_FSEngineClientHandler->isActive()
+ const bool becameAdmin = !RemoteClient::instance().isActive()
&& operation->value(QLatin1String("admin")).toBool() && gainAdminRights();
if (operation->hasValue(QLatin1String("uninstall-only"))) {
@@ -726,7 +657,7 @@ bool PackageManagerCore::isFileExtensionRegistered(const QString &extension) con
}
/*!
- \qmlmethod boolean QInstaller::fileExists(string filePath)
+ \qmlmethod boolean installer::fileExists(string filePath)
Returns \c true if the \a filePath exists; otherwise returns \c false.
@@ -747,17 +678,48 @@ bool PackageManagerCore::fileExists(const QString &filePath) const
PackageManagerCore::PackageManagerCore()
: d(new PackageManagerCorePrivate(this))
{
+ Repository::registerMetaType(); // register, cause we stream the type as QVariant
qRegisterMetaType<QInstaller::PackageManagerCore::Status>("QInstaller::PackageManagerCore::Status");
qRegisterMetaType<QInstaller::PackageManagerCore::WizardPage>("QInstaller::PackageManagerCore::WizardPage");
}
-PackageManagerCore::PackageManagerCore(qint64 magicmaker, const OperationList &performedOperations)
- : d(new PackageManagerCorePrivate(this, magicmaker, performedOperations))
+PackageManagerCore::PackageManagerCore(qint64 magicmaker, const QList<OperationBlob> &operations)
+ : d(new PackageManagerCorePrivate(this, magicmaker, operations))
{
+ Repository::registerMetaType(); // register, cause we stream the type as QVariant
qRegisterMetaType<QInstaller::PackageManagerCore::Status>("QInstaller::PackageManagerCore::Status");
qRegisterMetaType<QInstaller::PackageManagerCore::WizardPage>("QInstaller::PackageManagerCore::WizardPage");
d->initialize(QHash<QString, QString>());
+
+
+ //
+ // Sanity check to detect a broken installations with missing operations.
+ // Every installed package should have at least one MinimalProgress operation.
+ //
+ QSet<QString> installedPackages = d->m_core->localInstalledPackages().keys().toSet();
+ QSet<QString> operationPackages;
+ foreach (QInstaller::Operation *operation, d->m_performedOperationsOld) {
+ if (operation->hasValue(QLatin1String("component")))
+ operationPackages.insert(operation->value(QLatin1String("component")).toString());
+ }
+
+ QSet<QString> packagesWithoutOperation = installedPackages - operationPackages;
+ QSet<QString> orphanedOperations = operationPackages - installedPackages;
+ if (!packagesWithoutOperation.isEmpty() || !orphanedOperations.isEmpty()) {
+ qCritical() << "Operations missing for installed packages" << packagesWithoutOperation.toList();
+ qCritical() << "Orphaned operations" << orphanedOperations.toList();
+ MessageBoxHandler::critical(
+ MessageBoxHandler::currentBestSuitParent(),
+ QLatin1String("Corrupt_Installation_Error"),
+ QCoreApplication::translate("QInstaller", "Corrupt installation"),
+ QCoreApplication::translate("QInstaller",
+ "Your installation seems to be corrupted. "
+ "Please consider re-installing from scratch."
+ ));
+ } else {
+ qDebug() << "Operations sanity check succeeded.";
+ }
}
PackageManagerCore::~PackageManagerCore()
@@ -766,7 +728,7 @@ PackageManagerCore::~PackageManagerCore()
QDir targetDir(value(scTargetDir));
QString logFileName = targetDir.absoluteFilePath(value(QLatin1String("LogFileName"),
QLatin1String("InstallationLog.txt")));
- QInstaller::VerboseWriter::instance()->setOutputStream(logFileName);
+ QInstaller::VerboseWriter::instance()->setFileName(logFileName);
}
delete d;
@@ -986,7 +948,7 @@ bool PackageManagerCore::fetchRemotePackagesTree()
}
/*!
- \qmlmethod boolean QInstaller::addWizardPage(Component component, string name, int page)
+ \qmlmethod boolean installer::addWizardPage(Component component, string name, int page)
Adds the widget with objectName() \a name registered by \a component as a new page
into the installer's GUI wizard. The widget is added before \a page.
@@ -1007,7 +969,7 @@ bool PackageManagerCore::addWizardPage(Component *component, const QString &name
}
/*!
- \qmlmethod boolean QInstaller::removeWizardPage(Component component, string name)
+ \qmlmethod boolean installer::removeWizardPage(Component component, string name)
Removes the widget with objectName() \a name previously added to the installer's wizard
by \a component.
@@ -1026,7 +988,7 @@ bool PackageManagerCore::removeWizardPage(Component *component, const QString &n
}
/*!
- \qmlmethod boolean QInstaller::setDefaultPageVisible(int page, boolean visible)
+ \qmlmethod boolean installer::setDefaultPageVisible(int page, boolean visible)
Sets the visibility of the default page with id \a page to \a visible, i.e.
removes or adds it from/to the wizard. This works only for pages which have been
@@ -1043,7 +1005,7 @@ bool PackageManagerCore::setDefaultPageVisible(int page, bool visible)
}
/*!
- \qmlmethod void QInstaller::setValidatorForCustomPage(Component component, string name,
+ \qmlmethod void installer::setValidatorForCustomPage(Component component, string name,
string callbackName)
\sa setValidatorForCustomPageRequested
@@ -1055,7 +1017,7 @@ void PackageManagerCore::setValidatorForCustomPage(Component *component, const Q
}
/*!
- \qmlmethod boolean QInstaller::addWizardPageItem(Component component, string name, int page)
+ \qmlmethod boolean installer::addWizardPageItem(Component component, string name, int page)
Adds the widget with objectName() \a name registered by \a component as an GUI element
into the installer's GUI wizard. The widget is added on \a page.
@@ -1074,7 +1036,7 @@ bool PackageManagerCore::addWizardPageItem(Component *component, const QString &
}
/*!
- \qmlmethod boolean QInstaller::removeWizardPageItem(Component component, string name)
+ \qmlmethod boolean installer::removeWizardPageItem(Component component, string name)
Removes the widget with objectName() \a name previously added to the installer's wizard
by \a component.
@@ -1091,7 +1053,7 @@ bool PackageManagerCore::removeWizardPageItem(Component *component, const QStrin
}
/*!
- \qmlmethod void QInstaller::addUserRepositories(stringlist repositories)
+ \qmlmethod void installer::addUserRepositories(stringlist repositories)
Registers additional \a repositories.
@@ -1107,7 +1069,7 @@ void PackageManagerCore::addUserRepositories(const QStringList &repositories)
}
/*!
- \qmlmethod void QInstaller::setTemporaryRepositories(stringlist repositories, boolean replace)
+ \qmlmethod void installer::setTemporaryRepositories(stringlist repositories, boolean replace)
Sets additional \a repositories for this instance of the installer or updater.
Will be removed after invoking it again.
@@ -1150,33 +1112,6 @@ ScriptEngine *PackageManagerCore::controlScriptEngine() const
}
/*!
- Returns the number of components in the list for installer and package manager mode. Might return 0 in
- case the engine has only been run in updater mode or no components have been fetched.
-*/
-int PackageManagerCore::rootComponentCount() const
-{
- return d->m_rootComponents.size();
-}
-
-/*!
- Returns the component at index position \a i in the components list. \a i must be a valid index
- position in the list (i.e., 0 <= i < rootComponentCount()).
-*/
-Component *PackageManagerCore::rootComponent(int i) const
-{
- return d->m_rootComponents.value(i, 0);
-}
-
-/*!
- Returns a list of root components if run in installer or package manager mode. Might return an empty list
- in case the engine has only been run in updater mode or no components have been fetched.
-*/
-QList<Component*> PackageManagerCore::rootComponents() const
-{
- return d->m_rootComponents;
-}
-
-/*!
Appends a component as root component to the internal storage for installer or package manager components.
To append a component as a child to an already existing component, use Component::appendComponent(). Emits
the componentAdded() signal.
@@ -1188,32 +1123,59 @@ void PackageManagerCore::appendRootComponent(Component *component)
}
/*!
- \qmlmethod int QInstaller::updaterComponentCount()
+ \class PackageManagerCore::ComponentType
+ \inmodule QtInstallerFramework
+ \brief The ComponentType class is used with components() to describe what type of \c Component
+ list this function should return.
- Returns the number of components in the list for updater mode. Might return 0 in case the engine has only
- been run in installer or package manager mode or no components have been fetched.
-*/
-int PackageManagerCore::updaterComponentCount() const
-{
- return d->m_updaterComponents.size();
-}
+ \value Root
+ Return a list of root components.
-/*!
- Returns the component at index position \a i in the updates component list. \a i must be a valid index
- position in the list (i.e., 0 <= i < updaterComponentCount()).
+ \value Descendants
+ Return a list of all descendant components. \b Note: In updater mode the list is empty,
+ because component updates cannot have children.
+
+ \value Dependencies
+ Return a list of all available dependencies when run as updater. \b Note: In Installer,
+ package manager and uninstaller mode, this will always result in an empty list.
+
+ \value Replacements
+ Return a list of all available replacement components relevant to the run mode.
+
+ \value AllNoReplacements
+ Return a list of available components, including root, descendant and dependency
+ components relevant to the run mode.
+
+ \value All
+ Return a list of all available components, including root, descendant, dependency and
+ replacement components relevant to the run mode.
*/
-Component *PackageManagerCore::updaterComponent(int i) const
-{
- return d->m_updaterComponents.value(i, 0);
-}
/*!
- Returns a list of components if run in updater mode. Might return an empty list in case the engine has only
- been run in installer or package manager mode or no components have been fetched.
+ Returns a list of components depending on the component types passed in \a mask.
*/
-QList<Component*> PackageManagerCore::updaterComponents() const
+QList<Component *> PackageManagerCore::components(ComponentTypes mask) const
{
- return d->m_updaterComponents;
+ QList<Component *> components;
+
+ const bool updater = isUpdater();
+ if (mask.testFlag(ComponentType::Root))
+ components += updater ? d->m_updaterComponents : d->m_rootComponents;
+ if (mask.testFlag(ComponentType::Replacements))
+ components += updater ? d->m_updaterDependencyReplacements : d->m_rootDependencyReplacements;
+
+ if (!updater) {
+ if (mask.testFlag(ComponentType::Descendants)) {
+ foreach (QInstaller::Component *component, d->m_rootComponents)
+ components += component->childComponents(Component::Descendants);
+ }
+ } else {
+ if (mask.testFlag(ComponentType::Dependencies))
+ components.append(d->m_updaterComponentsDeps);
+ // No descendants here, updates are always a flat list and cannot have children!
+ }
+
+ return components;
}
/*!
@@ -1227,45 +1189,41 @@ void PackageManagerCore::appendUpdaterComponent(Component *component)
}
/*!
- Returns a list of all available components found during a fetch. Note that depending on the run mode the
- returned list might have different values. In case of updater mode, components scheduled for an
- update as well as all possible dependencies are returned.
-*/
-QList<Component*> PackageManagerCore::availableComponents() const
-{
- if (isUpdater())
- return d->m_updaterComponents + d->m_updaterComponentsDeps + d->m_updaterDependencyReplacements;
-
- QList<Component*> result = d->m_rootComponents;
- foreach (QInstaller::Component *component, d->m_rootComponents)
- result += component->childComponents(Component::Descendants);
- return result + d->m_rootDependencyReplacements;
-}
-
-/*!
- \qmlmethod Component QInstaller::componentByName(string name)
+ \qmlmethod component installer::componentByName(string name)
- Returns a component matching \a name. \a name can also contains a version requirement.
- E.g. "org.qt-project.sdk.qt" returns any component with that name, "org.qt-project.sdk.qt->=4.5" requires
- the returned component to have at least version 4.5.
+ Returns a component matching \a name. \a name can also contain a version requirement.
+ For example "org.qt-project.sdk.qt" returns any component with that name,
+ "org.qt-project.sdk.qt->=4.5" requires the returned component to have at least version 4.5.
If no component matches the requirement, 0 is returned.
*/
Component *PackageManagerCore::componentByName(const QString &name) const
{
+ return componentByName(name, components(ComponentType::AllNoReplacements));
+}
+
+Component *PackageManagerCore::componentByName(const QString &name, const QList<Component *> &components)
+{
if (name.isEmpty())
return 0;
+ QString fixedVersion;
+ QString fixedName = name;
if (name.contains(QChar::fromLatin1('-'))) {
// the last part is considered to be the version, then
- const QString version = name.section(QLatin1Char('-'), 1);
- return subComponentByName(this, name.section(QLatin1Char('-'), 0, 0), version);
+ fixedVersion = name.section(QLatin1Char('-'), 1);
+ fixedName = name.section(QLatin1Char('-'), 0, 0);
+ }
+
+ foreach (Component *component, components) {
+ if (componentMatches(component, fixedName, fixedVersion))
+ return component;
}
- return subComponentByName(this, name);
+ return 0;
}
/*!
- \qmlmethod boolean QInstaller::calculateComponentsToInstall()
+ \qmlmethod boolean installer::calculateComponentsToInstall()
Calculates an ordered list of components to install based on the current run mode. Also auto
installed dependencies are resolved. The aboutCalculateComponentsToInstall() signal is emitted
@@ -1276,29 +1234,29 @@ bool PackageManagerCore::calculateComponentsToInstall() const
{
emit aboutCalculateComponentsToInstall();
if (!d->m_componentsToInstallCalculated) {
- d->clearComponentsToInstall();
- QList<Component*> components;
+ d->clearInstallerCalculator();
+ QList<Component*> componentsToInstall;
+ const QList<Component*> relevant = components(ComponentType::Root | ComponentType::Descendants);
if (isUpdater()) {
- foreach (Component *component, updaterComponents()) {
+ foreach (Component *component, relevant) {
if (component->updateRequested())
- components.append(component);
+ componentsToInstall.append(component);
}
} else if (!isUpdater()) {
// relevant means all components which are not replaced
- QList<Component*> relevantComponents = rootComponents();
- foreach (QInstaller::Component *component, rootComponents())
- relevantComponents += component->childComponents(Component::Descendants);
- foreach (Component *component, relevantComponents) {
+ foreach (Component *component, relevant) {
// ask for all components which will be installed to get all dependencies
// even dependencies which are changed without an increased version
if (component->installationRequested() || (component->isInstalled()
&& !component->uninstallationRequested())) {
- components.append(component);
+ componentsToInstall.append(component);
}
}
}
- d->m_componentsToInstallCalculated = d->appendComponentsToInstall(components);
+ d->storeCheckState();
+ d->m_componentsToInstallCalculated =
+ d->installerCalculator()->appendComponentsToInstall(componentsToInstall);
}
emit finishedCalculateComponentsToInstall();
return d->m_componentsToInstallCalculated;
@@ -1309,36 +1267,36 @@ bool PackageManagerCore::calculateComponentsToInstall() const
*/
QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
{
- return d->m_orderedComponentsToInstall;
+ return d->installerCalculator()->orderedComponentsToInstall();
}
/*!
- \qmlmethod boolean QInstaller::calculateComponentsToUninstall()
+ \qmlmethod boolean installer::calculateComponentsToUninstall()
Calculates a list of components to uninstall based on the current run mode. Auto installed
dependencies are not yet resolved. The aboutCalculateComponentsToUninstall() signal is emitted
before the calculation starts, the finishedCalculateComponentsToUninstall() signal once all
- calculations are done.
+ calculations are done. Returns always true.
*/
bool PackageManagerCore::calculateComponentsToUninstall() const
{
- bool result = true;
emit aboutCalculateComponentsToUninstall();
if (!isUpdater()) {
// hack to avoid removing needed dependencies
- QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
+ QSet<Component*> componentsToInstall = d->installerCalculator()->orderedComponentsToInstall().toSet();
- QList<Component*> components;
- foreach (Component *component, availableComponents()) {
+ QList<Component*> componentsToUninstall;
+ foreach (Component *component, components(ComponentType::All)) {
if (component->uninstallationRequested() && !componentsToInstall.contains(component))
- components.append(component);
+ componentsToUninstall.append(component);
}
- d->m_componentsToUninstall.clear();
- result = d->appendComponentsToUninstall(components);
+ d->clearUninstallerCalculator();
+ d->storeCheckState();
+ d->uninstallerCalculator()->appendComponentsToUninstall(componentsToUninstall);
}
emit finishedCalculateComponentsToUninstall();
- return result;
+ return true;
}
/*!
@@ -1346,12 +1304,12 @@ bool PackageManagerCore::calculateComponentsToUninstall() const
*/
QList<Component *> PackageManagerCore::componentsToUninstall() const
{
- return d->m_componentsToUninstall.toList();
+ return d->uninstallerCalculator()->componentsToUninstall().toList();
}
QString PackageManagerCore::componentsToInstallError() const
{
- return d->m_componentsToInstallError;
+ return d->installerCalculator()->componentsToInstallError();
}
/*!
@@ -1361,7 +1319,7 @@ QString PackageManagerCore::componentsToInstallError() const
*/
QString PackageManagerCore::installReason(Component *component) const
{
- return d->installReason(component);
+ return d->installerCalculator()->installReason(component);
}
/*!
@@ -1370,13 +1328,16 @@ QString PackageManagerCore::installReason(Component *component) const
*/
QList<Component*> PackageManagerCore::dependees(const Component *_component) const
{
- QList<Component*> dependees;
- const QList<Component*> components = availableComponents();
- if (!_component || components.isEmpty())
- return dependees;
+ if (!_component)
+ return QList<Component *>();
+
+ const QList<QInstaller::Component *> availableComponents = components(ComponentType::All);
+ if (availableComponents.isEmpty())
+ return QList<Component *>();
const QLatin1Char dash('-');
- foreach (Component *component, components) {
+ QList<Component *> dependees;
+ foreach (Component *component, availableComponents) {
const QStringList &dependencies = component->dependencies();
foreach (const QString &dependency, dependencies) {
// the last part is considered to be the version then
@@ -1389,24 +1350,6 @@ QList<Component*> PackageManagerCore::dependees(const Component *_component) con
return dependees;
}
-/*!
- Returns a list of dependencies for \a component. If there's a dependency which cannot be fulfilled,
- \a missingComponents will contain the missing components. Note: Auto installed dependencies are not
- resolved.
-*/
-QList<Component*> PackageManagerCore::dependencies(const Component *component, QStringList &missingComponents) const
-{
- QList<Component*> result;
- foreach (const QString &dependency, component->dependencies()) {
- Component *component = componentByName(dependency);
- if (component)
- result.append(component);
- else
- missingComponents.append(dependency);
- }
- return result;
-}
-
ComponentModel *PackageManagerCore::defaultComponentModel() const
{
QMutexLocker _(globalModelMutex());
@@ -1437,7 +1380,7 @@ Settings &PackageManagerCore::settings() const
}
/*!
- \qmlmethod boolean QInstaller::gainAdminRights()
+ \qmlmethod boolean installer::gainAdminRights()
Tries to gain admin rights. On success, it returns \c true.
@@ -1448,14 +1391,14 @@ bool PackageManagerCore::gainAdminRights()
if (AdminAuthorization::hasAdminRights())
return true;
- d->m_FSEngineClientHandler->setActive(true);
- if (!d->m_FSEngineClientHandler->isActive())
- throw Error(QObject::tr("Error while elevating access rights."));
+ RemoteClient::instance().setActive(true);
+ if (!RemoteClient::instance().isActive())
+ throw Error(tr("Error while elevating access rights."));
return true;
}
/*!
- \qmlmethod void QInstaller::dropAdminRights()
+ \qmlmethod void installer::dropAdminRights()
Drops admin rights gained by gainAdminRights.
@@ -1463,11 +1406,11 @@ bool PackageManagerCore::gainAdminRights()
*/
void PackageManagerCore::dropAdminRights()
{
- d->m_FSEngineClientHandler->setActive(false);
+ RemoteClient::instance().setActive(false);
}
/*!
- \qmlmethod boolean QInstaller::isProcessRunning(string name)
+ \qmlmethod boolean installer::isProcessRunning(string name)
Returns true, if a process with \a name is running. On Windows, the comparison
is case-insensitive.
@@ -1478,7 +1421,7 @@ bool PackageManagerCore::isProcessRunning(const QString &name) const
}
/*!
- \qmlmethod boolean QInstaller::killProcess(string absoluteFilePath)
+ \qmlmethod boolean installer::killProcess(string absoluteFilePath)
Returns true, if a process with \a absoluteFilePath could be killed or isn't running
@@ -1517,7 +1460,7 @@ bool PackageManagerCore::killProcess(const QString &absoluteFilePath) const
/*!
- \qmlmethod void QInstaller::setDependsOnLocalInstallerBinary()
+ \qmlmethod void installer::setDependsOnLocalInstallerBinary()
Makes sure the installer runs from a local drive. Otherwise the user will get an
appropriate error message.
@@ -1533,7 +1476,7 @@ void PackageManagerCore::setDependsOnLocalInstallerBinary()
}
/*!
- \qmlmethod boolean QInstaller::localInstallerBinaryUsed()
+ \qmlmethod boolean installer::localInstallerBinaryUsed()
Returns \c false if the installer is run on Windows, and the installer has been started from
a remote file system drive. Otherwise returns \c true.
@@ -1549,7 +1492,7 @@ bool PackageManagerCore::localInstallerBinaryUsed()
}
/*!
- \qmlmethod array QInstaller::execute(string program, stringlist arguments = undefined,
+ \qmlmethod array installer::execute(string program, stringlist arguments = undefined,
string stdin = "")
Starts the program \a program with the arguments \a arguments in a
@@ -1592,7 +1535,7 @@ QList<QVariant> PackageManagerCore::execute(const QString &program, const QStrin
}
/*!
- \qmlmethod boolean QInstaller::executeDetached(string program, stringlist arguments = undefined,
+ \qmlmethod boolean installer::executeDetached(string program, stringlist arguments = undefined,
string workingDirectory = "")
Starts the program \a program with the arguments \a arguments in a
@@ -1629,7 +1572,7 @@ bool PackageManagerCore::executeDetached(const QString &program, const QStringLi
/*!
- \qmlmethod string QInstaller::environmentVariable(string name)
+ \qmlmethod string installer::environmentVariable(string name)
Returns content of an environment variable \a name. An empty string is returned if the
environment variable is not set.
@@ -1672,7 +1615,7 @@ bool PackageManagerCore::operationExists(const QString &name)
}
/*!
- \qmlmethod boolean QInstaller::performOperation(string name, stringlist arguments)
+ \qmlmethod boolean installer::performOperation(string name, stringlist arguments)
Instantly performs an operation \a name with \a arguments.
*/
@@ -1692,7 +1635,7 @@ bool PackageManagerCore::performOperation(const QString &name, const QStringList
}
/*!
- \qmlmethod boolean QInstaller::versionMatches(string version, string requirement)
+ \qmlmethod boolean installer::versionMatches(string version, string requirement)
Returns \c true when \a version matches the \a requirement.
\a requirement can be a fixed version number or it can be prefix by the comparators '>', '>=',
@@ -1721,7 +1664,7 @@ bool PackageManagerCore::versionMatches(const QString &version, const QString &r
}
/*!
- \qmlmethod string QInstaller::findLibrary(string name, stringlist paths = [])
+ \qmlmethod string installer::findLibrary(string name, stringlist paths = [])
Finds a library named \a name in \a paths.
If \a paths is empty, it gets filled with platform dependent default paths.
@@ -1737,7 +1680,7 @@ QString PackageManagerCore::findLibrary(const QString &name, const QStringList &
#if defined(Q_OS_WIN)
return findPath(QString::fromLatin1("%1.lib").arg(name), findPaths);
#else
-#if defined(Q_OS_MAC)
+#if defined(Q_OS_OSX)
if (findPaths.isEmpty()) {
findPaths.push_back(QLatin1String("/lib"));
findPaths.push_back(QLatin1String("/usr/lib"));
@@ -1763,7 +1706,7 @@ QString PackageManagerCore::findLibrary(const QString &name, const QStringList &
}
/*!
- \qmlmethod string QInstaller::findPath(string name, stringlist paths = [])
+ \qmlmethod string installer::findPath(string name, stringlist paths = [])
Tries to find a file name \a name in one of \a paths.
The resulting path is returned.
@@ -1786,9 +1729,9 @@ QString PackageManagerCore::findPath(const QString &name, const QStringList &pat
}
/*!
- \qmlmethod void QInstaller::setInstallerBaseBinary(string path)
+ \qmlmethod void installer::setInstallerBaseBinary(string path)
- Sets the "installerbase" binary to use when writing the package manager/uninstaller.
+ Sets the "installerbase" binary to use when writing the maintenance tool.
Set this if an update to installerbase is available.
If not set, the executable segment of the running un/installer will be used.
@@ -1799,7 +1742,7 @@ void PackageManagerCore::setInstallerBaseBinary(const QString &path)
}
/*!
- \qmlmethod string QInstaller::value(string key, string defaultValue = "")
+ \qmlmethod string installer::value(string key, string defaultValue = "")
Returns the installer value for \a key. If \a key is not known to the system, \a defaultValue is
returned. Additionally, on Windows, \a key can be a registry key.
@@ -1812,7 +1755,20 @@ QString PackageManagerCore::value(const QString &key, const QString &defaultValu
}
/*!
- \qmlmethod void QInstaller::setValue(string key, string value)
+ \qmlmethod stringlist installer::values(string key, stringlist defaultValue = [])
+
+ Returns the installer value for \a key. If \a key is not known to the system, \a defaultValue is
+ returned. Additionally, on Windows, \a key can be a registry key.
+
+ \sa value
+*/
+QStringList PackageManagerCore::values(const QString &key, const QStringList &defaultValue) const
+{
+ return d->m_data.value(key, defaultValue).toStringList();
+}
+
+/*!
+ \qmlmethod void installer::setValue(string key, string value)
Sets the installer value for \a key to \a value.
@@ -1826,7 +1782,7 @@ void PackageManagerCore::setValue(const QString &key, const QString &value)
}
/*!
- \qmlmethod boolean QInstaller::containsValue(string key)
+ \qmlmethod boolean installer::containsValue(string key)
Returns \c true if the installer contains a value for \a key.
@@ -1838,7 +1794,7 @@ bool PackageManagerCore::containsValue(const QString &key) const
}
/*!
- \qmlmethod void QInstaller::setSharedFlag(string key, boolean value)
+ \qmlmethod void installer::setSharedFlag(string key, boolean value)
Sets a shared flag with name \a key to \a value. This is one option
to share information between scripts.
@@ -1851,7 +1807,7 @@ void PackageManagerCore::setSharedFlag(const QString &key, bool value)
}
/*!
- \qmlmethod boolean QInstaller::sharedFlag(string key)
+ \qmlmethod boolean installer::sharedFlag(string key)
Returns shared flag with name \a key. This is one option
to share information between scripts.
@@ -1889,11 +1845,11 @@ QString PackageManagerCore::error() const
*/
bool PackageManagerCore::finishedWithSuccess() const
{
- return d->m_status == PackageManagerCore::Success || d->m_needToWriteUninstaller;
+ return d->m_status == PackageManagerCore::Success || d->m_needToWriteMaintenanceTool;
}
/*!
- \qmlmethod void QInstaller::interrupt()
+ \qmlmethod void installer::interrupt()
Cancels an ongoing installation.
@@ -1906,7 +1862,7 @@ void PackageManagerCore::interrupt()
}
/*!
- \qmlmethod void QInstaller::setCanceled()
+ \qmlmethod void installer::setCanceled()
Cancels the installation.
*/
@@ -1956,7 +1912,7 @@ QString PackageManagerCore::installerBinaryPath() const
}
/*!
- \qmlmethod boolean QInstaller::isInstaller()
+ \qmlmethod boolean installer::isInstaller()
Returns \c true if executed in an install step.
@@ -1968,7 +1924,7 @@ bool PackageManagerCore::isInstaller() const
}
/*!
- \qmlmethod boolean QInstaller::isOfflineOnly()
+ \qmlmethod boolean installer::isOfflineOnly()
Returns \c true if this is an offline-only installer.
*/
@@ -1978,7 +1934,7 @@ bool PackageManagerCore::isOfflineOnly() const
}
/*!
- \qmlmethod void QInstaller::setUninstaller()
+ \qmlmethod void installer::setUninstaller()
Forces an uninstaller context.
@@ -1986,11 +1942,11 @@ bool PackageManagerCore::isOfflineOnly() const
*/
void PackageManagerCore::setUninstaller()
{
- d->m_magicBinaryMarker = QInstaller::MagicUninstallerMarker;
+ d->m_magicBinaryMarker = BinaryContent::MagicUninstallerMarker;
}
/*!
- \qmlmethod boolean QInstaller::isUninstaller()
+ \qmlmethod boolean installer::isUninstaller()
Returns \c true if the script is executed in an uninstall context.
@@ -2002,7 +1958,7 @@ bool PackageManagerCore::isUninstaller() const
}
/*!
- \qmlmethod void QInstaller::setUpdater()
+ \qmlmethod void installer::setUpdater()
Forces an updater context.
@@ -2010,11 +1966,11 @@ bool PackageManagerCore::isUninstaller() const
*/
void PackageManagerCore::setUpdater()
{
- d->m_magicBinaryMarker = QInstaller::MagicUpdaterMarker;
+ d->m_magicBinaryMarker = BinaryContent::MagicUpdaterMarker;
}
/*!
- \qmlmethod boolean QInstaller::isUpdater()
+ \qmlmethod boolean installer::isUpdater()
Returns \c true if the script is executed in an updater context.
@@ -2026,18 +1982,18 @@ bool PackageManagerCore::isUpdater() const
}
/*!
- \qmlmethod void QInstaller::setPackageManager()
+ \qmlmethod void installer::setPackageManager()
Forces a package manager context.
*/
void PackageManagerCore::setPackageManager()
{
- d->m_magicBinaryMarker = QInstaller::MagicPackageManagerMarker;
+ d->m_magicBinaryMarker = BinaryContent::MagicPackageManagerMarker;
}
/*!
- \qmlmethod boolean QInstaller::isPackageManager()
+ \qmlmethod boolean installer::isPackageManager()
Returns \c true if the script is executed in a package manager context.
\sa setPackageManager, isInstaller, isUninstaller, isUpdater
@@ -2048,7 +2004,7 @@ bool PackageManagerCore::isPackageManager() const
}
/*!
- \qmlmethod boolean QInstaller::runInstaller()
+ \qmlmethod boolean installer::runInstaller()
Runs the installer. Returns \c true on success, \c false otherwise.
*/
@@ -2058,7 +2014,7 @@ bool PackageManagerCore::runInstaller()
}
/*!
- \qmlmethod boolean QInstaller::runUninstaller()
+ \qmlmethod boolean installer::runUninstaller()
Runs the uninstaller. Returns \c true on success, \c false otherwise.
*/
@@ -2068,7 +2024,7 @@ bool PackageManagerCore::runUninstaller()
}
/*!
- \qmlmethod boolean QInstaller::runPackageUpdater()
+ \qmlmethod boolean installer::runPackageUpdater()
Runs the package updater. Returns \c true on success, \c false otherwise.
*/
@@ -2078,13 +2034,13 @@ bool PackageManagerCore::runPackageUpdater()
}
/*!
- \qmlmethod void QInstaller::languageChanged()
+ \qmlmethod void installer::languageChanged()
Calls languangeChanged on all components.
*/
void PackageManagerCore::languageChanged()
{
- foreach (Component *component, availableComponents())
+ foreach (Component *component, components(ComponentType::All))
component->languageChanged();
}
@@ -2103,11 +2059,11 @@ bool PackageManagerCore::run()
}
/*!
- Returns the path name of the uninstaller binary.
+ Returns the path name of the maintenance tool binary.
*/
-QString PackageManagerCore::uninstallerName() const
+QString PackageManagerCore::maintenanceToolName() const
{
- return d->uninstallerName();
+ return d->maintenanceToolName();
}
bool PackageManagerCore::updateComponentData(struct Data &data, Component *component)
@@ -2232,6 +2188,9 @@ bool PackageManagerCore::fetchAllPackages(const PackagesList &remotes, const Loc
if (d->statusCanceledOrFailed())
return false;
+ if (!ProductKeyCheck::instance()->isValidPackage(package->data(scName).toString()))
+ continue;
+
QScopedPointer<QInstaller::Component> component(new QInstaller::Component(this));
data.package = package;
component->loadDataFromPackage(*package);
@@ -2278,6 +2237,9 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
if (d->statusCanceledOrFailed())
return false;
+ if (!ProductKeyCheck::instance()->isValidPackage(update->data(scName).toString()))
+ continue;
+
QScopedPointer<QInstaller::Component> component(new QInstaller::Component(this));
data.package = update;
component->loadDataFromPackage(*update);
@@ -2411,32 +2373,32 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
return true;
}
-void PackageManagerCore::resetComponentsToUserCheckedState()
+void PackageManagerCore::restoreCheckState()
{
- d->resetComponentsToUserCheckedState();
+ d->restoreCheckState();
}
void PackageManagerCore::updateDisplayVersions(const QString &displayKey)
{
- QHash<QString, QInstaller::Component *> components;
- const QList<QInstaller::Component *> componentList = availableComponents();
- foreach (QInstaller::Component *component, componentList)
- components[component->name()] = component;
+ QHash<QString, QInstaller::Component *> componentsHash;
+ foreach (QInstaller::Component *component, components(ComponentType::All))
+ componentsHash[component->name()] = component;
// set display version for all components in list
- const QStringList &keys = components.keys();
+ const QStringList &keys = componentsHash.keys();
foreach (const QString &key, keys) {
QHash<QString, bool> visited;
- if (components.value(key)->isInstalled()) {
- components.value(key)->setValue(scDisplayVersion,
- findDisplayVersion(key, components, scInstalledVersion, visited));
+ if (componentsHash.value(key)->isInstalled()) {
+ componentsHash.value(key)->setValue(scDisplayVersion,
+ findDisplayVersion(key, componentsHash, scInstalledVersion, visited));
}
visited.clear();
- const QString displayVersionRemote = findDisplayVersion(key, components, scRemoteVersion, visited);
+ const QString displayVersionRemote = findDisplayVersion(key, componentsHash,
+ scRemoteVersion, visited);
if (displayVersionRemote.isEmpty())
- components.value(key)->setValue(displayKey, tr("invalid"));
+ componentsHash.value(key)->setValue(displayKey, tr("invalid"));
else
- components.value(key)->setValue(displayKey, displayVersionRemote);
+ componentsHash.value(key)->setValue(displayKey, displayVersionRemote);
}
}