]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* don't launch Konqueror when the protocol is invalid
authorPeter Penz <peter.penz19@gmail.com>
Thu, 13 Nov 2008 18:15:12 +0000 (18:15 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 13 Nov 2008 18:15:12 +0000 (18:15 +0000)
* launch default browser when the protocol is http

CCMAIL: faure@kde.org

svn path=/trunk/KDE/kdebase/apps/; revision=883858

src/dolphinviewcontainer.cpp

index 6795aca9bd7e836335318f3d3a1443a2e005e45b..6e5385f5e4dd748bd9a890c79e0fa49b87ea4c8a 100644 (file)
@@ -355,12 +355,24 @@ void DolphinViewContainer::restoreView(const KUrl& url)
 {
     if (KProtocolManager::supportsListing(url)) {
         m_view->updateView(url, m_urlNavigator->savedRootUrl());
+    } else if (KProtocolManager::isSourceProtocol(url)) {
+        QString app = "konqueror";
+        if (url.protocol().startsWith(QLatin1String("http"))) {
+            showErrorMessage(i18nc("@info:status",
+                                   "Dolphin does not support web pages, the web browser has been launched"));
+            const KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "General");
+            const QString browser = config.readEntry("BrowserApplication");
+            if (!browser.isEmpty()) {
+                app = browser;
+            }
+        } else {
+            showErrorMessage(i18nc("@info:status",
+                                   "Protocol not supported by Dolphin, Konqueror has been launched"));        
+        }
+        const QString command = app + ' ' + url.pathOrUrl();
+        KRun::runCommand(command, app, app, this);
     } else {
-        // The URL navigator only checks for validity, not
-        // if the URL can be listed. 
-        showErrorMessage(i18nc("@info:status", "Protocol not supported by Dolphin, Konqueror has been launched"));        
-        QString command = "konqueror " + url.pathOrUrl();
-        KRun::runCommand(command, "konqueror", "konqueror", this);
+        showErrorMessage(i18nc("@info:status", "Invalid protocol"));
     }
 }