summaryrefslogtreecommitdiff
path: root/src/adblock/adblockmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-02-13 22:48:51 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-03-13 10:24:42 +0100
commit908a1dbfb08c30ae2a92ce7f6e36a9e88e8b5d09 (patch)
treec9bcf7d01b3553ad934bea9e1279a02e409accfb /src/adblock/adblockmanager.cpp
parentAdd adblock icon to inform users that some contents was hidden (diff)
downloadrekonq-908a1dbfb08c30ae2a92ce7f6e36a9e88e8b5d09.tar.xz
Let rekonq block sparse images (this idea has been copied from Arora)
Diffstat (limited to 'src/adblock/adblockmanager.cpp')
-rw-r--r--src/adblock/adblockmanager.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index b435d437..27fb4020 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -62,6 +62,12 @@ AdBlockManager::~AdBlockManager()
}
+bool AdBlockManager::isEnabled()
+{
+ return _isAdblockEnabled;
+}
+
+
void AdBlockManager::loadSettings()
{
// first, check this...
@@ -347,3 +353,26 @@ void AdBlockManager::showSettings()
dialog->deleteLater();
}
+
+
+void AdBlockManager::addCustomRule(const QString &stringRule)
+{
+ // save rule in local filters
+ QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local"));
+
+ QFile ruleFile(localRulesFilePath);
+ if (!ruleFile.open(QFile::WriteOnly | QFile::Text))
+ {
+ kDebug() << "Unable to open rule file" << localRulesFilePath;
+ return;
+ }
+
+ QTextStream out(&ruleFile);
+ out << stringRule << '\n';
+
+ // load it
+ AdBlockRule rule(stringRule);
+ _blackList << rule;
+
+ // TODO: update page?
+}