summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2013-10-01 08:04:36 +0200
committerMontel Laurent <montel@kde.org>2013-10-01 08:04:36 +0200
commit1e925a3ec0efb342a1044c0b1273704a83ee1144 (patch)
tree9684b0b901d8e5bdd0931baaf6d98d49dd3c9fbf
parentAllow to dnd manual filter. (diff)
downloadrekonq-1e925a3ec0efb342a1044c0b1273704a83ee1144.tar.xz
Allow to remove multi manual filters. Send hasChanged when necessary
-rw-r--r--src/adblock/adblocksettingwidget.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/adblock/adblocksettingwidget.cpp b/src/adblock/adblocksettingwidget.cpp
index a55ee506..3f3af557 100644
--- a/src/adblock/adblocksettingwidget.cpp
+++ b/src/adblock/adblocksettingwidget.cpp
@@ -52,7 +52,7 @@ AdBlockSettingWidget::AdBlockSettingWidget(KSharedConfig::Ptr config, QWidget *p
hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"));
connect(hintLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotInfoLinkActivated(QString)));
- manualFiltersListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+ manualFiltersListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
searchLine->setListWidget(manualFiltersListWidget);
@@ -68,7 +68,6 @@ AdBlockSettingWidget::AdBlockSettingWidget(KSharedConfig::Ptr config, QWidget *p
// emit changed signal
connect(insertButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
- connect(removeButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
connect(checkEnableAdblock, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
connect(checkHideAds, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(hasChanged()));
@@ -106,7 +105,14 @@ void AdBlockSettingWidget::insertRule()
void AdBlockSettingWidget::removeRule()
{
- delete manualFiltersListWidget->takeItem(manualFiltersListWidget->currentRow());
+ QList<QListWidgetItem *> select = manualFiltersListWidget->selectedItems();
+ if (select.isEmpty()) {
+ return;
+ }
+ Q_FOREACH (QListWidgetItem *item, select) {
+ delete item;
+ }
+ hasChanged();
}