diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -652,30 +652,35 @@ QTimer::singleShot(0, this, &DolphinViewContainer::requestFocus); } } else if (KProtocolManager::isSourceProtocol(url)) { - QString app = QStringLiteral("konqueror"); if (url.scheme().startsWith(QLatin1String("http"))) { - showMessage(i18nc("@info:status", // krazy:exclude=qmethods - "Dolphin does not support web pages, the web browser has been launched"), - Information); + bool ok = false; - const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General"); + const KConfigGroup config(KSharedConfig::openConfig(), "General"); const QString browser = config.readEntry("BrowserApplication"); - if (!browser.isEmpty()) { - app = browser; - if (app.startsWith('!')) { - // a literal command has been configured, remove the '!' prefix - app = app.mid(1); + + if (browser.startsWith(QLatin1Char('!'))) { + // Literal command + const QString quotedUrl = KShell::quoteArg(url.toDisplayString(QUrl::PreferLocalFile)); + const QString command = browser.mid(1) + QLatin1Char(' ') + quotedUrl; + ok = KRun::runCommand(command, this); + } else { + // Run as service + KService::Ptr service = KService::serviceByStorageId(browser); + if (service) { + KRun::runService(*service, {url}, this); + ok = true; } } - } else { - showMessage(i18nc("@info:status", - "Protocol not supported by Dolphin, Konqueror has been launched"), - Information); + + if (ok) { + showMessage(i18nc("@info:status", // krazy:exclude=qmethods + "Dolphin does not support web pages, the web browser has been launched"), + Information); + return; + } } - const QString secureUrl = KShell::quoteArg(url.toDisplayString(QUrl::PreferLocalFile)); - const QString command = app + ' ' + secureUrl; - KRun::runCommand(command, app, app, this); + showMessage(i18nc("@info:status", "Protocol not supported by Dolphin."), Error); } else { showMessage(i18nc("@info:status", "Invalid protocol"), Error); }