• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi

Akonadi::ItemSearchJob

Akonadi::ItemSearchJob Class Reference

Job that searches for items in the Akonadi storage. More...

#include <itemsearchjob.h>

Inheritance diagram for Akonadi::ItemSearchJob:
Inheritance graph
[legend]

List of all members.

Signals

void itemsReceived (const Akonadi::Item::List &items)

Public Member Functions

 ItemSearchJob (const QString &query, QObject *parent=0)
 ~ItemSearchJob ()
ItemFetchScope & fetchScope ()
Item::List items () const
void setFetchScope (const ItemFetchScope &fetchScope)
void setQuery (const QString &query)

Static Public Member Functions

static QUrl akonadiItemIdUri ()

Protected Member Functions

virtual void doHandleResponse (const QByteArray &tag, const QByteArray &data)
void doStart ()

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

Definition at line 63 of file itemsearchjob.h.


Constructor & Destructor Documentation

ItemSearchJob::ItemSearchJob ( const QString &  query,
QObject *  parent = 0 
) [explicit]

Creates an item search job.

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

Definition at line 59 of file itemsearchjob.cpp.

ItemSearchJob::~ItemSearchJob (  ) 

Destroys the item search job.

Definition at line 71 of file itemsearchjob.cpp.


Member Function Documentation

QUrl ItemSearchJob::akonadiItemIdUri (  )  [static]

Returns an URI that represents a predicate that is always added to the Nepomuk resource by the Akonadi Nepomuk feeders.

The statement containing this predicate has the Akonadi Item ID of the resource as string as the object, and the Nepomuk resource, e.g. a PersonContact, as the subject.

Always limit your searches to statements that contain this URI as predicate.

Since:
4.4.3

Definition at line 141 of file itemsearchjob.cpp.

void ItemSearchJob::doHandleResponse ( const QByteArray &  tag,
const QByteArray &  data 
) [protected, virtual]

This method should be reimplemented in the concrete jobs in case you want to handle incoming data.

It will be called on received data from the backend. The default implementation does nothing.

Parameters:
tag The tag of the corresponding command, empty if this is an untagged response.
data The received data.

Reimplemented from Akonadi::Job.

Definition at line 107 of file itemsearchjob.cpp.

void ItemSearchJob::doStart (  )  [protected, virtual]

This method must be reimplemented in the concrete jobs.

It will be called after the job has been started and a connection to the Akonadi backend has been established.

Implements Akonadi::Job.

Definition at line 96 of file itemsearchjob.cpp.

ItemFetchScope & ItemSearchJob::fetchScope (  ) 

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

Definition at line 89 of file itemsearchjob.cpp.

Item::List ItemSearchJob::items (  )  const

Returns the items that matched the search query.

Definition at line 134 of file itemsearchjob.cpp.

void Akonadi::ItemSearchJob::itemsReceived ( const Akonadi::Item::List &  items  )  [signal]

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.
void ItemSearchJob::setFetchScope ( const 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()

Definition at line 82 of file itemsearchjob.cpp.

void ItemSearchJob::setQuery ( const QString &  query  ) 

Sets the search query in SPARQL format.

Definition at line 75 of file itemsearchjob.cpp.


The documentation for this class was generated from the following files:
  • itemsearchjob.h
  • itemsearchjob.cpp

akonadi

Skip menu "akonadi"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.2-20100208
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal