Monitor Class Reference
from PyKDE4.akonadi import *
Inherits: QObject
Subclasses: Akonadi.ChangeRecorder
Namespace: Akonadi
Detailed Description
Monitors an item or collection for changes.
The Monitor emits signals if some of these objects are changed or removed or new ones are added to the Akonadi storage.
There are various ways to filter these notifications. There are three types of filter evaluation: - (-) removal-only filter, ie. if the filter matches the notification is dropped, if not filter evaluation continues with the next one - (+) pass-exit filter, ie. if the filter matches the notification is delivered, if not evaluation is continued - (f) final filter, ie. evaluation ends here if the corresponding filter criteria is set, the notification is delievered depending on the result, evaluation is only continued if no filter criteria is defined
The following filter are available, listed in evaluation order: (1) ignored sessions (-) (2) monitor everything (+) (3a) resource and mimetype filters (f) (items only) (3b) resource filters (f) (collections only) (4) item is monitored (+) (5) collection is monitored (+)
Optionally, the changed objects can be fetched automatically from the server. To enable this, see itemFetchScope() and collectionFetchScope().
Note that as a consequence of rule 3a, it is not possible to monitor (more than zero resources OR more than zero mimetypes) AND more than zero collections.
To do: Distinguish between monitoring collection properties and collection content. To do: Special case for collection content counts changed
Signal Documentation
allMonitored | ( | bool | monitored | |
) |
This signal is emitted if the Monitor starts or stops monitoring everything.
- Parameters:
-
monitored Whether everything is now being monitored or not.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("allMonitored(bool)"), target_slot)
collectionAdded | ( | Akonadi.Collection | collection, | |
Akonadi.Collection | parent | |||
) |
This signal is emitted if a new collection has been added to a monitored collection in the Akonadi storage.
- Parameters:
-
collection The new collection. parent The parent collection.
- Signal syntax:
QObject.connect(source, SIGNAL("collectionAdded(const Akonadi::Collection&, const Akonadi::Collection&)"), target_slot)
collectionChanged | ( | Akonadi.Collection | collection | |
) |
This signal is emitted if a monitored collection has been changed (properties or attributes).
- Parameters:
-
collection The changed collection. attributeNames The names of the collection attributes that have been changed.
- Since:
- 4.4
- Signal syntax:
QObject.connect(source, SIGNAL("collectionChanged(const Akonadi::Collection&)"), target_slot)
collectionChanged | ( | Akonadi.Collection | collection, | |
QSet |
attributeNames | |||
) |
This signal is emitted if a monitored collection has been changed (properties or attributes).
- Parameters:
-
collection The changed collection. attributeNames The names of the collection attributes that have been changed.
- Since:
- 4.4
- Signal syntax:
QObject.connect(source, SIGNAL("collectionChanged(const Akonadi::Collection&, const QSet
&)"), target_slot)
collectionMonitored | ( | Akonadi.Collection | collection, | |
bool | monitored | |||
) |
This signal is emitted if the Monitor starts or stops monitoring collection explicitly.
- Parameters:
-
collection The collection monitored Whether the collection is now being monitored or not.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("collectionMonitored(const Akonadi::Collection&, bool)"), target_slot)
collectionMoved | ( | Akonadi.Collection | collection, | |
Akonadi.Collection | source, | |||
Akonadi.Collection | destination | |||
) |
This signals is emitted if a monitored collection has been moved.
- Parameters:
-
collection The moved collection. source The previous parent collection. destination The new parent collection.
- Since:
- 4.4
- Signal syntax:
QObject.connect(source, SIGNAL("collectionMoved(const Akonadi::Collection&, const Akonadi::Collection&, const Akonadi::Collection&)"), target_slot)
collectionRemoved | ( | Akonadi.Collection | collection | |
) |
This signal is emitted if a monitored collection has been removed from the Akonadi storage.
- Parameters:
-
collection The removed collection.
- Signal syntax:
QObject.connect(source, SIGNAL("collectionRemoved(const Akonadi::Collection&)"), target_slot)
collectionStatisticsChanged | ( | long | id, | |
Akonadi.CollectionStatistics | statistics | |||
) |
This signal is emitted if the statistics information of a monitored collection has changed.
- Parameters:
-
id The collection identifier of the changed collection. statistics The updated collection statistics, invalid if automatic fetching of statistics changes is disabled.
- Signal syntax:
QObject.connect(source, SIGNAL("collectionStatisticsChanged(Akonadi::Entity::Id, const Akonadi::CollectionStatistics&)"), target_slot)
collectionSubscribed | ( | Akonadi.Collection | collection, | |
Akonadi.Collection | parent | |||
) |
This signal is emitted if a collection has been subscribed to by the user. It will be emitted even for unmonitored collections as the check for whether to monitor it has not been applied yet.
- Parameters:
-
collection The subscribed collection parent The parent collection of the subscribed collection.
- Since:
- 4.6
- Signal syntax:
QObject.connect(source, SIGNAL("collectionSubscribed(const Akonadi::Collection&, const Akonadi::Collection&)"), target_slot)
collectionUnsubscribed | ( | Akonadi.Collection | collection | |
) |
This signal is emitted if a user unsubscribes from a collection.
- Parameters:
-
collection The unsubscribed collection
- Since:
- 4.6
- Signal syntax:
QObject.connect(source, SIGNAL("collectionUnsubscribed(const Akonadi::Collection&)"), target_slot)
itemAdded | ( | Akonadi.Item | item, | |
Akonadi.Collection | collection | |||
) |
This signal is emitted if an item has been added to a monitored collection in the Akonadi storage.
- Parameters:
-
item The new item. collection The collection the item has been added to.
- Signal syntax:
QObject.connect(source, SIGNAL("itemAdded(const Akonadi::Item&, const Akonadi::Collection&)"), target_slot)
itemChanged | ( | Akonadi.Item | item, | |
QSet |
partIdentifiers | |||
) |
This signal is emitted if a monitored item has changed, e.g. item parts have been modified.
- Parameters:
-
item The changed item. partIdentifiers The identifiers of the item parts that has been changed.
- Signal syntax:
QObject.connect(source, SIGNAL("itemChanged(const Akonadi::Item&, const QSet
&)"), target_slot)
itemLinked | ( | Akonadi.Item | item, | |
Akonadi.Collection | collection | |||
) |
This signal is emitted if a reference to an item is added to a virtual collection.
- Parameters:
-
item The linked item. collection The collection the item is linked to.
- Since:
- 4.2
- Signal syntax:
QObject.connect(source, SIGNAL("itemLinked(const Akonadi::Item&, const Akonadi::Collection&)"), target_slot)
itemMonitored | ( | Akonadi.Item | item, | |
bool | monitored | |||
) |
This signal is emitted if the Monitor starts or stops monitoring item explicitly.
- Parameters:
-
item The item monitored Whether the item is now being monitored or not.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("itemMonitored(const Akonadi::Item&, bool)"), target_slot)
itemMoved | ( | Akonadi.Item | item, | |
Akonadi.Collection | collectionSource, | |||
Akonadi.Collection | collectionDestination | |||
) |
This signal is emitted if a monitored item has been moved between two collections
- Parameters:
-
item The moved item. collectionSource The collection the item has been moved from. collectionDestination The collection the item has been moved to.
- Signal syntax:
QObject.connect(source, SIGNAL("itemMoved(const Akonadi::Item&, const Akonadi::Collection&, const Akonadi::Collection&)"), target_slot)
itemRemoved | ( | Akonadi.Item | item | |
) |
This signal is emitted if - a monitored item has been removed from the Akonadi storage or - a item has been removed from a monitored collection.
- Parameters:
-
item The removed item.
- Signal syntax:
QObject.connect(source, SIGNAL("itemRemoved(const Akonadi::Item&)"), target_slot)
itemUnlinked | ( | Akonadi.Item | item, | |
Akonadi.Collection | collection | |||
) |
This signal is emitted if a reference to an item is removed from a virtual collection.
- Parameters:
-
item The unlinked item. collection The collection the item is unlinked from.
- Since:
- 4.2
- Signal syntax:
QObject.connect(source, SIGNAL("itemUnlinked(const Akonadi::Item&, const Akonadi::Collection&)"), target_slot)
mimeTypeMonitored | ( | QString | mimeType, | |
bool | monitored | |||
) |
This signal is emitted if the Monitor starts or stops monitoring mimeType explicitly.
- Parameters:
-
mimeType The mimeType. monitored Whether the mimeType is now being monitored or not.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("mimeTypeMonitored(const QString&, bool)"), target_slot)
resourceMonitored | ( | QByteArray | identifier, | |
bool | monitored | |||
) |
This signal is emitted if the Monitor starts or stops monitoring the resource with the identifier identifier explicitly.
- Parameters:
-
identifier The identifier of the resource. monitored Whether the resource is now being monitored or not.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("resourceMonitored(const QByteArray&, bool)"), target_slot)
Method Documentation
__init__ | ( | self, | ||
QObject | parent=0 | |||
) |
Creates a new monitor.
- Parameters:
-
parent The parent object.
Akonadi.CollectionFetchScope collectionFetchScope | ( | self ) |
Returns the collection fetch scope.
Since this returns a reference it can be used to conveniently modify the current scope in-place, i.e. by calling a method on the returned reference without storing it in a local variable. See the CollectionFetchScope documentation for an example.
- Returns:
- a reference to the current collection fetch scope
- See also:
- setCollectionFetchScope() for replacing the current collection fetch scope
- Since:
- 4.4
[Akonadi.Collection] collectionsMonitored | ( | self ) |
Returns the list of collections being monitored.
- Since:
- 4.3
fetchChangedOnly | ( | self, | ||
bool | enable | |||
) |
Instructs the monitor to fetch only those parts that were changed and were requested in the fetch scope.
This is taken in account only for item modifications. Example usage:
monitor->itemFetchScope().fetchFullPayload( true ); monitor->fetchChangedOnly(true);
In the example if an item was changed, but its payload was not, the full payload will not be retrieved. If the item's payload was changed, the monitor retrieves the changed payload as well.
The default is to fetch everything requested.
- Since:
- 4.8
- Parameters:
-
enable true to enable the feature, false means everything that was requested will be fetched.
- Returns:
- void
fetchCollection | ( | self, | ||
bool | enable | |||
) |
Enables automatic fetching of changed collections from the Akonadi storage.
- Parameters:
-
enable true enables automatic fetching, false disables automatic fetching.
fetchCollectionStatistics | ( | self, | ||
bool | enable | |||
) |
Enables automatic fetching of changed collection statistics information from the Akonadi storage.
- Parameters:
-
enable true to enables automatic fetching, false disables automatic fetching.
ignoreSession | ( | self, | ||
Akonadi.Session | session | |||
) |
Ignores all change notifications caused by the given session. This overrides all other settings on this session.
- Parameters:
-
session The session you want to ignore.
bool isAllMonitored | ( | self ) |
Returns true if everything is being monitored.
- Since:
- 4.3
Akonadi.ItemFetchScope itemFetchScope | ( | self ) |
Returns the item fetch scope.
Since this returns a reference it can be used to conveniently modify the current scope in-place, i.e. by calling a method on the returned reference without storing it in a local variable. See the ItemFetchScope documentation for an example.
- Returns:
- a reference to the current item fetch scope
- See also:
- setItemFetchScope() for replacing the current item fetch scope
[long] itemsMonitored | ( | self ) |
Returns the set of items being monitored.
- Since:
- 4.3
- Deprecated:
- Use itemsMonitoredEx() instead.
QVector |
( | self ) |
Returns the set of items being monitored.
Faster version (at least on 32-bit systems) of itemsMonitored().
- Since:
- 4.6
QStringList mimeTypesMonitored | ( | self ) |
Returns the set of mimetypes being monitored.
- Since:
- 4.3
[QByteArray] resourcesMonitored | ( | self ) |
Returns the set of identifiers for resources being monitored.
- Since:
- 4.3
Akonadi.Session session | ( | self ) |
Returns the Session used by the monitor to communicate with Akonadi.
- Since:
- 4.4
setAllMonitored | ( | self, | ||
bool | monitored=1 | |||
) |
Sets whether all items shall be monitored.
Note that if a session is being ignored, this takes precedence over setAllMonitored() on that session.
setCollectionFetchScope | ( | self, | ||
Akonadi.CollectionFetchScope | fetchScope | |||
) |
Sets the collection fetch scope.
Controls which collections are monitored and how much of a collection's data is fetched from the server.
- Parameters:
-
fetchScope The new scope for collection fetch operations.
- See also:
- collectionFetchScope()
- Since:
- 4.4
setCollectionMonitored | ( | self, | ||
Akonadi.Collection | collection, | |||
bool | monitored=1 | |||
) |
Sets whether the specified collection shall be monitored for changes. If monitoring is turned on for the collection, all notifications for items in that collection will be emitted, and its child collections will also be monitored. Note that move notifications will be emitted if either one of the collections involved is being monitored.
Note that if a session is being ignored, this takes precedence over setCollectionMonitored() on that session.
- Parameters:
-
collection The collection to monitor. If this collection is Collection.root(), all collections in the Akonadi storage will be monitored. monitored Whether to monitor the collection.
setItemFetchScope | ( | self, | ||
Akonadi.ItemFetchScope | fetchScope | |||
) |
Sets the item fetch scope.
Controls how much of an item's data is fetched from the server, e.g. whether to fetch the full item payload or only meta data.
- Parameters:
-
fetchScope The new scope for item fetch operations.
- See also:
- itemFetchScope()
setItemMonitored | ( | self, | ||
Akonadi.Item | item, | |||
bool | monitored=1 | |||
) |
Sets whether the specified item shall be monitored for changes.
Note that if a session is being ignored, this takes precedence over setItemMonitored() on that session.
- Parameters:
-
item The item to monitor. monitored Whether to monitor the item.
setMimeTypeMonitored | ( | self, | ||
QString | mimetype, | |||
bool | monitored=1 | |||
) |
Sets whether items of the specified mime type shall be monitored for changes. If monitoring is turned on for the mime type, all notifications for items matching that mime type will be emitted, but notifications for collections matching that mime type will only be emitted if this is otherwise specified, for example by setCollectionMonitored().
Note that if a session is being ignored, this takes precedence over setMimeTypeMonitored() on that session.
- Parameters:
-
mimetype The mime type to monitor. monitored Whether to monitor the mime type.
setResourceMonitored | ( | self, | ||
QByteArray | resource, | |||
bool | monitored=1 | |||
) |
Sets whether the specified resource shall be monitored for changes. If monitoring is turned on for the resource, all notifications for collections and items in that resource will be emitted.
Note that if a session is being ignored, this takes precedence over setResourceMonitored() on that session.
- Parameters:
-
resource The resource identifier. monitored Whether to monitor the resource.
setSession | ( | self, | ||
Akonadi.Session | session | |||
) |
Sets the session used by the Monitor to communicate with the %Akonadi server. If not set, the Akonadi.Session.defaultSession is used.
- Since:
- 4.4