mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
ClipboardHistory: Listen for configuration changes
Resize the clipboard history size dynamically by listening for config changes. This is currently not ideal since we don't have the callbacks for `Config::Listener::config_i32_did_change`, so for now we are just taking the string and attempting to convert it to an int.
This commit is contained in:
parent
b1a3bb638b
commit
441e601689
3 changed files with 28 additions and 2 deletions
|
@ -8,11 +8,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibConfig/Listener.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
||||
class ClipboardHistoryModel final : public GUI::Model
|
||||
, public GUI::Clipboard::ClipboardClient {
|
||||
, public GUI::Clipboard::ClipboardClient
|
||||
, public Config::Listener {
|
||||
public:
|
||||
static NonnullRefPtr<ClipboardHistoryModel> create();
|
||||
|
||||
|
@ -28,6 +30,9 @@ public:
|
|||
const GUI::Clipboard::DataAndType& item_at(int index) const { return m_history_items[index]; }
|
||||
void remove_item(int index);
|
||||
|
||||
// ^Config::Listener
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
||||
|
||||
private:
|
||||
ClipboardHistoryModel();
|
||||
void add_item(const GUI::Clipboard::DataAndType& item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue