[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kinit
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-10-15 20:33:52
Message-ID: 1255638832.524721.6825.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1035769 by aseigo:

support merging autostart .desktop files across the directory hierarchy, as is \
assumed by KAutostart, e.g.


 M  +23 -18    autostart.cpp  
 M  +2 -1      klauncher.cpp  


--- trunk/KDE/kdelibs/kinit/autostart.cpp #1035768:1035769
@@ -20,6 +20,8 @@
 #define QT_NO_CAST_FROM_ASCII
 #include "autostart.h"
 
+#include <QtCore/QDir>
+
 #include <kautostart.h>
 #include <kglobal.h>
 #include <kstandarddirs.h>
@@ -64,17 +66,6 @@
    m_phasedone = true;
 }
 
-static QString extractName(QString path) // krazy:exclude=passbyvalue
-{
-  int i = path.lastIndexOf(QLatin1Char('/'));
-  if (i >= 0)
-     path = path.mid(i+1);
-  i = path.lastIndexOf(QLatin1Char('.'));
-  if (i >= 0)
-     path = path.left(i);
-  return path;
-}
-
 void
 AutoStart::loadAutoStartList()
 {
@@ -86,17 +77,31 @@
        it != files.end();
        ++it)
    {
-       KAutostart config(*it);
-       if( !config.autostarts(QString::fromLatin1("KDE"), KAutostart::CheckAll))
+       QString path = *it;
+       KAutostart config(path);
+
+       if (!config.autostarts(QString::fromLatin1("KDE"), KAutostart::CheckAll)) {
            continue;
+       }
 
        AutoStartItem *item = new AutoStartItem;
-       item->name = extractName(*it);
-       item->service = *it;
+
+       // the service is the file name part of the path
+       int i = path.lastIndexOf(QDir::separator());
+       if (i >= 0) {
+           path = path.mid(i+1);
+       }
+       item->service = path;
+
+       // the name is part before the file name suffix of "*.desktop"
+       i = path.lastIndexOf(QLatin1Char('.'));
+       if (i >= 0) {
+           path = path.left(i);
+       }
+       item->name = path;
+
        item->startAfter = config.startAfter();
-       item->phase = config.startPhase();
-       if (item->phase < 0)
-          item->phase = 0;
+       item->phase = qBound(KAutostart::BaseDesktop, config.startPhase(), \
KAutostart::Applications);  m_startList->append(item);
    }
 }
--- trunk/KDE/kdelibs/kinit/klauncher.cpp #1035768:1035769
@@ -539,7 +539,8 @@
 	 }
          return;
       }
-      s = new KService(service);
+      KDesktopFile df("autostart", service);
+      s = new KService(&df);
    }
    while (!start_service(s, QStringList(), QStringList(), "0", false, true, \
QDBusMessage()));  // Loop till we find a service that we can start.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic