コード例 #1
0
const AdBlockRule* AdBlockSubscription::disableRule(int offset)
{
    if (!QzTools::vectorContainsIndex(m_rules, offset)) {
        return 0;
    }

    AdBlockRule* rule = m_rules[offset];
    rule->setEnabled(false);
    AdBlockManager::instance()->addDisabledRule(rule->filter());

    if (rule->isCssRule()) {
        populateCache();
        mApp->reloadUserStyleSheet();
    }

    return rule;
}
コード例 #2
0
const AdBlockRule* AdBlockSubscription::enableRule(int offset)
{
    if (!QzTools::containsIndex(m_rules, offset)) {
        return 0;
    }

    AdBlockRule* rule = m_rules[offset];
    rule->setEnabled(true);
    AdBlockManager::instance()->removeDisabledRule(rule->filter());

    emit subscriptionChanged();

    if (rule->isCssRule())
        mApp->reloadUserStyleSheet();

    return rule;
}