• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • ContactSearchJob
Public Types | Public Member Functions | List of all members
Akonadi::ContactSearchJob Class Reference

#include <contactsearchjob.h>

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

Public Types

enum  Criterion {
  Name, Email, NickName, NameOrEmail,
  ContactUid
}
 
enum  Match { ExactMatch, StartsWithMatch, ContainsMatch, ContainsWordBoundaryMatch }
 
- Public Types inherited from Akonadi::Job
enum  Error {
  ConnectionFailed = UserDefinedError, ProtocolVersionMismatch, UserCanceled, Unknown,
  UserError = UserDefinedError + 42
}
 
typedef QList< Job * > List
 

Public Member Functions

 ContactSearchJob (QObject *parent=0)
 
 ~ContactSearchJob ()
 
KABC::Addressee::List contacts () const
 
void setLimit (int limit)
 
void setQuery (Criterion criterion, const QString &value)
 
void setQuery (Criterion criterion, const QString &value, Match match)
 
- Public Member Functions inherited from Akonadi::ItemSearchJob
 ItemSearchJob (const QString &query, QObject *parent=0)
 
 ~ItemSearchJob ()
 
ItemFetchScope & fetchScope ()
 
Item::List items () const
 
void setFetchScope (const ItemFetchScope &fetchScope)
 
void setQuery (const QString &query)
 
- Public Member Functions inherited from Akonadi::Job
 Job (QObject *parent=0)
 
virtual ~Job ()
 
virtual QString errorString () const
 
void start ()
 

Additional Inherited Members

- Signals inherited from Akonadi::ItemSearchJob
void itemsReceived (const Akonadi::Item::List &items)
 
- Signals inherited from Akonadi::Job
void aboutToStart (Akonadi::Job *job)
 
void writeFinished (Akonadi::Job *job)
 
- Static Public Member Functions inherited from Akonadi::ItemSearchJob
static QUrl akonadiItemIdUri ()
 
- Protected Slots inherited from Akonadi::Job
virtual void slotResult (KJob *job)
 
- Protected Member Functions inherited from Akonadi::ItemSearchJob
virtual void doHandleResponse (const QByteArray &tag, const QByteArray &data)
 
void doStart ()
 
- Protected Member Functions inherited from Akonadi::Job
virtual bool addSubjob (KJob *job)
 
virtual bool doKill ()
 
void emitWriteFinished ()
 
virtual bool removeSubjob (KJob *job)
 

Detailed Description

Job that searches for contacts in the Akonadi storage.

This job searches for contacts that match given search criteria and returns the list of contacts.

Examples:

// Search all contacts with email address tokoe@kde.org
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setQuery( Akonadi::ContactSearchJob::Email, "tokoe@kde.org" );
connect( job, SIGNAL( result( KJob* ) ), this, SLOT( searchResult( KJob* ) ) );
...
MyClass::searchResult( KJob *job )
{
Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
const KABC::Addressee::List contacts = searchJob->contacts();
// do something with the contacts
}
// Search for all existing contacts
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
connect( job, SIGNAL( result( KJob* ) ), this, SLOT( searchResult( KJob* ) ) );
...
MyClass::searchResult( KJob *job )
{
Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
const KABC::Addressee::List contacts = searchJob->contacts();
// do something with the contacts
}
Author
Tobias Koenig tokoe.nosp@m.@kde.nosp@m..org
Since
4.4

Definition at line 79 of file contactsearchjob.h.

Member Enumeration Documentation

enum Akonadi::ContactSearchJob::Criterion

Describes the criteria that can be searched for.

Enumerator
Name 

The name of the contact.

Email 

The email address of the contact.

NickName 

The nickname of the contact.

NameOrEmail 

The name or email address of the contact.

Since
4.5
ContactUid 

The global unique identifier of the contact.

Since
4.5

Definition at line 99 of file contactsearchjob.h.

enum Akonadi::ContactSearchJob::Match

Describes the type of pattern matching that shall be used.

Since
4.5
Enumerator
ExactMatch 

The result must match exactly the pattern (case sensitive).

StartsWithMatch 

The result must start with the pattern (case insensitive).

ContainsMatch 

The result must contain the pattern (case insensitive).

ContainsWordBoundaryMatch 

The result must contain a word starting with the pattern (case insensitive).

Definition at line 112 of file contactsearchjob.h.

Constructor & Destructor Documentation

ContactSearchJob::ContactSearchJob ( QObject *  parent = 0)
explicit

Creates a new contact search job.

Parameters
parentThe parent object.

Definition at line 34 of file contactsearchjob.cpp.

ContactSearchJob::~ContactSearchJob ( )

Destroys the contact search job.

Definition at line 57 of file contactsearchjob.cpp.

Member Function Documentation

KABC::Addressee::List ContactSearchJob::contacts ( ) const

Returns the contacts that matched the search criteria.

Definition at line 593 of file contactsearchjob.cpp.

void ContactSearchJob::setLimit ( int  limit)

Sets a limit on how many results will be returned by this search job.

This is useful in situation where for example only the first search result is needed anyway, setting a limit of 1 here will greatly reduce the resource usage of Nepomuk during the search. This needs to be called before calling setQuery() to have an effect. By default, the number of results is unlimited.

Parameters
limitthe upper limit for number of search results

Definition at line 588 of file contactsearchjob.cpp.

void ContactSearchJob::setQuery ( Criterion  criterion,
const QString &  value 
)

Sets the criterion and value for the search.

Parameters
criterionthe query criterion to compare with
valuethe value to match against
Note
ExactMatch is used for the matching.
Todo:
Merge with the method below in KDE5

Definition at line 62 of file contactsearchjob.cpp.

void ContactSearchJob::setQuery ( Criterion  criterion,
const QString &  value,
Match  match 
)

Sets the criterion and value for the search with match.

Parameters
criterionthe query criterion to compare with
valuethe value to match against
matchhow to match the given value
Since
4.5

Definition at line 82 of file contactsearchjob.cpp.


The documentation for this class was generated from the following files:
  • contactsearchjob.h
  • contactsearchjob.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal