summaryrefslogtreecommitdiff
path: root/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
diff options
context:
space:
mode:
authorTim Ledbetter <timledbetter@gmail.com>2023-01-15 14:09:10 +0000
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-15 19:19:06 +0100
commit174135f9090d85063660905933977a4f6d2eec71 (patch)
tree508c5936435dad877b80424665770ba07ededd23 /Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
parent0f831dbcc720e177e2e4fa392b096b0d59b088d3 (diff)
downloadserenity-174135f9090d85063660905933977a4f6d2eec71.zip
ClipboardHistory: Update clipboard when the topmost item is deleted
Diffstat (limited to 'Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp')
-rw-r--r--Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
index 350f7f9a78..93d3606298 100644
--- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
+++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
* Copyright (c) 2021, Mustafa Quraish <mustafa@cs.toronto.edu>
- * Copyright (c) 2022, the SerenityOS developers.
+ * Copyright (c) 2022-2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -110,6 +110,13 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
}
}
+void ClipboardHistoryModel::clipboard_content_did_change(DeprecatedString const&)
+{
+ auto data_and_type = GUI::Clipboard::the().fetch_data_and_type();
+ if (!(data_and_type.data.is_empty() && data_and_type.mime_type.is_empty() && data_and_type.metadata.is_empty()))
+ add_item(data_and_type);
+}
+
void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item)
{
m_history_items.remove_first_matching([&](ClipboardItem& existing) {