From c71fc0683f5b421bc994ff1b480c31680a6fc3fc Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 7 Dec 2022 22:51:37 +0100 Subject: [PATCH] LibFileSystemAccessClient: Rename `Result` => `DeprecatedResult` This precedes the addition of a new `Result`, using `Core::Stream::File` instead `Core::File`. --- .../LibFileSystemAccessClient/Client.cpp | 18 +++++++++--------- .../LibFileSystemAccessClient/Client.h | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp index d689545342..dc3961797b 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp @@ -23,10 +23,10 @@ Client& Client::the() return *s_the; } -Result Client::try_request_file_read_only_approved(GUI::Window* parent_window, DeprecatedString const& path) +DeprecatedResult Client::try_request_file_read_only_approved(GUI::Window* parent_window, DeprecatedString const& path) { auto const id = get_new_id(); - m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); + m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id(); auto child_window_server_client_id = expose_window_server_client_id(); @@ -48,10 +48,10 @@ Result Client::try_request_file_read_only_approved(GUI::Window* parent_window, D return handle_promise(id); } -Result Client::try_request_file(GUI::Window* parent_window, DeprecatedString const& path, Core::OpenMode mode) +DeprecatedResult Client::try_request_file(GUI::Window* parent_window, DeprecatedString const& path, Core::OpenMode mode) { auto const id = get_new_id(); - m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); + m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id(); auto child_window_server_client_id = expose_window_server_client_id(); @@ -73,10 +73,10 @@ Result Client::try_request_file(GUI::Window* parent_window, DeprecatedString con return handle_promise(id); } -Result Client::try_open_file(GUI::Window* parent_window, DeprecatedString const& window_title, StringView path, Core::OpenMode requested_access) +DeprecatedResult Client::try_open_file(GUI::Window* parent_window, DeprecatedString const& window_title, StringView path, Core::OpenMode requested_access) { auto const id = get_new_id(); - m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); + m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id(); auto child_window_server_client_id = expose_window_server_client_id(); @@ -93,10 +93,10 @@ Result Client::try_open_file(GUI::Window* parent_window, DeprecatedString const& return handle_promise(id); } -Result Client::try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access) +DeprecatedResult Client::try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access) { auto const id = get_new_id(); - m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); + m_promises.set(id, PromiseAndWindow { Core::Promise::construct(), parent_window }); auto parent_window_server_client_id = GUI::ConnectionToWindowServer::the().expose_client_id(); auto child_window_server_client_id = expose_window_server_client_id(); @@ -166,7 +166,7 @@ int Client::get_new_id() return new_id; } -Result Client::handle_promise(int id) +DeprecatedResult Client::handle_promise(int id) { auto result = m_promises.get(id)->promise->await(); m_promises.remove(id); diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.h b/Userland/Libraries/LibFileSystemAccessClient/Client.h index dbabcc71b3..5cc4585f18 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.h +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.h @@ -18,7 +18,7 @@ namespace FileSystemAccessClient { -using Result = ErrorOr>; +using DeprecatedResult = ErrorOr>; class Client final : public IPC::ConnectionToServer @@ -26,10 +26,10 @@ class Client final IPC_CLIENT_CONNECTION(Client, "/tmp/session/%sid/portal/filesystemaccess"sv) public: - Result try_request_file_read_only_approved(GUI::Window* parent_window, DeprecatedString const& path); - Result try_request_file(GUI::Window* parent_window, DeprecatedString const& path, Core::OpenMode mode); - Result try_open_file(GUI::Window* parent_window, DeprecatedString const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), Core::OpenMode requested_access = Core::OpenMode::ReadOnly); - Result try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access = Core::OpenMode::WriteOnly | Core::OpenMode::Truncate); + DeprecatedResult try_request_file_read_only_approved(GUI::Window* parent_window, DeprecatedString const& path); + DeprecatedResult try_request_file(GUI::Window* parent_window, DeprecatedString const& path, Core::OpenMode mode); + DeprecatedResult try_open_file(GUI::Window* parent_window, DeprecatedString const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), Core::OpenMode requested_access = Core::OpenMode::ReadOnly); + DeprecatedResult try_save_file(GUI::Window* parent_window, DeprecatedString const& name, DeprecatedString const ext, Core::OpenMode requested_access = Core::OpenMode::WriteOnly | Core::OpenMode::Truncate); static Client& the(); @@ -45,10 +45,10 @@ private: virtual void handle_prompt_end(i32 request_id, i32 error, Optional const& fd, Optional const& chosen_file) override; int get_new_id(); - Result handle_promise(int); + DeprecatedResult handle_promise(int); struct PromiseAndWindow { - RefPtr> promise {}; + RefPtr> promise {}; GUI::Window* parent_window { nullptr }; };