From kde-commits Sun May 31 22:23:43 2009 From: Daniel Nicoletti Date: Sun, 31 May 2009 22:23:43 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/applets/kickoff Message-Id: <1243808623.572447.15021.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124386172727509 SVN commit 976108 by dantti: FIX kickoff to have the right behavior with relative urls M +4 -1 core/models.cpp M +13 -4 ui/contextmenufactory.cpp --- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/core/models.cpp #976107:976108 @@ -59,7 +59,10 @@ QStandardItem *item = 0; - if (url.isLocalFile() && urlString.endsWith(".desktop")) { + // Match files ending with ".desktop" and being local or having a relative + // path. For instance applications that still installs .desktop files at + // /usr/share/applnk, like KVirc 3 + if (urlString.endsWith(".desktop") && (url.isLocalFile() || url.isRelative())) { // .desktop files may be services (type field == 'Application' or 'Service') // or they may be other types such as links. // --- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/contextmenufactory.cpp #976107:976108 @@ -38,6 +38,7 @@ #include #include #include +#include // Plasma #include @@ -149,7 +150,15 @@ if ((d->applet) && (kurl.scheme() != "leave")) { Plasma::Containment *containment = d->applet->containment(); - if (containment && containment->corona()) { + // There might be relative paths for .desktop installed in + // /usr/shar/applnk, we need to locate them + bool urlFound = true; + if (kurl.isRelative() && kurl.url().endsWith(".desktop")) { + kurl = KStandardDirs::locate("apps", url); + urlFound = !kurl.isEmpty(); + } + + if (urlFound && containment && containment->corona()) { Plasma::Containment *desktop = containment->corona()->containmentForScreen(containment->screen()); if (desktop && desktop->immutability() == Plasma::Mutable) { @@ -158,7 +167,7 @@ } } - if (containment && containment->immutability() == Plasma::Mutable && + if (urlFound && containment && containment->immutability() == Plasma::Mutable && containment->containmentType() == Plasma::Containment::PanelContainment) { addToPanelAction->setText(i18n("Add to Panel")); actions << addToPanelAction; @@ -234,7 +243,7 @@ Plasma::Containment *desktop = corona->containmentForScreen(containment->screen()); if (desktop) { QVariantList args; - args << url; + args << kurl.url(); desktop->addApplet("icon", args); } } @@ -246,7 +255,7 @@ Plasma::Containment *panel = d->applet->containment(); if (panel) { QVariantList args; - args << url; + args << kurl.url(); // move it to the middle of the panel QRectF rect(panel->geometry().width() / 2, 0, 150, panel->boundingRect().height());