# eric6.Helpviewer.AdBlock.AdBlockManager

Module implementing the AdBlock manager.

### Global Attributes

None

### Classes

AdBlockManager | Class implementing the AdBlock manager.

### Functions

None

## AdBlockManager

Class implementing the AdBlock manager.

### Signals

rulesChanged()
  emitted after some rule has changed

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

AdBlockManager | Constructor
__customSubscriptionLocation | Private method to generate the path for custom subscriptions.
__customSubscriptionUrl | Private method to generate the URL for custom subscriptions.
__loadSubscriptions | Private method to load the set of subscriptions.
addException | Public method to add an exception.
addSubscription | Public method to add an AdBlock subscription.
close | Public method to close the open search engines manager.
customRules | Public method to get a subscription for custom rules.
elementHidingRules | Public method to get the element hiding rules.
elementHidingRulesForDomain | Public method to get the element hiding rules for a domain.
exceptions | Public method to get a list of excepted hosts.
getRequiresSubscriptions | Public method to get a list of subscriptions, that require the given one.
isEnabled | Public method to check, if blocking ads is enabled.
isHostExcepted | Public slot to check, if a host is excepted.
load | Public method to load the AdBlock subscriptions.
loadRequiredSubscription | Public method to load a subscription required by another one.
network | Public method to get a reference to the network block object.
page | Public method to get a reference to the page block object.
removeException | Public method to remove an exception.
removeSubscription | Public method to remove an AdBlock subscription.
save | Public method to save the AdBlock subscriptions.
setEnabled | Public slot to set the enabled state.
setExceptions | Public method to set the list of excepted hosts.
showDialog | Public slot to show the AdBlock subscription management dialog.
showExceptionsDialog | Public method to show the AdBlock Exceptions dialog.
showRule | Public slot to show an AdBlock rule.
subscription | Public method to get a subscription based on its location.
subscriptions | Public method to get all subscriptions.
updateAllSubscriptions | Public method to update all subscriptions.

### Static Methods

None

#### AdBlockManager (Constructor)

AdBlockManager(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### AdBlockManager.__customSubscriptionLocation

__customSubscriptionLocation()

Private method to generate the path for custom subscriptions.

Returns:
  URL for custom subscriptions (QUrl)

#### AdBlockManager.__customSubscriptionUrl

__customSubscriptionUrl()

Private method to generate the URL for custom subscriptions.

Returns:
  URL for custom subscriptions (QUrl)

#### AdBlockManager.__loadSubscriptions

__loadSubscriptions()

Private method to load the set of subscriptions.

#### AdBlockManager.addException

addException(host)

Public method to add an exception.

host
  to be excepted (string)

#### AdBlockManager.addSubscription

addSubscription(subscription)

Public method to add an AdBlock subscription.

subscription
  AdBlock subscription to be added (AdBlockSubscription)

#### AdBlockManager.close

close()

Public method to close the open search engines manager.

#### AdBlockManager.customRules

customRules()

Public method to get a subscription for custom rules.

Returns:
  subscription object for custom rules (AdBlockSubscription)

#### AdBlockManager.elementHidingRules

elementHidingRules()

Public method to get the element hiding rules.

Returns:
  element hiding rules (string)

#### AdBlockManager.elementHidingRulesForDomain

elementHidingRulesForDomain(url)

Public method to get the element hiding rules for a domain.

url
  URL to get hiding rules for (QUrl)

Returns:
  element hiding rules (string)

#### AdBlockManager.exceptions

exceptions()

Public method to get a list of excepted hosts.

Returns:
  list of excepted hosts (list of string)

#### AdBlockManager.getRequiresSubscriptions

getRequiresSubscriptions(subscription)

Public method to get a list of subscriptions, that require the given one.

subscription
  subscription to check for (AdBlockSubscription)

Returns:
  list of subscription requiring the given one (list of AdBlockSubscription)

#### AdBlockManager.isEnabled

isEnabled()

Public method to check, if blocking ads is enabled.

Returns:
  flag indicating the enabled state (boolean)

#### AdBlockManager.isHostExcepted

isHostExcepted(host)

Public slot to check, if a host is excepted.

host
  host to check (string)

Returns:
  flag indicating an exception (boolean)

#### AdBlockManager.load

load()

Public method to load the AdBlock subscriptions.

#### AdBlockManager.loadRequiredSubscription

loadRequiredSubscription(location, title)

Public method to load a subscription required by another one.

location
  location of the required subscription (string)
title
  title of the required subscription (string)

#### AdBlockManager.network

network()

Public method to get a reference to the network block object.

Returns:
  reference to the network block object (AdBlockNetwork)

#### AdBlockManager.page

page()

Public method to get a reference to the page block object.

Returns:
  reference to the page block object (AdBlockPage)

#### AdBlockManager.removeException

removeException(host)

Public method to remove an exception.

host
  to be removed from the list of exceptions (string)

#### AdBlockManager.removeSubscription

removeSubscription(subscription, emitSignal=True)

Public method to remove an AdBlock subscription.

subscription
  AdBlock subscription to be removed (AdBlockSubscription)
emitSignal
  flag indicating to send a signal (boolean)

#### AdBlockManager.save

save()

Public method to save the AdBlock subscriptions.

#### AdBlockManager.setEnabled

setEnabled(enabled)

Public slot to set the enabled state.

enabled
  flag indicating the enabled state (boolean)

#### AdBlockManager.setExceptions

setExceptions(hosts)

Public method to set the list of excepted hosts.

hosts
  list of excepted hosts (list of string)

#### AdBlockManager.showDialog

showDialog()

Public slot to show the AdBlock subscription management dialog.

Returns:
  reference to the dialog (AdBlockDialog)

#### AdBlockManager.showExceptionsDialog

showExceptionsDialog()

Public method to show the AdBlock Exceptions dialog.

Returns:
  reference to the exceptions dialog (AdBlockExceptionsDialog)

#### AdBlockManager.showRule

showRule()

Public slot to show an AdBlock rule.

#### AdBlockManager.subscription

subscription(location)

Public method to get a subscription based on its location.

location
  location of the subscription to search for (string)

Returns:
  subscription or None (AdBlockSubscription)

#### AdBlockManager.subscriptions

subscriptions()

Public method to get all subscriptions.

Returns:
  list of subscriptions (list of AdBlockSubscription)

#### AdBlockManager.updateAllSubscriptions

updateAllSubscriptions()

Public method to update all subscriptions.

Up