1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 19:27:35 +00:00

LibFileSystemAccessClient: Rename Result => DeprecatedResult

This precedes the addition of a new `Result`, using `Core::Stream::File`
instead `Core::File`.
This commit is contained in:
Lucas CHOLLET 2022-12-07 22:51:37 +01:00 committed by Linus Groh
parent 806a55eda1
commit c71fc0683f
2 changed files with 16 additions and 16 deletions

View file

@ -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<Result>::construct(), parent_window });
m_promises.set(id, PromiseAndWindow { Core::Promise<DeprecatedResult>::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<Result>::construct(), parent_window });
m_promises.set(id, PromiseAndWindow { Core::Promise<DeprecatedResult>::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<Result>::construct(), parent_window });
m_promises.set(id, PromiseAndWindow { Core::Promise<DeprecatedResult>::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<Result>::construct(), parent_window });
m_promises.set(id, PromiseAndWindow { Core::Promise<DeprecatedResult>::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);

View file

@ -18,7 +18,7 @@
namespace FileSystemAccessClient {
using Result = ErrorOr<NonnullRefPtr<Core::File>>;
using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::File>>;
class Client final
: public IPC::ConnectionToServer<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>
@ -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<IPC::File> const& fd, Optional<DeprecatedString> const& chosen_file) override;
int get_new_id();
Result handle_promise(int);
DeprecatedResult handle_promise(int);
struct PromiseAndWindow {
RefPtr<Core::Promise<Result>> promise {};
RefPtr<Core::Promise<DeprecatedResult>> promise {};
GUI::Window* parent_window { nullptr };
};