#include <contactsearchjob.h>

Public Types | |
| enum | Criterion { Name, Email, NickName, NameOrEmail, ContactUid } |
| enum | Match { ExactMatch, StartsWithMatch, ContainsMatch } |
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) |
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 }
- Since:
- 4.4
Member Enumeration Documentation
| enum Akonadi::ContactSearchJob::Criterion |
Describes the criteria that can be searched for.
- Enumerator:
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:
Definition at line 113 of file contactsearchjob.h.
Constructor & Destructor Documentation
| Akonadi::ContactSearchJob::ContactSearchJob | ( | QObject * | parent = 0 | ) | [explicit] |
Creates a new contact search job.
- Parameters:
-
parent The parent object.
| Akonadi::ContactSearchJob::~ContactSearchJob | ( | ) |
Destroys the contact search job.
Member Function Documentation
| KABC::Addressee::List Akonadi::ContactSearchJob::contacts | ( | ) | const |
Returns the contacts that matched the search criteria.
| void Akonadi::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.
| void Akonadi::ContactSearchJob::setQuery | ( | Criterion | criterion, |
| const QString & | value | ||
| ) |
Sets the criterion and value for the search.
- Note:
- ExactMatch is used for the matching.
- Todo:
- Merge with the method below in KDE5
| void Akonadi::ContactSearchJob::setQuery | ( | Criterion | criterion, |
| const QString & | value, | ||
| Match | match | ||
| ) |
Sets the criterion and value for the search with match.
- Since:
- 4.5
The documentation for this class was generated from the following file:
KDE 4.7 API Reference