diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-11-17 12:33:51 +0100 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-11-21 12:10:33 +0100 |
commit | 653bac34d7d03d581657ad781e6bdb89713a8a12 (patch) | |
tree | 5cee8fb63e9fe197a287035a9cf2fe3a678dcb55 /installerbuilder/libinstaller | |
parent | 89668a8654cc079d751f9dfb351daa420a0b64dc (diff) |
introduce beginInstallation() method in Component
- with this we have the possiblity to set some variables or show a messagebox if that component is really installed, like to ask the user to stop a process
Change-Id: Ibe2044006835b301fd13e5ba226dc81ae6e25244
Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller')
-rw-r--r-- | installerbuilder/libinstaller/component.cpp | 10 | ||||
-rw-r--r-- | installerbuilder/libinstaller/component.h | 1 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.cpp | 9 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.h | 1 |
4 files changed, 21 insertions, 0 deletions
diff --git a/installerbuilder/libinstaller/component.cpp b/installerbuilder/libinstaller/component.cpp index cc93e0b55..81a41732c 100644 --- a/installerbuilder/libinstaller/component.cpp +++ b/installerbuilder/libinstaller/component.cpp @@ -601,6 +601,16 @@ void Component::createOperationsForArchive(const QString &archive) } } +void Component::beginInstallation() +{ + // the script can override this method + if (callScriptMethod(QLatin1String("beginInstallation")).isValid()) { + d->m_operationsCreated = true; + return; + } +} + + /*! Creates all operations needed to install this component. You can override this method by providing a method with the same name in the component script. diff --git a/installerbuilder/libinstaller/component.h b/installerbuilder/libinstaller/component.h index 2c1421535..c3d23c4e3 100644 --- a/installerbuilder/libinstaller/component.h +++ b/installerbuilder/libinstaller/component.h @@ -108,6 +108,7 @@ public: QStringList userInterfaces() const; QHash<QString, QPair<QString, QString> > licenses() const; Q_INVOKABLE QWidget *userInterface(const QString &name) const; + Q_INVOKABLE virtual void beginInstallation(); Q_INVOKABLE virtual void createOperations(); Q_INVOKABLE virtual void createOperationsForArchive(const QString &archive); Q_INVOKABLE virtual void createOperationsForPath(const QString &path); diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index df6e6bff8..e3c1c7754 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -692,6 +692,12 @@ void PackageManagerCorePrivate::readUninstallerIniFile(const QString &targetDir) m_settings.addUserRepositories(repositories); } +void PackageManagerCorePrivate::callBeginInstallation(const QList<Component*> &componentList) +{ + foreach (Component *component, componentList) + component->beginInstallation(); +} + void PackageManagerCorePrivate::stopProcessesForUpdates(const QList<Component*> &components) { QStringList processList; @@ -1234,6 +1240,7 @@ void PackageManagerCorePrivate::runInstaller() // Clear the packages as we might install into an already existing installation folder. m_updaterApplication.packagesInfo()->clearPackageInfoList(); + callBeginInstallation(componentsToInstall); stopProcessesForUpdates(componentsToInstall); const int progressOperationCount = countProgressOperations(componentsToInstall); @@ -1398,6 +1405,7 @@ void PackageManagerCorePrivate::runPackageUpdater() } m_performedOperationsOld = nonRevertedOperations; // these are all operations left: those not reverted + callBeginInstallation(componentsToInstall); stopProcessesForUpdates(componentsToInstall); const double progressOperationCount = countProgressOperations(componentsToInstall); @@ -1470,6 +1478,7 @@ void PackageManagerCorePrivate::runUninstaller() const double undoOperationProgressSize = double(1) / double(uninstallOperationCount); //yes uninstallation is like an update on the component so please inform the user to stop processes + callBeginInstallation(m_core->availableComponents()); stopProcessesForUpdates(m_core->availableComponents()); runUndoOperations(undoOperations, undoOperationProgressSize, adminRightsGained, false); diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h index d58f269a1..4792c9153 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.h +++ b/installerbuilder/libinstaller/packagemanagercore_p.h @@ -124,6 +124,7 @@ public: QString replaceVariables(const QString &str) const; QByteArray replaceVariables(const QByteArray &str) const; + void callBeginInstallation(const QList<Component*> &componentList); void stopProcessesForUpdates(const QList<Component*> &components); int countProgressOperations(const QList<Component*> &components); int countProgressOperations(const OperationList &operations); |