Akonadi::ContactSearchJob

Search for usage in LXR

Akonadi::ContactSearchJob Class Reference

#include <contactsearchjob.h>

Inheritance diagram for Akonadi::ContactSearchJob:

Public Types

enum  Criterion {
  Name, Email, NickName, NameOrEmail,
  ContactUid
}
 
enum  Match { ExactMatch, StartsWithMatch, ContainsMatch, ContainsWordBoundaryMatch }
 
- Public Types inherited from Akonadi::Job
enum  Error
 
typedef QList< Job * > List
 

Public Member Functions

 ContactSearchJob (QObject *parent=nullptr)
 
 ~ContactSearchJob () override
 
KContacts::Addressee::List contacts () const
 
void setLimit (int limit)
 
void setQuery (Criterion criterion, const QString &value, Match match=ExactMatch)
 
- Public Member Functions inherited from Akonadi::ItemSearchJob
 ItemSearchJob (const SearchQuery &query, QObject *parent=nullptr)
 
 ItemSearchJob (QObject *parent=nullptr)
 
ItemFetchScopefetchScope ()
 
bool isRecursive () const
 
bool isRemoteSearchEnabled () const
 
Item::List items () const
 
QStringList mimeTypes () const
 
Collection::List searchCollections () const
 
void setFetchScope (const ItemFetchScope &fetchScope)
 
void setMimeTypes (const QStringList &mimeTypes)
 
void setQuery (const SearchQuery &query)
 
void setRecursive (bool recursive)
 
void setRemoteSearchEnabled (bool enabled)
 
void setSearchCollections (const Collection::List &collections)
 
void setTagFetchScope (const TagFetchScope &fetchScope)
 
TagFetchScopetagFetchScope ()
 
- Public Member Functions inherited from Akonadi::Job
 Job (QObject *parent=nullptr)
 
QString errorString () const final
 
void start () override
 

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)
 
- Public Attributes inherited from Akonadi::Job
 ConnectionFailed
 
 ProtocolVersionMismatch
 
 Unknown
 
 UserCanceled
 
 UserError
 
- Protected Member Functions inherited from Akonadi::ItemSearchJob
bool doHandleResponse (qint64 tag, const Protocol::CommandPtr &response) override
 
void doStart () override
 
- Protected Member Functions inherited from Akonadi::Job
bool addSubjob (KJob *job) override
 
bool doKill () override
 
void emitWriteFinished ()
 
bool removeSubjob (KJob *job) override
 

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 [email protected]
connect( job, SIGNAL(result(KJob*)), this, SLOT(searchResult(KJob*)) );
...
MyClass::searchResult( KJob *job )
{
Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
// do something with the contacts
}
// Search for all existing contacts
connect( job, SIGNAL(result(KJob*)), this, SLOT(searchResult(KJob*)) );
...
MyClass::searchResult( KJob *job )
{
Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
// do something with the contacts
}
Author
Tobias Koenig tokoe.nosp@m.@kde.nosp@m..org
Since
4.4

Definition at line 68 of file contactsearchjob.h.

Member Enumeration Documentation

◆ 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 88 of file contactsearchjob.h.

◆ 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 101 of file contactsearchjob.h.

Constructor & Destructor Documentation

◆ ContactSearchJob()

ContactSearchJob::ContactSearchJob ( QObject parent = nullptr)
explicit

Creates a new contact search job.

Parameters
parentThe parent object.

Definition at line 22 of file contactsearchjob.cpp.

◆ ~ContactSearchJob()

ContactSearchJob::~ContactSearchJob ( )
overridedefault

Destroys the contact search job.

Member Function Documentation

◆ contacts()

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

Returns the contacts that matched the search criteria.

Definition at line 79 of file contactsearchjob.cpp.

◆ setLimit()

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 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 74 of file contactsearchjob.cpp.

◆ setQuery()

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

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 52 of file contactsearchjob.cpp.


The documentation for this class was generated from the following files:
void setQuery(Criterion criterion, const QString &value, Match match=ExactMatch)
Sets the criterion and value for the search with match.
@ Email
The email address of the contact.
KContacts::Addressee::List contacts() const
Returns the contacts that matched the search criteria.
Job that searches for contacts in the Akonadi storage.
AddresseeList List
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 03:51:43 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.