mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:18:12 +00:00
ClipboardHistory: Update clipboard when the topmost item is deleted
This commit is contained in:
parent
0f831dbcc7
commit
174135f909
3 changed files with 19 additions and 4 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue