diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-12-02 11:42:10 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-12-02 11:42:10 +0100 |
commit | 9a25b11cc97f453b4c82d68c76a8c4026fd62b21 (patch) | |
tree | b94c77619f84ff57cf4c01e3110871f07df27da5 /src/adblock | |
parent | rekonq 0.3.18 (diff) | |
download | rekonq-9a25b11cc97f453b4c82d68c76a8c4026fd62b21.tar.xz |
trade-off: speed vs mem saving.
This time I decided for speed..
Diffstat (limited to 'src/adblock')
-rw-r--r-- | src/adblock/adblockmanager.cpp | 24 | ||||
-rw-r--r-- | src/adblock/adblockmanager.h | 6 | ||||
-rw-r--r-- | src/adblock/adblockrule.h | 1 |
3 files changed, 9 insertions, 22 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index 4f4cff51..bfdbd5ad 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -30,7 +30,6 @@ // Local Includes #include "adblocknetworkreply.h" -#include "adblockrule.h" // KDE Includes #include <KSharedConfig> @@ -76,7 +75,8 @@ void AdBlockManager::loadSettings() if (name.startsWith(QLatin1String("Filter"))) { - filterList << url; + AdBlockRule filter(url); + filterList << filter; } } } @@ -95,30 +95,14 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request) QString urlString = request.url().toString(); kDebug() << "****************************** ADBLOCK: Matching url: "<< urlString; - foreach(const QString &filter, filterList) + foreach(const AdBlockRule &filter, filterList) { - AdBlockRule rule(filter); - if(rule.match(urlString)) + if(filter.match(urlString)) { kDebug() << "****ADBLOCK: Matched: **************************"; AdBlockNetworkReply *reply = new AdBlockNetworkReply(request, urlString, this); return reply; } } - - - - // Check the blacklist, and only if that matches, the whitelist - - - - - -// if(_adBlackList.isUrlMatched(urlString) && !_adWhiteList.isUrlMatched(urlString)) -// { -// kDebug() << "****ADBLOCK: Matched: **************************"; -// AdBlockNetworkReply *reply = new AdBlockNetworkReply(request, urlString, this); -// return reply; -// } return 0; } diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h index 32f123fd..499a0cde 100644 --- a/src/adblock/adblockmanager.h +++ b/src/adblock/adblockmanager.h @@ -28,10 +28,12 @@ #ifndef ADBLOCK_MANAGER_H #define ADBLOCK_MANAGER_H +// Local Includes +#include "adblockrule.h" +typedef QList<AdBlockRule> AdBlockRuleList; // Qt Includes #include <QObject> -#include <QStringList> #include <QNetworkReply> // Forward Includes @@ -53,7 +55,7 @@ private: bool _isAdblockEnabled; bool _isHideAdsEnabled; - QStringList filterList; + AdBlockRuleList filterList; }; #endif diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h index 3f1bd8bf..8680942f 100644 --- a/src/adblock/adblockrule.h +++ b/src/adblock/adblockrule.h @@ -79,4 +79,5 @@ private: QStringList m_options; }; + #endif // ADBLOCKRULE_H |