From b5047356264eb7040d963b47b4a21828e3fddfad Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 14 Sep 2021 16:33:20 +0300 Subject: [PATCH] always execute xdg-open in QDesktopServices::openUrl() Signed-off-by: Ivailo Monev --- src/gui/util/qdesktopservices.cpp | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 30f5d9149..d6810e625 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -34,13 +34,6 @@ QT_BEGIN_NAMESPACE - -inline static bool qt_launch(const QUrl &url, const QString &client) -{ - QString command = client + QLatin1Char(' ') + url.toEncoded(); - return QProcess::startDetached(command); -} - class QOpenUrlHandlerRegistry : public QObject { Q_OBJECT @@ -172,33 +165,8 @@ bool QDesktopServices::openUrl(const QUrl &url) if (!url.isValid()) return false; - if (url.scheme() == QLatin1String("file") || url.scheme() == QLatin1String("mailto")) { - if (qt_launch(url, QLatin1String("xdg-open"))) - return true; - - if (qt_launch(url, QLatin1String("firefox"))) - return true; - if (qt_launch(url, QLatin1String("chromium"))) - return true; - if (qt_launch(url, QLatin1String("opera"))) - return true; - return false; - } - - if (qt_launch(url, QLatin1String("xdg-open"))) - return true; - if (qt_launch(url, QLatin1String(qgetenv("DEFAULT_BROWSER")))) - return true; - if (qt_launch(url, QLatin1String(qgetenv("BROWSER")))) - return true; - - if (qt_launch(url, QLatin1String("firefox"))) - return true; - if (qt_launch(url, QLatin1String("chromium"))) - return true; - if (qt_launch(url, QLatin1String("opera"))) - return true; - return false; + const QString command = QLatin1String("xdg-open ") + url.toEncoded(); + return QProcess::startDetached(command); } /*! -- 2.11.0