# class Monitor

###

Module | akonadi
Namespace | Akonadi
Class | Monitor
Inherits | QObject

Monitors an Item or Collection for changes and emits signals if some of these objects are changed or removed or new ones are added to the storage backend.

Optionally, the changed objects can be fetched automatically from the server. To enable this, see fetchCollection(), fetchItemMetaData(), fetchItemData().

@todo: support un-monitoring @todo: distinguish between monitoring collection properties and collection content. @todo: special case for collection content counts changed

### methods

- Monitor (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QObject | 0

  Creates a new monitor.

  parent - The parent object.

- Monitor (d, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  d | MonitorPrivate |
  parent | QObject | 0

- collectionAdded (collection, parent)

  returns Nothing
  SIGNAL ("collectionAdded (const Collection&, const Collection&)")

  Argument | Type | Default
  --- | --- | ---
  collection | Akonadi.Collection |
  parent | Akonadi.Collection |

  Emitted if a new collection was added in the storage and if a monitored collection got this new collection as a child.

  collection - The new collection.

  parent - The parent collection.

- collectionChanged (collection)

  returns Nothing
  SIGNAL ("collectionChanged (const Collection&)")

  Argument | Type | Default
  --- | --- | ---
  collection | Akonadi.Collection |

  Emitted if a monitored collection changed (properties and content). Also emitted if the collection was reparented.

  collection - The changed collection.

- collectionRemoved (collection)

  returns Nothing
  SIGNAL ("collectionRemoved (const Collection&)")

  Argument | Type | Default
  --- | --- | ---
  collection | Akonadi.Collection |

  Emitted if a monitored collection has been removed from the storage.

  collection - The removed collection.

- collectionStatisticsChanged (id, statistics)

  returns Nothing
  SIGNAL ("collectionStatisticsChanged (Id, const CollectionStatistics&)")

  Argument | Type | Default
  --- | --- | ---
  id | Akonadi.Collection.Id |
  statistics | Akonadi.CollectionStatistics |

  Emitted if the statistics information of a monitored collection has changed.

  id - The collection identifier of the changed collection.

  statistics - The updated collection statistics, invalid if automatic fetching of statistics changes is disabled.

- fetchCollection (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Enable automatic fetching of changed collections from the server.

  enable - true enables auto-fetching, false disables auto-fetching.

- fetchCollectionStatistics (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Enable automatic fetching of changed collection statistics information.

  enable - true to enable.

- ignoreSession (session)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  session | Akonadi.Session |

  Ignore all notifications caused by the given session.

  session - The session you want to ignore.

- itemAdded (item, collection)

  returns Nothing
  SIGNAL ("itemAdded (const Item&, const Collection&)")

  Argument | Type | Default
  --- | --- | ---
  item | Akonadi.Item |
  collection | Akonadi.Collection |

  Emitted if a item has been added to the storage, in a monitored collection.

  item - The new item.

  collection - The collection the item is added to.

- itemChanged (item, partIdentifiers)

  returns Nothing
  SIGNAL ("itemChanged (const Item&, const QSet<QByteArray>&)")

  Argument | Type | Default
  --- | --- | ---
  item | Akonadi.Item |
  partIdentifiers | QSet<QByteArray> |

  Emitted if a monitored item has changed: item parts have been modified.

  item - The changed item.

  partIdentifiers - The identifiers of the item parts that has been changed.

- itemFetchScope ( )

  returns Akonadi.ItemFetchScope

  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

- itemMoved (item, collectionSource, collectionDestination)

  returns Nothing
  SIGNAL ("itemMoved (const Item&, const Collection&, const Collection&)")

  Argument | Type | Default
  --- | --- | ---
  item | Akonadi.Item |
  collectionSource | Akonadi.Collection |
  collectionDestination | Akonadi.Collection |

  Emitted if a monitored item has been moved between two collections

  item - The moved item

  collectionSource - The collection the item has been moved from

  collectionDestination - The collection the item has been moved to

- itemRemoved (item)

  returns Nothing
  SIGNAL ("itemRemoved (const Item&)")

  Argument | Type | Default
  --- | --- | ---
  item | Akonadi.Item |

  Emitted if a monitored object has been removed from the storage and from a monitored collection.

  item - The removed item.

- setAllMonitored (monitored)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  monitored | bool | 1

  Monitor all items.

- setCollectionMonitored (collection, monitored)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  collection | Akonadi.Collection |
  monitored | bool | 1

  Monitors the specified collection for changes. Monitoring Collection.root() monitors all collections.

  collection - The collection to monitor.

- setItemFetchScope (fetchScope)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  fetchScope | Akonadi.ItemFetchScope |

  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 metadata.

  fetchScope - the new scope for item fetch operations

  See also itemFetchScope()

- setItemMonitored (item, monitored)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  item | Akonadi.Item |
  monitored | bool | 1

  Monitors the specified item for changes.

  item - The item to monitor.

- setMimeTypeMonitored (mimetype, monitored)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  mimetype | QString |
  monitored | bool | 1

  Monitor all items matching the specified mimetype.

  mimetype - The mimetype.

- setResourceMonitored (resource, monitored)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  resource | QByteArray |
  monitored | bool | 1

  Monitors the specified resource for changes.

  resource - The resource identifier.