From 6820f9e14f2bcf542595b29e3d3e6ea28a8b7025 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 8 Mar 2019 13:27:19 +0100 Subject: WindowServer+LibGUI: Add a server-side clipboard. On the client side, use GClipboard's data() and set_data(String) to access the global clipboard. :^) --- Applications/TextEditor/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Applications/TextEditor/main.cpp') diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp index 84b474cf04..9200794c22 100644 --- a/Applications/TextEditor/main.cpp +++ b/Applications/TextEditor/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -83,11 +84,14 @@ int main(int argc, char** argv) }); auto copy_action = GAction::create("Copy", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/copyfile16.rgb", { 16, 16 }), [&] (const GAction&) { - printf("Copy: \"%s\"\n", text_editor->selected_text().characters()); + auto selected_text = text_editor->selected_text(); + printf("Copy: \"%s\"\n", selected_text.characters()); + GClipboard::the().set_data(selected_text); }); auto paste_action = GAction::create("Paste", { Mod_Ctrl, Key_V }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/paste16.rgb", { 16, 16 }), [&] (const GAction&) { - dbgprintf("FIXME: Implement Edit/Paste"); + auto paste_text = GClipboard::the().data(); + printf("Paste: \"%s\"\n", paste_text.characters()); }); auto menubar = make(); -- cgit v1.2.3