KDE 4.7 PyKDE API Reference

- KDE's Python API

# PartFetcher Class Reference

`from PyKDE4.akonadi import *`

Inherits: KJob → QObject
Namespace: Akonadi

## Detailed Description

Convenience class for getting payload parts from an Akonadi Model.

This class can be used to retrieve individual payload parts from an EntityTreeModel, and fetch them asynchronously from the Akonadi storage if necessary.

The requested part is emitted though the partFetched signal.

Example:

     const QModelIndex index = view->selectionModel()->currentIndex();

     PartFetcher *fetcher = new PartFetcher( index, Akonadi.MessagePart.Envelope );
     connect( fetcher, SIGNAL( result( KJob* ) ), SLOT( fetchResult( KJob* ) ) );
     fetcher->start();

     ...

     MyClass.fetchResult( KJob *job )
     {
       if ( job->error() ) {
         qDebug() << job->errorText();
         return;
       }

       PartFetcher *fetcher = qobject_cast<PartFetcher*>( job );

       const Item item = fetcher->item();
       // do something with the item
     }

Author:
  Stephen Kelly <steveire@gmail.com>

Since:
  4.4

## Methods

| __init__ (self, QModelIndex index, QByteArray partName, QObject parent=0)
QModelIndex | index (self)
Akonadi.Item | item (self)
QByteArray | partName (self)
| start (self)

## Method Documentation

__init__ | ( | self, |
|  | QModelIndex | index,
|  | QByteArray | partName,
|  | QObject | parent=0
| ) |  |  |

Creates a new part fetcher.

Parameters:

  | index | The index of the item to fetch the part from.
  | partName | The name of the payload part to fetch.
  | parent | The parent object.

QModelIndex index | ( |  | self ) |

Returns the index of the item the part was fetched from.

Akonadi.Item item | ( |  | self ) |

Returns the item that contains the fetched payload part.

QByteArray partName | ( |  | self ) |

Returns the name of the part that has been fetched.

start | ( |  | self ) |

Starts the fetch operation.