The QMessageManager class represents the main interface for storage and retrieval of messages, folders and accounts in the system message store. More...
#include <QMessageManager>
Inherits: QObject.
This class was introduced in Qt Mobility 1.0.
enum | Error { NoError, InvalidId, ConstraintFailure, ContentInaccessible, ..., RequestIncomplete } |
typedef | NotificationFilterId |
typedef | NotificationFilterIdSet |
enum | RemovalOption { RemoveLocalCopyOnly, RemoveOnOriginatingServer } |
QMessageManager ( QObject * parent = 0 ) | |
~QMessageManager () | |
QMessageAccount | account ( const QMessageAccountId & id ) const |
bool | addMessage ( QMessage * message ) |
int | countAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter() ) const |
int | countFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter() ) const |
int | countMessages ( const QMessageFilter & filter = QMessageFilter() ) const |
QMessageManager::Error | error () const |
QMessageFolder | folder ( const QMessageFolderId & id ) const |
QMessage | message ( const QMessageId & id ) const |
QMessageAccountIdList | queryAccounts ( const QMessageAccountFilter & filter = QMessageAccountFilter(), const QMessageAccountSortOrder & sortOrder = QMessageAccountSortOrder(), uint limit = 0, uint offset = 0 ) const |
QMessageAccountIdList | queryAccounts ( const QMessageAccountFilter & filter, const QList<QMessageAccountSortOrder> & sortOrders, uint limit = 0, uint offset = 0 ) const |
QMessageFolderIdList | queryFolders ( const QMessageFolderFilter & filter = QMessageFolderFilter(), const QMessageFolderSortOrder & sortOrder = QMessageFolderSortOrder(), uint limit = 0, uint offset = 0 ) const |
QMessageFolderIdList | queryFolders ( const QMessageFolderFilter & filter, const QList<QMessageFolderSortOrder> & sortOrders, uint limit = 0, uint offset = 0 ) const |
QMessageIdList | queryMessages ( const QMessageFilter & filter = QMessageFilter(), const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 ) const |
QMessageIdList | queryMessages ( const QMessageFilter & filter, const QList<QMessageSortOrder> & sortOrders, uint limit = 0, uint offset = 0 ) const |
QMessageIdList | queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::MatchFlags matchFlags = 0, const QMessageSortOrder & sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0 ) const |
QMessageIdList | queryMessages ( const QMessageFilter & filter, const QString & body, QMessageDataComparator::MatchFlags matchFlags, const QList<QMessageSortOrder> & sortOrders, uint limit = 0, uint offset = 0 ) const |
NotificationFilterId | registerNotificationFilter ( const QMessageFilter & filter ) |
bool | removeAccount ( const QMessageAccountId & id ) |
bool | removeMessage ( const QMessageId & id, RemovalOption option = RemoveOnOriginatingServer ) |
bool | removeMessages ( const QMessageFilter & filter, RemovalOption option = RemoveOnOriginatingServer ) |
void | unregisterNotificationFilter ( NotificationFilterId notificationFilterId ) |
bool | updateMessage ( QMessage * message ) |
void | accountRemoved ( const QMessageAccountId & id ) |
void | messageAdded ( const QMessageId & id, const QMessageManager::NotificationFilterIdSet & matchingFilterIds ) |
void | messageRemoved ( const QMessageId & id, const QMessageManager::NotificationFilterIdSet & matchingFilterIds ) |
void | messageUpdated ( const QMessageId & id, const QMessageManager::NotificationFilterIdSet & matchingFilterIds ) |
The QMessageManager class represents the main interface for storage and retrieval of messages, folders and accounts in the system message store.
The system contains a single store for messages, which is accessed via the handle class QMessageManager. QMessageManager provides the interface for adding, updating and deleting messages in the system's message store.
QMessageManager provides the countFolders() and queryFolders() functions for counting and listing the folders contained by the messaging store, and the countAccounts() and queryAccounts() functions for counting and listing the accounts contained by the store. These functions use the QMessageFolderFilter and QMessageFolderSortOrder classes, and the QMessageAccountFilter and QMessageAccountSortOrder classes to constrain their searches.
QMessageManager also implements functionality allowing the messages contained by the store to be counted or listed, using various filtering and sortOrder constraints. Clients can access this functionality via the countMessages and queryMessages functions of the QMessageService class.
With the exception of Windows mobile and desktop platforms, QMessageManager functions should not initiate network activity. Instead functions are restricted to operating on data already on the device. See QMessageService for functions related to initiating network activity.
If a QMessageManager operation fails, the error() function will return an error code value indicating the failure mode encountered. A successful operation will set the error() result to QMessageManager::NoError.
Messages in the messaging store are identified by QMessageId objects. The data associated with a message is retrieved in the form of a QMessage object using message(). Likewise a folder is retrieved in the form of a QMessageFolder object using folder(), and an account is retrieved in the form of a QMessageAccount object using account().
Messages can be inserted into the store using the addMessage() function, messages in the store can be manipulated via the updateMessage() function, and removed by the removeMessage() functions.
Messaging store manipulations involving messages are reported via the messagesAdded(), messagesUpdated() and messagesRemoved() signals.
See also QMessage, QMessageId, QMessageContentContainerId, and QMessageService.
Defines the result of attempting to perform a messaging store operation.
Constant | Value | Description |
---|---|---|
QMessageManager::NoError | 0 | The operation was successfully performed. |
QMessageManager::InvalidId | 1 | The operation failed due to the specification of an invalid identifier. |
QMessageManager::ConstraintFailure | 2 | The operation failed due to a constraint violation. |
QMessageManager::ContentInaccessible | 3 | The operation failed because the content data cannot be accessed by the messaging store. |
QMessageManager::NotYetImplemented | 4 | The operation failed because the messaging store does not yet implement the operation. |
QMessageManager::FrameworkFault | 5 | The operation failed because the messaging store encountered an error in performing the operation. |
QMessageManager::WorkingMemoryOverflow | 6 | The operation failed because the messaging store exhausted all memory available for evaluating queries. |
QMessageManager::Busy | 7 | The operation failed because the messaging store is being used by another thread. |
QMessageManager::RequestIncomplete | 8 | The operation failed to report successful completion, although no specific error was reported. |
This type contains a value identifying a registered message filter.
This type contains a set of values identifying registered message filters.
Defines whether or not a message will be removed from the originating server.
Constant | Value | Description |
---|---|---|
QMessageManager::RemoveLocalCopyOnly | 1 | Do not remove the message from the originating server. |
QMessageManager::RemoveOnOriginatingServer | 2 | Remove the message both from the local store and from the originating server if any. |
Constructs a handle to the message store.
If parent is not 0 then the handle will be deleted when parent is deleted.
Destroys the handle to the message store.
Returns the QMessageAccount identified by id from the store.
This function was introduced in Qt Mobility 1.0.
Adds a copy of the message indicated by message to the messaging store and modifies the message indicated by message to contain the identifier of the created message.
Returns true if the operation successfully updates the store; otherwise returns false.
To ensure the change is propagated to any affected external server QMessageService::exportUpdates() should be subsequently called.
On the Maemo 5 (Fremantle) platform for SMS type messages this function is not yet supported.
Using this function to explicitly set a size or date is not currently supported on some platforms.
This function was introduced in Qt Mobility 1.0.
See also message(), updateMessage(), removeMessage(), and QMessageService::exportUpdates().
Returns the number of messages which match the filtering criteria defined in QMessageAccountFilter filter. If filter is empty the count of all available accounts is returned.
This function was introduced in Qt Mobility 1.0.
See also error() and queryAccounts().
Returns the number of folders which match the filtering criteria defined in QMessageFolderFilter filter. If filter is empty the count of all available folders is returned.
This function was introduced in Qt Mobility 1.0.
See also error() and queryFolders().
Returns the number of messages which match the filtering criteria defined in QMessageFilter filter. If filter is empty the count of all available messages is returned.
The performance of counting messages is currently significantly less than optimal for some filters on some platforms.
This function was introduced in Qt Mobility 1.0.
See also error() and queryMessages().
Returns the code of the last error condition reported by the messaging store.
This function was introduced in Qt Mobility 1.0.
Returns the QMessageFolder identified by id from the store.
This function was introduced in Qt Mobility 1.0.
Returns the QMessage identified by id from the store.
This function was introduced in Qt Mobility 1.0.
Signal that is emitted when the message identified by id is added to the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.
This function was introduced in Qt Mobility 1.0.
See also messageRemoved(), messageUpdated(), and registerNotificationFilter().
Signal that is emitted when the message identified by id is removed from the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.
Since the filters apply to the state of the data after the message removal, the only data item that may be subject to filtration is the identifier of the removed message.
On Symbian^3 platform to get signals about removed emails the related mailbox must be manually synchronized.
This function was introduced in Qt Mobility 1.0.
See also messageAdded(), messageUpdated(), and registerNotificationFilter().
Signal that is emitted when the message identified by id is updated in the message store. matchingFilterIds contains a set of values identifiying registered notification filters that matched the message.
Since the filters apply to the state of the data after the message modification, updates to messages which matched a given filter prior to modification but not afterwards will not result in the emission of the messageUpdated signal.
This function was introduced in Qt Mobility 1.0.
See also messageAdded(), messageRemoved(), and registerNotificationFilter().
Returns the QMessageAccountIds of accounts in the messaging store. If filter is not empty only accounts matching the parameters set by filter will be returned, otherwise identifiers for all accounts will be returned. 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.
This function was introduced in Qt Mobility 1.0.
See also error() and countAccounts().
Returns the QMessageAccountIds of accounts in the messaging store. If filter is not empty only accounts matching the parameters set by filter will be returned, otherwise identifiers for all accounts will be returned. If sortOrders is not empty, then the identifiers will be sorted by applying each sort order element in sequence. 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.
This function was introduced in Qt Mobility 1.0.
See also error() and countAccounts().
Returns the QMessageFolderIds of folders in the messaging store. If filter is not empty only folders matching the parameters set by filter will be returned, otherwise identifiers for all folders will be returned. 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.
This function was introduced in Qt Mobility 1.0.
See also error() and countFolders().
Returns the QMessageFolderIds of folders in the messaging store. If filter is not empty only folders matching the parameters set by filter will be returned, otherwise identifiers for all folders will be returned. If sortOrders is not empty, then the identifiers will be sorted by applying each sort order element in sequence. 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.
This function was introduced in Qt Mobility 1.0.
See also error() and countFolders().
Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter will be returned, otherwise identifiers for all messages will be returned. 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.
The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.
This function was introduced in Qt Mobility 1.0.
See also error() and countMessages().
Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter will be returned, otherwise identifiers for all messages will be returned. If sortOrders is not empty, then the identifiers will be sorted by applying each sort order element in sequence. 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.
The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.
This function was introduced in Qt Mobility 1.0.
See also error() and countMessages().
Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter and with a body containing the string body will be returned, otherwise identifiers for all messages with a body containing body will be returned. 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. matchFlags specifies the matching method to use.
The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.
This function was introduced in Qt Mobility 1.0.
See also error() and countMessages().
Returns the QMessageIds of messages in the messaging store. If filter is not empty only messages matching the parameters set by filter and with a body containing the string body will be returned, otherwise identifiers for all messages with a body containing body will be returned. If sortOrders is not empty, then the identifiers will be sorted by applying each sort order element in sequence. 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. matchFlags specifies the matching method to use.
The performance of querying messages is currently significantly less than optimal for some querying criteria on some platforms.
This function was introduced in Qt Mobility 1.0.
See also error() and countMessages().
Registers a message filter that will be used to generate messageAdded(), messageRemoved() and messageUpdated() signals. Returns an identifier value that can be used to identify the reason that a signal was emitted, and to unregister the filter at a later time.
The filter is applied to the state of the data after the occurrence of the event for which a notification may be emitted.
On Linux and Meego.com it is only possible to filter messageRemoved() signals with an empty QMessageFilter() that matches all messages.
This function was introduced in Qt Mobility 1.0.
See also unregisterNotificationFilter(), messageAdded(), messageRemoved(), and messageUpdated().
Remove account id and all associated information (folders, messages etc.)
On Windows mobile and desktop platforms, Maemo 5, and Symbian prior to SR1.11 this function performs no operation.
This function was introduced in Qt Mobility 1.2.
Removes the message with QMessageId id from the messaging store. If option is QMessageManager::RemoveOnOriginatingServer then when synchronization is performed the message should be removed from both the local message store and the originating server if any.
Returns true if the operation successfully updates the store; otherwise returns false.
To ensure the change is propagated to any affected external server QMessageService::exportUpdates() should be subsequently called.
option is ignored on Windows mobile and desktop platforms.
This function was introduced in Qt Mobility 1.0.
See also removeMessages(), addMessage(), updateMessage(), and QMessageService::exportUpdates().
Removes all messages identified by the filter filter from the messaging store. If option is QMessageManager::RemoveOnOriginatingServer then when synchronization is performed the messages should be removed from both the local message store and the originating server if any.
Returns true if the operation successfully updates the store; otherwise returns false.
To ensure the change is propagated to any affected external server QMessageService::exportUpdates() should be subsequently called.
option is ignored on Windows mobile and desktop platforms.
For example:
To implement a function to remove a list messages identified by QMessageIds from the messaging store.
bool removeMessages(const QMessageIdList& ids) { QMessageFilter idsFilter(ids); return QMessageManager().removeMessages(idsFilter); }
This function was introduced in Qt Mobility 1.0.
See also removeMessage(), addMessage(), updateMessage(), and QMessageService::exportUpdates().
Removes the message filter associated with notificationFilterId from the set used to generate message event signals.
This function was introduced in Qt Mobility 1.0.
See also registerNotificationFilter(), messageAdded(), messageRemoved(), and messageUpdated().
Updates the messaging store so that the message whose identifier is contained by the message at message contains the content at message. If message does not contain a valid identifier, no changes will result. Internal data of the QMessage object at message can be modified by this operation.
Returns true if the operation successfully updates the store; otherwise returns false.
To ensure the change is propagated to any affected external server QMessageService::exportUpdates() should be subsequently called.
Using this function to explicitly set a size or date is not currently supported on some platforms.
On the Maemo 5 (Fremantle) platform this function may only be used to update the priority and status of email type messages.
This function was introduced in Qt Mobility 1.0.
See also addMessage(), removeMessage(), and QMessageService::exportUpdates().
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.