listen to Containment::appletRemoved for the applet count

BUG:164335

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=821592
This commit is contained in:
Aaron J. Seigo 2008-06-17 21:55:35 +00:00
parent 9e1a1a0ed3
commit 97be4fc11b
2 changed files with 5 additions and 12 deletions

View File

@ -69,7 +69,7 @@ public:
/** /**
* A running applet is no more * A running applet is no more
*/ */
void appletDestroyed(QObject* applet); void appletRemoved(Plasma::Applet* applet);
AppletBrowserWidget *q; AppletBrowserWidget *q;
QString application; QString application;
@ -189,13 +189,7 @@ void AppletBrowserWidget::Private::initRunningApplets()
QList<Containment*> containments = c->containments(); QList<Containment*> containments = c->containments();
foreach (Containment * containment,containments) { foreach (Containment * containment,containments) {
connect(containment, SIGNAL(appletAdded(Plasma::Applet*,QPointF)), q, SLOT(appletAdded(Plasma::Applet*))); connect(containment, SIGNAL(appletAdded(Plasma::Applet*,QPointF)), q, SLOT(appletAdded(Plasma::Applet*)));
//TODO track containments too? connect(containment, SIGNAL(appletRemoved(Plasma::Applet*)), q, SLOT(appletRemoved(Plasma::Applet*)));
QList<Applet*>applets = containment->applets();
foreach (Applet *applet,applets) {
runningApplets[applet->name()]++;
appletNames.insert(applet, applet->name());
connect(applet, SIGNAL(destroyed(QObject*)), q, SLOT(appletDestroyed(QObject*)));
}
} }
//kDebug() << runningApplets; //kDebug() << runningApplets;
@ -255,13 +249,12 @@ void AppletBrowserWidget::Private::appletAdded(Plasma::Applet* applet)
runningApplets[name]++; runningApplets[name]++;
appletNames.insert(applet, name); appletNames.insert(applet, name);
connect(applet, SIGNAL(destroyed(QObject*)), q, SLOT(appletDestroyed(QObject*)));
itemModel.setRunningApplets(name, runningApplets[name]); itemModel.setRunningApplets(name, runningApplets[name]);
} }
void AppletBrowserWidget::Private::appletDestroyed(QObject* applet) void AppletBrowserWidget::Private::appletRemoved(Plasma::Applet* applet)
{ {
//kDebug() << applet; //kDebug() << (QObject*)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 = appletNames.take(a); QString name = appletNames.take(a);

View File

@ -76,7 +76,7 @@ public Q_SLOTS:
private: private:
Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*)) Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*)) Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
class Private; class Private;
Private * const d; Private * const d;