diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-06-01 18:18:58 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-06-01 18:18:58 +0200 |
commit | 3382254edb177767e312a0517dbcbe2153ddf838 (patch) | |
tree | be04fb23bdeaf9cd8b6050d1c14894f54ca379d0 /installerbuilder/libinstaller/qinstallercomponent.cpp | |
parent | 5dbc80df0a1d5d1e7021757a4b7c1352424bfc2a (diff) |
now we have a default tag which can contain true or script
Diffstat (limited to 'installerbuilder/libinstaller/qinstallercomponent.cpp')
-rw-r--r-- | installerbuilder/libinstaller/qinstallercomponent.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/installerbuilder/libinstaller/qinstallercomponent.cpp b/installerbuilder/libinstaller/qinstallercomponent.cpp index 57c456a90..367b6af96 100644 --- a/installerbuilder/libinstaller/qinstallercomponent.cpp +++ b/installerbuilder/libinstaller/qinstallercomponent.cpp @@ -62,6 +62,7 @@ using namespace QInstaller; static const QLatin1String skName("Name"); static const QLatin1String skDisplayName("DisplayName"); static const QLatin1String skDescription("Description"); +static const QLatin1String skDefault("Default"); static const QLatin1String skCompressedSize("CompressedSize"); static const QLatin1String skUncompressedSize("UncompressedSize"); static const QLatin1String skVersion("Version"); @@ -169,6 +170,7 @@ void Component::loadDataFromUpdate(KDUpdater::Update* update) setValue(skName, update->data(skName).toString()); setValue(skDisplayName, update->data(skDisplayName).toString()); setValue(skDescription, update->data(skDescription).toString()); + setValue(skDefault, update->data(skDefault).toString()); setValue(skCompressedSize, QString::number(update->compressedSize())); setValue(skUncompressedSize, QString::number(update->uncompressedSize())); setValue(skVersion, update->data(skVersion).toString()); @@ -278,6 +280,9 @@ void Component::setValue(const QString &key, const QString &value) if (d->m_vars.value(key) == value) return; + if (key == QLatin1String("Name")) + m_name = value; + d->m_vars[key] = value; emit valueChanged(key, value); } @@ -433,7 +438,7 @@ void Component::languageChanged() \note The method is not called, if the current script context is the same method, to avoid infinite recursion. */ -QScriptValue Component::callScriptMethod(const QString &methodName, const QScriptValueList& arguments) +QScriptValue Component::callScriptMethod(const QString &methodName, const QScriptValueList& arguments) const { if (!d->m_unexistingScriptMethods.value(methodName, true)) return QScriptValue(); @@ -918,14 +923,7 @@ bool Component::isSelected() const */ void Component::setSelected(bool selected) { - const Qt::CheckState previousState = checkState(); - const Qt::CheckState newState = selected ? Qt::Checked : Qt::Unchecked; - - if (newState != previousState && !isTristate()) { - setCheckState(newState); - QMetaObject::invokeMethod(this, "selectedChanged", Qt::QueuedConnection, - Q_ARG(bool, newState == Qt::Checked)); - } + verbose() << Q_FUNC_INFO << " is deprecated!!!" << std::endl; } /*! @@ -946,6 +944,24 @@ void Component::setInstalled() } /*! + Determines if the component is a default one. +*/ +bool Component::isDefault() const +{ + // the script can override this method + if (value(skDefault).compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) { + const QScriptValue valueFromScript = callScriptMethod(QLatin1String("isDefault")); + if (valueFromScript.isValid()) { + return valueFromScript.toBool(); + } + verbose() << "value from script is not valid " << std::endl; + return false; + } + + return value(skDefault).compare(QLatin1String("true"), Qt::CaseInsensitive) == 0; +} + +/*! Determines if the component is installed. */ bool Component::isInstalled() const |