mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
FileSystemAccessServer: Implement FileTypeFilter to open_file()
This is the same functionality as in FilePicker. It allows the specification of what file types are allowed.
This commit is contained in:
parent
106ad6bb13
commit
6a5c561a41
5 changed files with 10 additions and 7 deletions
|
@ -74,7 +74,7 @@ Result Client::request_file(GUI::Window* parent_window, DeprecatedString const&
|
|||
return handle_promise(id);
|
||||
}
|
||||
|
||||
Result Client::open_file(GUI::Window* parent_window, DeprecatedString const& window_title, StringView path, Core::File::OpenMode requested_access)
|
||||
Result Client::open_file(GUI::Window* parent_window, DeprecatedString const& window_title, StringView path, Core::File::OpenMode requested_access, Optional<Vector<GUI::FileTypeFilter>> const& allowed_file_types)
|
||||
{
|
||||
auto const id = get_new_id();
|
||||
m_promises.set(id, PromiseAndWindow { { Core::Promise<Result>::construct() }, parent_window });
|
||||
|
@ -89,7 +89,7 @@ Result Client::open_file(GUI::Window* parent_window, DeprecatedString const& win
|
|||
GUI::ConnectionToWindowServer::the().remove_window_stealing_for_client(child_window_server_client_id, parent_window_id);
|
||||
});
|
||||
|
||||
async_prompt_open_file(id, parent_window_server_client_id, parent_window_id, window_title, path, requested_access);
|
||||
async_prompt_open_file(id, parent_window_server_client_id, parent_window_id, window_title, path, requested_access, allowed_file_types);
|
||||
|
||||
return handle_promise(id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue