summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/qinstallercomponent.cpp
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-04-01 10:20:07 +0200
committerkh1 <qt-info@nokia.com>2011-04-01 10:20:07 +0200
commit260200567c25eb29c0dc7512593ca17b221f7bca (patch)
tree1b1ead19edc5962d14f170bf4f9785cb26a409b2 /installerbuilder/libinstaller/qinstallercomponent.cpp
parent0c4abcc841fa87189e9c52b1db67ea6e3547e637 (diff)
Keep components in seperate list.
Have a list for normal and virtual components. Also sort the normal components when they get added. Still childComponents() will return the full components list.
Diffstat (limited to 'installerbuilder/libinstaller/qinstallercomponent.cpp')
-rw-r--r--installerbuilder/libinstaller/qinstallercomponent.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/installerbuilder/libinstaller/qinstallercomponent.cpp b/installerbuilder/libinstaller/qinstallercomponent.cpp
index aacfa4ea2..851f581e5 100644
--- a/installerbuilder/libinstaller/qinstallercomponent.cpp
+++ b/installerbuilder/libinstaller/qinstallercomponent.cpp
@@ -55,6 +55,8 @@
#include <QtUiTools/QUiLoader>
+#include <algorithm>
+
using namespace QInstaller;
static const QLatin1String skName("Name");
@@ -112,12 +114,12 @@ Component::Component(KDUpdater::Update* update, Installer* installer)
Component::~Component()
{
if (parentComponent() != 0)
- d->m_parent->d->m_components.removeAll(this);
+ d->m_parent->d->m_allComponents.removeAll(this);
if (!d->m_newlyInstalled)
qDeleteAll(d->operations);
- qDeleteAll(d->m_components);
+ qDeleteAll(d->m_allComponents);
delete d;
}
@@ -280,9 +282,16 @@ Component* Component::parentComponent(RunModes runMode) const
*/
void Component::appendComponent(Component* component)
{
- d->m_components.append(component);
- if (component->parentComponent() != 0)
- component->d->m_parent->d->m_components.removeAll(component);
+ if (component->value(skVirtual).toLower() != QLatin1String("true")) {
+ d->m_components.append(component);
+ std::sort(d->m_components.begin(), d->m_components.end(), Component::SortingPriorityLessThan());
+ } else {
+ d->m_virtualComponents.append(component);
+ }
+
+ d->m_allComponents = d->m_components + d->m_virtualComponents;
+ if (Component *parent = component->parentComponent())
+ parent->removeComponent(component);
component->d->m_parent = this;
}
@@ -296,10 +305,10 @@ QList<Component*> Component::childComponents(bool recursive, RunModes runMode) c
return QList<Component*>();
if (!recursive)
- return d->m_components;
+ return d->m_allComponents;
QList<Component*> result;
- foreach (Component *component, d->m_components) {
+ foreach (Component *component, d->m_allComponents) {
result.append(component);
result += component->childComponents(true);
}