Fix URL opening in snap sandbox

For some reason, snapd doesn't allow dbus activating of xdg-desktop-portal and returns AccessDenied to any request. Qt checks the returned error and if it is not ServiceUnknown, Qt doesn't try to open URL through xdg-open, which encounters into situation that URLs doesn't open until some other app tries to access xdg-desktop-portal.

Fixes: QTBUG-83837
Change-Id: I9e600f734401bd4295d97e2b5686b916c6c7f762
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ilya Fedin 2020-04-28 10:59:00 +04:00
parent cacac863e7
commit 38337fa9d3

View File

@ -189,7 +189,7 @@ static inline bool isPortalReturnPermanent(const QDBusError &error)
// A service unknown error isn't permanent, it just indicates that we // A service unknown error isn't permanent, it just indicates that we
// should fall back to the regular way. This check includes // should fall back to the regular way. This check includes
// QDBusError::NoError. // QDBusError::NoError.
return error.type() != QDBusError::ServiceUnknown; return error.type() != QDBusError::ServiceUnknown && error.type() != QDBusError::AccessDenied;
} }
static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url) static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)