ItemCreateJob Class Reference
from PyKDE4.akonadi import *
Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi
Detailed Description
Job that creates a new item in the Akonadi storage.
This job creates a new item with all the set properties in the given target collection.
Note that items can not be created in the root collection (Collection.root()) and the collection must have Collection.contentMimeTypes() that match the mimetype of the item being created.
Example:
// Create a contact item in the root collection KABC.Addressee addr; addr.setNameFromString( "Joe Jr. Miller" ); Akonadi.Item item; item.setMimeType( "text/directory" ); item.setPayload<KABC.Addressee>( addr ); Akonadi.Collection collection = getCollection(); Akonadi.ItemCreateJob *job = new Akonadi.ItemCreateJob( item, collection ); connect( job, SIGNAL( result( KJob* ) ), SLOT( jobFinished( KJob* ) ) ); ... MyClass.jobFinished( KJob *job ) { if ( job->error() ) qDebug() << "Error occurred"; else qDebug() << "Contact item created successfully"; }
Methods | |
__init__ (self, Akonadi.Item item, Akonadi.Collection collection, QObject parent=0) | |
doHandleResponse (self, QByteArray tag, QByteArray data) | |
doStart (self) | |
Akonadi.Item | item (self) |
Method Documentation
__init__ | ( | self, | ||
Akonadi.Item | item, | |||
Akonadi.Collection | collection, | |||
QObject | parent=0 | |||
) |
Creates a new item create job.
- Parameters:
-
item The item to create.
- Note:
- It must have a mime type set.
- Parameters:
-
collection The parent collection where the new item shall be located in. parent The parent object.
doHandleResponse | ( | self, | ||
QByteArray | tag, | |||
QByteArray | data | |||
) |
doStart | ( | self ) |
Akonadi.Item item | ( | self ) |
Returns the created item with the new unique id, or an invalid item if the job failed.