unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 505fff13c22334661cdf38cdec7030e4e8b4ce24 3929 bytes (raw)
name: gnu/packages/patches/qtbase-use-xdg-open-in-store.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
 
To make Qt respect the user's settings for the preferred browser, use xdg-open
even if it is not installed in the profile. The patch makes Qt always use
xdg-open, and makes the path used easy to substitute when building.
========================================================================
--- qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices.cpp	2020-01-01 20:47:16.775671802 +0100
+++ qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices.cpp	2020-01-01 20:56:22.167662035 +0100
@@ -117,47 +117,6 @@
     return QByteArrayLiteral("UNKNOWN");
 }
 
-static inline bool checkExecutable(const QString &candidate, QString *result)
-{
-    *result = QStandardPaths::findExecutable(candidate);
-    return !result->isEmpty();
-}
-
-static inline bool detectWebBrowser(const QByteArray &desktop,
-                                    bool checkBrowserVariable,
-                                    QString *browser)
-{
-    const char *browsers[] = {"google-chrome", "firefox", "mozilla", "opera"};
-
-    browser->clear();
-    if (checkExecutable(QStringLiteral("xdg-open"), browser))
-        return true;
-
-    if (checkBrowserVariable) {
-        QByteArray browserVariable = qgetenv("DEFAULT_BROWSER");
-        if (browserVariable.isEmpty())
-            browserVariable = qgetenv("BROWSER");
-        if (!browserVariable.isEmpty() && checkExecutable(QString::fromLocal8Bit(browserVariable), browser))
-            return true;
-    }
-
-    if (desktop == QByteArray("KDE")) {
-        // Konqueror launcher
-        if (checkExecutable(QStringLiteral("kfmclient"), browser)) {
-            browser->append(QLatin1String(" exec"));
-            return true;
-        }
-    } else if (desktop == QByteArray("GNOME")) {
-        if (checkExecutable(QStringLiteral("gnome-open"), browser))
-            return true;
-    }
-
-    for (size_t i = 0; i < sizeof(browsers)/sizeof(char *); ++i)
-        if (checkExecutable(QLatin1String(browsers[i]), browser))
-            return true;
-    return false;
-}
-
 static inline bool launch(const QString &launcher, const QUrl &url)
 {
     const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded());
@@ -297,6 +256,8 @@
     return result;
 }
 
+static QString xdg_open = QStringLiteral("@@GUIX:XDG-OPEN@@");
+
 bool QGenericUnixServices::openUrl(const QUrl &url)
 {
     if (url.scheme() == QLatin1String("mailto")) {
@@ -320,11 +281,7 @@
     }
 #endif
 
-    if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
-        qWarning("Unable to detect a web browser to launch '%s'", qPrintable(url.toString()));
-        return false;
-    }
-    return launch(m_webBrowser, url);
+    return launch(xdg_open, url);
 }
 
 bool QGenericUnixServices::openDocument(const QUrl &url)
@@ -337,11 +294,7 @@
     }
 #endif
 
-    if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) {
-        qWarning("Unable to detect a launcher for '%s'", qPrintable(url.toString()));
-        return false;
-    }
-    return launch(m_documentLauncher, url);
+    return launch(xdg_open, url);
 }
 
 #else
diff -ur qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices_p.h qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices_p.h
--- qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices_p.h	2020-01-01 20:47:16.775671802 +0100
+++ qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices_p.h	2020-01-01 20:54:12.135664364 +0100
@@ -65,10 +65,6 @@
 
     bool openUrl(const QUrl &url) override;
     bool openDocument(const QUrl &url) override;
-
-private:
-    QString m_webBrowser;
-    QString m_documentLauncher;
 };
 
 QT_END_NAMESPACE

debug log:

solving 505fff13c2 ...
found 505fff13c2 in https://yhetil.org/guix-patches/20200112154709.fhxirioephom3zvc@zdrowyportier.kadziolka.net/

applying [1/1] https://yhetil.org/guix-patches/20200112154709.fhxirioephom3zvc@zdrowyportier.kadziolka.net/
diff --git a/gnu/packages/patches/qtbase-use-xdg-open-in-store.patch b/gnu/packages/patches/qtbase-use-xdg-open-in-store.patch
new file mode 100644
index 0000000000..505fff13c2

1:16: trailing whitespace.
 
1:64: trailing whitespace.
 
1:73: trailing whitespace.
 
1:81: trailing whitespace.
 
1:86: trailing whitespace.
 
Checking patch gnu/packages/patches/qtbase-use-xdg-open-in-store.patch...
Applied patch gnu/packages/patches/qtbase-use-xdg-open-in-store.patch cleanly.
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.

index at:
100644 505fff13c22334661cdf38cdec7030e4e8b4ce24	gnu/packages/patches/qtbase-use-xdg-open-in-store.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).