|  | Home |

# QMailAccountSortKey Class Reference

The QMailAccountSortKey class defines the parameters used for sorting a subset of queried accounts from the store. More...

        #include <QMailAccountSortKey>

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, Status, LastSynchronized }

## Public Functions

| QMailAccountSortKey ()
| QMailAccountSortKey ( const QMailAccountSortKey & other )
virtual | ~QMailAccountSortKey ()
const QList<ArgumentType> & | arguments () const
void | deserialize ( Stream & stream )
bool | isEmpty () const
void | serialize ( Stream & stream ) const
bool | operator!= ( const QMailAccountSortKey & other ) const
QMailAccountSortKey | operator& ( const QMailAccountSortKey & other ) const
QMailAccountSortKey & | operator&= ( const QMailAccountSortKey & other )
QMailAccountSortKey & | operator= ( const QMailAccountSortKey & other )
bool | operator== ( const QMailAccountSortKey & other ) const

## Static Public Members

QMailAccountSortKey | id ( Qt::SortOrder order = Qt::AscendingOrder )
QMailAccountSortKey | lastSynchronized ( Qt::SortOrder order = Qt::AscendingOrder )
QMailAccountSortKey | messageType ( Qt::SortOrder order = Qt::AscendingOrder )
QMailAccountSortKey | name ( Qt::SortOrder order = Qt::AscendingOrder )
QMailAccountSortKey | status ( quint64 mask, Qt::SortOrder order = Qt::DescendingOrder )

## Detailed Description

The QMailAccountSortKey class defines the parameters used for sorting a subset of queried accounts from the store.

A QMailAccountSortKey is composed of an account property to sort and a sort order. The QMailAccountSortKey class is used in conjunction with the QMailStore::query() function to sort account results according to the criteria defined by the sort key.

For example: To create a query for all accounts sorted by the name in ascending order:

        QMailAccountSortKey sortNameKey(QMailAccountSortKey::name(Qt::Ascending));
        QMailAccountIdList results = QMailStore::instance()->query(sortNameKey);

See also QMailStore.

## Member Type Documentation

### typedef QMailAccountSortKey::ArgumentType

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

### enum QMailAccountSortKey::Property

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

Constant | Value | Description
--- | --- | ---
`QMailAccountSortKey::Id` | `0` | The ID of the account.
`QMailAccountSortKey::Name` | `1` | The name of the account.
`QMailAccountSortKey::MessageType` | `2` | The type of messages handled by the account.
`QMailAccountSortKey::Status` | `3` | The status value of the account.
`QMailAccountSortKey::LastSynchronized` | `4` | The most recent time that a check for new mail in all folders of the account was completed successfully.

## Member Function Documentation

### QMailAccountSortKey::QMailAccountSortKey ()

Create a QMailAccountSortKey with specifying matching parameters.

A default-constructed key (one for which isEmpty() returns true) sorts no folders.

The result of combining an empty key with a non-empty key is the same as the original non-empty key.

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

### QMailAccountSortKey::QMailAccountSortKey ( const QMailAccountSortKey & other )

Create a copy of the QMailAccountSortKey other.

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

Destroys this QMailAccountSortKey.

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

Returns the list of arguments to this QMailAccountSortKey.

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

Reads the contents of a QMailAccountSortKey from stream.

### QMailAccountSortKey QMailAccountSortKey::id ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts accounts by their identifiers, according to order.

See also QMailAccount::id().

### bool QMailAccountSortKey::isEmpty () const

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

### QMailAccountSortKey QMailAccountSortKey::lastSynchronized ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts accounts by the message type they handle, according to order.

See also QMailAccount::lastSynchronized().

### QMailAccountSortKey QMailAccountSortKey::messageType ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts accounts by the message type they handle, according to order.

See also QMailAccount::messageType().

### QMailAccountSortKey QMailAccountSortKey::name ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts accounts by their names, according to order.

See also QMailAccount::name().

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

Writes the contents of a QMailAccountSortKey to a stream.

### QMailAccountSortKey QMailAccountSortKey::status ( quint64 mask, Qt::SortOrder order = Qt::DescendingOrder ) `[static]`

Returns a key that sorts accounts by comparing their status value bitwise ANDed with mask, according to order.

See also QMailAccount::status().

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

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

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

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

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

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

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

Assign the value of the QMailAccountSortKey other to this.

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

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