renamed a potentially confusing var and added some debug output

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=722749
This commit is contained in:
Chani Armitage 2007-10-08 02:22:29 +00:00
parent fab3611a21
commit fe0c9c5272

View File

@ -136,16 +136,16 @@ void Corona::saveApplets() const
saveApplets("plasma-appletsrc"); saveApplets("plasma-appletsrc");
} }
void Corona::loadApplets(const QString& config) void Corona::loadApplets(const QString& configname)
{ {
clearApplets(); clearApplets();
KConfig cg(config, KConfig::SimpleConfig); KConfig config(configname, KConfig::SimpleConfig);
QList<KConfigGroup> applets; QList<KConfigGroup> applets;
QHash<int, Containment*> containments; QHash<int, Containment*> containments;
foreach (const QString& group, cg.groupList()) { foreach (const QString& group, config.groupList()) {
KConfigGroup appletConfig(&cg, group); KConfigGroup appletConfig(&config, group);
if (group.contains("containment")) { if (group.contains("containment")) {
int cid = group.left(group.indexOf('-')).toUInt(); int cid = group.left(group.indexOf('-')).toUInt();
Containment *c = addContainment(appletConfig.readEntry("plugin", QString()), QVariantList(), Containment *c = addContainment(appletConfig.readEntry("plugin", QString()), QVariantList(),
@ -167,11 +167,12 @@ void Corona::loadApplets(const QString& config)
//kDebug() << "number of applets?" << applets.count(); //kDebug() << "number of applets?" << applets.count();
foreach (KConfigGroup cg, applets) { foreach (KConfigGroup cg, applets) {
int cid = cg.readEntry("containment", 0); int cid = cg.readEntry("containment", 0);
kDebug() << "trying to load applet" << cg.name() << cid; kDebug() << "trying to load applet " << cg.name() << " in containment " << cid;
Containment* c = containments.value(cid, 0); Containment* c = containments.value(cid, 0);
if (!c) { if (!c) {
kDebug() << "couldn't find containment " << cid << ", skipping this applet";
continue; continue;
} }
@ -185,7 +186,7 @@ void Corona::loadApplets(const QString& config)
foreach (Containment* c, containments) { foreach (Containment* c, containments) {
QString cid = QString::number(c->id()); QString cid = QString::number(c->id());
KConfigGroup containmentConfig(&cg, cid.append("-containment")); KConfigGroup containmentConfig(&config, cid.append("-containment"));
c->setImmutable(containmentConfig.isImmutable()); c->setImmutable(containmentConfig.isImmutable());
} }
@ -194,14 +195,14 @@ void Corona::loadApplets(const QString& config)
} }
foreach (Containment* containment, d->containments) { foreach (Containment* containment, d->containments) {
containment->init(); containment->init(); //FIXME: is this being called twice?
foreach(Applet* applet, containment->applets()) { foreach(Applet* applet, containment->applets()) {
applet->init(); applet->init();
} }
} }
setImmutable(cg.isImmutable()); setImmutable(config.isImmutable());
} }
void Corona::loadApplets() void Corona::loadApplets()
@ -278,6 +279,7 @@ Containment* Corona::addContainment(const QString& name, const QVariantList& arg
containment = dynamic_cast<Containment*>(applet); containment = dynamic_cast<Containment*>(applet);
if (!containment) { if (!containment) {
kDebug() << "loading failed.";
delete applet; // in case we got a non-Containment from Applet::loadApplet delete applet; // in case we got a non-Containment from Applet::loadApplet
containment = new Containment; containment = new Containment;
containment->setFailedToLaunch(false); // we want to provide something and don't care about the failure to launch containment->setFailedToLaunch(false); // we want to provide something and don't care about the failure to launch