move all the init to loadDefaultSetup if we are loading a default setup; as an extra bonus this prevents Containment::init() being called twice

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=723422
This commit is contained in:
Aaron J. Seigo 2007-10-09 16:32:34 +00:00
parent 599a527eb0
commit 3e90dfe02b

View File

@ -176,9 +176,7 @@ void Corona::loadApplets(const QString& configname)
continue; continue;
} }
kDebug() << "loading containment " << cid; kDebug() << "creating applet " << cg.name() << "in containment" << cid;
kDebug() << "creating applet " << cg.name();
int appId = cg.name().left(cg.name().indexOf('-')).toUInt(); int appId = cg.name().left(cg.name().indexOf('-')).toUInt();
c->addApplet(cg.readEntry("plugin", QString()), QVariantList(), c->addApplet(cg.readEntry("plugin", QString()), QVariantList(),
appId, cg.readEntry("geometry", QRectF()), true); appId, cg.readEntry("geometry", QRectF()), true);
@ -192,13 +190,13 @@ void Corona::loadApplets(const QString& configname)
if (d->containments.count() < 1) { if (d->containments.count() < 1) {
loadDefaultSetup(); loadDefaultSetup();
} } else {
foreach (Containment* containment, d->containments) {
containment->init();
foreach (Containment* containment, d->containments) { foreach(Applet* applet, containment->applets()) {
containment->init(); //FIXME: is this being called twice? applet->init();
}
foreach(Applet* applet, containment->applets()) {
applet->init();
} }
} }
@ -235,6 +233,7 @@ void Corona::loadDefaultSetup()
foreach (Plasma::Applet* applet , applets) { foreach (Plasma::Applet* applet , applets) {
// If we have a Panel class (is a Container), this should move there // If we have a Panel class (is a Container), this should move there
applet->init();
applet->setDrawStandardBackground(false); applet->setDrawStandardBackground(false);
} }
} }