Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KDE PIM Add-ons
Commits
b62d9958
Commit
b62d9958
authored
Mar 03, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reactivate code
parent
021f8df6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
...eviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
+1
-1
plugins/messageviewerwebengineurlinterceptor/adblock/lib/adblockmatcher.cpp
...werwebengineurlinterceptor/adblock/lib/adblockmatcher.cpp
+8
-7
plugins/messageviewerwebengineurlinterceptor/adblock/lib/adblockmatcher.h
...iewerwebengineurlinterceptor/adblock/lib/adblockmatcher.h
+5
-4
No files found.
plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
View file @
b62d9958
...
...
@@ -4,7 +4,7 @@ set(adblocklibprivate_SRCS
adblockrule.cpp
qzregexp.cpp
adblockutil.cpp
#
adblockmatcher.cpp
adblockmatcher.cpp
adblocksubscription.cpp
)
...
...
plugins/messageviewerwebengineurlinterceptor/adblock/lib/adblockmatcher.cpp
View file @
b62d9958
...
...
@@ -37,11 +37,11 @@
#include "adblocksubscription.h"
using
namespace
AdBlock
;
AdBlockMatcher
::
AdBlockMatcher
(
Ad
B
lockManager
*
manager
)
AdBlockMatcher
::
AdBlockMatcher
(
Ad
b
lockManager
*
manager
)
:
QObject
(
manager
)
,
m_manager
(
manager
)
{
connect
(
manager
,
SIGNAL
(
enabledChanged
(
bool
)),
this
,
SLOT
(
enabledChanged
(
bool
)));
//FIXME
connect(manager, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool)));
}
AdBlockMatcher
::~
AdBlockMatcher
()
...
...
@@ -127,7 +127,7 @@ QString AdBlockMatcher::elementHidingRulesForDomain(const QString &domain) const
if
(
Q_UNLIKELY
(
addedRulesCount
==
1000
))
{
rules
.
append
(
rule
->
cssSelector
());
rules
.
append
(
QL
1S
(
"{display:none !important;}
\n
"
));
rules
.
append
(
QL
atin1String
(
"{display:none !important;}
\n
"
));
addedRulesCount
=
0
;
}
else
{
rules
.
append
(
rule
->
cssSelector
()
+
QLatin1Char
(
','
));
...
...
@@ -137,7 +137,7 @@ QString AdBlockMatcher::elementHidingRulesForDomain(const QString &domain) const
if
(
addedRulesCount
!=
0
)
{
rules
=
rules
.
left
(
rules
.
size
()
-
1
);
rules
.
append
(
QL
1S
(
"{display:none !important;}
\n
"
));
rules
.
append
(
QL
atin1String
(
"{display:none !important;}
\n
"
));
}
return
rules
;
...
...
@@ -149,7 +149,7 @@ void AdBlockMatcher::update()
QHash
<
QString
,
const
AdBlockRule
*>
cssRulesHash
;
QVector
<
const
AdBlockRule
*>
exceptionCssRules
;
#if 0 //FIXME
foreach (AdBlockSubscription *subscription, m_manager->subscriptions()) {
foreach (const AdBlockRule *rule, subscription->allRules()) {
// Don't add internally disabled rules to cache
...
...
@@ -215,7 +215,7 @@ void AdBlockMatcher::update()
m_domainRestrictedCssRules.append(rule);
} else if (Q_UNLIKELY(hidingRulesCount == 1000)) {
m_elementHidingRules.append(rule->cssSelector());
m_elementHidingRules
.
append
(
QL
1S
(
"{display:none !important;} "
));
m_elementHidingRules.append(QL
atin1String
("{display:none !important;} "));
hidingRulesCount = 0;
} else {
m_elementHidingRules.append(rule->cssSelector() + QLatin1Char(','));
...
...
@@ -225,8 +225,9 @@ void AdBlockMatcher::update()
if (hidingRulesCount != 0) {
m_elementHidingRules = m_elementHidingRules.left(m_elementHidingRules.size() - 1);
m_elementHidingRules
.
append
(
QL
1S
(
"{display:none !important;} "
));
m_elementHidingRules.append(QL
atin1String
("{display:none !important;} "));
}
#endif
}
void
AdBlockMatcher
::
clear
()
...
...
plugins/messageviewerwebengineurlinterceptor/adblock/lib/adblockmatcher.h
View file @
b62d9958
...
...
@@ -37,19 +37,20 @@
#include <QUrl>
#include <QObject>
#include <QVector>
#include "adblockrule.h"
#include "adblocksearchtree.h"
class
QWebEngineUrlRequestInfo
;
namespace
AdBlock
{
class
Ad
B
lockManager
;
class
Ad
b
lockManager
;
class
AdBlockMatcher
:
public
QObject
{
Q_OBJECT
public:
explicit
AdBlockMatcher
(
Ad
B
lockManager
*
manager
);
explicit
AdBlockMatcher
(
Ad
b
lockManager
*
manager
);
~
AdBlockMatcher
();
const
AdBlockRule
*
match
(
const
QWebEngineUrlRequestInfo
&
request
,
const
QString
&
urlDomain
,
const
QString
&
urlString
)
const
;
...
...
@@ -68,7 +69,7 @@ private Q_SLOTS:
void
enabledChanged
(
bool
enabled
);
private:
Ad
B
lockManager
*
m_manager
;
Ad
b
lockManager
*
m_manager
;
QVector
<
AdBlockRule
*>
m_createdRules
;
QVector
<
const
AdBlockRule
*>
m_networkExceptionRules
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment