>On Sunday 31 May 2009, dantti85-...@yahoo.com.br wrote:
>> What about doing the old test (isLocalFile || isRelativePath()), this would
>> keep the old behavior and add support for relative paths, i believe
>> something like http://path_to/thing.desktop will never be relative?
>
>hm.. probably not.
>
>so, let's try isRelativePath and see if that brings any new edge cases with
>it. hopefully not :) add a comment in there about all this and we should be
>golden.
Comments added :D
>thanks for fixing this ...
No problem :D, this seems a bit rare case but i got upset with that gear :P
Now the attached diff seems to fix better the problem, if
you don't have anything against it I'll commit.
Cheers,
Daniel.
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Index: applets/kickoff/core/models.cpp
===================================================================
--- applets/kickoff/core/models.cpp (revisão 975387)
+++ applets/kickoff/core/models.cpp (cópia de trabalho)
@@ -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.
//
Index: applets/kickoff/ui/contextmenufactory.cpp
===================================================================
--- applets/kickoff/ui/contextmenufactory.cpp (revisão 975387)
+++ applets/kickoff/ui/contextmenufactory.cpp (cópia de trabalho)
@@ -38,6 +38,7 @@
#include <Solid/OpticalDrive>
#include <Solid/OpticalDisc>
#include <KUrl>
+#include <KStandardDirs>
// Plasma
#include <Plasma/Containment>
@@ -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());
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel