1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

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
parent 27011cf55d
commit 8bd68198d6
10 changed files with 69 additions and 16 deletions

View file

@ -99,7 +99,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(game_menu->try_add_separator());
TRY(game_menu->try_add_action(GUI::Action::create("&Import PGN...", { Mod_Ctrl, Key_O }, [&](auto&) {
auto result = FileSystemAccessClient::Client::the().open_file(window);
FileSystemAccessClient::OpenFileOptions options {
.allowed_file_types = Vector {
GUI::FileTypeFilter { "PGN Files", { { "pgn" } } },
GUI::FileTypeFilter::all_files(),
}
};
auto result = FileSystemAccessClient::Client::the().open_file(window, options);
if (result.is_error())
return;