aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-21 19:03:13 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-21 19:03:13 +0200
commitb90769d526e06b7cf235ab31a8e0984070882fc6 (patch)
treea65f19c8699d43f6b8e75a9f23f3490f8e8a50c1 /plugins
parentAdd Browser::about (diff)
downloadsmolbote-b90769d526e06b7cf235ab31a8e0984070882fc6.tar.xz
ProfileEditor: add Delete Session and Delete All buttons to Cookies
CookiesList: delete cookies based on selectedRanges
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ProfileEditor/forms/profileview.cpp8
-rw-r--r--plugins/ProfileEditor/forms/profileview.ui35
2 files changed, 40 insertions, 3 deletions
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<QNetworkCookie>();
+ 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<QNetworkCookie>();
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 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="cookies">
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
<column>
<property name="text">
<string>Name</string>
@@ -504,6 +525,20 @@
</widget>
</item>
<item>
+ <widget class="QPushButton" name="cookies_deleteSession">
+ <property name="text">
+ <string>Delete Session</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cookies_deleteAll">
+ <property name="text">
+ <string>Delete All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>