summaryrefslogtreecommitdiff
path: root/src/adblock/blockedelementswidget.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-03-06 11:16:04 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-03-13 10:24:42 +0100
commit6f072c5dfcac294a12283d4ba93e22d50df9c660 (patch)
tree76b4e27b03bf9976a66cd5bc02462851b9e659f4 /src/adblock/blockedelementswidget.cpp
parentClean up adblock manager code and fix unblock feature (diff)
downloadrekonq-6f072c5dfcac294a12283d4ba93e22d50df9c660.tar.xz
Let user change his mind enabling block/unblock
Diffstat (limited to 'src/adblock/blockedelementswidget.cpp')
-rw-r--r--src/adblock/blockedelementswidget.cpp25
1 files changed, 16 insertions, 9 deletions
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;
}