summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/packagemanagercore.cpp61
-rw-r--r--src/libs/installer/packagemanagercore.h7
2 files changed, 50 insertions, 18 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 61ce92467..82f852faf 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -129,6 +129,24 @@
*/
/*!
+ \qmlsignal QInstaller::finishedCalculateComponentsToInstall()
+
+ Emitted after the ordered list of components to install was calculated.
+*/
+
+/*!
+ \qmlsignal QInstaller::aboutCalculateComponentsToUninstall()
+
+ Emitted before the ordered list of components to uninstall is calculated.
+*/
+
+/*!
+ \qmlsignal QInstaller::finishedCalculateComponentsToUninstall()
+
+ Emitted after the ordered list of components to uninstall was calculated.
+*/
+
+/*!
\qmlsignal QInstaller::componentAdded(Component component)
Emitted when a new root component has been added.
@@ -1247,8 +1265,12 @@ Component *PackageManagerCore::componentByName(const QString &name) const
}
/*!
- Calculates an ordered list of components to install based on the current run mode. Also auto installed
- dependencies are resolved.
+ \qmlmethod boolean QInstaller::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
+ before the calculation starts, the finishedCalculateComponentsToInstall() signal once all
+ calculations are done.
*/
bool PackageManagerCore::calculateComponentsToInstall() const
{
@@ -1278,6 +1300,7 @@ bool PackageManagerCore::calculateComponentsToInstall() const
d->m_componentsToInstallCalculated = d->appendComponentsToInstall(components);
}
+ emit finishedCalculateComponentsToInstall();
return d->m_componentsToInstallCalculated;
}
@@ -1290,26 +1313,32 @@ QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
}
/*!
- Calculates a list of components to uninstall based on the current run mode. Auto installed dependencies
- are resolved as well.
+ \qmlmethod boolean QInstaller::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.
*/
bool PackageManagerCore::calculateComponentsToUninstall() const
{
- if (isUpdater())
- return true;
+ bool result = true;
+ emit aboutCalculateComponentsToUninstall();
+ if (!isUpdater()) {
+ // hack to avoid removing needed dependencies
+ QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
- // hack to avoid removing needed dependencies
- QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
+ QList<Component*> components;
+ foreach (Component *component, availableComponents()) {
+ if (component->uninstallationRequested() && !componentsToInstall.contains(component))
+ components.append(component);
+ }
- QList<Component*> components;
- foreach (Component *component, availableComponents()) {
- if (component->uninstallationRequested() && !componentsToInstall.contains(component))
- components.append(component);
+ d->m_componentsToUninstall.clear();
+ result = d->appendComponentsToUninstall(components);
}
-
-
- d->m_componentsToUninstall.clear();
- return d->appendComponentsToUninstall(components);
+ emit finishedCalculateComponentsToUninstall();
+ return result;
}
/*!
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index a3f2b7eb0..7b45b008e 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -199,10 +199,10 @@ public:
QList<Component*> availableComponents() const;
Component *componentByName(const QString &identifier) const;
- bool calculateComponentsToInstall() const;
+ Q_INVOKABLE bool calculateComponentsToInstall() const;
QList<Component*> orderedComponentsToInstall() const;
- bool calculateComponentsToUninstall() const;
+ Q_INVOKABLE bool calculateComponentsToUninstall() const;
QList<Component*> componentsToUninstall() const;
QString componentsToInstallError() const;
@@ -270,6 +270,9 @@ public Q_SLOTS:
Q_SIGNALS:
void aboutCalculateComponentsToInstall() const;
+ void finishedCalculateComponentsToInstall() const;
+ void aboutCalculateComponentsToUninstall() const;
+ void finishedCalculateComponentsToUninstall() const;
void componentAdded(QInstaller::Component *comp);
void rootComponentsAdded(QList<QInstaller::Component*> components);
void updaterComponentsAdded(QList<QInstaller::Component*> components);