src/gui/util/qdesktopservices_x11.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
--- a/src/gui/util/qdesktopservices_x11.cpp	Fri Sep 17 08:34:18 2010 +0300
+++ b/src/gui/util/qdesktopservices_x11.cpp	Mon Oct 04 01:19:32 2010 +0300
@@ -71,10 +71,12 @@
     if (launch(url, QLatin1String("xdg-open")))
         return true;
 
-    if (X11->desktopEnvironment == DE_GNOME && launch(url, QLatin1String("gnome-open"))) {
+    // Use the X11->desktopEnvironment value if X11 is non-NULL,
+    //  otherwise just attempt to launch command regardless of the desktop environment
+    if ((!X11 || (X11 && X11->desktopEnvironment == DE_GNOME)) && launch(url, QLatin1String("gnome-open"))) {
         return true;
     } else {
-        if (X11->desktopEnvironment == DE_KDE && launch(url, QLatin1String("kfmclient exec")))
+        if ((!X11 || (X11 && X11->desktopEnvironment == DE_KDE)) && launch(url, QLatin1String("kfmclient exec")))
             return true;
     }
 
@@ -104,10 +106,12 @@
     if (launch(url, QString::fromLocal8Bit(getenv("BROWSER"))))
         return true;
 
-    if (X11->desktopEnvironment == DE_GNOME && launch(url, QLatin1String("gnome-open"))) {
+    // Use the X11->desktopEnvironment value if X11 is non-NULL,
+    //  otherwise just attempt to launch command regardless of the desktop environment
+    if ((!X11 || (X11 && X11->desktopEnvironment == DE_GNOME)) && launch(url, QLatin1String("gnome-open"))) {
         return true;
     } else {
-        if (X11->desktopEnvironment == DE_KDE && launch(url, QLatin1String("kfmclient openURL")))
+        if ((!X11 || (X11 && X11->desktopEnvironment == DE_KDE)) && launch(url, QLatin1String("kfmclient openURL")))
             return true;
     }