mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Userland: Filter out unsupported file types in open dialogs in more apps
This commit is contained in:
parent
27011cf55d
commit
8bd68198d6
10 changed files with 69 additions and 16 deletions
|
@ -128,14 +128,26 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR
|
|||
if (!request_close())
|
||||
return;
|
||||
|
||||
auto response = FileSystemAccessClient::Client::the().open_file(window());
|
||||
FileSystemAccessClient::OpenFileOptions options {
|
||||
.allowed_file_types = Vector {
|
||||
{ "Spreadsheets", { { "sheets", "csv" } } },
|
||||
GUI::FileTypeFilter::all_files(),
|
||||
},
|
||||
};
|
||||
auto response = FileSystemAccessClient::Client::the().open_file(window(), options);
|
||||
if (response.is_error())
|
||||
return;
|
||||
load_file(response.value().filename(), response.value().stream());
|
||||
});
|
||||
|
||||
m_import_action = GUI::Action::create("Import Sheets...", [&](auto&) {
|
||||
auto response = FileSystemAccessClient::Client::the().open_file(window());
|
||||
FileSystemAccessClient::OpenFileOptions options {
|
||||
.allowed_file_types = Vector {
|
||||
{ "Spreadsheets", { { "sheets", "csv" } } },
|
||||
GUI::FileTypeFilter::all_files(),
|
||||
},
|
||||
};
|
||||
auto response = FileSystemAccessClient::Client::the().open_file(window(), options);
|
||||
if (response.is_error())
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue