[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/kickoff/ui
From:       Ivan Čukić <ivan.cukic+kde () gmail ! com>
Date:       2009-09-01 18:10:03
Message-ID: 1251828603.938980.1681.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1018461 by ivan:

Added add to favs for krunner returned services

 M  +20 -5     contextmenufactory.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/contextmenufactory.cpp #1018460:1018461
@@ -112,8 +112,25 @@
         return;
     }
 
-    const QString url = index.data(UrlRole).value<QString>();
+    QString url = index.data(UrlRole).value<QString>();
+    qDebug() << "ContextMenuFactory::showContextMenu: " << url;
 
+    // ivan: The url handling is dirty - instead of handling it in
+    // the source data models (that define them), we are handling
+    // them here. So, we need to make urls from KRunner model
+    // to behave properly
+    if (url.startsWith("krunner://")) {
+        url = url.replace("krunner://", "");
+        qDebug() << "ContextMenuFactory::showContextMenu: 1 " << url;
+        if (url.startsWith("services/services_")) {
+            url = url.replace("services/services_", "");
+        } else {
+            return;
+        }
+    }
+
+    qDebug() << "ContextMenuFactory::showContextMenu: " << url;
+
     if (url.isEmpty()) {
         return;
     }
@@ -132,8 +149,7 @@
             favoriteAction->setIcon(KIcon("list-remove"));
             actions << favoriteAction;
             //exclude stuff in the leave tab
-        } else if (KUrl(url).protocol() != "leave" &&
-                   KUrl(url).protocol() != "krunner") {
+        } else if (KUrl(url).protocol() != "leave") {
             favoriteAction->setText(i18n("Add to Favorites"));
             favoriteAction->setIcon(KIcon("bookmark-new"));
             actions << favoriteAction;
@@ -151,8 +167,7 @@
     //### TODO : do not forget to remove (kurl.scheme() != "leave") and kurl declaration
     //when proper action for such case will be provided
     KUrl kurl(url);
-    if ((d->applet) && (kurl.scheme() != "leave") &&
-       (d->applet) && (kurl.scheme() != "krunner")) {
+    if ((d->applet) && (kurl.scheme() != "leave")) {
         Plasma::Containment *containment = d->applet->containment();
 
         // There might be relative paths for .desktop installed in
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic