Home · All Classes · Grouped Classes · Annotated · Functions

QMailMessageKey Class Reference

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

    #include <QMailMessageKey>

Public Types

Public Functions


Detailed Description

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

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

QMailMessageKey's can be combined using the logical operators (&), (|) and (~) to create more refined queries.

For example: To create a query for all message's sent from "joe@user.com" with subject "meeting":

    QMailMessageKey subjectKey(QMailMessageKey::Subject,"meeting");
    QMailMessageKey senderKey(QMailMessageKey::Sender,"joe@user.com")
    QMailIdList results = QMailStore::query(subjectKey & senderKey);

To query all unread messages from a specific folder parent:

    \\assuming parent has been retrieved from the mail store.
    QMailFolder parent;
    QMailMessageKey parentFolderKey(QMailMessageKey::ParentFolderId,parent.id())
    QMailMessageKey readKey(QMailMessageKey::Flags,QMailMessage::Read,QMailMessageKey::Contains);
    QMailIdList results = QMailStore::query(parentFolderKey & ~readKey);

See also QMailStore and QMailFolderKey.


Member Type Documentation

enum QMailMessageKey::Operand

Defines the comparison operators that can be used to comapare QMailMessage::Property elements with user sepecified values.

ConstantValueDescription
QMailMessageKey::LessThan0represents the '<' operator.
QMailMessageKey::LessThanEqual1represents the '<=' operator.
QMailMessageKey::GreaterThan2represents the '>' operator.
QMailMessageKey::GreaterThanEqual3represents the '>= operator'.
QMailMessageKey::Equal4represents the '=' operator.
QMailMessageKey::NotEqual5represents the '!=' operator.
QMailMessageKey::Contains6represents an operation in which an associated property is checked to see if it contains a provided value. For most property types this will perform a string based check. For Flag type properties this will perform a check to see if a flag bit value is set.

enum QMailMessageKey::Property

This enum type describes the data query properties of a QMailMessage.

ConstantValueDescription
QMailMessageKey::Id0The ID of the message.
QMailMessageKey::Type1The type of the message.
QMailMessageKey::ParentFolderId2The parent folder ID this message is contained in.
QMailMessageKey::Sender3The message sender address string.
QMailMessageKey::Recipients4The message recipient address string.
QMailMessageKey::Subject5The message subject string.
QMailMessageKey::TimeStamp6The message timestamp
QMailMessageKey::Flags7The message status flags.
QMailMessageKey::FromAccount8The name of the account the mesasge was downloaded from.
QMailMessageKey::FromMailbox9The imap mailbox the message was downloaded from.
QMailMessageKey::ServerUid10The IMAP server UID of the message.
QMailMessageKey::Size11The size of the message.


Member Function Documentation

QMailMessageKey::QMailMessageKey ( const Property & p, const QVariant & value, const Operand & c = Equal )

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

QMailMessageKey::QMailMessageKey ( const QMailMessageKey & other )

Create a copy of the QMailMessageKey other.

QMailMessageKey::~QMailMessageKey ()   [virtual]

Destroys the QMailMessageKey

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

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

QMailMessageKey QMailMessageKey::operator& ( const QMailMessageKey & other ) const

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

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

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

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

Assign the value of the QMailMessageKey other to this.

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

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

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

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

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

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

QMailMessageKey QMailMessageKey::operator~ () const

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


Copyright © 2007 Trolltech Trademarks
Qtopia 4.3.0