From fc4b474f5cd8a43233bac4b9ff4c15e2f8e5a579 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 13 Sep 2007 17:03:13 +0000 Subject: [PATCH] call init() on the applets after they are added to the scene ... do it all at once in the case of loading applets en mass svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=712120 --- corona.cpp | 12 ++++++++++-- corona.h | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/corona.cpp b/corona.cpp index b0d68c0c3..7e80b5591 100644 --- a/corona.cpp +++ b/corona.cpp @@ -199,7 +199,11 @@ void Corona::loadApplets(const QString& config) foreach (const QString& group, appletConfig.groupList()) { KConfigGroup cg(&appletConfig, group); addApplet(cg.readEntry("plugin", QString()), QVariantList(), - group.toUInt(), cg.readEntry("geometry", QRectF())); + group.toUInt(), cg.readEntry("geometry", QRectF()), true); + } + + foreach (Applet* applet, d->applets) { + applet->init(); } } @@ -214,7 +218,7 @@ void Corona::clearApplets() d->applets.clear(); } -Applet* Corona::addApplet(const QString& name, const QVariantList& args, uint id, const QRectF& geometry) +Applet* Corona::addApplet(const QString& name, const QVariantList& args, uint id, const QRectF& geometry, bool delayInit) { Applet* applet = Applet::loadApplet(name, id, args); if (!applet) { @@ -255,6 +259,10 @@ Applet* Corona::addApplet(const QString& name, const QVariantList& args, uint id addItem(applet); applet->updateConstraints(); + if (!delayInit) { + applet->init(); + } + //applet->constraintsUpdated(); d->applets << applet; connect(applet, SIGNAL(destroyed(QObject*)), diff --git a/corona.h b/corona.h index 2bdd64906..59175f74b 100644 --- a/corona.h +++ b/corona.h @@ -135,7 +135,8 @@ public Q_SLOTS: * @return a pointer to the applet on success, or 0 on failure */ Applet* addApplet(const QString& name, const QVariantList& args = QVariantList(), - uint id = 0, const QRectF &geometry = QRectF(-1, -1, -1, -1)); + uint id = 0, const QRectF &geometry = QRectF(-1, -1, -1, -1), + bool delayInit = false); /** * Adds a SuperKaramba theme to the scene