QtMobility Reference Documentation

QMessageService Class Reference

The QMessageService class provides the interface for requesting messaging service operations. More...

 #include <QMessageService>

Inherits: QObject.

This class was introduced in Qt Mobility 1.0.

Public Types

enum State { InactiveState, ActiveState, CanceledState, FinishedState }

Public Functions

QMessageService ( QObject * parent = 0 )
~QMessageService ()
bool compose ( const QMessage & message )
bool countMessages ( const QMessageFilter & filter = QMessageFilter() )
QMessageManager::Error error () const
bool exportUpdates ( const QMessageAccountId & id )
bool moveMessages ( const QMessageIdList & messageIds, const QMessageFolderId & toFolderId )
bool queryMessages ( const QMessageFilter & filter = QMessageFilter(), const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 )
bool queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::MatchFlags matchFlags = 0, const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 )
bool retrieve ( const QMessageId & messageId, const QMessageContentContainerId & id )
bool retrieveBody ( const QMessageId & id )
bool retrieveHeader ( const QMessageId & id )
bool send ( QMessage & message )
bool show ( const QMessageId & id )
State state () const
bool synchronize ( const QMessageAccountId & id )
  • 29 public functions inherited from QObject

Public Slots

void cancel ()
  • 1 public slot inherited from QObject

Signals

void messagesCounted ( int count )
void messagesFound ( const QMessageIdList & ids )
void progressChanged ( uint value, uint total )
void stateChanged ( QMessageService::State newState )

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QMessageService class provides the interface for requesting messaging service operations.

QMessageService provides the mechanisms for messaging clients to request services, and to receive information in response. All requestable service operations present the same interface for communicating status, and progress information.

All service request operations communicate changes in their operational state by emitting the stateChanged() signal.

Service request operations report progress information by emitting the progressChanged() signal.

If a requested operation fails after being initiated then the error() function will return a value indicating the failure mode encountered.

A client may attempt to cancel a requested operation after it has been initiated. The cancel() slot is provided for this purpose. Cancelation is not guaranteed to succeed, and is not possible on all platforms.

A QMessageService instance supports only a single request at a time. Attempting to initiate an operation on a QMessageService while another operation is already in progress will result in function initiating the latter request returning false. A client may, however, use multiple QMessageService instances to concurrently initiate a queue of requests that will be serviced sequentially.

Each QMessageService instance will report only the changes pertaining to the request that instance initiated.

Except where noted QMessageServices may initiate network activity. Other functions in the mobility messaging API will not initiate network activity, with the exception of Windows mobile and desktop platforms which may initiate network activity during the evaluation of any function call.

Warning: On Symbian this class does not support QObject::moveToThread().

Member Type Documentation

enum QMessageService::State

This enum type is used to describe the state of the requested operation.

ConstantValueDescription
QMessageService::InactiveState0The operation has not yet begun execution.
QMessageService::ActiveState1The operation is currently executing.
QMessageService::CanceledState2The operation was canceled.
QMessageService::FinishedState3The operation has finished execution; successfully completed or otherwise.

Member Function Documentation

QMessageService::QMessageService ( QObject * parent = 0 )

Constructs a message service representation object.

The parent is passed to the QObject constructor.

QMessageService::~QMessageService ()

Destroys the message service representation.

void QMessageService::cancel () [slot]

Attempts to cancel the last requested operation.

This function was introduced in Qt Mobility 1.0.

bool QMessageService::compose ( const QMessage & message )

Open a composer application using message as a prototype.

The default application for handling the type of message should be used.

Returns true if the operation can be initiated; otherwise returns false.

On the QMF platform implementation of this function is left as a task for system integrators.

This function was introduced in Qt Mobility 1.0.

See also QMessage::type().

bool QMessageService::countMessages ( const QMessageFilter & filter = QMessageFilter() )

Emits via a messagesCounted() signal the number messages in the messaging store matching filter.

Calling this function may result in the progressChanged() signal being emitted multiple times. An emission of the progressChanged() signal with a total of 0 indicates that the number of progress steps is unknown.

The performance of counting messages is currently significantly less than optimal for some filters on some platforms.

Returns true if the operation can be initiated; otherwise returns false.

Note: This function should not initiate network activity, instead only message data already stored on the device will be used during evaluation of the function.

This function was introduced in Qt Mobility 1.0.

See also QMessage, QMessageFilter, messagesCounted(), progressChanged(), and queryMessages().

QMessageManager::Error QMessageService::error () const

Returns a value indicating the last error condition encountered by the operation.

This function was introduced in Qt Mobility 1.0.

bool QMessageService::exportUpdates ( const QMessageAccountId & id )

Initiate synchronization with external servers of local changes that have been queued by message store operations, for messages with parent account id.

On Windows mobile and desktop platforms this function performs no operation, as when a connection is available, local changes are opportunistically synchronized with external servers.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.0.

See also QMessageManager::addMessage(), QMessageManager::updateMessage(), QMessageManager::removeMessage(), and QMessageManager::removeMessages().

void QMessageService::messagesCounted ( int count ) [signal]

This signal is emitted when a countMessages() operation has counted messages.

count is the number of matching messages found.

This function was introduced in Qt Mobility 1.0.

See also queryMessages().

void QMessageService::messagesFound ( const QMessageIdList & ids ) [signal]

This signal is emitted when a queryMessages() operation has found messages.

ids is the list of identifiers of messages found.

This function was introduced in Qt Mobility 1.0.

See also queryMessages().

bool QMessageService::moveMessages ( const QMessageIdList & messageIds, const QMessageFolderId & toFolderId )

Initiate a request to move messages messageIds to the folder toFolderId

The folder must be in the same account as the message. This will move the message on the external server, as well as locally.

On Windows mobile and desktop platforms this function is not supported. On Symbian prior to Belle this function is not supported. On Symbian Belle POP supports moving messages to drafts folder only and source folder must be either sent or outbox folder in IMAP and POP if target is drafts folder.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.2.

void QMessageService::progressChanged ( uint value, uint total ) [signal]

This signal is emitted when the operation has progressed.

total is the total number of progress steps to perform, or zero if the number of progress steps is unknown.

value is the number of progress steps completed so far.

This function was introduced in Qt Mobility 1.0.

bool QMessageService::queryMessages ( const QMessageFilter & filter = QMessageFilter(), const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 )

Emits the messagesFound() signal providing QMessageIds of messages in the messaging store. If filter is not empty only identifiers for messages matching the parameters set by filter will be emitted, otherwise identifiers for all messages will be emitted. If sortOrder is not empty, then the identifiers will be sorted by the parameters set by sortOrder. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned.

Calling this function may result in the messagesFound() and progressChanged() signals being emitted multiple times. An emission of the progressChanged() signal with a total of 0 indicates that the number of progress steps is unknown.

The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.

Returns true if the operation can be initiated; otherwise returns false.

Note: This function should not initiate network activity, instead only message data already stored on the device will be used during evaluation of the function.

This function was introduced in Qt Mobility 1.0.

See also QMessage, QMessageFilter, QMessageSortOrder, messagesFound(), progressChanged(), and countMessages().

bool QMessageService::queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::MatchFlags matchFlags = 0, const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 )

Emits the messagesFound() signal providing QMessageIds of messages in the messaging store. If filter is not empty only identifiers for messages matching the parameters set by filter and with a body containing the string body will be emitted, otherwise identifiers for all messages with a body containing body using matching flags matchFlags will be emitted. If sortOrder is not empty, then the identifiers will be sorted by the parameters set by sortOrder. If limit is not zero, then limit places an upper bound on the number of ids in the list returned. offset specifies how many ids to skip at the beginning of the list returned.

Calling this function may result in the messagesFound() and progressChanged() signals being emitted multiple times. An emission of the progressChanged() signal with a total of 0 indicates that the number of progress steps is unknown.

The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.

Returns true if the operation can be initiated; otherwise returns false.

Note: This function should not initiate network activity, instead only message data already stored on the device will be used during evaluation of the function.

This function was introduced in Qt Mobility 1.0.

See also QMessage, QMessageFilter, QMessageSortOrder, messagesFound(), progressChanged(), and countMessages().

bool QMessageService::retrieve ( const QMessageId & messageId, const QMessageContentContainerId & id )

Retrieve the container identified by messageId and id, the contents of the container should also be retrieved.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.0.

See also QMessageContentContainerId.

bool QMessageService::retrieveBody ( const QMessageId & id )

Retrieve the body of the message identified by id.

If the message can not be found on the originating server it will be marked as removed.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.0.

See also QMessageId and QMessage::Removed.

bool QMessageService::retrieveHeader ( const QMessageId & id )

Retrieve meta data of the message identified by id.

The meta data (including flags, from, to, subject, and date fields where applicable) of the message identified by id should be retrieved. If only the message envelope information is present, any other accessible header information should be retrieved.

If the message can not be found on the originating server it will be marked as removed.

Returns true if the operation can be initiated; otherwise returns false.

On the Symbian^3 platform this function is not yet supported.

See also QMessageId and QMessage::Removed.

bool QMessageService::send ( QMessage & message )

Transmit message using the account identified by the message's parentAccountId function. If the message does not have a valid parentAccountId, it will be set to the result of QMessageAccount::defaultAccount() for the message's type.

The message will be stored in the standard Outbox folder for the account before transmission, or moved to that folder if it is already stored in another folder. If transmission is successful, the message will be moved to the standard Sent folder for the account.

Currently on the Maemo 5 (Fremantle), Symbian, and Windows Mobile platforms the service action object enters the FinishedState when the message is queued for sending rather than actually sent.

On the MeeGo.com platform this function is not yet supported for SMS type messages.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.0.

See also QMessage and QMessageAccountId.

bool QMessageService::show ( const QMessageId & id )

Show the message identified by id.

The default application for handling the type of message that id identifies should be used.

Returns true if the operation can be initiated; otherwise returns false.

On the Maemo 5 (Fremantle) platform this function is not yet supported for SMS type messages.

On the QMF platform implementation of this function is left as a task for system integrators.

This function was introduced in Qt Mobility 1.0.

See also QMessageId and QMessage::type().

State QMessageService::state () const

Returns the current state of the operation.

This function was introduced in Qt Mobility 1.0.

See also stateChanged().

void QMessageService::stateChanged ( QMessageService::State newState ) [signal]

This signal is emitted when the state of the operation changes, with the new state described by newState.

This function was introduced in Qt Mobility 1.0.

See also state().

bool QMessageService::synchronize ( const QMessageAccountId & id )

Initiate synchronization with external server identified by id

On Windows mobile and desktop platforms, and Maemo 5 this function performs no operation.

Returns true if the operation can be initiated; otherwise returns false.

This function was introduced in Qt Mobility 1.2.

See also QMessageManager::addMessage(), QMessageManager::updateMessage(), QMessageManager::removeMessage(), and QMessageManager::removeMessages().

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.