1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
diff -ru ./kio/kio/kservice.cpp ../kdelibs-new/kio/kio/kservice.cpp
--- ./kio/kio/kservice.cpp 2008-02-13 10:41:06.000000000 +0100
+++ ../kdelibs-new/kio/kio/kservice.cpp 2009-05-21 01:53:22.000000000 +0200
@@ -97,6 +97,19 @@
m_bValid = true;
bool absPath = !QDir::isRelativePath(entryPath());
+ QString kde4prefix = config->fileName();
+ QString kde4menusuffix = " (KDE4)";
+ int index = kde4prefix.find("/share/applications/kde4/");
+ bool kde4app = index != -1;
+ QString kdedir;
+ // get kdeprefix and kde version
+ if (kde4app)
+ {
+ kde4prefix.truncate(index);
+ kdedir = kde4prefix.section('/', -1, -1).upper();
+ if (kdedir != "USR")
+ kde4menusuffix = QString(" (KDE-%1)").arg(kdedir);
+ }
config->setDesktopGroup();
@@ -133,6 +146,8 @@
if (i != -1)
m_strName = m_strName.left(i);
}
+ if (kde4app)
+ m_strName += kde4menusuffix;
m_strType = config->readEntry( "Type" );
entryMap.remove("Type");
@@ -196,6 +211,18 @@
name = name.left(pos);
m_strExec = config->readPathEntry( "Exec" );
+ if (kde4app && !m_strExec.startsWith("/"))
+ m_strExec = kde4prefix + QString("/bin/") + m_strExec;
+ else if (config->readBoolEntry("X-KDE-SubstituteUID")) {
+ int space = m_strExec.find(" ");
+ if (space==-1)
+ m_strExec = KStandardDirs::findExe(m_strExec);
+ else {
+ const QString command = m_strExec.left(space);
+ m_strExec.replace(command,KStandardDirs::findExe(command));
+ }
+ }
+
entryMap.remove("Exec");
m_strIcon = config->readEntry( "Icon", "unknown" );
@@ -245,11 +272,15 @@
m_DCOPServiceType = DCOP_None;
m_strDesktopEntryName = name.lower();
+ if (kde4app)
+ m_strDesktopEntryName = QString("kde%1-").arg(kdedir.lower()) + m_strDesktopEntryName;
m_bAllowAsDefault = config->readBoolEntry( "AllowDefault", true );
entryMap.remove("AllowDefault");
m_initialPreference = config->readNumEntry( "InitialPreference", 1 );
+ if (kde4app)
+ m_initialPreference = 1;
entryMap.remove("InitialPreference");
// Store all additional entries in the property map.
@@ -260,7 +291,10 @@
for( ; it != entryMap.end();++it)
{
//qDebug(" Key = %s Data = %s", it.key().latin1(), it.data().latin1());
- m_mapProps.insert( it.key(), QVariant( it.data()));
+ QString key = it.key();
+ if (kde4app && key == "OnlyShownIn" && it.data() == "KDE;")
+ key = "NotShowIn";
+ m_mapProps.insert(key, QVariant( it.data()));
}
}
|