QMessageManager Class ReferenceThe 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. Public Types
Public Functions
Signals
Additional Inherited Members
Detailed DescriptionThe 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. Member Type Documentation
|
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.
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.
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.
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.
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.
See also error() and queryMessages().
Returns the code of the last error condition reported by the messaging store.
Returns the QMessageFolder identified by id from the store.
Returns the QMessage identified by id from the store.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
See also unregisterNotificationFilter(), messageAdded(), messageRemoved(), and messageUpdated().
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.
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); }
See also removeMessage(), addMessage(), updateMessage(), and QMessageService::exportUpdates().
Removes the message filter associated with notificationFilterId from the set used to generate message event signals.
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.
See also addMessage(), removeMessage(), and QMessageService::exportUpdates().