|  | Home |

# QMailAccount Class Reference

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

        #include <QMailAccount>

This class is under development and is subject to change.

- List of all members, including inherited members

## Public Functions

| QMailAccount ()
| QMailAccount ( const QMailAccountId & id )
| QMailAccount ( const QMailAccount & other )
| ~QMailAccount ()
QString | customField ( const QString & name ) const
const QMap<QString, QString> & | customFields () const
QMailAddress | fromAddress () const
QMailAccountId | id () const
QMailTimeStamp | lastSynchronized () const
QStringList | messageSinks () const
QStringList | messageSources () const
QMailMessageMetaDataFwd::MessageType | messageType () const
QString | name () const
void | removeCustomField ( const QString & name )
void | setCustomField ( const QString & name, const QString & value )
void | setCustomFields ( const QMap<QString, QString> & fields )
void | setFromAddress ( const QMailAddress & address )
void | setId ( const QMailAccountId & id )
void | setLastSynchronized ( const QMailTimeStamp & synced )
void | setMessageType ( QMailMessageMetaDataFwd::MessageType type )
void | setName ( const QString & str )
void | setSignature ( const QString & str )
void | setStandardFolder ( QMailFolder::StandardFolder folder, const QMailFolderId & folderId )
void | setStatus ( quint64 newStatus )
void | setStatus ( quint64 mask, bool set )
QString | signature () const
QMailFolderId | standardFolder ( QMailFolder::StandardFolder folder ) const
const QMap<QMailFolder::StandardFolder, QMailFolderId> & | standardFolders () const
quint64 | status () const
QMailAccount & | operator= ( const QMailAccount & other )

## Static Public Members

const quint64 & | AppendSignature
const quint64 & | CanCreateFolders
const quint64 & | CanReferenceExternalData
const quint64 & | CanRetrieve
const quint64 & | CanTransmit
const quint64 & | CanTransmitViaReference
const quint64 & | Enabled
const quint64 & | MessageSink
const quint64 & | MessageSource
const quint64 & | PreferredSender
const quint64 & | SynchronizationEnabled
const quint64 & | Synchronized
const quint64 & | UseSmartReply
const quint64 & | UserEditable
const quint64 & | UserRemovable
quint64 | statusMask ( const QString & flagName )

## 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 sources 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 QMailAccountConfiguration class allows for the configuration details of the account itself to be modified. A newly created account must also have a QMailAccountConfiguration defined, in order to be used for the transfer of messages.

QMailAccount allows the communications properties of the account to be tested. The MessageSource status flag indicates that the account acts a source of incoming messages, and the MessageSink status flag indicates that the account provides a mechanism for transmitting outgoing messages. The messageSources() and messageSinks() functions return the protocol tags for each message source or message sink implementation 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 mailbox() 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 QMailAccountConfiguration 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::customField ( const QString & name ) const

Returns the value recorded in the custom field named name.

See also setCustomField() and customFields().

### const QMap<QString, QString> & QMailAccount::customFields () const

Returns the map of custom fields stored in the account.

See also setCustomFields(), customField(), and setCustomField().

### QMailAddress QMailAccount::fromAddress () const

Returns the address from which the account's outgoing messages should be reported as originating.

See also setFromAddress().

### QMailAccountId QMailAccount::id () const

Returns the storage id for this account.

See also setId().

### QMailTimeStamp QMailAccount::lastSynchronized () const

Returns the time the account was last succesfully synchronized.

Should be updated by QMailRetrievalAction::retrieveMessageList() when an account is synchronized.

See also setLastSynchronized() and QMailRetrievalAction::retrieveMessageList().

### 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.

### QMailMessageMetaDataFwd::MessageType QMailAccount::messageType () const

Returns the types of messages this account deals with.

See also setMessageType().

### QString QMailAccount::name () const

Returns the name of the account for display purposes.

See also setName().

### void QMailAccount::removeCustomField ( const QString & name )

Removes the custom field named name.

See also customField() and customFields().

### void QMailAccount::setCustomField ( const QString & name, const QString & value )

Sets the value of the custom field named name to value.

See also customField() and customFields().

### void QMailAccount::setCustomFields ( const QMap<QString, QString> & fields )

Sets the account to contain the custom fields in fields.

See also setCustomField() and customFields().

### void QMailAccount::setFromAddress ( const QMailAddress & address )

Sets the address from which the account's outgoing messages should be reported as originating to address.

See also fromAddress().

### void QMailAccount::setId ( const QMailAccountId & id )

Sets the storage id for this account to id.

See also id().

### void QMailAccount::setLastSynchronized ( const QMailTimeStamp & synced )

Sets the last successful synchronized time to synced

See also lastSynchronized().

### void QMailAccount::setMessageType ( QMailMessageMetaDataFwd::MessageType type )

Sets the types of messages this account deals with to type.

See also messageType().

### void QMailAccount::setName ( const QString & str )

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

See also name().

### void QMailAccount::setSignature ( const QString & str )

Sets the signature text configured for the account to str.

See also signature().

### void QMailAccount::setStandardFolder ( QMailFolder::StandardFolder folder, const QMailFolderId & folderId )

Sets the folder configured for the standard folder role folder for this account to folderId.

See also standardFolder().

### void QMailAccount::setStatus ( quint64 newStatus )

Sets the status value for the account to newStatus.

See also status() and statusMask().

### void QMailAccount::setStatus ( quint64 mask, bool set )

Sets the status flags indicated in mask to set.

See also status() and statusMask().

### QString QMailAccount::signature () const

Returns the signature text configured for the account.

See also setSignature().

### QMailFolderId QMailAccount::standardFolder ( QMailFolder::StandardFolder folder ) const

Returns the folder configured for the standard folder role folder for this account, if there is one.

See also setStandardFolder().

### const QMap<QMailFolder::StandardFolder, QMailFolderId> & QMailAccount::standardFolders () const

Returns the map of standard folders configured for this account.

See also standardFolder() and setStandardFolder().

### quint64 QMailAccount::status () const

Returns the status value for the account.

See also setStatus() and statusMask().

### quint64 QMailAccount::statusMask ( const QString & flagName ) `[static]`

Returns the status bitmask needed to test the result of QMailAccount::status() against the QMailAccount status flag registered with the identifier flagName.

See also status() and QMailStore::accountStatusMask().

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

Assigns the value of this account to the account other

## Member Variable Documentation

### const quint64 & QMailAccount::AppendSignature

The status mask needed for testing the value of the registered status flag named `"AppendSignature"` against the result of QMailAccount::status().

This flag indicates that an account has been configured to append a signature block to outgoing messages.

### const quint64 & QMailAccount::CanCreateFolders

The status mask needed for testing the value of the registered status flag named `"CanCreateFolders"` against the result of QMailAccount::status().

This flag indicates that top level folders can be created for the account.

See also QMailStorageAction::createFolder() and QMailFolder::ChildCreationPermitted.

### const quint64 & QMailAccount::CanReferenceExternalData

The status mask needed for testing the value of the registered status flag named `"CanReferenceExternalData"` against the result of QMailAccount::status().

This flag indicates that the account can contain messages that reference data in other messages.

See also QMailMessagePart::setReference().

### const quint64 & QMailAccount::CanRetrieve

The status mask needed for testing the value of the registered status flag named `"CanRetrieve"` against the result of QMailAccount::status().

This flag indicates that the account has been sufficiently configured that an attempt to retrieve messages may be performed.

### const quint64 & QMailAccount::CanTransmit

The status mask needed for testing the value of the registered status flag named `"CanTransmit"` against the result of QMailAccount::status().

This flag indicates that the account has been sufficiently configured that an attempt to transmit messages may be performed.

### const quint64 & QMailAccount::CanTransmitViaReference

The status mask needed for testing the value of the registered status flag named `"CanTransmitViaReference"` against the result of QMailAccount::status().

This flag indicates that the account can be used to transmit messages that contain references.

See also QMailMessagePart::setReference().

### const quint64 & QMailAccount::Enabled

The status mask needed for testing the value of the registered status flag named `"Enabled"` against the result of QMailAccount::status().

This flag indicates that the account has been marked as suitable for use by the messaging server.

### const quint64 & QMailAccount::MessageSink

The status mask needed for testing the value of the registered status flag named `"MessageSink"` against the result of QMailAccount::status().

This flag indicates that the account has been configured to act as a transmitter of outgoing messages.

### const quint64 & QMailAccount::MessageSource

The status mask needed for testing the value of the registered status flag named `"MessageSink"` against the result of QMailAccount::status().

This flag indicates that the account has been configured to act as a source of incoming messages.

### const quint64 & QMailAccount::PreferredSender

The status mask needed for testing the value of the registered status flag named `"PreferredSender"` against the result of QMailAccount::status().

This flag indicates that the account is the user's preferred account for sending the type of message that the account creates.

See also QMailAccount::messageType().

### const quint64 & QMailAccount::SynchronizationEnabled

The status mask needed for testing the value of the registered status flag named `"SynchronizationEnabled"` against the result of QMailAccount::status().

This flag indicates that an account should be synchronized against an external message source.

### const quint64 & QMailAccount::Synchronized

The status mask needed for testing the value of the registered status flag named `"Synchronized"` against the result of QMailAccount::status().

This flag indicates that an account has been synchronized by a synchronization operation.

### const quint64 & QMailAccount::UseSmartReply

The status mask needed for testing the value of the registered status flag named `"UseSmartReply"` against the result of QMailAccount::status().

This flag indicates that the account uses 'Smart Reply', a technique in which the server will automatically append the text of the replied-to message, and as such does not need to be done manually.

### const quint64 & QMailAccount::UserEditable

The status mask needed for testing the value of the registered status flag named `"UserEditable"` against the result of QMailAccount::status().

This flag indicates that the account's configuration may be modified by the user.

### const quint64 & QMailAccount::UserRemovable

The status mask needed for testing the value of the registered status flag named `"UserRemovable"` against the result of QMailAccount::status().

This flag indicates that the account may be removed by the user.