diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2021-05-10 19:03:55 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-10 19:09:53 +0100 |
commit | f15f03376b58eb24a978330e8e1a0e0b431f463c (patch) | |
tree | a3bef5ae8cc03d8f8eb4c53466397c82015be32b | |
parent | e81d35995e8b3811be7436e5579ed6cec2bf0022 (diff) | |
download | serenity-f15f03376b58eb24a978330e8e1a0e0b431f463c.zip |
LibGUI: Add Clipboard::clear()
Does exactly what it says on the tin :^)
-rw-r--r-- | Userland/Libraries/LibGUI/Clipboard.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Clipboard.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index d1f51b7794..844f7adaf1 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -78,6 +78,11 @@ void Clipboard::set_data(ReadonlyBytes data, const String& type, const HashMap<S connection().async_set_clipboard_data(move(buffer), type, metadata); } +void Clipboard::clear() +{ + connection().async_set_clipboard_data({}, {}, {}); +} + void ClipboardServerConnection::clipboard_data_changed(String const& mime_type) { auto& clipboard = Clipboard::the(); diff --git a/Userland/Libraries/LibGUI/Clipboard.h b/Userland/Libraries/LibGUI/Clipboard.h index 178afaff99..47627cd84c 100644 --- a/Userland/Libraries/LibGUI/Clipboard.h +++ b/Userland/Libraries/LibGUI/Clipboard.h @@ -22,6 +22,7 @@ public: ByteBuffer data() const { return data_and_type().data; } String mime_type() const { return data_and_type().mime_type; } void set_data(ReadonlyBytes, const String& mime_type = "text/plain", const HashMap<String, String>& metadata = {}); + void clear(); void set_plain_text(const String& text) { |