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
This commit is contained in:
Aaron J. Seigo 2007-09-13 17:03:13 +00:00
parent 7d3327c884
commit fc4b474f5c
2 changed files with 12 additions and 3 deletions

View File

@ -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*)),

View File

@ -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