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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/kernel
From:       Benjamin Reed <ranger () befunk ! com>
Date:       2007-06-30 23:44:11
Message-ID: 1183247051.605702.6865.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 681959 by reed:

ugh, this gets uglier and uglier, but hey, kuniqueapplications work ;)

 M  +18 -6     kapplication_mac.cpp  
 M  +9 -0      kuniqueapplication.cpp  


--- trunk/KDE/kdelibs/kdeui/kernel/kapplication_mac.cpp #681958:681959
@@ -37,16 +37,27 @@
  * @internal
 */
 
+bool mac_initialized;
+
 void KApplication_early_init_mac()
 {
+    if (mac_initialized)
+        return;
+
     KConfigGroup g( KGlobal::config(), "General" );
-    QStringList newPath = g.readPathListEntry("AddDirectoriesToPath");
-    QStringList path = QFile::decodeName(getenv("PATH")).split(':');
-    for (int i = 0; i < path.size(); ++i) {
-        newPath.append(path.at(i));
+    QStringList envVars, envAppend, path, newPath;
+    envVars << "XDG_DATA_DIRS" << "XDG_CONFIG_DIRS" << "PATH";
+    envAppend << "AddDirectoriesToXdgDataDirs" << "AddDirectoriesToXdgConfigDirs" << \
"AddDirectoriesToPath"; +
+    for (int i = 0; i < envVars.size(); ++i) {
+        newPath = g.readPathListEntry(envAppend.at(i));
+        path = QFile::decodeName(getenv(envVars.at(i).toLocal8Bit())).split(":");
+        for (int j = 0; j < path.size(); ++j) {
+            newPath.append(path.at(j));
+        }
+        ::setenv(envVars.at(i).toLocal8Bit(), newPath.join(":").toLocal8Bit(), 1);
+        kDebug() << envVars.at(i) << "=" << newPath.join(":") << endl;
     }
-    ::setenv("PATH", newPath.join(":").toLocal8Bit(), 1);
-    kDebug() << "PATH=" << newPath.join(":") << endl;
 
     /* temporary until we implement autolaunch for dbus  on Mac OS X */
     QString dbusSession;
@@ -88,4 +99,5 @@
             qp.waitForFinished(-1);
         }
     }
+    mac_initialized = true;
 }
--- trunk/KDE/kdelibs/kdeui/kernel/kuniqueapplication.cpp #681958:681959
@@ -69,6 +69,10 @@
 bool s_kuniqueapplication_startCalled = false;
 bool KUniqueApplication::s_handleAutoStarted = false;
 
+#ifdef Q_WS_MAC
+void KApplication_early_init_mac();
+#endif
+
 static KCmdLineOptions kunique_options[] =
 {
   { "nofork", "Don't run in the background.", 0 },
@@ -99,6 +103,7 @@
   if( s_kuniqueapplication_startCalled )
     return true;
   s_kuniqueapplication_startCalled = true;
+
   addCmdLineOptions(); // Make sure to add cmd line options
 #ifdef Q_WS_WIN
   s_nofork = true;
@@ -119,6 +124,10 @@
         appName.prepend(s);
      }
 
+#ifdef Q_WS_MAC
+  KApplication_early_init_mac();
+#endif
+
   if (s_nofork)
   {
      QDBusConnectionInterface* dbusService = tryToInitDBusConnection();


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

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