KDE 4.4 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

ItemSearchJob Class Reference

from PyKDE4.akonadi import *

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

Detailed Description

Job that searches for items in the Akonadi storage.

This job searches for items that match a given search query and returns the list of matching item.


 const QString query = "..."; // some sparql query

 Akonadi.ItemSearchJob *job = new Akonadi.ItemSearchJob( query );
 job->fetchScope().fetchFullPayload();
 connect( job, SIGNAL( result( KJob* ) ), this, SLOT( searchResult( KJob* ) ) );

 ...

 MyClass.searchResult( KJob *job )
 {
   Akonadi.ItemSearchJob *searchJob = qobject_cast<Akonadi.ItemSearchJob*>( job );
   const Akonadi.Item.List items = searchJob->items();
   foreach ( const Akonadi.Item &item, items ) {
     // extract the payload and do further stuff
   }
 }

Author:
Tobias Koenig <tokoe@kde.org>
Since:
4.4


Signals

 itemsReceived (, Akonadi.Item.List items)

Methods

 __init__ (self, QString query, QObject parent=0)
 doHandleResponse (self, QByteArray tag, QByteArray data)
 doStart (self)
Akonadi.ItemFetchScope fetchScope (self)
Akonadi.Item.List items (self)
 itemsReceived (self, Akonadi.Item.List items)
 setFetchScope (self, Akonadi.ItemFetchScope fetchScope)
 setQuery (self, QString query)

Method Documentation

__init__ (  self,
QString  query,
QObject  parent=0
)

Creates an item search job.

Parameters:
query  The search query in SPARQL format.
parent  The parent object.

doHandleResponse (  self,
QByteArray  tag,
QByteArray  data
)
doStart (   self )
Akonadi.ItemFetchScope fetchScope (   self )

Returns the item fetch scope.

Since this returns a reference it can be used to conveniently modify the current scope in-place, i.e. by calling a method on the returned reference without storing it in a local variable. See the ItemFetchScope documentation for an example.

Returns:
a reference to the current item fetch scope

See also:
setFetchScope() for replacing the current item fetch scope

Akonadi.Item.List items (   self )

Returns the items that matched the search query.

itemsReceived (  self,
Akonadi.Item.List  items
)

This signal is emitted whenever new matching items have been fetched completely.

Note:
This is an optimization, instead of waiting for the end of the job and calling items(), you can connect to this signal and get the items incrementally.

Parameters:
items  The matching items.

Signal syntax:
QObject.connect(source, SIGNAL("itemsReceived(const Akonadi::Item::List&)"), target_slot)
setFetchScope (  self,
Akonadi.ItemFetchScope  fetchScope
)

Sets the item fetch scope.

The ItemFetchScope controls how much of an matching item's data is fetched from the server, e.g. whether to fetch the full item payload or only meta data.

Parameters:
fetchScope  The new scope for item fetch operations.

See also:
fetchScope()

setQuery (  self,
QString  query
)

Sets the search query in SPARQL format.

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal