diff options
author | Jan Grulich <jgrulich@redhat.com> | 2018-08-30 10:45:49 +0200 |
---|---|---|
committer | Jan Grulich <jgrulich@redhat.com> | 2018-09-02 14:15:38 +0000 |
commit | 101cb8e5d97f2f26ff0b3efd7b6e8b0e336e62be (patch) | |
tree | a3038489aa471e41bc1d118d537fa91ae984a8c9 /src/platformsupport/services/genericunix | |
parent | 7c0884f2a2b02ed91ee49f79ef2fff27c2567c39 (diff) | |
download | qtbase-101cb8e5d97f2f26ff0b3efd7b6e8b0e336e62be.tar.gz |
Make flatpak portal support to be used also by Snap applications
Snap now uses xdg-desktop-portal for portal support. Add check for apps
running in Snap and make them use portals by default. We also should be
using different name for the platform theme used by sandboxed apps.
Change-Id: Ibaa35b7549b3d94775d7edb937f729a300d071b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/platformsupport/services/genericunix')
-rw-r--r-- | src/platformsupport/services/genericunix/qgenericunixservices.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp index 5b15cccaf1..67884cef92 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp +++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp @@ -50,7 +50,7 @@ #include <QtCore/QUrl> #if QT_CONFIG(dbus) -// These QtCore includes are needed for flatpak support +// These QtCore includes are needed for xdg-desktop-portal support #include <QtCore/private/qcore_unix_p.h> #include <QtCore/QFileInfo> @@ -172,12 +172,12 @@ static inline bool launch(const QString &launcher, const QUrl &url) } #if QT_CONFIG(dbus) -static inline bool checkRunningUnderFlatpak() +static inline bool checkNeedPortalSupport() { - return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty(); + return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP"); } -static inline bool flatpakOpenFile(const QUrl &url) +static inline bool xdgDesktopPortalOpenFile(const QUrl &url) { // DBus signature: // OpenFile (IN s parent_window, @@ -212,7 +212,7 @@ static inline bool flatpakOpenFile(const QUrl &url) return false; } -static inline bool flatpakOpenUrl(const QUrl &url) +static inline bool xdgDesktopPortalOpenUrl(const QUrl &url) { // DBus signature: // OpenURI (IN s parent_window, @@ -236,7 +236,7 @@ static inline bool flatpakOpenUrl(const QUrl &url) return !reply.isError(); } -static inline bool flatpakSendEmail(const QUrl &url) +static inline bool xdgDesktopPortalSendEmail(const QUrl &url) { // DBus signature: // ComposeEmail (IN s parent_window, @@ -294,15 +294,15 @@ bool QGenericUnixServices::openUrl(const QUrl &url) { if (url.scheme() == QLatin1String("mailto")) { #if QT_CONFIG(dbus) - if (checkRunningUnderFlatpak()) - return flatpakSendEmail(url); + if (checkNeedPortalSupport()) + return xdgDesktopPortalSendEmail(url); #endif return openDocument(url); } #if QT_CONFIG(dbus) - if (checkRunningUnderFlatpak()) - return flatpakOpenUrl(url); + if (checkNeedPortalSupport()) + return xdgDesktopPortalOpenUrl(url); #endif if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) { @@ -315,8 +315,8 @@ bool QGenericUnixServices::openUrl(const QUrl &url) bool QGenericUnixServices::openDocument(const QUrl &url) { #if QT_CONFIG(dbus) - if (checkRunningUnderFlatpak()) - return flatpakOpenFile(url); + if (checkNeedPortalSupport()) + return xdgDesktopPortalOpenFile(url); #endif if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) { |