1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-14 10:32:09 +00:00
serenity/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h
thankyouverycool 7323a54e59 LibGUI+FileSystemAccessServer: Avoid using dummy windows
Creates two new gatekept helpers for FilePicker and MessageBox to be
used by FSAS to replace the "dummy window" approach to centering
Dialogs. There was a slight delay in creating two windows, one a
transparent intermediary hidden behind the second, to display FSAS
Dialogs. Now we only need to make the window we actually see.
2023-05-15 12:15:39 +02:00

49 lines
1.7 KiB
C++

/*
* Copyright (c) 2021, timmot <tiwwot@protonmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashMap.h>
#include <FileSystemAccessServer/FileSystemAccessClientEndpoint.h>
#include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h>
#include <LibCore/Forward.h>
#include <LibGUI/FileTypeFilter.h>
#include <LibGUI/Forward.h>
#include <LibIPC/ConnectionFromClient.h>
namespace FileSystemAccessServer {
class ConnectionFromClient final
: public IPC::ConnectionFromClient<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint> {
C_OBJECT(ConnectionFromClient);
public:
~ConnectionFromClient() override = default;
virtual void die() override;
private:
explicit ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket>);
virtual void request_file_read_only_approved(i32, i32, i32, DeprecatedString const&) override;
virtual void request_file(i32, i32, i32, DeprecatedString const&, Core::File::OpenMode) override;
virtual void prompt_open_file(i32, i32, i32, DeprecatedString const&, DeprecatedString const&, Core::File::OpenMode, Optional<Vector<GUI::FileTypeFilter>> const&) override;
virtual void prompt_save_file(i32, i32, i32, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Core::File::OpenMode) override;
void prompt_helper(i32, Optional<DeprecatedString> const&, Core::File::OpenMode);
enum class ShouldPrompt {
No,
Yes
};
void request_file_handler(i32, i32, i32, DeprecatedString const&, Core::File::OpenMode, ShouldPrompt);
virtual Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse expose_window_server_client_id() override;
HashMap<DeprecatedString, Core::File::OpenMode> m_approved_files;
};
}