File kde3-autostart.diff of Package kdelibs4
Index: kdecore/kernel/kautostart.cpp
===================================================================
--- kdecore/kernel/kautostart.cpp.orig
+++ kdecore/kernel/kautostart.cpp
@@ -22,6 +22,7 @@
#include "kaboutdata.h"
#include "kglobal.h"
+#include "kshell.h"
#include "kcomponentdata.h"
#include "kdesktopfile.h"
#include "kstandarddirs.h"
@@ -30,6 +31,8 @@
#include <QtCore/QFile>
#include <QStringList>
+#include <stdlib.h>
+
class KAutostart::Private
{
public:
@@ -117,6 +120,14 @@ bool KAutostart::checkStartCondition() c
if (list[0].isEmpty() || list[2].isEmpty())
return true;
+ if( d->name.startsWith( "/etc/opt/kde3/" ) || d->name.startsWith( "/opt/kde3/" ))
+ {
+ QString cmd = QString( "/opt/kde3/bin/kreadconfig --file %1 --group %2 --key %3 --default %4 --type bool" )
+ .arg( KShell::quoteArg( list[0] ), KShell::quoteArg( list[1] ), KShell::quoteArg( list[2] ),
+ KShell::quoteArg( list[3] ));
+ return system( cmd.toLocal8Bit()) == 0;
+ }
+
KConfig config(list[0], KConfig::NoGlobals);
KConfigGroup cg(&config, list[1]);
Index: kinit/autostart.cpp
===================================================================
--- kinit/autostart.cpp.orig
+++ kinit/autostart.cpp
@@ -22,7 +22,10 @@
#include <kautostart.h>
#include <kglobal.h>
+#include <kshell.h>
#include <kstandarddirs.h>
+#include <qdir.h>
+#include <stdlib.h>
class AutoStartItem
{
@@ -78,9 +81,10 @@ static QString extractName(QString path)
void
AutoStart::loadAutoStartList()
{
- const QStringList files = KGlobal::dirs()->findAllResources("autostart",
+ QStringList files = KGlobal::dirs()->findAllResources("autostart",
QString::fromLatin1("*.desktop"),
KStandardDirs::NoDuplicates);
+ files = mergeKDE3Autostart( files );
for(QStringList::ConstIterator it = files.begin();
it != files.end();
@@ -101,6 +105,30 @@ AutoStart::loadAutoStartList()
}
}
+// KStandardDirs cannot be used for KDE3, because it applies KDE4 prefixes,
+// so KDE3 files need to be found manually. Also, include only KDE3 autostart
+// items that don't have their normal equivalent - this way it is possible
+// for KDE4 to blacklist e.g. KDE3's Kicker by using its own .desktop
+// file with Hidden=true.
+QStringList
+AutoStart::mergeKDE3Autostart( QStringList autostart )
+{
+ QStringList dupecheck;
+ foreach( QString file, autostart )
+ dupecheck.append( QString( file ).mid( file.lastIndexOf( QLatin1Char('/') ) + 1 ));
+ foreach( QString prefix, QStringList() << QString::fromLatin1("/etc/opt/kde3/") << QString::fromLatin1("/opt/kde3") )
+ {
+ foreach( QString name, QDir( prefix + QString::fromLatin1("/share/autostart/") ).entryList( QStringList() << QString::fromLatin1("*.desktop"), QDir::Files ))
+ {
+ if( dupecheck.contains( name ))
+ continue;
+ autostart.append( prefix + QString::fromLatin1("/share/autostart/") + name ); // add it to the list
+ dupecheck.append( name );
+ }
+ }
+ return autostart;
+}
+
QString
AutoStart::startService()
{
Index: kinit/autostart.h
===================================================================
--- kinit/autostart.h.orig
+++ kinit/autostart.h
@@ -39,6 +39,7 @@ public:
bool phaseDone() const { return m_phasedone; }
private:
+ static QStringList mergeKDE3Autostart( QStringList autostart );
AutoStartList *m_startList;
QStringList m_started;
int m_phase;