summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/component.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-02-19 16:03:35 +0100
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-02-20 11:18:26 +0100
commit2635cb74cfe3c14a2f0acc385de8b022ec9ddded (patch)
treecfbdc438eaf92a22f2aba4e566e987ebbef277a6 /src/libs/installer/component.cpp
parent8092e354949370be204071258661aefad6f2b58e (diff)
Fix boolean parameter which lead to less readable code.
Change-Id: Ie680654f39fce130c607929f98db372dbe3c6ea1 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/libs/installer/component.cpp')
-rw-r--r--src/libs/installer/component.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index ddc74328d..824d6ead5 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -303,23 +303,22 @@ 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. Note: The returned list does include ALL children, non virtual
- components as well as virtual components.
+ Returns a list of child components. If \a kind is set to DirectChildrenOnly, the returned list contains
+ only the direct children, if set to Descendants it will also include all descendants of the components
+ children. Note: The returned list does include ALL children, non virtual components as well as virtual
+ components.
*/
-QList<Component*> Component::childComponents(bool recursive) const
+QList<Component *> Component::childComponents(Kind kind) const
{
- QList<Component*> result;
if (d->m_core->isUpdater())
- return result;
+ return QList<Component*>();
- if (!recursive)
- return d->m_allChildComponents;
+ QList<Component *> result = d->m_allChildComponents;
+ if (kind == Kind::DirectChildrenOnly)
+ return result;
- foreach (Component *component, d->m_allChildComponents) {
- result.append(component);
- result += component->childComponents(true);
- }
+ foreach (Component *component, d->m_allChildComponents)
+ result += component->childComponents(kind);
return result;
}