mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Check for KDE portal backend when using portals on KDE
This commit is contained in:
parent
4033a091b5
commit
ca67ac913f
1 changed files with 15 additions and 4 deletions
|
@ -123,6 +123,14 @@ void PortalAutostart(bool autostart, bool silent = false) {
|
|||
}
|
||||
}
|
||||
|
||||
bool IsXDGDesktopPortalKDEPresent() {
|
||||
static const auto Result = QDBusInterface(
|
||||
qsl("org.freedesktop.impl.portal.desktop.kde"),
|
||||
kXDGDesktopPortalObjectPath.utf16()).isValid();
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
uint FileChooserPortalVersion() {
|
||||
static const auto Result = [&]() -> uint {
|
||||
auto message = QDBusMessage::createMethodCall(
|
||||
|
@ -731,17 +739,20 @@ bool IsXDGDesktopPortalPresent() {
|
|||
}
|
||||
|
||||
bool UseXDGDesktopPortal() {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
static const auto Result = [&] {
|
||||
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
|
||||
const auto portalPresent = IsXDGDesktopPortalPresent();
|
||||
const auto neededForKde = DesktopEnvironment::IsKDE()
|
||||
&& IsXDGDesktopPortalKDEPresent();
|
||||
|
||||
return (
|
||||
DesktopEnvironment::IsKDE()
|
||||
|| envVar
|
||||
) && portalPresent;
|
||||
return (neededForKde || envVar) && portalPresent;
|
||||
}();
|
||||
|
||||
return Result;
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CanOpenDirectoryWithPortal() {
|
||||
|
|
Loading…
Add table
Reference in a new issue