diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-08-23 16:19:56 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-08-23 16:42:41 +0200 |
commit | 4fa9047a8d51bd58c568509500d38cc4f3fd8bde (patch) | |
tree | e7a042a1a3a4b3fbfd2acbd9361836c198030f02 /installerbuilder | |
parent | 77292bee62114b31aafaf762219616fd0b2aa48a (diff) |
Add a hack to be able to check components.
This is needed to make the resolve code working properly
for scripts as well for the uninstall code to resolve
auto dependencies. Should be removed as soon as possible.
Change-Id: Ia33efdc63d4e3845927b3bbfa5af7a375ceed9ac
Reviewed-on: http://codereview.qt.nokia.com/3415
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder')
7 files changed, 54 insertions, 4 deletions
diff --git a/installerbuilder/installerbase/installerbasecommons.cpp b/installerbuilder/installerbase/installerbasecommons.cpp index b483f4adb..768699227 100644 --- a/installerbuilder/installerbase/installerbasecommons.cpp +++ b/installerbuilder/installerbase/installerbasecommons.cpp @@ -346,11 +346,11 @@ int InstallerGui::nextId() const core->calculateComponentsToInstall(); foreach (Component* component, core->orderedComponentsToInstall()) { if (!component->licenses().isEmpty()) - return next; + return QWizard::nextId(); } return nextNextId; } - return next; + return QWizard::nextId(); } @@ -397,11 +397,11 @@ int MaintenanceGui::nextId() const if (component->isInstalled()) continue; if (!component->licenses().isEmpty()) - return next; + return QWizard::nextId(); } return nextNextId; } - return next; + return QWizard::nextId(); } void MaintenanceGui::updateRestartPage() diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp index ca1b1cd67..e10edf823 100644 --- a/installerbuilder/libinstaller/packagemanagercore.cpp +++ b/installerbuilder/libinstaller/packagemanagercore.cpp @@ -1688,3 +1688,8 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const emit finishUpdaterComponentsReset(); return true; } + +void PackageManagerCore::resetComponentsToUserCheckedState() +{ + d->resetComponentsToUserCheckedState(); +} diff --git a/installerbuilder/libinstaller/packagemanagercore.h b/installerbuilder/libinstaller/packagemanagercore.h index e92583c2b..dda09b036 100644 --- a/installerbuilder/libinstaller/packagemanagercore.h +++ b/installerbuilder/libinstaller/packagemanagercore.h @@ -269,6 +269,11 @@ private: private: PackageManagerCorePrivate *const d; friend class PackageManagerCorePrivate; + +private: + // remove once we deprecate isSelected, setSelected etc... + friend class ComponentSelectionPage; + void resetComponentsToUserCheckedState(); }; } diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index f22473113..a9a2123bd 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -401,6 +401,9 @@ QString PackageManagerCorePrivate::installReason(Component *component) void PackageManagerCorePrivate::initialize() { + m_coreCheckedHash.clear(); + m_componentsToInstallCalculated = false; + // first set some common variables that may used e.g. as placeholder // in some of the settings variables or in a script or... m_vars.insert(QLatin1String("rootDir"), QDir::rootPath()); @@ -1839,6 +1842,7 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe void PackageManagerCorePrivate::realAppendToInstallComponents(Component *component) { + setCheckedState(component, Qt::Checked); m_orderedComponentsToInstall.append(component); m_toInstallComponentIds.insert(component->name()); } @@ -1855,6 +1859,7 @@ bool PackageManagerCorePrivate::appendComponentToUninstall(Component *component) // remove all already resolved dependees QSet<Component*> dependees = m_core->dependees(component).toSet().subtract(m_componentsToUninstall); if (dependees.isEmpty()) { + setCheckedState(component, Qt::Unchecked); m_componentsToUninstall.insert(component); m_componentsToUninstallIds.insert(component->name()); return true; @@ -1864,6 +1869,7 @@ bool PackageManagerCorePrivate::appendComponentToUninstall(Component *component) foreach (Component *dependee, dependees) { if (dependee->isInstalled()) { // keep them as already resolved + setCheckedState(dependee, Qt::Unchecked); m_componentsToUninstall.insert(dependee); m_componentsToUninstallIds.insert(dependee->name()); // gather possible dependees, keep them to resolve it later @@ -1888,6 +1894,7 @@ bool PackageManagerCorePrivate::appendComponentsToUninstall(const QList<Componen bool allResolved = true; foreach (Component *component, components) { if (component->isInstalled()) { + setCheckedState(component, Qt::Unchecked); m_componentsToUninstall.insert(component); m_componentsToUninstallIds.insert(component->name()); allResolved &= appendComponentToUninstall(component); @@ -1913,4 +1920,22 @@ bool PackageManagerCorePrivate::appendComponentsToUninstall(const QList<Componen return allResolved; } +void PackageManagerCorePrivate::resetComponentsToUserCheckedState() +{ + if (m_coreCheckedHash.isEmpty()) + return; + + foreach (Component *component, m_coreCheckedHash.keys()) + component->setCheckState(m_coreCheckedHash.value(component)); + + m_coreCheckedHash.clear(); + m_componentsToInstallCalculated = false; +} + +void PackageManagerCorePrivate::setCheckedState(Component *component, Qt::CheckState state) +{ + m_coreCheckedHash.insert(component, component->checkState()); + component->setCheckState(state); +} + } // QInstaller diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h index 123bd99a2..e688331b3 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.h +++ b/installerbuilder/libinstaller/packagemanagercore_p.h @@ -231,6 +231,12 @@ private: //we can't use this reason hash as component id hash, because some reasons are ready before //the component is added QHash<QString, QString> m_toInstallComponentIdReasonHash; + +private: + // remove once we deprecate isSelected, setSelected etc... + void resetComponentsToUserCheckedState(); + QHash<Component*, Qt::CheckState> m_coreCheckedHash; + void setCheckedState(Component *component, Qt::CheckState state); }; } // QInstaller diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp index 74989e56b..9b41372dc 100644 --- a/installerbuilder/libinstaller/packagemanagergui.cpp +++ b/installerbuilder/libinstaller/packagemanagergui.cpp @@ -1120,6 +1120,14 @@ void ComponentSelectionPage::entering() setModified(isComplete()); } +int ComponentSelectionPage::nextId() const +{ + // remove once we deprecate isSelected, setSelected etc... + const int next = PackageManagerPage::nextId(); + packageManagerCore()->resetComponentsToUserCheckedState(); + return next; +} + void ComponentSelectionPage::selectAll() { d->selectAll(); diff --git a/installerbuilder/libinstaller/packagemanagergui.h b/installerbuilder/libinstaller/packagemanagergui.h index 894034c9a..728da5c93 100644 --- a/installerbuilder/libinstaller/packagemanagergui.h +++ b/installerbuilder/libinstaller/packagemanagergui.h @@ -234,6 +234,7 @@ public: protected: void entering(); + int nextId() const; private Q_SLOTS: void setModified(bool modified); |