summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-11-22 18:02:34 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2023-01-26 15:24:58 +0200
commitf5750078a7a75e7ad7b0260b54236ee87f3900f9 (patch)
tree2552953e7ff14b64f8372b3b7090bae3533a0cf5
parentb72b90662e718d022dd06e7369008fe4f319e650 (diff)
Show check box for AutoDependOn components in updater view
In addition to the automatic selection, allow end user to select components declaring the AutoDependOn property when updating components. This does not change the previous rules for automatic selection for update, meaning the component 'A' declaring AutoDependOn relation to component 'B' will still be updated when 'B' is selected for update, regardless of the user selected check state for 'A'. This fixes some cases not handled by the automatic selection, where the component declaring AutoDependOn relation could not be updated. An example scenario: - 'A' (1.0.0) declaring an auto dependency to 'B' does not follow the release schedule and versioning of the component 'B' (2.1.0). - 'A' has a new release (1.0.1) that is pushed to remote repository - The end user cannot update the component 'A' unless 'B' is also updated to the repository, which would trigger the automatic selection Task-number: QTIFW-2855 Change-Id: Iea06c366f7f14f391cbc0b4a6526c8aee349ae59 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--doc/installerfw.qdoc8
-rw-r--r--src/libs/installer/componentmodel.cpp10
-rw-r--r--src/libs/installer/packagemanagercore.cpp4
3 files changed, 16 insertions, 6 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index 631c4d413..652fcc65d 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -907,8 +907,12 @@
The component is installed if and only if
all of the specified dependencies are fulfilled.
If a component has an automatic dependency on other components,
- the check box will not be visible next to the component in the component tree.
- The selection will be performed automatically.
+ the check box will not be visible next to the component in the component tree,
+ but this does not change the visibility of the check box in the updater view
+ where the end user may still manually select the component for update.
+
+ When running an installer or a maintenance tool in package manager
+ mode, the selection will be performed automatically.
If the component was not installed before, it will
be selected for installation only when all components
from this list are also selected for installation.
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index ef662b309..23e8680f6 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -214,7 +214,10 @@ QVariant ComponentModel::data(const QModelIndex &index, int role) const
return component->data(Qt::UserRole + index.column());
}
if (role == Qt::CheckStateRole) {
- if (!component->isCheckable() || !component->autoDependencies().isEmpty() || component->isUnstable())
+ if (!component->isCheckable() || component->isUnstable())
+ return QVariant();
+
+ if (!m_core->isUpdater() && !component->autoDependencies().isEmpty())
return QVariant();
}
if (role == ComponentModelHelper::ExpandedByDefault) {
@@ -558,9 +561,12 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone
checkable = false;
}
- if ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty() || node->isUnstable())
+ if ((!node->isCheckable() && checkable) || !node->isEnabled() || node->isUnstable())
continue;
+ if (!m_core->isUpdater() && !node->autoDependencies().isEmpty())
+ continue;
+
Qt::CheckState newState = state;
const Qt::CheckState recentState = node->checkState();
if (node->isTristate())
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index c866f1112..c0902569d 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -4325,7 +4325,7 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
if (d->statusCanceledOrFailed())
return false;
- if (!component->isUnstable() && component->autoDependencies().isEmpty())
+ if (!component->isUnstable())
component->setCheckState(Qt::Checked);
}
@@ -4337,7 +4337,7 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
foreach (QInstaller::Component *component, d->m_updaterComponentsDeps) {
if (d->statusCanceledOrFailed())
return false;
- if (component->isInstalled() && !component->autoDependencies().isEmpty()) {
+ if (component->isInstalled()) {
// since we do not put them into the model, which would force a update of e.g. tri state
// components, we have to check all installed components ourselves
if (!component->isUnstable())