1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:27:34 +00:00

FileSystemAccessServer+TextEditor: Implement cross-process modal prompts

This transitions from synchronous IPC calls to asynchronous IPC calls
provided through a synchronous interface in LibFileSystemAccessClient
which allows the parent Application to stay responsive.

It achieves this with Promise which is pumping the Application event
loop while waiting for the Dialog to respond with the user's action.

LibFileSystemAccessClient provides a lazy singleton which also ensures
that FileSystemAccessServer is running in the event of a crash.

This also transitions TextEditor into using LibFileSystemAccessClient.
This commit is contained in:
Timothy 2021-07-12 01:16:26 +10:00 committed by Andreas Kling
parent ab353fd4e1
commit 38594dde79
12 changed files with 224 additions and 88 deletions

View file

@ -10,6 +10,7 @@
#include <FileSystemAccessServer/FileSystemAccessClientEndpoint.h>
#include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h>
#include <LibCore/Forward.h>
#include <LibGUI/Forward.h>
#include <LibIPC/ClientConnection.h>
namespace FileSystemAccessServer {
@ -25,12 +26,12 @@ public:
virtual void die() override;
private:
virtual Messages::FileSystemAccessServer::RequestFileResponse request_file(String const&, Core::OpenMode const&) override;
virtual Messages::FileSystemAccessServer::PromptOpenFileResponse prompt_open_file(String const&, Core::OpenMode const&) override;
virtual Messages::FileSystemAccessServer::PromptSaveFileResponse prompt_save_file(String const&, String const&, String const&, Core::OpenMode const&) override;
virtual void request_file(i32, i32, String const&, Core::OpenMode const&) override;
virtual void prompt_open_file(i32, i32, String const&, Core::OpenMode const&) override;
virtual void prompt_save_file(i32, i32, String const&, String const&, String const&, Core::OpenMode const&) override;
template<typename T>
T prompt_helper(Optional<String> const&, Core::OpenMode const&);
void prompt_helper(Optional<String> const&, Core::OpenMode const&);
RefPtr<GUI::Window> create_dummy_child_window(i32, i32);
HashMap<String, Core::OpenMode> m_approved_files;
};