MessageSearchFilter

Since: BlackBerry 10.0.0

#include <bb/pim/message/MessageSearchFilter>

To link against this class, add the following line to your .pro file: LIBS += -lbbpim

The MessageSearchFilter class lets you specify search criteria for messages.

This class lets you search for and retrieve Message objects that fit certain criteria. For example, you can search for messages that include the text "Cascades" in the subject. Or, you can search for messages that have a certain status, such as read or unread messages.

You can create a MessageSearchFilter object and then pass it as a parameter to search functions in MessageService (MessageService::searchLocal() and MessageService::searchRemote()). A MessageSearchFilter uses the SearchFilterCriteria and SearchStatusCriteria to hold the criteria to search for.


Overview

Public Functions Index

MessageSearchFilter ()
MessageSearchFilter (const MessageSearchFilter &other)
~MessageSearchFilter ()
voidaddSearchCriteria (SearchFilterCriteria::Type searchCriteria, const QString &value)
voidaddStatusCriteria (SearchStatusCriteria::Type statusCriteria)
boolisPriorityInboxSearch () const
MessageSearchFilter &operator= (const MessageSearchFilter &other)
voidremoveStatusCriteria (SearchStatusCriteria::Type statusCriteria)
QHash< QString, QString >searchParams () const
voidsetAccountId (bb::pim::account::AccountKey accountId)
voidsetFolderId (MessageFolderKey folderId)
voidsetLimit (int limit)
voidsetOffset (int offset)
voidsetPriorityInboxSearch (bool)

Public Functions

MessageSearchFilter ()

Constructs a new MessageSearchFilter.

Since:

BlackBerry 10.0.0

MessageSearchFilter (

Copy constructor.

This function constructs a MessageSearchFilter containing exactly the same values as the provided MessageSearchFilter.

Parameters
other

The MessageSearchFilter to be copied.

Since:

BlackBerry 10.0.0

~MessageSearchFilter ()

Destructor.

Since:

BlackBerry 10.0.0

void addSearchCriteria (

Adds a search criteria to this MessageSearchFilter.

For example, if you want search for all messages that have a subject of "hello", you should call this function with parameters of SearchFilterCriteria::Subject and "hello".

Parameters
searchCriteria

The type of search criteria to add (for example, subject, body, and so on).

value

The value to search for.

Since:

BlackBerry 10.0.0

void addStatusCriteria (

Adds a status criteria to this MessageSearchFilter.

For example, if you want search for unread messages only, you should call this function with a parameter of SearchStatusCriteria::Unread.

Parameters
statusCriteria

The status criteria to add.

Since:

BlackBerry 10.0.0

bool isPriorityInboxSearch ()

Gets the priority inbox flag status for search MessageSearchFilter.

Return:

true if Priority Inbox Search flag was set to true earlier, false otherwise.

Since:

BlackBerry 10.2.0

MessageSearchFilter & operator= (

Assignment operator.

This operator copies all values from the provided MessageSearchFilter into this MessageSearchFilter.

Parameters
other

The MessageSearchFilter from which to copy all values.

Return:

A MessageSearchFilter with all copied data.

Since:

BlackBerry 10.0.0

void removeStatusCriteria (

Removes the provided status criteria that was previously set for this MessageSearchFilter.

Parameters
statusCriteria

The status criteria to remove.

Since:

BlackBerry 10.0.0

QHash< QString, QString > searchParams ()

Retrieves the key-value pairs of search parameters for this MessageSearchFilter.

For example, if you want to search for all messages that have a subject of "hello", this function returns a key-value pair of <"subject", "hello">

Return:

The key-value pairs of search parameters.

Since:

BlackBerry 10.0.0

void setAccountId (
  • bb::pim::account::AccountKeyaccountId)

Sets the account ID that this MessageSearchFilter applies to.

Note that this function may be deprecated in the future. The account ID must be passed as a parameter to MessageService::searchLocal() and MessageService::searchRemote(), and so the account ID that's specified here is not used.

Parameters
accountId

The account to search.

Since:

BlackBerry 10.0.0

void setFolderId (
  • MessageFolderKeyfolderId)

Sets the folder ID of the message folder that this MessageSearchFilter applies to.

Parameters
folderId

The folder to search.

Since:

BlackBerry 10.0.0

void setLimit (
  • intlimit)

Sets the maximum number of search results for this MessageSearchFilter.

Parameters
limit

The maximum number of search results.

Since:

BlackBerry 10.0.0

void setOffset (
  • intoffset)

Sets the offset of this MessageSearchFilter.

This function sets the number of messages after the first message that this MessageSearchFilter starts searching.

Parameters
offset

The offset (in number of messages).

Since:

BlackBerry 10.0.0

void setPriorityInboxSearch (
  • bool)

Sets the priority inbox flag for search MessageSearchFilter.

Parameters
isPriorityInboxSearch

Set to true if only priority inbox emails need to be shown in search results.

Since:

BlackBerry 10.2.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus