# class ItemSync

###

Module | akonadi
Namespace | Akonadi
Class | ItemSync
Inherits | Akonadi::TransactionSequence

Syncs between items known to a client (usually a resource) and Akonadi.

Remote Id must only be set by the resource storing the item, other clients should leave it empty, since the resource responsible for the target collection will be notified about the addition and then create a suitable remote Id.

There are two different forms of ItemSync usage: - Full-Sync: meaning the client provides all valid items, i.e. any item not part of the list but currently stored in Akonadi will be removed - Incremental-Sync: meaning the client provides two lists, one for items which are new or modified and one for items which should be removed. Any item not part of either list but currently stored in Akonadi will not be changed.

This is provided for convenience to implement "save all" like behavior, however it is strongly recommended to use single item jobs whenever possible, e.g. ItemCreateJob, ItemModifyJob and ItemDeleteJob

### methods

- ItemSync (collection, parent)

  returns ctor

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

  Creates a new item synchronizer.

  collection - The collection we are syncing.

  parent - The parent object.

- doStart ( )

  returns Nothing

- setFullSyncItems (items)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  items | Akonadi.Item.List |

  Sets the full item list for the collection.

  Usually the result of a full item listing.

  If the client using this is a resource, all items must have a valid remote identifier.

  items - A list of items.

- setIncrementalSyncItems (changedItems, removedItems)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  changedItems | Akonadi.Item.List |
  removedItems | Akonadi.Item.List |

  Sets the item lists for incrementally syncing the collection.

  Usually the result of an incremental remote item listing.

  If the client using this is a resource, all items must have a valid remote identifier.

  changedItems - A list of items added or changed by the client.

  removedItems - A list of items deleted by the client.

- setPartSyncItems (items)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  items | Akonadi.Item.List |

  Sets the item list for the collection, but not the full list, a part of the list. Call this as many times as you wish. But you need to remember to call setTotalItems() first.

  Do not pass more or less items then announced in setTotalItems();

  If the client using this is a resource, all items must have a valid remote identifier.

  items - A list of items.

- setTotalItems (amount)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  amount | int |

  Set the amount of items which you are going to return in total by using the setPartSyncItems() method.

  @params amount The amount of items in total.