summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-08-10 13:01:37 +0200
committerkh1 <qt-info@nokia.com>2011-08-10 13:39:23 +0200
commitdd59146f9d4f6a8deb95096acb71b5f4cfc4d022 (patch)
tree4f87dde77d82a91508ec39f0767b6e65808c125a /installerbuilder
parent70dc0bfe77bfce6ce28e026c541a966f994f6f2c (diff)
Revert: 308dc03e a1a130b9 5fb0f4ac
The proper fix for 308dc03e would have been to check if we run in installer mode and only than check default components initially. Not sure how a1a130b9 could state that the code would work as expected, as proper testing would have revealed that the "Next" button now was enabled always enabled in package manager mode and always disabled in updater mode... Fixes also the problem seen by Niels that in package manager case components would have been scheduled for uninstall even if we just selected a new component without removing an other. Reviewed-By: Niels Weber
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/libinstaller/component.cpp3
-rw-r--r--installerbuilder/libinstaller/component_p.cpp5
-rw-r--r--installerbuilder/libinstaller/componentmodel.cpp49
-rw-r--r--installerbuilder/libinstaller/componentmodel.h2
-rw-r--r--installerbuilder/libinstaller/packagemanagercore.cpp6
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.cpp2
6 files changed, 33 insertions, 34 deletions
diff --git a/installerbuilder/libinstaller/component.cpp b/installerbuilder/libinstaller/component.cpp
index 1529fec15..c2ebabec8 100644
--- a/installerbuilder/libinstaller/component.cpp
+++ b/installerbuilder/libinstaller/component.cpp
@@ -302,7 +302,8 @@ void Component::removeComponent(Component *component)
/*!
Returns a list of child components. If \a recursive is set to true, the returned list
- contains not only the direct children, but all ancestors.
+ contains not only the direct children, but all ancestors. Note: The returned list does include ALL
+ children, non virtual components as well as virtual components.
*/
QList<Component*> Component::childComponents(bool recursive, RunMode runMode) const
{
diff --git a/installerbuilder/libinstaller/component_p.cpp b/installerbuilder/libinstaller/component_p.cpp
index 099420868..fb63f6d6f 100644
--- a/installerbuilder/libinstaller/component_p.cpp
+++ b/installerbuilder/libinstaller/component_p.cpp
@@ -140,7 +140,8 @@ ComponentModelHelper::~ComponentModelHelper()
}
/*!
- Returns the number of child components.
+ Returns the number of child components. Depending if virtual components are visible or not the count might
+ differ from what one will get if calling Component::childComponents(...).count().
*/
int ComponentModelHelper::childCount() const
{
@@ -172,7 +173,7 @@ QList<Component*> ComponentModelHelper::childs() const
QList<Component*> result;
foreach (Component *component, *components) {
result.append(component);
- result += component->childComponents(true, AllMode);
+ result += component->childs();
}
return result;
}
diff --git a/installerbuilder/libinstaller/componentmodel.cpp b/installerbuilder/libinstaller/componentmodel.cpp
index 02d5f3392..97a37f545 100644
--- a/installerbuilder/libinstaller/componentmodel.cpp
+++ b/installerbuilder/libinstaller/componentmodel.cpp
@@ -273,7 +273,7 @@ PackageManagerCore *ComponentModel::packageManagerCore() const
/*!
Returns true if no changes to the components checked state have been done, otherwise returns false.
*/
-bool ComponentModel::isUnChanged() const
+bool ComponentModel::defaultCheckState() const
{
return m_initialCheckedSet == m_currentCheckedSet;
}
@@ -353,27 +353,8 @@ void ComponentModel::deselectAll()
*/
void ComponentModel::selectDefault()
{
- if (m_core->isUpdater())
- return;
- deselectAll();
- if (m_core->isInstaller()) {
- for (int i = 0; i < m_rootComponentList.count(); ++i) {
- foreach (Component *child, m_rootComponentList.at(i)->childs()) {
- if (child->isCheckable() && !child->isTristate() && child->isDefault()) {
- m_initialCheckedSet.insert(child->name());
- }
- }
- }
- } else {
- for (int i = 0; i < m_rootComponentList.count(); ++i) {
- foreach (Component *child, m_rootComponentList.at(i)->childs()) {
- if (child->isCheckable() && !child->isTristate() && child->isInstalled())
- m_initialCheckedSet.insert(child->name());
- }
- }
- }
- m_currentCheckedSet += m_initialCheckedSet;
- foreach (const QString &name, m_currentCheckedSet)
+ m_currentCheckedSet = m_currentCheckedSet.subtract(select(Qt::Unchecked));
+ foreach (const QString &name, m_initialCheckedSet)
setData(indexFromComponentName(name), Qt::Checked, Qt::CheckStateRole);
emit defaultCheckStateChanged(m_initialCheckedSet != m_currentCheckedSet);
}
@@ -382,10 +363,23 @@ void ComponentModel::selectDefault()
void ComponentModel::slotModelReset()
{
- if (m_core->isUpdater())
- selectAll();
- else
- selectDefault();
+ QList<QInstaller::Component*> components = m_rootComponentList;
+ if (m_core->runMode() == QInstaller::AllMode) {
+ for (int i = m_rootIndex; i < m_rootComponentList.count(); ++i)
+ components.append(m_rootComponentList.at(i)->childs());
+ }
+
+ foreach (Component *child, components) {
+ if (child->checkState() == Qt::Checked && !child->isTristate())
+ m_initialCheckedSet.insert(child->name());
+ }
+ m_currentCheckedSet += m_initialCheckedSet;
+
+ if (m_core->runMode() == QInstaller::AllMode)
+ select(Qt::Unchecked);
+
+ foreach (const QString &name, m_currentCheckedSet)
+ setData(indexFromComponentName(name), Qt::Checked, Qt::CheckStateRole);
}
static Qt::CheckState verifyPartiallyChecked(Component *component)
@@ -486,7 +480,8 @@ QSet<QString> ComponentModel::select(Qt::CheckState state)
QSet<QString> changed;
for (int i = 0; i < m_rootComponentList.count(); ++i) {
QSet<QString> tmp;
- const QList<Component*> &children = m_rootComponentList.at(i)->childs();
+ QList<Component*> children = m_rootComponentList.at(i)->childs();
+ children.prepend(m_rootComponentList.at(i)); // we need to take the root item into account as well
foreach (Component *child, children) {
if (child->isCheckable() && !child->isTristate() && child->checkState() != state) {
tmp.insert(child->name());
diff --git a/installerbuilder/libinstaller/componentmodel.h b/installerbuilder/libinstaller/componentmodel.h
index 0eb30d644..f7da17b8f 100644
--- a/installerbuilder/libinstaller/componentmodel.h
+++ b/installerbuilder/libinstaller/componentmodel.h
@@ -66,7 +66,7 @@ public:
PackageManagerCore *packageManagerCore() const;
- bool isUnChanged() const;
+ bool defaultCheckState() const;
bool hasCheckedComponents() const;
QList<Component*> checkedComponents() const;
diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp
index 9ec9dd6ce..2ea580dac 100644
--- a/installerbuilder/libinstaller/packagemanagercore.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore.cpp
@@ -1444,9 +1444,11 @@ bool PackageManagerCore::fetchAllPackages(const PackagesList &remotes, const Loc
foreach (QInstaller::Component *component, components) {
component->loadComponentScript();
- // set the checked state for all components without child(means without tristate)
+ // set the checked state for all components without child (means without tristate)
if (component->isCheckable() && !component->isTristate()) {
- if (component->isInstalled())
+ if (component->isDefault() && isInstaller())
+ component->setCheckState(Qt::Checked);
+ else if (component->isInstalled())
component->setCheckState(Qt::Checked);
}
}
diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp
index b9f3818bd..5e819e399 100644
--- a/installerbuilder/libinstaller/packagemanagergui.cpp
+++ b/installerbuilder/libinstaller/packagemanagergui.cpp
@@ -1164,7 +1164,7 @@ bool ComponentSelectionPage::isComplete() const
{
if (packageManagerCore()->isInstaller() || packageManagerCore()->isUpdater())
return d->m_currentModel->hasCheckedComponents();
- return !d->m_currentModel->isUnChanged();
+ return !d->m_currentModel->defaultCheckState();
}