Userland: Filter out unsupported file types in open dialogs in more apps

This commit is contained in:
Karol Kosek 2023-05-28 17:57:02 +02:00 committed by Sam Atkins
commit 8bd68198d6
Notes: sideshowbarker 2024-07-16 23:57:20 +09:00
10 changed files with 69 additions and 16 deletions

View file

@ -121,7 +121,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Actions
auto open_action = GUI::CommonActions::make_open_action(
[&](auto&) {
auto result = FileSystemAccessClient::Client::the().open_file(window, { .window_title = "Open Image"sv });
FileSystemAccessClient::OpenFileOptions options {
.window_title = "Open Image"sv,
.allowed_file_types = Vector { GUI::FileTypeFilter::image_files(), GUI::FileTypeFilter::all_files() },
};
auto result = FileSystemAccessClient::Client::the().open_file(window, options);
if (result.is_error())
return;