mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
AdBlockRule: Add copy() method
Faster method to copy rule than parse again the filter.
This commit is contained in:
parent
e8cddd16ea
commit
6ae0109115
@ -111,6 +111,31 @@ AdBlockRule::~AdBlockRule()
|
|||||||
delete m_regExp;
|
delete m_regExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdBlockRule* AdBlockRule::copy() const
|
||||||
|
{
|
||||||
|
AdBlockRule* rule = new AdBlockRule();
|
||||||
|
rule->m_subscription = m_subscription;
|
||||||
|
rule->m_type = m_type;
|
||||||
|
rule->m_options = m_options;
|
||||||
|
rule->m_exceptions = m_exceptions;
|
||||||
|
rule->m_filter = m_filter;
|
||||||
|
rule->m_matchString = m_matchString;
|
||||||
|
rule->m_caseSensitivity = m_caseSensitivity;
|
||||||
|
rule->m_isEnabled = m_isEnabled;
|
||||||
|
rule->m_isException = m_isException;
|
||||||
|
rule->m_isInternalDisabled = m_isInternalDisabled;
|
||||||
|
rule->m_allowedDomains = m_allowedDomains;
|
||||||
|
rule->m_blockedDomains = m_blockedDomains;
|
||||||
|
|
||||||
|
if (m_regExp) {
|
||||||
|
rule->m_regExp = new RegExp;
|
||||||
|
rule->m_regExp->regExp = m_regExp->regExp;
|
||||||
|
rule->m_regExp->matchers = m_regExp->matchers;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
AdBlockSubscription* AdBlockRule::subscription() const
|
AdBlockSubscription* AdBlockRule::subscription() const
|
||||||
{
|
{
|
||||||
return m_subscription;
|
return m_subscription;
|
||||||
|
@ -64,6 +64,8 @@ public:
|
|||||||
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
|
||||||
~AdBlockRule();
|
~AdBlockRule();
|
||||||
|
|
||||||
|
AdBlockRule* copy() const;
|
||||||
|
|
||||||
AdBlockSubscription* subscription() const;
|
AdBlockSubscription* subscription() const;
|
||||||
void setSubscription(AdBlockSubscription* subscription);
|
void setSubscription(AdBlockSubscription* subscription);
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ void AdBlockSubscription::populateCache()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockRule* copiedRule = new AdBlockRule(originalRule->filter());
|
AdBlockRule* copiedRule = originalRule->copy();
|
||||||
copiedRule->m_options |= AdBlockRule::DomainRestrictedOption;
|
copiedRule->m_options |= AdBlockRule::DomainRestrictedOption;
|
||||||
copiedRule->m_blockedDomains.append(rule->m_allowedDomains);
|
copiedRule->m_blockedDomains.append(rule->m_allowedDomains);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user