|  | Home |

# QMailMessageSortKey Class Reference

The QMailMessageSortKey class defines the parameters used for sorting a subset of queried messages from the mail store. More...

        #include <QMailMessageSortKey>

This class is under development and is subject to change.

- List of all members, including inherited members

## Public Types

typedef | ArgumentType
enum | Property { Id, Type, ParentFolderId, Sender, ..., ParentThreadId }

## Public Functions

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

## Static Public Members

QMailMessageSortKey | contentType ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | copyServerUid ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | id ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | listId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | messageType ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | parentAccountId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | parentFolderId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | previousParentFolderId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | receptionTimeStamp ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | recipients ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | restoreFolderId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | rfcId ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | sender ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | serverUid ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | size ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | status ( quint64 mask, Qt::SortOrder order = Qt::DescendingOrder )
QMailMessageSortKey | subject ( Qt::SortOrder order = Qt::AscendingOrder )
QMailMessageSortKey | timeStamp ( Qt::SortOrder order = Qt::AscendingOrder )

## Detailed Description

The QMailMessageSortKey class defines the parameters used for sorting a subset of queried messages from the mail store.

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

For example: To create a query for all messages sorted by their timestamp in decending order:

        QMailMessageSortKey sortKey(QMailMessageSortKey::timeStamp(Qt::DescendingOrder));
        QMailIdList results = QMailStore::instance()->queryMessages(QMailMessageKey(), sortKey);

See also QMailStore and QMailMessageKey.

## Member Type Documentation

### typedef QMailMessageSortKey::ArgumentType

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

### enum QMailMessageSortKey::Property

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

Constant | Value | Description
--- | --- | ---
`QMailMessageSortKey::Id` | `0` | The ID of the message.
`QMailMessageSortKey::Type` | `1` | The type of the message.
`QMailMessageSortKey::ParentFolderId` | `2` | The parent folder ID this message is contained in.
`QMailMessageSortKey::Sender` | `3` | The message sender address string.
`QMailMessageSortKey::Recipients` | `4` | The message recipient address string.
`QMailMessageSortKey::Subject` | `5` | The message subject string.
`QMailMessageSortKey::TimeStamp` | `6` | The message origination timestamp.
`QMailMessageSortKey::ReceptionTimeStamp` | `7` | The message reception timestamp.
`QMailMessageSortKey::Status` | `8` | The message status flags.
`QMailMessageSortKey::ServerUid` | `9` | The IMAP server UID of the message.
`QMailMessageSortKey::ParentAccountId` | `11` | The ID of the account the mesasge was downloaded from.
`QMailMessageSortKey::Size` | `10` | The size of the message.
`QMailMessageSortKey::ContentType` | `12` | The type of data contained within the message.
`QMailMessageSortKey::PreviousParentFolderId` | `13` | The parent folder ID this message was contained in, prior to moving to the current parent folder.
`QMailMessageSortKey::CopyServerUid` | `14` | The server uid of the message this is a copy of
`QMailMessageSortKey::ListId` | `15` | The name of the list
`QMailMessageSortKey::RestoreFolderId` | `16` | The folderId of where the message should be restored to
`QMailMessageSortKey::RfcId` | `17` | The message rfcId, that is the message-id header field value.
`QMailMessageSortKey::ParentThreadId` | `18` | The QMailThreadId of the thread (conversation) of the message.

## Member Function Documentation

### QMailMessageSortKey::QMailMessageSortKey ()

Create a QMailMessageSortKey with specifying matching parameters.

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

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.

### QMailMessageSortKey::QMailMessageSortKey ( const QMailMessageSortKey & other )

Create a copy of the QMailMessageSortKey other.

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

Destroys this QMailMessageSortKey.

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

Returns the list of arguments to this QMailMessageSortKey.

### QMailMessageSortKey QMailMessageSortKey::contentType ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their content types, according to order.

See also QMailMessage::content().

### QMailMessageSortKey QMailMessageSortKey::copyServerUid ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their copy server identifiers, according to order.

See also QMailMessage::copyServerUid().

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

Reads the contents of a QMailMessageSortKey from stream.

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

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

See also QMailMessage::id().

### bool QMailMessageSortKey::isEmpty () const

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

### QMailMessageSortKey QMailMessageSortKey::listId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by list identifier according to order.

See also QMailMessage::listId().

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

Returns a key that sorts messages by their message type, according to order.

See also QMailMessage::messageType().

### QMailMessageSortKey QMailMessageSortKey::parentAccountId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

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

See also QMailMessage::parentAccountId().

### QMailMessageSortKey QMailMessageSortKey::parentFolderId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their parent folders' identifiers, according to order.

See also QMailMessage::parentFolderId().

### QMailMessageSortKey QMailMessageSortKey::previousParentFolderId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their previous parent folders' identifiers, according to order.

See also QMailMessage::previousParentFolderId().

### QMailMessageSortKey QMailMessageSortKey::receptionTimeStamp ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their reception timestamp, according to order.

See also QMailMessage::receivedDate().

### QMailMessageSortKey QMailMessageSortKey::recipients ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by the addresses to which they were sent, according to order.

See also QMailMessage::to().

### QMailMessageSortKey QMailMessageSortKey::restoreFolderId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their restore folder identifiers, according to order.

See also QMailMessage::restoreFolderId().

### QMailMessageSortKey QMailMessageSortKey::rfcId ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by message-id headerfield according to order.

See also QMailMessage::listId().

### QMailMessageSortKey QMailMessageSortKey::sender ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by the address from which they were sent, according to order.

See also QMailMessage::from().

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

Writes the contents of a QMailMessageSortKey to a stream.

### QMailMessageSortKey QMailMessageSortKey::serverUid ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

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

See also QMailMessage::serverUid().

### QMailMessageSortKey QMailMessageSortKey::size ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their size, according to order.

See also QMailMessage::size().

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

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

See also QMailMessage::status().

### QMailMessageSortKey QMailMessageSortKey::subject ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their subject, according to order.

See also QMailMessage::subject().

### QMailMessageSortKey QMailMessageSortKey::timeStamp ( Qt::SortOrder order = Qt::AscendingOrder ) `[static]`

Returns a key that sorts messages by their origination timestamp, according to order.

See also QMailMessage::date().

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

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

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

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

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

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

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

Assign the value of the QMailMessageSortKey other to this.

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

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