mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
ClipboardHistory: Ensure model is populated on startup
This ensures that, if the applet restarts, it will remain in sync with the clipboard.
This commit is contained in:
parent
174135f909
commit
944c43a8b4
2 changed files with 6 additions and 1 deletions
|
@ -35,6 +35,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto table_view = TRY(main_window->set_main_widget<GUI::TableView>());
|
||||
auto model = ClipboardHistoryModel::create();
|
||||
|
||||
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()))
|
||||
model->add_item(data_and_type);
|
||||
|
||||
table_view->set_model(model);
|
||||
|
||||
table_view->on_activation = [&](GUI::ModelIndex const& index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue