Akonadi.Item

KDE 4.2 PyKDE API Reference

- KDE's Python API

# Item Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Entity
Namespace: Akonadi

## Detailed Description

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 meta data to items in order to handle them but the meta data 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>

## Enumerations
UrlType | { UrlShort, UrlWithMimeType }
## Attributes
QString | FullPayload
## Methods
| __init__ (self)
| __init__ (self, Id id)
| __init__ (self, QString mimeType)
| __init__ (self, Akonadi.Item other)
| clearFlag (self, QByteArray name)
| clearFlags (self)
Akonadi.Item.Flags | flags (self)
bool | hasFlag (self, QByteArray name)
bool | hasPayload (self)
QSet | loadedPayloadParts (self)
QString | mimeType (self)
QDateTime | modificationTime (self)
QByteArray | payloadData (self)
int | revision (self)
| setFlag (self, QByteArray name)
| setFlags (self, Akonadi.Item.Flags flags)
| setMimeType (self, QString mimeType)
| setModificationTime (self, QDateTime datetime)
| setPayloadFromData (self, QByteArray data)
| setRevision (self, int revision)
| setSize (self, long size)
long | size (self)
KUrl | url (self, Akonadi.Item.UrlType type=Akonadi.Item.UrlShort)
## Static Methods
Akonadi.Item | fromUrl (KUrl url)

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | Id | id
| ) |  |  |

Creates a new item with the given unique id.

__init__ | ( | self, |
|  | QString | mimeType
| ) |  |  |

Creates a new item with the given mime type.

Parameters:

  | mimeType | The mime type of the item.

__init__ | ( | self, |
|  | Akonadi.Item | other
| ) |  |  |

Creates a new item from an other item.

clearFlag | ( | self, |
|  | QByteArray | name
| ) |  |  |

Removes the flag with the given name from the item.

clearFlags | ( |  | self ) |

Removes all flags from the item.

Akonadi.Item.Flags flags | ( |  | self ) |

Returns all flags of this item.

Akonadi.Item fromUrl | ( | KUrl | url
| ) |  |  |

Creates an item from the given url.

bool hasFlag | ( | self, |
|  | QByteArray | name
| ) |  |  |

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

bool hasPayload | ( |  | self ) |

Returns whether the item has a payload object.

QSet loadedPayloadParts | ( |  | self ) |

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.

QString mimeType | ( |  | self ) |

Returns the mime type of the item.

QDateTime modificationTime | ( |  | self ) |

Returns the timestamp of the last modification of this item.

Since:
  4.2

QByteArray payloadData | ( |  | self ) |

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.

int revision | ( |  | self ) |

Returns the revision number of the item.

setFlag | ( | self, |
|  | QByteArray | name
| ) |  |  |

Sets the flag with the given name in the item.

setFlags | ( | self, |
|  | Akonadi.Item.Flags | flags
| ) |  |  |

Overwrites all flags of the item by the given flags.

setMimeType | ( | self, |
|  | QString | mimeType
| ) |  |  |

Sets the mime type of the item to mimeType.

setModificationTime | ( | self, |
|  | QDateTime | datetime
| ) |  |  |

Sets the timestamp of the last modification of this item.

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

Since:
  4.2

setPayloadFromData | ( | self, |
|  | QByteArray | data
| ) |  |  |

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

Parameters:

  | data | The encoded data.

See also:
  fullPayloadData

setRevision | ( | self, |
|  | int | revision
| ) |  |  |

Sets the revision number of the item.

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

setSize | ( | self, |
|  | long | size
| ) |  |  |

Set the size of the item in bytes.

Since:
  4.2

long size | ( |  | self ) |

Returns the size of the items in bytes.

Since:
  4.2

KUrl url | ( | self, |
|  | Akonadi.Item.UrlType | type=Akonadi.Item.UrlShort
| ) |  |  |

Returns the url of the item.

## Attribute Documentation

QString FullPayload

Creates a new item.

## Enumeration Documentation

UrlType

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

Enumerator:

  UrlShort = 0 |
  UrlWithMimeType = 1 |