mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Move the excluding portal checks to UseXDGDesktopPortal
This commit is contained in:
parent
f521275acc
commit
6c023084d9
1 changed files with 19 additions and 17 deletions
|
@ -657,12 +657,19 @@ bool IsXDGDesktopPortalPresent() {
|
||||||
bool UseXDGDesktopPortal() {
|
bool UseXDGDesktopPortal() {
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
static const auto Result = [&] {
|
static const auto Result = [&] {
|
||||||
|
const auto onlyIn = AreQtPluginsBundled()
|
||||||
|
// it is handled by Qt for flatpak and snap
|
||||||
|
&& !InFlatpak()
|
||||||
|
&& !InSnap();
|
||||||
|
|
||||||
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
|
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
|
||||||
const auto portalPresent = IsXDGDesktopPortalPresent();
|
const auto portalPresent = IsXDGDesktopPortalPresent();
|
||||||
const auto neededForKde = DesktopEnvironment::IsKDE()
|
const auto neededForKde = DesktopEnvironment::IsKDE()
|
||||||
&& IsXDGDesktopPortalKDEPresent();
|
&& IsXDGDesktopPortalKDEPresent();
|
||||||
|
|
||||||
return (neededForKde || envVar) && portalPresent;
|
return onlyIn
|
||||||
|
&& portalPresent
|
||||||
|
&& (neededForKde || envVar);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
@ -1086,24 +1093,19 @@ void start() {
|
||||||
qputenv("QT_WAYLAND_DECORATION", "material");
|
qputenv("QT_WAYLAND_DECORATION", "material");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AreQtPluginsBundled()
|
// this can give us a chance to use
|
||||||
// it is handled by Qt for flatpak and snap
|
// a proper file dialog for current session
|
||||||
&& !InFlatpak()
|
DEBUG_LOG(("Checking for XDG Desktop Portal..."));
|
||||||
&& !InSnap()) {
|
if (IsXDGDesktopPortalPresent()) {
|
||||||
LOG(("Checking for XDG Desktop Portal..."));
|
DEBUG_LOG(("XDG Desktop Portal is present!"));
|
||||||
// this can give us a chance to use
|
if (UseXDGDesktopPortal()) {
|
||||||
// a proper file dialog for current session
|
LOG(("Using XDG Desktop Portal."));
|
||||||
if (IsXDGDesktopPortalPresent()) {
|
qputenv("QT_QPA_PLATFORMTHEME", "xdgdesktopportal");
|
||||||
LOG(("XDG Desktop Portal is present!"));
|
|
||||||
if (UseXDGDesktopPortal()) {
|
|
||||||
LOG(("Using XDG Desktop Portal."));
|
|
||||||
qputenv("QT_QPA_PLATFORMTHEME", "xdgdesktopportal");
|
|
||||||
} else {
|
|
||||||
LOG(("Not using XDG Desktop Portal."));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LOG(("XDG Desktop Portal is not present :("));
|
DEBUG_LOG(("Not using XDG Desktop Portal."));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG_LOG(("XDG Desktop Portal is not present :("));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue