2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Fix directory opening with portal and use them by default with KDE

This commit is contained in:
Ilya Fedin
2020-04-21 23:05:17 +04:00
committed by John Preston
parent c1f3fe1961
commit 7bc86cc9af
2 changed files with 4 additions and 4 deletions

View File

@@ -83,11 +83,11 @@ constexpr auto kPreviewHeight = 512;
using Type = ::FileDialog::internal::Type;
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
bool NativeSupported() {
bool NativeSupported(Type type = Type::ReadFile) {
#ifndef TDESKTOP_FORCE_GTK_FILE_DIALOG
return false;
#endif // TDESKTOP_FORCE_GTK_FILE_DIALOG
return !Platform::UseXDGDesktopPortal()
return (!Platform::UseXDGDesktopPortal() || type == Type::ReadFolder)
&& Platform::internal::GdkHelperLoaded()
&& (Libs::gtk_widget_hide_on_delete != nullptr)
&& (Libs::gtk_clipboard_store != nullptr)
@@ -192,7 +192,7 @@ bool Get(
parent = parent->window();
}
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
if (NativeSupported()) {
if (NativeSupported(type)) {
return GetNative(
parent,
files,

View File

@@ -266,7 +266,7 @@ bool UseXDGDesktopPortal() {
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
const auto portalPresent = IsXDGDesktopPortalPresent();
return envVar && portalPresent;
return (DesktopEnvironment::IsKDE() || envVar) && portalPresent;
}();
return UsePortal;