1
This patch is an attempt to make KDE find desktop files
2
and other stuff when /usr or anything else in the file
4
--- a/kdecore/services/kservicefactory.cpp
5
+++ b/kdecore/services/kservicefactory.cpp
6
@@ -124,22 +124,16 @@ KService::Ptr KServiceFactory::findServi
10
-KService::Ptr KServiceFactory::findServiceByDesktopPath(const QString &_name)
11
+KService::Ptr KServiceFactory::serviceFromPath(const QString &_name)
13
- if (!m_relNameDict) return KService::Ptr(); // Error!
15
- // Warning : this assumes we're NOT building a database
16
- // KBuildServiceFactory reimplements it for the case where we are building one
18
int offset = m_relNameDict->find_string( _name );
20
- //kDebug(servicesDebugArea()) << "findServiceByDesktopPath:" << _name << "not found";
21
return KService::Ptr(); // Not found
24
KService::Ptr newService(createEntry(offset));
26
- kDebug(servicesDebugArea()) << "findServiceByDesktopPath: createEntry failed!";
27
+ kDebug(servicesDebugArea()) << "serviceFromPath: createEntry failed!";
29
// Check whether the dictionary was right
30
// It's ok that it's wrong, for the case where we're looking up an unknown service,
31
@@ -150,6 +144,27 @@ KService::Ptr KServiceFactory::findServi
36
+KService::Ptr KServiceFactory::findServiceByDesktopPath(const QString &_name)
38
+ if (!m_relNameDict) return KService::Ptr(); // Error!
40
+ // Warning : this assumes we're NOT building a database
41
+ // KBuildServiceFactory reimplements it for the case where we are building one
43
+ KService::Ptr newService(serviceFromPath(_name));
45
+ // We might have been given a symlink or non-canonical path of some sort.
46
+ // Therefore try looking up KStandardDirs::realFilePath'ed path too.
47
+ newService = serviceFromPath(KStandardDirs::realFilePath(_name));
51
+ kDebug(servicesDebugArea()) << _name << "not found";
52
+ return KService::Ptr(); // Not found
57
KService::Ptr KServiceFactory::findServiceByMenuId(const QString &_menuId)
59
--- a/kdecore/services/kservicefactory.h
60
+++ b/kdecore/services/kservicefactory.h
61
@@ -121,6 +121,8 @@ protected:
62
virtual void virtual_hook( int id, void* data );
64
class KServiceFactoryPrivate* d;
66
+ KService::Ptr serviceFromPath(const QString &_name);