summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/packagemanagercore.cpp13
-rw-r--r--tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp10
2 files changed, 17 insertions, 6 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index bb9608505..913666068 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -2256,6 +2256,8 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
throw Error(tr("Running processes found."));
setUpdater();
+ ComponentModel *model = updaterComponentModel();
+
fetchRemotePackagesTree();
// List contains components containing update, if essential found contains only essential component
const QList<QInstaller::Component*> componentList = componentsMarkedForInstallation();
@@ -2277,15 +2279,16 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
QList<Component*> componentsToBeUpdated;
//Mark components to be updated
foreach (Component *comp, componentList) {
+ const QModelIndex &idx = model->indexFromComponentName(comp->name());
if (!userSelectedComponents) { // No components given, update all
- comp->setCheckState(Qt::Checked);
+ model->setData(idx, Qt::Checked, Qt::CheckStateRole);
} else {
//Collect the componets to list which we want to update
foreach (const QString &name, componentsToUpdate) {
if (comp->name() == name)
componentsToBeUpdated.append(comp);
else
- comp->setCheckState(Qt::Unchecked);
+ model->setData(idx, Qt::Unchecked, Qt::CheckStateRole);
}
}
}
@@ -2295,8 +2298,10 @@ bool PackageManagerCore::updateComponentsSilently(const QStringList &componentsT
<< "No updates available for selected components.";
return false;
}
- foreach (Component *componentToUpdate, componentsToBeUpdated)
- componentToUpdate->setCheckState(Qt::Checked);
+ foreach (Component *componentToUpdate, componentsToBeUpdated) {
+ const QModelIndex &idx = model->indexFromComponentName(componentToUpdate->name());
+ model->setData(idx, Qt::Checked, Qt::CheckStateRole);
+ }
}
if (d->calculateComponentsAndRun()) {
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
index bf6d8729a..e260ab175 100644
--- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
+++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
@@ -73,12 +73,18 @@ private slots:
setRepository(":///data/installPackagesRepositoryUpdate");
core->updateComponentsSilently(QStringList() << "componentA");
+ // componentD is autodependent and cannot be deselected
+ // componentE is a forced component and thus will be updated
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "2.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentA", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentD", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentE", "1.0.0content.txt");
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentA_update.txt"
- << "installcontentE.txt" << "installcontentG.txt"
- << "installcontentB.txt" << "installcontentD.txt");
+ << "installcontentE_update.txt" << "installcontentG.txt"
+ << "installcontentB.txt" << "installcontentD_update.txt");
}
void testUpdateNoUpdatesForSelectedPackage()