From b90769d526e06b7cf235ab31a8e0984070882fc6 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 21 Jun 2018 19:03:13 +0200 Subject: ProfileEditor: add Delete Session and Delete All buttons to Cookies CookiesList: delete cookies based on selectedRanges --- plugins/ProfileEditor/forms/profileview.cpp | 8 ++++--- plugins/ProfileEditor/forms/profileview.ui | 35 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/ProfileEditor/forms/profileview.cpp b/plugins/ProfileEditor/forms/profileview.cpp index 7ab8d39..6f61db1 100644 --- a/plugins/ProfileEditor/forms/profileview.cpp +++ b/plugins/ProfileEditor/forms/profileview.cpp @@ -132,13 +132,15 @@ void ProfileView::loadCookies(QWebEngineCookieStore *store) }); connect(ui->cookies_delete, &QPushButton::clicked, store, [=]() { - for(auto *item : ui->cookies->selectedItems()) { - if(item->column() == 0) { - auto cookie = item->data(Qt::UserRole).value(); + for(auto &list : ui->cookies->selectedRanges()) { + for(int i = list.bottomRow(); i >= list.topRow(); --i) { + auto cookie = ui->cookies->item(i, 0)->data(Qt::UserRole).value(); store->deleteCookie(cookie); } } }); + connect(ui->cookies_deleteSession, &QPushButton::clicked, store, &QWebEngineCookieStore::deleteSessionCookies); + connect(ui->cookies_deleteAll, &QPushButton::clicked, store, &QWebEngineCookieStore::deleteAllCookies); } void ProfileView::cookieAdded(const QNetworkCookie &cookie) diff --git a/plugins/ProfileEditor/forms/profileview.ui b/plugins/ProfileEditor/forms/profileview.ui index c1507db..6c2edda 100644 --- a/plugins/ProfileEditor/forms/profileview.ui +++ b/plugins/ProfileEditor/forms/profileview.ui @@ -465,6 +465,27 @@ + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SelectRows + + + false + + + false + + + true + + + false + Name @@ -503,6 +524,20 @@ + + + + Delete Session + + + + + + + Delete All + + + -- cgit v1.2.1