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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       David Faure <faure () kde ! org>
Date:       2010-12-22 19:39:25
Message-ID: 20101222193925.3AF7CAC8AA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208671 by dfaure:

Replace hardcoded "kfmclient openURL" with "ask KMimeTypeTrader for the preferred app \
for text/html". It hurts me to allow people to move away from konqueror -- but it's \
                the right thing to do in this layer :)
BUG: 259426
FIXED-IN: 4.6


 M  +15 -5     ktoolinvocation_x11.cpp  


--- trunk/KDE/kdelibs/kdecore/kernel/ktoolinvocation_x11.cpp #1208670:1208671
@@ -27,6 +27,7 @@
 #include "ktoolinvocation.h"
 
 #include <kconfiggroup.h>
+#include <kmimetypetrader.h>
 
 #include "kcmdlineargs.h"
 #include "kconfig.h"
@@ -298,7 +299,7 @@
     // This method should launch a webbrowser, preferably without doing a mimetype
     // check first, like KRun (i.e. kde-open) would do.
 
-    // In a KDE session, honour BrowserApplication if set, otherwise call kfmclient \
if present, +    // In a KDE session, honour BrowserApplication if set, otherwise use \
                preferred app for text/html if any,
     // otherwise xdg-open, otherwise kde-open (which does a mimetype check first \
though).  
     // Outside KDE, call xdg-open if present, otherwise fallback to the above logic.
@@ -337,10 +338,19 @@
                 }
             }
         } else {
-            const QString kfmclient = \
                KStandardDirs::findExe(QString::fromLatin1("kfmclient"));
-            if (!kfmclient.isEmpty()) {
-                exe = kfmclient;
-                args.prepend(QLatin1String("openURL"));
+            const KService::Ptr htmlApp = \
KMimeTypeTrader::self()->preferredService(QLatin1String("text/html")); +            \
if (htmlApp) { +                QString error;
+                int pid = 0;
+                int err = startServiceByDesktopPath(htmlApp->entryPath(), url, \
&error, 0, &pid, startup_id); +                if (err != 0) {
+                    KMessage::message(KMessage::Error,
+                                      // TODO: i18n("Could not launch %1:\n\n%2", \
htmlApp->exec(), error), +                                      i18n("Could not \
launch the browser:\n\n%1", error), +                                      \
i18n("Could not launch Browser")); +                } else { // success
+                    return;
+                }
             } else {
                 exe = xdg_open;
             }


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

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