Class FilterStorage
Defined in: FilterStorage.jsm.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
This class reads user's filters from disk, manages them in memory and writes them back.
|
| Field Attributes | Field Name and Description |
|---|---|
| <private> <static> |
FilterStorage._needsSave
Will be set to true if a saveToDisk() call arrives while saveToDisk() is
already running (delayed execution).
|
| <private> <static> |
FilterStorage._saving
Will be set to true if saveToDisk() is running (reentrance protection).
|
| <static> |
FilterStorage.fileProperties
Map of properties listed in the filter storage file before the sections
start.
|
| <static> |
FilterStorage.formatVersion
Version number of the patterns.ini format used.
|
| <static> |
FilterStorage.knownSubscriptions
Map of subscriptions already on the list, by their URL/identifier
|
| <static> |
FilterStorage.sourceFile
File that the filter list has been loaded from and should be saved to
|
| <static> |
FilterStorage.subscriptions
List of filter subscriptions containing all filters
|
| Method Attributes | Method Name and Description |
|---|---|
| <private> <static> |
FilterStorage._generateFilterData(subscriptions)
|
| <static> |
FilterStorage.addFilter(filter, subscription, position, silent)
Adds a user-defined filter to the list
|
| <static> |
FilterStorage.addSubscription(subscription, silent)
Adds a filter subscription to the list
|
| <static> |
FilterStorage.getBackupFiles()
Returns the list of existing backup files.
|
| <static> |
FilterStorage.getGroupForFilter(filter)
Finds the filter group that a filter should be added to by default.
|
| <static> |
FilterStorage.increaseHitCount(filter)
Increases the hit count for a filter by one
|
| <static> |
FilterStorage.loadFromDisk(sourceFile)
Loads all subscriptions from the disk
|
| <static> |
FilterStorage.moveFilter(filter, subscription, oldPosition, newPosition)
Moves a user-defined filter to a new position
|
| <static> |
FilterStorage.moveSubscription(subscription, insertBefore)
Moves a subscription in the list to a new position.
|
| <static> |
FilterStorage.removeFilter(filter, subscription, position)
Removes a user-defined filter from the list
|
| <static> |
FilterStorage.removeSubscription(subscription, silent)
Removes a filter subscription from the list
|
| <static> |
FilterStorage.resetHitCounts(filters)
Resets hit count for some filters
|
| <static> |
FilterStorage.saveToDisk(targetFile)
Saves all subscriptions back to disk
|
| <static> |
FilterStorage.updateSubscriptionFilters(subscription, filters)
Replaces the list of filters in a subscription by a new list
|
Class Detail
FilterStorage()
This class reads user's filters from disk, manages them in memory and writes them back.
Field Detail
<private> <static>
{Boolean}
FilterStorage._needsSave
Will be set to true if a saveToDisk() call arrives while saveToDisk() is
already running (delayed execution).
<private> <static>
{Boolean}
FilterStorage._saving
Will be set to true if saveToDisk() is running (reentrance protection).
<static>
FilterStorage.fileProperties
Map of properties listed in the filter storage file before the sections
start. Right now this should be only the format version.
<static>
{Integer}
FilterStorage.formatVersion
Version number of the patterns.ini format used.
<static>
{Object}
FilterStorage.knownSubscriptions
Map of subscriptions already on the list, by their URL/identifier
<static>
{nsIFile}
FilterStorage.sourceFile
File that the filter list has been loaded from and should be saved to
<static>
{Array of Subscription}
FilterStorage.subscriptions
List of filter subscriptions containing all filters
Method Detail
<private> <static>
FilterStorage._generateFilterData(subscriptions)
- Parameters:
- subscriptions
<static>
FilterStorage.addFilter(filter, subscription, position, silent)
Adds a user-defined filter to the list
- Parameters:
- {Filter} filter
- {SpecialSubscription} subscription Optional
- particular group that the filter should be added to
- {Integer} position Optional
- position within the subscription at which the filter should be added
- {Boolean} silent
- if true, no listeners will be triggered (to be used when filter list is reloaded)
<static>
FilterStorage.addSubscription(subscription, silent)
Adds a filter subscription to the list
- Parameters:
- {Subscription} subscription
- filter subscription to be added
- {Boolean} silent
- if true, no listeners will be triggered (to be used when filter list is reloaded)
<static>
{nsIFile[]}
FilterStorage.getBackupFiles()
Returns the list of existing backup files.
<static>
{SpecialSubscription}
FilterStorage.getGroupForFilter(filter)
Finds the filter group that a filter should be added to by default. Will
return null if this group doesn't exist yet.
- Parameters:
- {Filter} filter
<static>
FilterStorage.increaseHitCount(filter)
Increases the hit count for a filter by one
- Parameters:
- {Filter} filter
<static>
FilterStorage.loadFromDisk(sourceFile)
Loads all subscriptions from the disk
- Parameters:
- {nsIFile} sourceFile Optional
- File to read from
<static>
FilterStorage.moveFilter(filter, subscription, oldPosition, newPosition)
Moves a user-defined filter to a new position
- Parameters:
- {Filter} filter
- {SpecialSubscription} subscription
- filter group where the filter is located
- {Integer} oldPosition
- current position of the filter
- {Integer} newPosition
- new position of the filter
<static>
FilterStorage.moveSubscription(subscription, insertBefore)
Moves a subscription in the list to a new position.
- Parameters:
- {Subscription} subscription
- filter subscription to be moved
- {Subscription} insertBefore Optional
- filter subscription to insert before (if omitted the subscription will be put at the end of the list)
<static>
FilterStorage.removeFilter(filter, subscription, position)
Removes a user-defined filter from the list
- Parameters:
- {Filter} filter
- {SpecialSubscription} subscription Optional
- a particular filter group that the filter should be removed from (if ommited will be removed from all subscriptions)
- {Integer} position Optional
- position inside the filter group at which the filter should be removed (if ommited all instances will be removed)
<static>
FilterStorage.removeSubscription(subscription, silent)
Removes a filter subscription from the list
- Parameters:
- {Subscription} subscription
- filter subscription to be removed
- {Boolean} silent
- if true, no listeners will be triggered (to be used when filter list is reloaded)
<static>
FilterStorage.resetHitCounts(filters)
Resets hit count for some filters
- Parameters:
- {Array of Filter} filters
- filters to be reset, if null all filters will be reset
<static>
FilterStorage.saveToDisk(targetFile)
Saves all subscriptions back to disk
- Parameters:
- {nsIFile} targetFile Optional
- File to be written
<static>
FilterStorage.updateSubscriptionFilters(subscription, filters)
Replaces the list of filters in a subscription by a new list
- Parameters:
- {Subscription} subscription
- filter subscription to be updated
- {Array of Filter} filters
- new filter lsit