Make flatpak check more backward compatible

Since 68de00e0d4, the check doesn't work
with flatpak versions lesser than 1.13.1. Checking the file in the root
directory works since flatpak 0.6.10.

Pick-to: 6.5 6.2
Change-Id: Icc83ea5de4a962b52a737c9842248df3b60b1331
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ilya Fedin 2023-04-03 22:47:13 +04:00
parent 2f35879649
commit 5c4a94ba85
3 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@
#include <qpa/qplatformintegration.h>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QStandardPaths>
#include <QtCore/QFileInfo>
#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
@ -231,7 +231,7 @@ static void initThemeHints()
static bool checkNeedPortalSupport()
{
#if QT_CONFIG(dbus)
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty() || qEnvironmentVariableIsSet("SNAP");
return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
#else
return false;
#endif // QT_CONFIG(dbus)

View File

@ -162,7 +162,7 @@ static inline bool launch(const QString &launcher, const QUrl &url,
#if QT_CONFIG(dbus)
static inline bool checkNeedPortalSupport()
{
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty() || qEnvironmentVariableIsSet("SNAP");
return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
}
static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url, const QString &parentWindow,

View File

@ -8,6 +8,7 @@
#include <QWindow>
#include <QEvent>
#include <QFile>
#include <QFileInfo>
#include <QStandardPaths>
#include <QDBusVariant>
#include <QDBusPendingReply>
@ -596,8 +597,7 @@ void QIBusPlatformInputContext::connectToContextSignals()
static inline bool checkNeedPortalSupport()
{
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty()
|| qEnvironmentVariableIsSet("SNAP");
return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
}
static bool shouldConnectIbusPortal()