|  | Home |

# QMailAccountKey Class Reference

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

        #include <QMailAccountKey>

This class is under development and is subject to change.

- List of all members, including inherited members

## Public Types

typedef | ArgumentType
enum | Property { Id, Name, MessageType, FromAddress, ..., LastSynchronized }

## Public Functions

| QMailAccountKey ()
| QMailAccountKey ( const QMailAccountKey & other )
virtual | ~QMailAccountKey ()
const QList<ArgumentType> & | arguments () const
QMailKey::Combiner | combiner () const
void | deserialize ( Stream & stream )
bool | isEmpty () const
bool | isNegated () const
bool | isNonMatching () const
void | serialize ( Stream & stream ) const
const QList<QMailAccountKey> & | subKeys () const
| operator QVariant () const
bool | operator!= ( const QMailAccountKey & other ) const
QMailAccountKey | operator& ( const QMailAccountKey & other ) const
const QMailAccountKey & | operator&= ( const QMailAccountKey & other )
const QMailAccountKey & | operator= ( const QMailAccountKey & other )
bool | operator== ( const QMailAccountKey & other ) const
QMailAccountKey | operator| ( const QMailAccountKey & other ) const
const QMailAccountKey & | operator|= ( const QMailAccountKey & other )
QMailAccountKey | operator~ () const

## Static Public Members

QMailAccountKey | customField ( const QString & name, QMailDataComparator::PresenceComparator cmp = QMailDataComparator::Present )
QMailAccountKey | customField ( const QString & name, const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | customField ( const QString & name, const QString & value, QMailDataComparator::InclusionComparator cmp )
QMailAccountKey | fromAddress ( const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | fromAddress ( const QString & value, QMailDataComparator::InclusionComparator cmp )
QMailAccountKey | id ( const QMailAccountId & id, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | id ( const QMailAccountIdList & ids, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes )
QMailAccountKey | id ( const QMailAccountKey & key, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes )
QMailAccountKey | lastSynchronized ( const QDateTime & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | lastSynchronized ( const QDateTime & value, QMailDataComparator::RelationComparator cmp )
QMailAccountKey | messageType ( QMailMessageMetaDataFwd::MessageType value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | messageType ( int value, QMailDataComparator::InclusionComparator cmp )
QMailAccountKey | name ( const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal )
QMailAccountKey | name ( const QString & value, QMailDataComparator::InclusionComparator cmp )
QMailAccountKey | name ( const QStringList & values, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes )
QMailAccountKey | nonMatchingKey ()
QMailAccountKey | status ( quint64 mask, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes )
QMailAccountKey | status ( quint64 value, QMailDataComparator::EqualityComparator cmp )

## Detailed Description

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

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

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

For example:

To create a query for all accounts handling email messages:

        QMailAccountKey emailKey(QMailAccountKey::messageType(QMailMessage::Email));
        QMailAccountIdList results = QMailStore::instance()->queryAccounts(emailKey);

To query all accounts handling SMS or MMS messages:

        QMailAccountKey mmsAccount(QMailAccountKey::messageType(QMailMessage::Mms));
        QMailAccountKey smsAccount(QMailAccountKey::messageType(QMailMessage::Sms));
        QMailAccountIdList results = QMailStore::instance()->queryAccounts(mmsAccount | smsAccount);

See also QMailStore and QMailAccount.

## Member Type Documentation

### typedef QMailAccountKey::ArgumentType

Defines the type used to represent a single criterion of an account filter.

Synonym for QMailKeyArgument<QMailAccountKey::Property>.

### enum QMailAccountKey::Property

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

Constant | Value | Description
--- | --- | ---
`QMailAccountKey::Id` | `( 1<<0 )` | The ID of the account.
`QMailAccountKey::Name` | `( 1<<1 )` | The name of the account.
`QMailAccountKey::MessageType` | `( 1<<2 )` | The type of messages handled by the account.
`QMailAccountKey::FromAddress` | `( 1<<3 )` | The address from which the account's outgoing messages should be reported as originating.
`QMailAccountKey::Status` | `( 1<<4 )` | The status value of the account.
`QMailAccountKey::Custom` | `( 1<<5 )` | The custom fields of the account.
`QMailAccountKey::LastSynchronized` | `( 1<<6 )` | The most recent time that a check for new mail in all folders of the account was completed successfully.

## Member Function Documentation

### QMailAccountKey::QMailAccountKey ()

Creates a QMailAccountKey without specifying matching parameters.

A default-constructed key (one for which isEmpty() returns true) matches all accounts.

See also isEmpty().

### QMailAccountKey::QMailAccountKey ( const QMailAccountKey & other )

Creates a copy of the QMailAccountKey other.

### QMailAccountKey::~QMailAccountKey () `[virtual]`

Destroys this QMailAccountKey.

### const QList<ArgumentType> & QMailAccountKey::arguments () const

Returns the list of arguments to this QMailAccountKey.

### QMailKey::Combiner QMailAccountKey::combiner () const

Returns the combiner used to combine arguments or sub keys of this QMailAccountKey.

### QMailAccountKey QMailAccountKey::customField ( const QString & name, QMailDataComparator::PresenceComparator cmp = QMailDataComparator::Present ) `[static]`

Returns a key matching accounts that possess a custom field with the name name, according to cmp.

See also QMailAccount::customField().

### QMailAccountKey QMailAccountKey::customField ( const QString & name, const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts that possess a custom field with the name name, whose value matches value, according to cmp.

See also QMailAccount::customField().

### QMailAccountKey QMailAccountKey::customField ( const QString & name, const QString & value, QMailDataComparator::InclusionComparator cmp ) `[static]`

Returns a key matching accounts that possess a custom field with the name name, whose value matches the substring value, according to cmp.

See also QMailAccount::customField().

### void QMailAccountKey::deserialize ( Stream & stream )

Reads the contents of a QMailAccountKey from stream.

### QMailAccountKey QMailAccountKey::fromAddress ( const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts whose address matches value, according to cmp.

See also QMailAccount::fromAddress().

### QMailAccountKey QMailAccountKey::fromAddress ( const QString & value, QMailDataComparator::InclusionComparator cmp ) `[static]`

Returns a key matching accounts whose address matches the substring value, according to cmp.

See also QMailAccount::fromAddress().

### QMailAccountKey QMailAccountKey::id ( const QMailAccountId & id, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts whose identifier matches id, according to cmp.

See also QMailAccount::id().

### QMailAccountKey QMailAccountKey::id ( const QMailAccountIdList & ids, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes ) `[static]`

Returns a key matching accounts whose identifier is a member of ids, according to cmp.

See also QMailAccount::id().

### QMailAccountKey QMailAccountKey::id ( const QMailAccountKey & key, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes ) `[static]`

Returns a key matching accounts whose identifier is a member of the set yielded by key, according to cmp.

See also QMailAccount::id().

### bool QMailAccountKey::isEmpty () const

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

An empty key matches all accounts.

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

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

See also isNonMatching().

### bool QMailAccountKey::isNegated () const

Returns true if the key's criteria should be negated in application.

### bool QMailAccountKey::isNonMatching () const

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

A non-matching key does not match any accounts.

The result of ANDing a non-matching key with a matching key is a non-matching key. The result of ORing a non-matching key with a matching key is the original matching key.

The result of combining two non-matching keys is a non-matching key.

See also nonMatchingKey() and isEmpty().

### QMailAccountKey QMailAccountKey::lastSynchronized ( const QDateTime & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts whose last synchronization time matches the time value, according to cmp.

See also QMailAccount::lastSynchronized().

### QMailAccountKey QMailAccountKey::lastSynchronized ( const QDateTime & value, QMailDataComparator::RelationComparator cmp ) `[static]`

Returns a key matching accounts whose last synchronization timestamp has the relation to value that is specified by cmp.

See also QMailAccount::lastSynchronized().

### QMailAccountKey QMailAccountKey::messageType ( QMailMessageMetaDataFwd::MessageType value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts whose messageType matches value, according to cmp.

See also QMailAccount::messageType().

### QMailAccountKey QMailAccountKey::messageType ( int value, QMailDataComparator::InclusionComparator cmp ) `[static]`

Returns a key matching accounts whose messageType is a bitwise match to value, according to cmp.

See also QMailAccount::messageType().

### QMailAccountKey QMailAccountKey::name ( const QString & value, QMailDataComparator::EqualityComparator cmp = QMailDataComparator::Equal ) `[static]`

Returns a key matching accounts whose name matches value, according to cmp.

See also QMailAccount::name().

### QMailAccountKey QMailAccountKey::name ( const QString & value, QMailDataComparator::InclusionComparator cmp ) `[static]`

Returns a key matching accounts whose name matches the substring value, according to cmp.

See also QMailAccount::name().

### QMailAccountKey QMailAccountKey::name ( const QStringList & values, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes ) `[static]`

Returns a key matching accounts whose name is a member of values, according to cmp.

See also QMailAccount::name().

### QMailAccountKey QMailAccountKey::nonMatchingKey () `[static]`

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

See also isNonMatching() and isEmpty().

### void QMailAccountKey::serialize ( Stream & stream ) const

Writes the contents of a QMailAccountKey to a stream.

### QMailAccountKey QMailAccountKey::status ( quint64 mask, QMailDataComparator::InclusionComparator cmp = QMailDataComparator::Includes ) `[static]`

Returns a key matching accounts whose status is a bitwise match to mask, according to cmp.

See also QMailAccount::status().

### QMailAccountKey QMailAccountKey::status ( quint64 value, QMailDataComparator::EqualityComparator cmp ) `[static]`

Returns a key matching accounts whose status matches value, according to cmp.

See also QMailAccount::status().

### const QList<QMailAccountKey> & QMailAccountKey::subKeys () const

Returns the list of sub keys held by this QMailAccountKey.

### QMailAccountKey::operator QVariant () const

Returns the QVariant representation of this QMailAccountKey.

### bool QMailAccountKey::operator!= ( const QMailAccountKey & other ) const

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

### QMailAccountKey QMailAccountKey::operator& ( const QMailAccountKey & other ) const

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

### const QMailAccountKey & QMailAccountKey::operator&= ( const QMailAccountKey & other )

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

### const QMailAccountKey & QMailAccountKey::operator= ( const QMailAccountKey & other )

Assign the value of the QMailAccountKey other to this.

### bool QMailAccountKey::operator== ( const QMailAccountKey & other ) const

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

### QMailAccountKey QMailAccountKey::operator| ( const QMailAccountKey & other ) const

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

### const QMailAccountKey & QMailAccountKey::operator|= ( const QMailAccountKey & other )

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

### QMailAccountKey QMailAccountKey::operator~ () const

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

If this key is empty, the result will be a non-matching key; if this key is non-matching, the result will be an empty key.

See also isEmpty() and isNonMatching().