mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Browser: Update Storage Inspector's cookie model when deleting cookies
We currently get a list of cookies when the Storage Inspector is opened and never update that list when deleting cookies. This updates the inspector to actually take cookies out of the model when deleting them, rather than deleting a copy of them.
This commit is contained in:
parent
a9888d4ea0
commit
d515929134
3 changed files with 21 additions and 10 deletions
|
@ -41,18 +41,16 @@ StorageWidget::StorageWidget()
|
|||
auto delete_cookie_action = GUI::Action::create(
|
||||
"&Delete Cookie", { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto const&) {
|
||||
auto cookie_index = m_cookies_table_view->selection().first();
|
||||
delete_cookie(m_cookies_model->get_cookie(cookie_index));
|
||||
delete_cookie(m_cookies_model->take_cookie(cookie_index));
|
||||
},
|
||||
m_cookies_table_view);
|
||||
|
||||
auto delete_all_cookies_action = GUI::Action::create(
|
||||
"Delete &All Cookies", [&](auto const&) {
|
||||
auto cookie_count = m_cookies_model->row_count({});
|
||||
for (auto i = 0; i < cookie_count; ++i) {
|
||||
auto cookie_index = m_cookies_model->index(i);
|
||||
if (cookie_index.is_valid())
|
||||
delete_cookie(m_cookies_model->get_cookie(cookie_index));
|
||||
}
|
||||
auto cookies = m_cookies_model->take_all_cookies();
|
||||
|
||||
for (auto& cookie : cookies)
|
||||
delete_cookie(move(cookie));
|
||||
},
|
||||
m_cookies_table_view);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue