Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMailFolderKey Class Reference
[QtMessagingModule, QtPimModule]

The QMailFolderKey class defines the parameters used for querying a subset of all available folders from the mail store. More...

    #include <QMailFolderKey>

This class is under development and is subject to change.

Public Types

Public Functions

Static Public Members


Detailed Description

The QMailFolderKey class defines the parameters used for querying a subset of all available folders from the mail store.

A QMailFolderKey is composed of a folder property, an optional comparison operator and a comparison value. The QMailFolderKey class is used in conjunction with the QMailStore::queryFolders() and QMailStore::countFolders() functions to filter results which meet the criteria defined by the key.

QMailFolderKey's can be combined using the logical operators (&), (|) and (~) to build more sophisticated queries.

For example:

To create a query for all folders named "inbox" or "sms":

    QMailFolderKey inboxKey(QMailFolderKey::Name, "inbox");
    QMailFolderKey smsKey(QMailFolderKey::Name, "sms");
    QMailFolderIdList results = QMailStore::instance()->queryFolders(inboxKey | smsKey);

To query all folders with name "foo" for a specified account:

    QMailFolderIdList fooFolders(const QMailAccountId& accountId)
    {
        QMailFolderKey nameKey(QMailFolderKey::Name, "foo");
        QMailFolderKey accountKey(QMailFolderKey::ParentAccountId, accountId);

        return QMailStore::instance()->queryFolders(nameKey & accountKey);
    }

See also QMailStore and QMailFolder.


Member Type Documentation

enum QMailFolderKey::Property

This enum type describes the queryable data properties of a QMailFolder.

ConstantValueDescription
QMailFolderKey::Id0The ID of the folder.
QMailFolderKey::Name1The name of the folder in native form.
QMailFolderKey::ParentId2The ID of the parent folder for a given folder.
QMailFolderKey::ParentAccountId3The ID of the parent account for this folder.
QMailFolderKey::DisplayName4The name of the folder, designed for display to users.
QMailFolderKey::Status5The status value of the folder.
QMailFolderKey::AncestorFolderIds6The set of IDs of folders which are direct or indirect parents of this folder.


Member Function Documentation

QMailFolderKey::QMailFolderKey ()

Create a QMailFolderKey with specifying matching parameters.

A default-constructed key (one for which isEmpty() returns true) matches all folders. The logical negation of an empty key also matches all folders.

The result of combining an empty key with a non-empty key is the same as the original non-empty key. This is true regardless of whether the combination is formed by a logical AND or a logical OR operation.

The result of combining two empty keys is an empty key.

QMailFolderKey::QMailFolderKey ( Property p, const QVariant & value, QMailDataComparator::Comparator c = QMailDataComparator::Equal )

Construct a QMailFolderKey which defines a query parameter where QMailFolder::Property p is compared using comparison operator c with a value value.

QMailFolderKey::QMailFolderKey ( const QMailFolderIdList & ids )

Construct a QMailFolderKey which defines a query parameter where folder id's matching those in ids are returned.

QMailFolderKey::QMailFolderKey ( const QMailFolderKey & other )

Create a copy of the QMailFolderKey other.

QMailFolderKey::~QMailFolderKey ()   [virtual]

Destroys this QMailFolderKey.

void QMailFolderKey::deserialize ( Stream & stream )

Reads the contents of a QMailFolderKey from stream.

bool QMailFolderKey::isEmpty () const

Returns true if the key remains empty after default construction; otherwise returns false.

See also isNonMatching().

bool QMailFolderKey::isNonMatching () const

Returns true if the key is a non-matching key; otherwise returns false.

See also isEmpty().

QMailFolderKey QMailFolderKey::nonMatchingKey ()   [static]

Returns a key that does not match any folders (unlike an empty key).

See also isNonMatching() and isEmpty().

void QMailFolderKey::serialize ( Stream & stream ) const

Writes the contents of a QMailFolderKey to a stream.

QMailFolderKey::operator QVariant () const

Returns the QVariant representation of this QMailFolderKey.

bool QMailFolderKey::operator!= ( const QMailFolderKey & other ) const

Returns true if the value of this key is not the same as the key other. Returns false otherwise.

QMailFolderKey QMailFolderKey::operator& ( const QMailFolderKey & other ) const

Returns a key that is the logical AND of this key and the value of key other.

QMailFolderKey & QMailFolderKey::operator&= ( const QMailFolderKey & other )

Performs a logical AND with this key and the key other and assigns the result to this key.

QMailFolderKey & QMailFolderKey::operator= ( const QMailFolderKey & other )

Assign the value of the QMailFolderKey other to this.

bool QMailFolderKey::operator== ( const QMailFolderKey & other ) const

Returns true if the value of this key is the same as the key other. Returns false otherwise.

QMailFolderKey QMailFolderKey::operator| ( const QMailFolderKey & other ) const

Returns a key that is the logical OR of this key and the value of key other.

QMailFolderKey & QMailFolderKey::operator|= ( const QMailFolderKey & other )

Performs a logical OR with this key and the key other and assigns the result to this key.

QMailFolderKey QMailFolderKey::operator~ () const

Returns a key that is the logical NOT of the value of this key.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3