mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
CookieManager: Add support for selecting more than one cookie at once
Summary: When manually cleaning cookies, it is very convenient to be able to delete a bunch of them at once, when we do not want to delete all cookies. Reviewers: #falkon, drosca Reviewed By: #falkon, drosca Subscribers: falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D24967
This commit is contained in:
parent
8f2cf86117
commit
7b404e73a8
|
@ -119,22 +119,22 @@ void CookieManager::removeAll()
|
|||
|
||||
void CookieManager::remove()
|
||||
{
|
||||
QTreeWidgetItem* current = ui->cookieTree->currentItem();
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QNetworkCookie> cookies;
|
||||
auto selection = ui->cookieTree->selectedItems();
|
||||
|
||||
if (current->childCount()) {
|
||||
for (int i = 0; i < current->childCount(); ++i) {
|
||||
QTreeWidgetItem *item = current->child(i);
|
||||
if (item && m_itemHash.contains(item)) {
|
||||
cookies.append(m_itemHash.value(item));
|
||||
for (int i = 0; i < selection.count(); i++) {
|
||||
QTreeWidgetItem* current = selection[i];
|
||||
|
||||
if (current->childCount()) {
|
||||
for (int i = 0; i < current->childCount(); ++i) {
|
||||
QTreeWidgetItem *item = current->child(i);
|
||||
if (item && m_itemHash.contains(item)) {
|
||||
cookies.append(m_itemHash.value(item));
|
||||
}
|
||||
}
|
||||
} else if (m_itemHash.contains(current)) {
|
||||
cookies.append(m_itemHash.value(current));
|
||||
}
|
||||
} else if (m_itemHash.contains(current)) {
|
||||
cookies.append(m_itemHash.value(current));
|
||||
}
|
||||
|
||||
foreach (const QNetworkCookie &cookie, cookies) {
|
||||
|
@ -157,6 +157,16 @@ void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem
|
|||
ui->secure->setText(tr("<cookie not selected>"));
|
||||
ui->expiration->setText(tr("<cookie not selected>"));
|
||||
|
||||
ui->removeOne->setText(tr("Remove cookies"));
|
||||
return;
|
||||
} else if (ui->cookieTree->selectedItems().count() > 1) {
|
||||
ui->name->setText(tr("<multiple cookies selected>"));
|
||||
ui->value->setText(tr("<multiple cookies selected>"));
|
||||
ui->server->setText(tr("<multiple cookies selected>"));
|
||||
ui->path->setText(tr("<multiple cookies selected>"));
|
||||
ui->secure->setText(tr("<multiple cookies selected>"));
|
||||
ui->expiration->setText(tr("<multiple cookies selected>"));
|
||||
|
||||
ui->removeOne->setText(tr("Remove cookies"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="TreeWidget" name="cookieTree">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
Loading…
Reference in New Issue
Block a user