mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Browser: Make removal of bookmark persistent (#1865)
Json model wasn't stored after bookmark removal. Store the model if remove() was successful.
This commit is contained in:
parent
1b2d954d47
commit
90f8a7a36b
1 changed files with 6 additions and 2 deletions
|
@ -184,8 +184,12 @@ bool BookmarksBarWidget::remove_bookmark(const String& url)
|
||||||
auto item_url = model()->data(model()->index(item_index, 1)).to_string();
|
auto item_url = model()->data(model()->index(item_index, 1)).to_string();
|
||||||
if (item_url == url) {
|
if (item_url == url) {
|
||||||
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
|
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
|
||||||
json_model.remove(item_index);
|
|
||||||
return true;
|
const auto item_removed = json_model.remove(item_index);
|
||||||
|
if (item_removed)
|
||||||
|
json_model.store();
|
||||||
|
|
||||||
|
return item_removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue