Prefer portal file dialog in all environments

This commit is contained in:
Ilya Fedin 2021-04-28 09:13:52 +04:00 committed by John Preston
parent d8ffc114d3
commit 16ba20f898
1 changed files with 1 additions and 13 deletions

View File

@ -8,8 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/linux/linux_xdp_file_dialog.h"
#include "platform/platform_file_utilities.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/specific_linux.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "storage/localstorage.h"
@ -642,18 +640,8 @@ rpl::producer<> XDPFileDialog::rejected() {
} // namespace
bool Use(Type type) {
static const auto ShouldUse = [&] {
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
const auto confined = InFlatpak() || InSnap();
const auto notGtkBased = !DesktopEnvironment::IsGtkBased();
return confined || notGtkBased || envVar;
}();
static const auto Version = FileChooserPortalVersion();
return ShouldUse
&& Version.has_value()
return Version.has_value()
&& (type != Type::ReadFolder || *Version >= 3);
}