aboutsummaryrefslogtreecommitdiff
path: root/src/blocker
diff options
context:
space:
mode:
Diffstat (limited to 'src/blocker')
-rw-r--r--src/blocker/blockermanager.cpp6
-rw-r--r--src/blocker/blockerrule.cpp6
-rw-r--r--src/blocker/blockersubscription.cpp4
-rw-r--r--src/blocker/blockersubscription.h4
4 files changed, 12 insertions, 8 deletions
diff --git a/src/blocker/blockermanager.cpp b/src/blocker/blockermanager.cpp
index 16caa98..6e3860d 100644
--- a/src/blocker/blockermanager.cpp
+++ b/src/blocker/blockermanager.cpp
@@ -33,8 +33,10 @@ BlockerManager::BlockerManager(QWidget *parent) :
{
ui->setupUi(this);
- for(QString listUrl : sSettings->value("blocker.subscriptions").toStringList()) {
- BlockerSubscription *sub = new BlockerSubscription(QUrl(listUrl), this);
+ const QStringList subscriptions = sSettings->value("blocker.subscriptions").toStringList();
+ QStringList::const_iterator i;
+ for(i = subscriptions.constBegin(); i != subscriptions.constEnd(); ++i) {
+ BlockerSubscription *sub = new BlockerSubscription(QUrl(*i), this);
m_subscriptions.append(sub);
ui->tabWidget->addTab(sub, sub->name());
}
diff --git a/src/blocker/blockerrule.cpp b/src/blocker/blockerrule.cpp
index f0bfbd6..b9c3730 100644
--- a/src/blocker/blockerrule.cpp
+++ b/src/blocker/blockerrule.cpp
@@ -54,8 +54,10 @@ BlockerRule::BlockerRule(QString rule, QObject *parent) :
QString opts = pattern.mid(pattern.indexOf("$")+1);
pattern.remove(pattern.indexOf("$"), pattern.length());
- for(QString opt : opts.split(',')) {
- parseOption(opt);
+ const QStringList optList = opts.split(',');
+ QStringList::const_iterator i;
+ for(i = optList.constBegin(); i != optList.constEnd(); ++i) {
+ parseOption(*i);
}
}
diff --git a/src/blocker/blockersubscription.cpp b/src/blocker/blockersubscription.cpp
index f5af196..ea95d57 100644
--- a/src/blocker/blockersubscription.cpp
+++ b/src/blocker/blockersubscription.cpp
@@ -70,7 +70,7 @@ BlockerSubscription::MatchResult BlockerSubscription::match(QWebEngineUrlRequest
{
MatchResult result;
- for(BlockerRule* rule : m_urlWhitelist) {
+ for(auto rule : qAsConst(m_urlWhitelist)) {
if(rule->match(info)) {
// this request is whitelisted
result.match = true;
@@ -81,7 +81,7 @@ BlockerSubscription::MatchResult BlockerSubscription::match(QWebEngineUrlRequest
}
// request is not in the whitelist
- for(BlockerRule* rule : m_urlBlacklist) {
+ for(auto rule : qAsConst(m_urlBlacklist)) {
if(rule->match(info)) {
// this request is blacklisted
result.match = true;
diff --git a/src/blocker/blockersubscription.h b/src/blocker/blockersubscription.h
index d3d2b7e..a0e051a 100644
--- a/src/blocker/blockersubscription.h
+++ b/src/blocker/blockersubscription.h
@@ -57,8 +57,8 @@ private:
QString m_name;
QUrl m_url;
- QList<BlockerRule*> m_urlWhitelist; // exception rules
- QList<BlockerRule*> m_urlBlacklist; // block rules
+ QVector<BlockerRule*> m_urlWhitelist; // exception rules
+ QVector<BlockerRule*> m_urlBlacklist; // block rules
};