From 97be4fc11b51ba1733203178a33d5b4e02b1de7a Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 17 Jun 2008 21:55:35 +0000 Subject: [PATCH] listen to Containment::appletRemoved for the applet count BUG:164335 svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=821592 --- appletbrowser.cpp | 15 ++++----------- appletbrowser.h | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/appletbrowser.cpp b/appletbrowser.cpp index 281e5f51d..34b4128d2 100644 --- a/appletbrowser.cpp +++ b/appletbrowser.cpp @@ -69,7 +69,7 @@ public: /** * A running applet is no more */ - void appletDestroyed(QObject* applet); + void appletRemoved(Plasma::Applet* applet); AppletBrowserWidget *q; QString application; @@ -189,13 +189,7 @@ void AppletBrowserWidget::Private::initRunningApplets() QList containments = c->containments(); foreach (Containment * containment,containments) { connect(containment, SIGNAL(appletAdded(Plasma::Applet*,QPointF)), q, SLOT(appletAdded(Plasma::Applet*))); - //TODO track containments too? - QListapplets = containment->applets(); - foreach (Applet *applet,applets) { - runningApplets[applet->name()]++; - appletNames.insert(applet, applet->name()); - connect(applet, SIGNAL(destroyed(QObject*)), q, SLOT(appletDestroyed(QObject*))); - } + connect(containment, SIGNAL(appletRemoved(Plasma::Applet*)), q, SLOT(appletRemoved(Plasma::Applet*))); } //kDebug() << runningApplets; @@ -255,13 +249,12 @@ void AppletBrowserWidget::Private::appletAdded(Plasma::Applet* applet) runningApplets[name]++; appletNames.insert(applet, name); - connect(applet, SIGNAL(destroyed(QObject*)), q, SLOT(appletDestroyed(QObject*))); 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 QString name = appletNames.take(a); diff --git a/appletbrowser.h b/appletbrowser.h index 567d56a58..8fd3febad 100644 --- a/appletbrowser.h +++ b/appletbrowser.h @@ -76,7 +76,7 @@ public Q_SLOTS: private: 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; Private * const d;