KDE 4.5 PyKDE API Reference

- KDE's Python API

# ItemModifyJob Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi

## Detailed Description

Job that modifies an existing item in the Akonadi storage.

This job is used to writing back items to the Akonadi storage, after the user has changed them in any way. For performance reasons either the full item (including the full payload) can written back or only the meta data of the item.

Example:

     // Fetch item with unique id 125
     Akonadi.ItemFetchJob *fetchJob = new Akonadi.ItemFetchJob( Akonadi.Item( 125 ) );
     connect( fetchJob, SIGNAL( result( KJob* ) ), SLOT( fetchFinished( KJob* ) ) );

     ...

     MyClass.fetchFinished( KJob *job )
     {
       if ( job->error() )
         return;

       Akonadi.ItemFetchJob *fetchJob = qobject_cast<Akonadi.ItemFetchJob*>( job );

       Akonadi.Item item = fetchJob->items().first();

       // Set a custom flag
       item.setFlag( "\GotIt" );

       // Store back modified item
       Akonadi.ItemModifyJob *modifyJob = new Akonadi.ItemModifyJob( item );
       connect( modifyJob, SIGNAL( result( KJob* ) ), SLOT( modifyFinished( KJob* ) ) );
     }

     MyClass.modifyFinished( KJob *job )
     {
       if ( job->error() )
         qDebug() << "Error occurred";
       else
         qDebug() << "Item modified successfully";
     }

Author:
  Volker Krause <vkrause@kde.org>

## Methods
| __init__ (self, Akonadi.Item item, QObject parent=0)
| disableRevisionCheck (self)
| doHandleResponse (self, QByteArray tag, QByteArray data)
| doStart (self)
bool | ignorePayload (self)
Akonadi.Item | item (self)
| setIgnorePayload (self, bool ignore)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Item | item,
|  | QObject | parent=0
| ) |  |  |

Creates a new item modify job.

Parameters:

  | item | The modified item object to store.
  | parent | The parent object.

disableRevisionCheck | ( |  | self ) |

Disables the check of the revision number.

Note:
  If disabled, no conflict detection is available.

doHandleResponse | ( | self, |
|  | QByteArray | tag,
|  | QByteArray | data
| ) |  |  |

doStart | ( |  | self ) |

bool ignorePayload | ( |  | self ) |

Returns whether the payload of the modified item shall be omitted from transmission to the Akonadi storage.

Akonadi.Item item | ( |  | self ) |

Returns the modified and stored item including the changed revision number.

setIgnorePayload | ( | self, |
|  | bool | ignore
| ) |  |  |

Sets whether the payload of the modified item shall be omitted from transmission to the Akonadi storage. The default is false, however it can be set for performance reasons.