summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-11-22 15:33:17 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-11-24 11:27:31 +0200
commit0f261598201698f73cf28541294b5027455d0f76 (patch)
tree19d30426eba67bdfa793e47b1f3108694e017674
parent69c9407d7fb7bafebf5e5b8de9ca98c31a14520c (diff)
Fix updater view behavior for non-checkable components
As the components can still be selected with the selection buttons above the view, it makes little sense to artificially limit selecting individual items for update and hiding their check state. Also the documented use case for the property - making a parent component non-checkable so only some of its children should be checked - does not apply for the updater view. Apply similar fix to forced installation components, which should be also toggleable for updates. Task-number: QTIFW-836 Change-Id: I18f34c4e8ee1e24e761e50edd3066ec4aea3432e Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--doc/installerfw.qdoc7
-rw-r--r--src/libs/installer/component.cpp8
-rw-r--r--tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp4
3 files changed, 12 insertions, 7 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index 3d251fbc7..631c4d413 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -983,7 +983,8 @@
\row
\li ForcedInstallation
\li Determines that the package must always be installed. End users
- cannot deselect it in the installer.
+ cannot deselect it in the installer. When updating components, the
+ component can still be deselected from an update.
\row
\li ForcedUpdate
\li Marks the package as \c ForcedUpdate to force a restart of the
@@ -1009,7 +1010,9 @@
\row
\li Checkable
\li Set to \c false if you want to hide the checkbox for an item. This is useful
- when only a few subcomponents should be selected instead of all. Optional.
+ when only a few subcomponents should be selected instead of all. When updating
+ components, the checkbox is still visible to allow toggling the component for
+ update. Optional.
\row
\li ExpandedByDefault
\li Set to \c true if you want this item to be expanded by default. Optional.
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 37abcea8a..e045d7f29 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -463,12 +463,14 @@ void Component::setValue(const QString &key, const QString &value)
if (key == scName)
d->m_componentName = normalizedValue;
- if (key == scCheckable)
- this->setCheckable(normalizedValue.toLower() == scTrue);
+ if (key == scCheckable) // Non-checkable components can still be toggled in updater
+ this->setCheckable(normalizedValue.toLower() == scTrue || d->m_core->isUpdater());
if (key == scExpandedByDefault)
this->setExpandedByDefault(normalizedValue.toLower() == scTrue);
if (key == scForcedInstallation) {
- if (value == scTrue && !PackageManagerCore::noForceInstallation()) {
+ if (value == scTrue && !d->m_core->isUpdater() && !PackageManagerCore::noForceInstallation()) {
+ // Forced installation components can still be toggled in updater or when
+ // core is set to ignore forced installations.
setCheckable(false);
setCheckState(Qt::Checked);
}
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
index 338157cba..ef3163980 100644
--- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
+++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
@@ -295,7 +295,7 @@ private slots:
componentResourcesAfterUpdate.append(ComponentResource("componentA", "1.0.0content.txt"));
componentResourcesAfterUpdate.append(ComponentResource("componentB", "2.0.0content.txt"));
componentResourcesAfterUpdate.append(ComponentResource("componentD", "2.0.0content.txt"));//AutodepenOn componentA,componentB
- componentResourcesAfterUpdate.append(ComponentResource("componentE", "2.0.0content.txt"));//ForcedInstall
+ componentResourcesAfterUpdate.append(ComponentResource("componentE", "1.0.0content.txt"));//ForcedInstall, not updated without user selection
componentResourcesAfterUpdate.append(ComponentResource("componentG", "1.0.0content.txt"));
deletedComponentResources.clear();
@@ -316,7 +316,7 @@ private slots:
<< componentResourcesAfterUpdate
<< (QStringList() << "components.xml" << "installcontent.txt" << "installcontentA.txt"
<< "installcontentD_update.txt" << "installcontentB_update.txt"
- << "installcontentE_update.txt" << "installcontentG.txt")
+ << "installcontentE.txt" << "installcontentG.txt")
<< deletedComponentResources;
}