File kde3-applications.diff of Package kdelibs4

Index: kdecore/services/kservice.cpp
===================================================================
--- kdecore/services/kservice.cpp.orig
+++ kdecore/services/kservice.cpp
@@ -57,6 +57,8 @@ void KServicePrivate::init( const KDeskt
 {
     const QString entryPath = q->entryPath();
     bool absPath = !QDir::isRelativePath(entryPath);
+    bool kde3application = config->fileName().startsWith("/opt/kde3/share/applications/kde/")
+        || config->fileName().startsWith("/opt/kde3/share/autostart/");
 
     // TODO: it makes sense to have a KConstConfigGroup I guess
     const KConfigGroup desktopGroup = const_cast<KDesktopFile*>(config)->desktopGroup();
@@ -84,6 +86,8 @@ void KServicePrivate::init( const KDeskt
         if (i != -1)
             m_strName = m_strName.left(i);
     }
+    if (kde3application)
+        m_strName += "/KDE3";
 
     m_strType = config->readType();
     entryMap.remove("Type");
@@ -107,6 +111,18 @@ void KServicePrivate::init( const KDeskt
     // NOT readPathEntry, it is not XDG-compliant. Path entries written by
     // KDE4 will be still treated as such, though.
     m_strExec = desktopGroup.readEntry( "Exec", QString() );
+    if (kde3application && !m_strExec.startsWith("/"))
+      m_strExec = "/opt/kde3/bin/"+m_strExec;
+    else if (desktopGroup.readEntry("X-KDE-SubstituteUID"), false) {
+      int space = m_strExec.indexOf(" ");
+      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");
 
     if ( m_strType == "Application" ) {
@@ -210,6 +226,9 @@ void KServicePrivate::init( const KDeskt
     m_initialPreference = desktopGroup.readEntry( "InitialPreference", 1 );
     entryMap.remove("InitialPreference");
 
+    if (kde3application)
+        m_initialPreference = 1;
+
     // Assign the "initial preference" to each mimetype/servicetype
     // (and to set such preferences in memory from kbuildsycoca)
     m_serviceTypes.reserve(lstServiceTypes.size());
@@ -250,6 +269,8 @@ void KServicePrivate::init( const KDeskt
         m_DBUSStartusType = KService::DBusNone;
 
     m_strDesktopEntryName = _name.toLower();
+    if (kde3application)
+        m_strDesktopEntryName = "kde-" + m_strDesktopEntryName;
 
     m_bAllowAsDefault = desktopGroup.readEntry("AllowDefault", true);
     entryMap.remove("AllowDefault");
@@ -269,7 +290,9 @@ void KServicePrivate::init( const KDeskt
 //  qDebug("Path = %s", entryPath.toLatin1().constData());
     QMap<QString,QString>::ConstIterator it = entryMap.constBegin();
     for( ; it != entryMap.constEnd();++it) {
-        const QString key = it.key();
+        QString key = it.key();
+        if (kde3application && key=="OnlyShowIn" && QVariant(*it)=="KDE;")
+            key = "NotShowIn";
         // do not store other translations like Name[fr]; kbuildsycoca will rerun if we change languages anyway
         if (!key.contains('[')) {
             //kDebug(7012) << "  Key =" << key << " Data =" << *it;
openSUSE Build Service is sponsored by