mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:47:46 +00:00
SpiceAgent: Handle file transfer requests properly :^)
Now, we write the data recieved to a file when the user drags a file onto the Spice Viewer window. Once complete, the FileExplorer will open with the copied file highlighted.
This commit is contained in:
parent
d87f823a68
commit
0f3f190a5a
6 changed files with 215 additions and 2 deletions
|
@ -6,7 +6,10 @@
|
|||
*/
|
||||
|
||||
#include "SpiceAgent.h"
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
|
@ -20,11 +23,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// We use the application to be able to easily write to the user's clipboard.
|
||||
auto app = TRY(GUI::Application::create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory())));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
// FIXME: Make Core::File support reading and writing, but without creating:
|
||||
// By default, Core::File opens the file descriptor with O_CREAT when using OpenMode::Write (and subsequently, OpenMode::ReadWrite).
|
||||
// To minimise confusion for people that have already used Core::File, we can probably just do `OpenMode::ReadWrite | OpenMode::DontCreate`.
|
||||
TRY(Core::System::pledge("unix rpath wpath stdio sendfd recvfd cpath"));
|
||||
TRY(Core::System::unveil(SPICE_DEVICE, "rwc"sv));
|
||||
TRY(Core::System::unveil(Core::StandardPaths::downloads_directory(), "rwc"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto agent = TRY(SpiceAgent::SpiceAgent::create(SPICE_DEVICE));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue