code improvements, ala chani
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=774434
This commit is contained in:
parent
fa490e10a8
commit
1e11418a8d
@ -249,12 +249,7 @@ void AppletBrowserWidget::appletAdded(Plasma::Applet* applet)
|
|||||||
QString name = applet->name();
|
QString name = applet->name();
|
||||||
kDebug() << name;
|
kDebug() << name;
|
||||||
|
|
||||||
if (d->runningApplets.contains(applet->name())) {
|
d->runningApplets[name]++;
|
||||||
d->runningApplets[name] = d->runningApplets[applet->name()] + 1;
|
|
||||||
} else {
|
|
||||||
d->runningApplets.insert(name, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
d->appletNames.insert(applet, name);
|
d->appletNames.insert(applet, name);
|
||||||
connect(applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed(QObject*)));
|
connect(applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed(QObject*)));
|
||||||
d->itemModel.setRunningApplets(name, d->runningApplets[name]);
|
d->itemModel.setRunningApplets(name, d->runningApplets[name]);
|
||||||
@ -265,7 +260,7 @@ void AppletBrowserWidget::appletDestroyed(QObject* applet)
|
|||||||
kDebug() << applet;
|
kDebug() << applet;
|
||||||
Plasma::Applet* a = (Plasma::Applet*)applet; //don't care if it's valid, just need the address
|
Plasma::Applet* a = (Plasma::Applet*)applet; //don't care if it's valid, just need the address
|
||||||
|
|
||||||
QString name = a->name();
|
QString name = d->appletNames.take(a);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (d->runningApplets.contains(name)) {
|
if (d->runningApplets.contains(name)) {
|
||||||
@ -278,8 +273,6 @@ void AppletBrowserWidget::appletDestroyed(QObject* applet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if !name, was the applet not found or was the name actually ""?
|
|
||||||
d->appletNames.remove(a);
|
|
||||||
d->itemModel.setRunningApplets(name, count);
|
d->itemModel.setRunningApplets(name, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user