From 1e11418a8d859ad66de35583884a68395cf28453 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 13 Feb 2008 09:33:29 +0000 Subject: [PATCH] code improvements, ala chani svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=774434 --- appletbrowser.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/appletbrowser.cpp b/appletbrowser.cpp index 8ccd2e296..e7a91d586 100644 --- a/appletbrowser.cpp +++ b/appletbrowser.cpp @@ -249,12 +249,7 @@ void AppletBrowserWidget::appletAdded(Plasma::Applet* applet) QString name = applet->name(); kDebug() << name; - if (d->runningApplets.contains(applet->name())) { - d->runningApplets[name] = d->runningApplets[applet->name()] + 1; - } else { - d->runningApplets.insert(name, 1); - } - + d->runningApplets[name]++; d->appletNames.insert(applet, name); connect(applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed(QObject*))); d->itemModel.setRunningApplets(name, d->runningApplets[name]); @@ -265,7 +260,7 @@ void AppletBrowserWidget::appletDestroyed(QObject* applet) kDebug() << applet; 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; 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); }