From kde-commits Tue Sep 01 18:10:03 2009 From: =?utf-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Tue, 01 Sep 2009 18:10:03 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/applets/kickoff/ui Message-Id: <1251828603.938980.1681.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125182863406223 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 url = index.data(UrlRole).value(); + 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