summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-08-23 16:12:50 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-08-23 16:35:29 +0200
commit77292bee62114b31aafaf762219616fd0b2aa48a (patch)
treedf435b00f776b34bda092566b4217495be5760e5 /installerbuilder
parenta222f8f9c7fccadd4c017b5c5be5639bb288adbb (diff)
Add a getter for auto dependency values.
Since we need the list anyway, we can move the is empty check to the beginning of the function. Change-Id: Iebe04b6f2904a02c807edaa7586af8a83c115c0a Reviewed-on: http://codereview.qt.nokia.com/3414 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/libinstaller/component.cpp19
-rw-r--r--installerbuilder/libinstaller/component.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/installerbuilder/libinstaller/component.cpp b/installerbuilder/libinstaller/component.cpp
index b63020d32..57a9c105f 100644
--- a/installerbuilder/libinstaller/component.cpp
+++ b/installerbuilder/libinstaller/component.cpp
@@ -910,6 +910,11 @@ QStringList Component::dependencies() const
return value(scDependencies).split(scCommaRegExp, QString::SkipEmptyParts);
}
+QStringList Component::autoDependencies() const
+{
+ return value(scAutoDependOn).split(scCommaRegExp, QString::SkipEmptyParts);
+}
+
/*!
Set's the components state to installed.
*/
@@ -924,8 +929,14 @@ void Component::setInstalled()
*/
bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
{
+ // If there is no auto depend on value or the value is empty, we have nothing todo. The component does
+ // not need to be installed as an auto dependency.
+ QStringList autoDependOnList = autoDependencies();
+ if (autoDependOnList.isEmpty())
+ return false;
+
// The script can override this method and determines if the component needs to be installed.
- if (value(scAutoDependOn).compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) {
+ if (autoDependOnList.first().compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) {
QScriptValue valueFromScript;
try {
valueFromScript = callScriptMethod(QLatin1String("isAutoDependOn"));
@@ -942,12 +953,6 @@ bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
return false;
}
- // If there is no auto depend on value or the value is empty, we have nothing todo. The component does
- // not need to be installed as an auto dependency.
- QStringList autoDependOnList = value(scAutoDependOn).split(scCommaRegExp, QString::SkipEmptyParts);
- if (autoDependOnList.isEmpty())
- return false;
-
QSet<QString> components = componentsToInstall;
const QStringList installedPackages = d->m_core->localInstalledPackages().keys();
foreach (const QString &name, installedPackages)
diff --git a/installerbuilder/libinstaller/component.h b/installerbuilder/libinstaller/component.h
index c0bef1608..53388989e 100644
--- a/installerbuilder/libinstaller/component.h
+++ b/installerbuilder/libinstaller/component.h
@@ -59,6 +59,7 @@ class INSTALLER_EXPORT Component : public QObject, public QScriptable, public Co
Q_PROPERTY(QStringList archives READ archives)
Q_PROPERTY(QStringList userInterfaces READ userInterfaces)
Q_PROPERTY(QStringList dependencies READ dependencies)
+ Q_PROPERTY(QStringList autoDependencies READ autoDependencies)
Q_PROPERTY(bool fromOnlineRepository READ isFromOnlineRepository)
Q_PROPERTY(QUrl repositoryUrl READ repositoryUrl)
Q_PROPERTY(bool removeBeforeUpdate READ removeBeforeUpdate WRITE setRemoveBeforeUpdate)
@@ -150,6 +151,7 @@ public:
void setRemoveBeforeUpdate(bool removeBeforeUpdate);
QStringList dependencies() const;
+ QStringList autoDependencies() const;
void languageChanged();
QString localTempPath() const;