# class Item

###

Module | akonadi
Namespace | Akonadi
Class | Item
Inherits | Akonadi::Entity

Represents a PIM item stored in Akonadi storage.

A PIM item consists of one or more parts, allowing a fine-grained access on its content where needed (eg. mail envelope, mail body and attachments).

There is also a namespace (prefix) for special parts which are local to Akonadi. These parts, prefixed by "akonadi-" will never be fetched in the resource. They are useful for local extensions like agents which might want to add metadata to items in order to handle them but the metadata should not be stored back to the resource.

This class contains beside some type-agnostic information (flags, revision) a single payload object representing its actual data. Which objects these actually are depends on the mimetype of the item and the corresponding serializer plugin.

This class is implicitly shared.

Author Volker Krause <vkrause@kde.org>, Till Adam <adam@kde.org>

### enums

- UrlType { UrlShort, UrlWithMimeType }

enum details

### methods

- Item ( )

  returns ctor

- Item (id)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  id | Id |

  Creates a new item with the given unique id.

- Item (mimeType)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  mimeType | QString |

  Creates a new item with the given mime type.

  mimeType - The mime type of the item.

- Item (other)

  returns ctor

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

  Creates a new item from an other item.

- clearFlag (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

  Removes the flag with the given name from the item.

- clearFlags ( )

  returns Nothing

  Removes all flags from the item.

- flags ( )

  returns Akonadi.Item.Flags

  Returns all flags of this item.

- fromUrl (url)

  returns Akonadi.Item
  static

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Creates an item from the given url.

- hasFlag (name)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

  Returns whether the flag with the given name is set in the item.

- hasPayload ( )

  returns bool

  Returns whether the item has a payload object.

- loadedPayloadParts ( )

  returns QSet<QByteArray>

  Returns the list of loaded payload parts. This is not necessarily identical to all parts in the cache or to all available parts on the backend.

- mimeType ( )

  returns QString

  Returns the mime type of the item.

- payloadData ( )

  returns QByteArray

  Returns the full payload in its canonical representation, e.g. the binary or textual format usually used for data with this mime type. This is useful when communicating with non-Akonadi application by e.g. drag&drop, copy&paste or stored files.

- revision ( )

  returns int

  Returns the revision number of the item.

- setFlag (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

  Sets the flag with the given name in the item.

- setFlags (flags)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  flags | Akonadi.Item.Flags |

  Overwrites all flags of the item by the given flags.

- setMimeType (mimeType)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  mimeType | QString |

  Sets the mime type of the item to mimeType.

- setPayloadFromData (data)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  data | QByteArray |

  Sets the payload based on the canonical representation normally used for data of this mime type.

  data - The encoded data.

  See also fullPayloadData

- setRevision (revision)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  revision | int |

  Sets the revision number of the item.

  Do not modify this value from within an application, it is updated automatically by the revision checking functions.

- url (type)

  returns KUrl

  Argument | Type | Default
  --- | --- | ---
  type | Akonadi.Item.UrlType | Akonadi.Item.UrlShort

  Returns the url of the item.

### variables

char* FullPayload | Creates a new item.

### enums - detail

- UrlType { UrlShort, UrlWithMimeType }

  Describes the type of url which is returned in url().

  | UrlShort | - 0 | - |
  | UrlWithMimeType | - 1 | - |