summaryrefslogtreecommitdiff
path: root/src/adblock
diff options
context:
space:
mode:
Diffstat (limited to 'src/adblock')
-rw-r--r--src/adblock/adblockmanager.cpp5
-rw-r--r--src/adblock/blockedelementswidget.cpp25
-rw-r--r--src/adblock/blockedelementswidget.h4
3 files changed, 25 insertions, 9 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index 39040767..b5739144 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -425,6 +425,11 @@ void AdBlockManager::showBlockedItemDialog()
dialog->setMainWidget(&widget);
dialog->exec();
+ Q_FOREACH(const QString &r, widget.rulesToAdd())
+ {
+ addCustomRule(r);
+ }
+
if (widget.pageNeedsReload())
emit reloadCurrentPage();
diff --git a/src/adblock/blockedelementswidget.cpp b/src/adblock/blockedelementswidget.cpp
index 58b96299..8c02134f 100644
--- a/src/adblock/blockedelementswidget.cpp
+++ b/src/adblock/blockedelementswidget.cpp
@@ -92,18 +92,25 @@ void BlockedElementsWidget::unblockElement()
if (!buttonClicked)
return;
- QString newText = i18n("Unblocked");
- if (buttonClicked->text() == newText)
- return;
-
- QString urlString = buttonClicked->property("URLTOUNBLOCK").toString();
+ QString urlString = QL1S("@@") + buttonClicked->property("URLTOUNBLOCK").toString();
kDebug() << "urlString: " << urlString;
- buttonClicked->setText(newText);
- buttonClicked->setIcon(KIcon("dialog-ok"));
+ QString newText = i18n("Unblocked");
+ QString buttonText = buttonClicked->text().remove('&');
+ if (buttonText == newText)
+ {
+ buttonClicked->setText(i18n("Unblock"));
+ buttonClicked->setIcon(KIcon("dialog-ok-apply"));
- AdBlockManager *m = qobject_cast<AdBlockManager *>(_manager);
- m->addCustomRule(QL1S("@@") + urlString, false);
+ _rulesToAdd.removeOne(urlString);
+ }
+ else
+ {
+ buttonClicked->setText(newText);
+ buttonClicked->setIcon(KIcon("dialog-ok"));
+ _rulesToAdd << urlString;
+ }
+
_reloadPage = true;
}
diff --git a/src/adblock/blockedelementswidget.h b/src/adblock/blockedelementswidget.h
index d1b0b387..c796be87 100644
--- a/src/adblock/blockedelementswidget.h
+++ b/src/adblock/blockedelementswidget.h
@@ -49,13 +49,17 @@ public:
void setHidedElements(int);
bool pageNeedsReload() { return _reloadPage; };
+
+ QStringList rulesToAdd() { return _rulesToAdd; };
private Q_SLOTS:
void unblockElement();
private:
QObject *_manager;
+
bool _reloadPage;
+ QStringList _rulesToAdd;
};
#endif // BLOCKED_ELEMENTS_WIDGET_H