summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-04-01 13:55:31 +0200
committerkh1 <qt-info@nokia.com>2011-04-01 13:55:31 +0200
commita509f1a2c9328bab4458fedccfb669c6b2c74de3 (patch)
treefe2007b88c2dcd2342d2c4dde21007b53122c63e /installerbuilder
parent4e5a483628ce1af16c3d934a04e40f9837e3c37f (diff)
Add slot to setup model data.
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/libinstaller/qinstallercomponent.cpp34
-rw-r--r--installerbuilder/libinstaller/qinstallercomponent.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/installerbuilder/libinstaller/qinstallercomponent.cpp b/installerbuilder/libinstaller/qinstallercomponent.cpp
index d1eac3694..919fa0c0d 100644
--- a/installerbuilder/libinstaller/qinstallercomponent.cpp
+++ b/installerbuilder/libinstaller/qinstallercomponent.cpp
@@ -78,6 +78,7 @@ static const QLatin1String skUpdateText("UpdateText");
static const QLatin1String skRequiresAdminRights("RequiresAdminRights");
static const QLatin1String skNewComponent("NewComponent");
static const QLatin1String skScript("Script");
+static const QLatin1String skInstalledVersion("InstalledVersion");
/*
TRANSLATOR QInstaller::Component
@@ -96,6 +97,8 @@ Component::Component(Installer *installer)
{
d->init();
setPrivate(d);
+
+ connect(this, SIGNAL(valueChanged(QString, QString)), this, SLOT(updateModelData(QString, QString)));
}
Component::Component(KDUpdater::Update* update, Installer* installer)
@@ -105,6 +108,8 @@ Component::Component(KDUpdater::Update* update, Installer* installer)
d->init();
setPrivate(d);
+ connect(this, SIGNAL(valueChanged(QString, QString)), this, SLOT(updateModelData(QString, QString)));
+
loadDataFromUpdate(update);
}
@@ -308,6 +313,7 @@ void Component::appendComponent(Component* component)
if (Component *parent = component->parentComponent())
parent->removeComponent(component);
component->d->m_parent = this;
+ setTristate(childCount() > 0);
}
/*!
@@ -1106,3 +1112,31 @@ void Component::setLocalTempPath(const QString &tempLocalPath)
{
d->localTempPath = tempLocalPath;
}
+
+void Component::updateModelData(const QString &key, const QString &data)
+{
+ if (key == skVirtual) {
+ if (data.toLower() == QLatin1String("true"))
+ setData(installer()->virtualComponentsFont(), Qt::FontRole);
+ }
+
+ if (key == skVersion)
+ setData(data, NewVersion);
+
+ if (key == skDisplayName)
+ setData(data, Qt::DisplayRole);
+
+ if (key == skInstalledVersion)
+ setData(data, InstalledVersion);
+
+ if (key == skUncompressedSize)
+ setData(uncompressedSize(), UncompressedSize);
+
+ bool force = value(skForcedInstallation).toLower() == QLatin1String("true");
+ setEnabled(!force);
+ setCheckable(!force);
+ setCheckState(force ? Qt::Checked : Qt::Unchecked);
+
+ setData(value(skDescription) + QLatin1String("<br><br>Update Info: ") + value(skUpdateText),
+ Qt::ToolTipRole);
+}
diff --git a/installerbuilder/libinstaller/qinstallercomponent.h b/installerbuilder/libinstaller/qinstallercomponent.h
index 51ab440d2..e0c762fd2 100644
--- a/installerbuilder/libinstaller/qinstallercomponent.h
+++ b/installerbuilder/libinstaller/qinstallercomponent.h
@@ -208,6 +208,9 @@ protected:
QScriptValue callScriptMethod(const QString &name,
const QScriptValueList &parameters = QScriptValueList());
+private Q_SLOTS:
+ void updateModelData(const QString &key, const QString &value);
+
private:
void setLocalTempPath(const QString &tempPath);