mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-06 09:35:12 +00:00
Add option to choose file dialog
This commit is contained in:
@@ -642,17 +642,18 @@ rpl::producer<> XDPFileDialog::rejected() {
|
||||
} // namespace
|
||||
|
||||
bool Use(Type type) {
|
||||
static const auto ShouldUse = [&] {
|
||||
const auto envVar = qEnvironmentVariableIsSet("TDESKTOP_USE_PORTAL");
|
||||
const auto shouldUse = [&] {
|
||||
const auto setting = cFileDialogType() <= ImplementationType::XDP;
|
||||
const auto forceSetting = cFileDialogType() == ImplementationType::XDP;
|
||||
const auto confined = InFlatpak() || InSnap();
|
||||
const auto notGtkBased = !DesktopEnvironment::IsGtkBased();
|
||||
|
||||
return confined || notGtkBased || envVar;
|
||||
return setting && (confined || notGtkBased || forceSetting);
|
||||
}();
|
||||
|
||||
static const auto Version = FileChooserPortalVersion();
|
||||
|
||||
return ShouldUse
|
||||
return shouldUse
|
||||
&& Version.has_value()
|
||||
&& (type != Type::ReadFolder || *Version >= 3);
|
||||
}
|
||||
|
Reference in New Issue
Block a user