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

QMailAccount Class Reference
[QtMessagingModule, QtPimModule]

The QMailAccount class represents a messaging account in the mail store. More...

    #include <QMailAccount>

This class is under development and is subject to change.

Public Functions


Detailed Description

The QMailAccount class represents a messaging account in the mail store.

A QMailAccount is a logical entity that groups messages according to the method by which they are sent and received. An account can be configured to support one more message sources, from which messages are imported into the mail store, and one or more message sinks by which messages are transmitted to external messaging services. Although an account can support multiple source or sinks, this facility is for grouping those that are logically equivalent; for example, using one of multiple connectivity options to retrieve messages from the same external server.

The QMailAccount class is used for accessing properties of the account related to dealing with the account's folders and messages, rather than for modifying the account itself. The AccountConfiguration class allows for the configuration of the account itself to be modified. A newly created account must also have an AccountConfiguration defined, in order to be used for transfer of messages to or from Qt Extended.

QMailAccount allows the communications properties of the account to be tested. The canSendMail() and canCollectMail() functions allow the basic transfer capabilities of the account to be queried. The messageSources() and messageSinks() functions return the protocol tags for each message source or message sink implementations configured for the account. These tags can be used to identify the implementation details of the account if necessary:

    void someFunction(const QMailMessage &message)
    {
        QMailAccount msgAccount(message.parentAccountId());
        if (msgAccount.messageSources().contains("imap4", Qt::CaseInsensitive)) {
            // This account uses IMAP
            ...
        }
    }

The QMailAccount class also provides functions which help clients to access the resources of the account. The mailboxes() function returns a list of each folder associated with the account, while the getMailbox() function allows a mailbox to be located by name. The deletedMessages() and serverUids() functions are primarily used in synchronizing the account's contents with those present on an external server.

See also AccountConfiguration and QMailStore::account().


Member Function Documentation

QMailAccount::QMailAccount ()

Creates an uninitialised account object.

QMailAccount::QMailAccount ( const QMailAccountId & id )

Convenience constructor that creates a QMailAccount by loading the data from the store as specified by the QMailAccountId id. If the account does not exist in the store, then this constructor will create an empty and invalid QMailAccount.

QMailAccount::QMailAccount ( const QMailAccount & other )

Creates a copy of the QMailAccount other.

QMailAccount::~QMailAccount ()

Destroys the account object.

QString QMailAccount::accountName () const

Returns the name of the account for display purposes.

See also setAccountName().

bool QMailAccount::canCollectMail () const

Returns true if the account can be used to collect mail. That is if it is an IMAP or POP account; otherwise returns false.

bool QMailAccount::canSendMail () const

Returns true if the account can be used to send mail.

const QStringList QMailAccount::deletedMessages () const

Return the list of messages removed from this account.

const QStringList QMailAccount::deletedMessages ( const QMailFolderId & folderId ) const

This is an overloaded member function, provided for convenience.

Return the list of messages removed from the mailbox identified by folderId.

QString QMailAccount::displayName () const

Returns the name of the account as suitable for displaying in the user interface. Currently simply returns the account name.

QMailFolderId QMailAccount::getMailbox ( const QString & name )

Returns the subfolder with the given name if any; other returns an invalid ID.

See also mailboxes().

bool QMailAccount::hasSettings () const

Returns true if the account has configuration file settings; otherwise false. Currently only returns false for SMS accounts.

See also saveSettings() and readSettings().

QMailAccountId QMailAccount::id () const

Returns the storage id for this account.

See also setId().

bool QMailAccount::isMessageSink () const

Returns true if this account can transmit outgoing messages to external messaging services.

bool QMailAccount::isMessageSource () const

Returns true if this account has incoming messages sourced from external messaging services.

const QMailFolderIdList QMailAccount::mailboxes () const

Returns the list of identifiers for the mailboxes of this account.

See also getMailbox().

QStringList QMailAccount::messageSinks () const

Returns the list of protocol tags identifying the message sink implementations that can transmit messages for this account.

QStringList QMailAccount::messageSources () const

Returns the list of protocol tags identifying the message source implementations that provide the messages for this account.

QMailMessage::MessageType QMailAccount::messageType () const

Returns the types of messsages this account deals with.

void QMailAccount::readSettings ( QSettings * conf )

Deserialize the account information from the current group of the given QSettings file conf.

See also saveSettings() and hasSettings().

void QMailAccount::saveSettings ( QSettings * conf ) const

Serialize the account information to the current group of the given QSettings file conf.

See also readSettings() and hasSettings().

const QStringList QMailAccount::serverUids () const

Returns the list of server UIDs for messages owned by this account.

const QStringList QMailAccount::serverUids ( const QMailFolderId & folderId ) const

This is an overloaded member function, provided for convenience.

Returns the list of message server UIDs for this account, that are located in the folder identified by folderId.

const QStringList QMailAccount::serverUids ( const QMailFolderId & folderId, quint64 messageStatusFilter, bool set = true ) const

This is an overloaded member function, provided for convenience.

Returns the list of message server UIDs located in the folder identified by folderId, whose status field yields set when logically ANDed with messageStatusFilter.

void QMailAccount::setAccountName ( const QString & str )

Sets the name of the account for display purposes to str.

See also accountName().

void QMailAccount::setId ( const QMailAccountId & id )

Sets the storage id for this account to id.

See also id().

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

Assigns the value of this account to the account other


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3