diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-11-22 18:02:34 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2023-01-26 15:24:58 +0200 |
commit | f5750078a7a75e7ad7b0260b54236ee87f3900f9 (patch) | |
tree | 2552953e7ff14b64f8372b3b7090bae3533a0cf5 /src/libs | |
parent | b72b90662e718d022dd06e7369008fe4f319e650 (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>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 10 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 4 |
2 files changed, 10 insertions, 4 deletions
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()) |