From d340be4b27b9067c0057b20f6bd0228f03c994c6 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 17 Jun 2018 19:50:56 +0200 Subject: WebProfile: cache a list of cookies ProfileView: delete selected items rather than current item Browser: store profiles in QMap instead of QHash --- plugins/ProfileEditor/forms/profileview.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'plugins/ProfileEditor') diff --git a/plugins/ProfileEditor/forms/profileview.cpp b/plugins/ProfileEditor/forms/profileview.cpp index f2e74ad..7ab8d39 100644 --- a/plugins/ProfileEditor/forms/profileview.cpp +++ b/plugins/ProfileEditor/forms/profileview.cpp @@ -71,6 +71,9 @@ ProfileView::ProfileView(WebProfile *profile, QWidget *parent) // cookies tab loadCookies(profile->cookieStore()); + for(const auto &c : profile->cookies()) { + cookieAdded(c); + } } ProfileView::~ProfileView() @@ -129,11 +132,13 @@ void ProfileView::loadCookies(QWebEngineCookieStore *store) }); connect(ui->cookies_delete, &QPushButton::clicked, store, [=]() { - auto index = ui->cookies->currentRow(); - auto cookie = ui->cookies->item(index, 0)->data(Qt::UserRole).value(); - store->deleteCookie(cookie); + for(auto *item : ui->cookies->selectedItems()) { + if(item->column() == 0) { + auto cookie = item->data(Qt::UserRole).value(); + store->deleteCookie(cookie); + } + } }); - } void ProfileView::cookieAdded(const QNetworkCookie &cookie) -- cgit v1.2.1