diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/adblock/adblockelementhiding.cpp | 2 | ||||
-rw-r--r-- | src/adblock/adblockelementhiding.h | 2 | ||||
-rw-r--r-- | src/adblock/adblocksettingwidget.cpp | 11 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/adblock/adblockelementhiding.cpp b/src/adblock/adblockelementhiding.cpp index bac693cb..d284975c 100644 --- a/src/adblock/adblockelementhiding.cpp +++ b/src/adblock/adblockelementhiding.cpp @@ -65,7 +65,7 @@ bool AdBlockElementHiding::addRule(const QString &rule) return true; } -void AdBlockElementHiding::apply(QWebElement &document, QString domain) const +void AdBlockElementHiding::apply(QWebElement &document, const QString &domain) const { //first apply generic rules diff --git a/src/adblock/adblockelementhiding.h b/src/adblock/adblockelementhiding.h index b480277e..032420f9 100644 --- a/src/adblock/adblockelementhiding.h +++ b/src/adblock/adblockelementhiding.h @@ -36,7 +36,7 @@ public: AdBlockElementHiding(); bool addRule(const QString &rule); - void apply(QWebElement &document, QString domain) const; + void apply(QWebElement &document, const QString &domain) const; void clear(); diff --git a/src/adblock/adblocksettingwidget.cpp b/src/adblock/adblocksettingwidget.cpp index 3f3af557..88eaa549 100644 --- a/src/adblock/adblocksettingwidget.cpp +++ b/src/adblock/adblocksettingwidget.cpp @@ -67,7 +67,6 @@ AdBlockSettingWidget::AdBlockSettingWidget(KSharedConfig::Ptr config, QWidget *p spinBox->setSuffix(ki18np(" day", " days")); // emit changed signal - connect(insertButton, 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())); @@ -94,12 +93,20 @@ void AdBlockSettingWidget::slotInfoLinkActivated(const QString &url) void AdBlockSettingWidget::insertRule() { - QString rule = addFilterLineEdit->text(); + const QString rule = addFilterLineEdit->text(); if (rule.isEmpty()) return; + const int numberItem(manualFiltersListWidget->count()); + for (int i = 0; i < numberItem; ++i) { + if (manualFiltersListWidget->item(i)->text() == rule) { + addFilterLineEdit->clear(); + return; + } + } manualFiltersListWidget->addItem(rule); addFilterLineEdit->clear(); + hasChanged(); } |