From ba1209000a3175ce3b8f88829485c7c01efcc852 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Tue, 1 Dec 2015 10:50:22 +0200 Subject: Allow defining non-checkable items This change will introduce new element 'Checkable' for package. Setting checkable to false will hide checkbox. Useful if use case is to install one sub item instead of all sub items. Change-Id: I8c731e77353b6da539dddcecdc8495b28ef5f7ea Task-number: QTIFW-773 Reviewed-by: Niels Weber Reviewed-by: Iikka Eklund --- src/libs/installer/component.cpp | 5 +++++ src/libs/installer/constants.h | 1 + src/libs/installer/packagemanagercore_p.cpp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libs/installer') diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 688a5b928..4ffefe384 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -66,6 +66,7 @@ static const QLatin1String scUpdateText("UpdateText"); static const QLatin1String scUninstalled("Uninstalled"); static const QLatin1String scCurrentState("CurrentState"); static const QLatin1String scForcedInstallation("ForcedInstallation"); +static const QLatin1String scCheckable("Checkable"); /*! \inmodule QtInstallerFramework @@ -261,6 +262,7 @@ void Component::loadDataFromPackage(const KDUpdater::LocalPackage &package) } setValue(scVirtual, package.virtualComp ? scTrue : scFalse); setValue(scCurrentState, scInstalled); + setValue(scCheckable, package.checkable ? scTrue : scFalse); } /*! @@ -293,6 +295,7 @@ void Component::loadDataFromPackage(const Package &package) setValue(scScriptTag, package.data(scScriptTag).toString()); setValue(scReplaces, package.data(scReplaces).toString()); setValue(scReleaseDate, package.data(scReleaseDate).toString()); + setValue(scCheckable, package.data(scCheckable).toString()); QString forced = package.data(scForcedInstallation, scFalse).toString().toLower(); if (PackageManagerCore::noForceInstallation()) @@ -384,6 +387,8 @@ void Component::setValue(const QString &key, const QString &value) if (key == scName) d->m_componentName = normalizedValue; + if (key == scCheckable) + this->setCheckable(normalizedValue.toLower() == scTrue); d->m_vars[key] = normalizedValue; emit valueChanged(key, normalizedValue); diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h index 0550b94f8..ecb998361 100644 --- a/src/libs/installer/constants.h +++ b/src/libs/installer/constants.h @@ -70,6 +70,7 @@ static const QLatin1String scRequiresAdminRights("RequiresAdminRights"); // constants used throughout the components class static const QLatin1String scVirtual("Virtual"); static const QLatin1String scSortingPriority("SortingPriority"); +static const QLatin1String scCheckable("Checkable"); // constants used throughout the settings and package manager core class static const QLatin1String scTitle("Title"); diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 51ea4df38..ce6bc8cd4 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -1924,7 +1924,8 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr component->forcedInstallation(), component->isVirtual(), component->value(scUncompressedSize).toULongLong(), - component->value(scInheritVersion)); + component->value(scInheritVersion), + component->isCheckable()); m_localPackageHub->writeToDisk(); component->setInstalled(); -- cgit v1.2.3