File plasma-fix-delete-preferred-launchers.diff of Package kdebase4-workspace

commit f8eb85a87846e49b10dae8170695533262011ae1
Author: Gregor T├Ątzner <gregor@freenet.de>
Date:   Thu Jul 26 14:32:38 2012 +0200

    Fix deletion of preferred application launchers
    
    In default panel config the host of that magic preferred app url is used
    as the key. So lets use that key to delete the launchers, too.
    
    BUG: 278724
    FIXED-IN: 4.9.1
    REVIEW: 105374

diff --git a/libs/taskmanager/groupmanager.cpp b/libs/taskmanager/groupmanager.cpp
index 5ca0159..45c15a9 100644
--- a/libs/taskmanager/groupmanager.cpp
+++ b/libs/taskmanager/groupmanager.cpp
@@ -1070,8 +1070,16 @@ void GroupManagerPrivate::unsaveLauncher(LauncherItem *launcher)
         return;
     }
 
-    if (cg.hasKey(launcher->name())) {
-        cg.deleteEntry(launcher->name());
+    QString launcherKey;
+
+    if (launcher->launcherUrl().protocol() == "preferred")
+        // in default config the host of the preferred application url is used as key
+        launcherKey = launcher->launcherUrl().host();
+    else
+        launcherKey = launcher->name();
+
+    if (cg.hasKey(launcherKey)) {
+        cg.deleteEntry(launcherKey);
         emit q->configChanged();
     }
 }
@@ -1127,7 +1135,7 @@ int GroupManagerPrivate::launcherIndex(const KUrl &url)
     foreach (const LauncherItem * item, launchers) {
         if (item->launcherUrl() == url) {
             return index;
-        } 
+        }
 
         ++index;
     }