src/messaging/qmessagemanager.cpp
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #include "qmessagemanager.h"
       
    42 #include "qmessagestore.h"
       
    43 #include <QDebug>
       
    44 
       
    45 
       
    46 QTM_BEGIN_NAMESPACE
       
    47 
       
    48 /*!
       
    49     \class QMessageManager
       
    50 
       
    51     \brief The QMessageManager class represents the main interface for storage and retrieval
       
    52     of messages, folders and accounts in the system message store.
       
    53 
       
    54     \ingroup messaging
       
    55 
       
    56     The system contains a single store for messages, which is accessed via the handle
       
    57     class QMessageManager.  QMessageManager provides the interface for adding, updating 
       
    58     and deleting messages in the system's message store. 
       
    59     
       
    60     QMessageManager provides the countFolders() and queryFolders() functions for
       
    61     counting and listing the folders contained by the messaging store, and the 
       
    62     countAccounts() and queryAccounts() functions for counting and listing the
       
    63     accounts contained by the store.  These functions use the QMessageFolderFilter
       
    64     and QMessageFolderSortOrder classes, and the QMessageAccountFilter and 
       
    65     QMessageAccountSortOrder classes to constrain their searches.
       
    66 
       
    67     QMessageManager also implements functionality allowing the messages contained by the 
       
    68     store to be counted or listed, using various filtering and sortOrder constraints.
       
    69     Clients can access this functionality via the \l{QMessageService::countMessages()}{countMessages}
       
    70     and \l{QMessageService::queryMessages()}{queryMessages} functions of the
       
    71     QMessageService class.
       
    72     
       
    73     With the exception of Windows mobile and desktop platforms, QMessageManager functions 
       
    74     should not initiate network activity. Instead functions are restricted to operating 
       
    75     on data already on the device. See QMessageService for functions related to 
       
    76     initiating network activity.
       
    77 
       
    78     If a QMessageManager operation fails, the error() function will return an error code
       
    79     value indicating the failure mode encountered.  A successful operation will set the 
       
    80     error() result to QMessageManager::NoError.
       
    81 
       
    82     Messages in the messaging store are identified by QMessageId objects. The data associated 
       
    83     with a message is retrieved in the form of a QMessage object using message(). Likewise 
       
    84     a folder is retrieved in the form of a QMessageFolder object using folder(), and an 
       
    85     account is retrieved in the form of a QMessageAccount object using account().
       
    86 
       
    87     Messages can be inserted into the store using the addMessage() function, messages in the 
       
    88     store can be manipulated via the updateMessage() function, and removed by the 
       
    89     removeMessage() functions.
       
    90     
       
    91     Messaging store manipulations involving messages are reported via the messagesAdded(), 
       
    92     messagesUpdated() and messagesRemoved() signals.
       
    93 
       
    94     \sa QMessage, QMessageId, QMessageContentContainerId, QMessageService
       
    95 */
       
    96 
       
    97 /*!
       
    98     \enum QMessageManager::RemovalOption
       
    99 
       
   100     Defines whether or not a message will be removed from the originating server.
       
   101 
       
   102     \value RemoveLocalCopyOnly        Do not remove the message from the originating server.
       
   103     \value RemoveOnOriginatingServer  Remove the message both from the local store and from the originating server if any.
       
   104 */
       
   105 
       
   106 /*!
       
   107     \typedef QMessageManager::NotificationFilterId
       
   108 
       
   109     This type contains a value identifying a registered message filter.
       
   110 */
       
   111 
       
   112 /*!
       
   113     \typedef QMessageManager::NotificationFilterIdSet
       
   114 
       
   115     This type contains a set of values identifying registered message filters.
       
   116 */
       
   117 
       
   118 /*!
       
   119     \enum QMessageManager::Error
       
   120 
       
   121     Defines the result of attempting to perform a messaging store operation.
       
   122 
       
   123     \value NoError                The operation was successfully performed.
       
   124     \value InvalidId              The operation failed due to the specification of an invalid identifier.
       
   125     \value ConstraintFailure      The operation failed due to a constraint violation.
       
   126     \value ContentInaccessible    The operation failed because the content data cannot be accessed by the messaging store.
       
   127     \value NotYetImplemented      The operation failed because the messaging store does not yet implement the operation.
       
   128     \value FrameworkFault         The operation failed because the messaging store encountered an error in performing the operation.
       
   129     \value WorkingMemoryOverflow  The operation failed because the messaging store exhausted all memory available for evaluating queries.
       
   130     \value Busy                   The operation failed because the messaging store is being used by another thread.
       
   131     \value RequestIncomplete      The operation failed to report successful completion, although no specific error was reported.
       
   132 */
       
   133 
       
   134 /*!
       
   135     \fn QMessageManager::QMessageManager(QObject *parent)
       
   136     
       
   137     Constructs a handle to the message store.
       
   138     
       
   139     If \a parent is not 0 then the handle will be deleted when \a parent is deleted.
       
   140 */
       
   141 QMessageManager::QMessageManager(QObject *parent)
       
   142     : QObject(parent),
       
   143       store(QMessageStore::instance())
       
   144 {
       
   145     connect(store, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)));
       
   146     connect(store, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)));
       
   147     connect(store, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)));
       
   148 }
       
   149 
       
   150 /*!
       
   151     \fn QMessageManager::~QMessageManager()
       
   152     
       
   153     Destroys the handle to the message store.
       
   154 */
       
   155 QMessageManager::~QMessageManager()
       
   156 {
       
   157 }
       
   158 
       
   159 /*!
       
   160     \fn QMessageManager::error() const
       
   161     
       
   162     Returns the code of the last error condition reported by the messaging store.
       
   163 */
       
   164 QMessageManager::Error QMessageManager::error() const
       
   165 {
       
   166     return store->error();
       
   167 }
       
   168 
       
   169 /*!
       
   170     \fn QMessageManager::queryMessages(const QMessageFilter &filter, const QMessageSortOrder &sortOrder, uint limit, uint offset) const
       
   171     
       
   172     Returns the \l{QMessageId}s of messages in the messaging store. If \a filter is not empty 
       
   173     only messages matching the parameters set by \a filter will be returned, otherwise 
       
   174     identifiers for all messages will be returned.
       
   175     If \a sortOrder is not empty, then the identifiers will be sorted by the parameters 
       
   176     set by \a sortOrder.
       
   177     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   178     ids in the list returned.
       
   179     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   180     
       
   181     The performance of querying messages is currently significantly less than 
       
   182     optimal for some querying criteria on some platforms.
       
   183     
       
   184     \sa error(), countMessages()
       
   185 */
       
   186 QMessageIdList QMessageManager::queryMessages(const QMessageFilter &filter, const QMessageSortOrder &sortOrder, uint limit, uint offset) const
       
   187 {
       
   188     return store->queryMessages(filter, sortOrder, limit, offset);
       
   189 }
       
   190 
       
   191 /*!
       
   192     \fn QMessageManager::queryMessages(const QMessageFilter &filter, const QList<QMessageSortOrder> &sortOrders, uint limit, uint offset) const
       
   193     
       
   194     Returns the \l{QMessageId}s of messages in the messaging store. If \a filter is not empty 
       
   195     only messages matching the parameters set by \a filter will be returned, otherwise 
       
   196     identifiers for all messages will be returned.
       
   197     If \a sortOrders is not empty, then the identifiers will be sorted by applying each
       
   198     sort order element in sequence.
       
   199     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   200     ids in the list returned.
       
   201     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   202     
       
   203     The performance of querying messages is currently significantly less than 
       
   204     optimal for some querying criteria on some platforms.
       
   205     
       
   206     \sa error(), countMessages()
       
   207 */
       
   208 QMessageIdList QMessageManager::queryMessages(const QMessageFilter &filter, const QList<QMessageSortOrder> &sortOrders, uint limit, uint offset) const
       
   209 {
       
   210     // Collapse the list of sort orders down to single sort object
       
   211     QMessageSortOrder cumulativeOrder;
       
   212     if (!sortOrders.isEmpty()) {
       
   213         foreach (const QMessageSortOrder &sort, sortOrders) {
       
   214             cumulativeOrder += sort;
       
   215         }
       
   216     }
       
   217 
       
   218     return store->queryMessages(filter, cumulativeOrder, limit, offset);
       
   219 }
       
   220 
       
   221 /*!
       
   222     \fn QMessageManager::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags, const QMessageSortOrder &sortOrder, uint limit, uint offset) const
       
   223     
       
   224     Returns the \l{QMessageId}s of messages in the messaging store. If \a filter is not empty 
       
   225     only messages matching the parameters set by \a filter and with a body containing the 
       
   226     string \a body will be returned, otherwise identifiers for all messages with 
       
   227     a body containing \a body will be returned.
       
   228     If \a sortOrder is not empty, then the identifiers will be sorted by the parameters 
       
   229     set by \a sortOrder.
       
   230     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   231     ids in the list returned.
       
   232     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   233     \a matchFlags specifies the matching method to use.
       
   234     
       
   235     The performance of querying messages is currently significantly less than 
       
   236     optimal for some querying criteria on some platforms.
       
   237     
       
   238     \sa error(), countMessages()
       
   239 */
       
   240 QMessageIdList QMessageManager::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags, const QMessageSortOrder &sortOrder, uint limit, uint offset) const
       
   241 {
       
   242     return store->queryMessages(filter, body, matchFlags, sortOrder, limit, offset);
       
   243 }
       
   244 
       
   245 /*!
       
   246     \fn QMessageManager::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags, const QList<QMessageSortOrder> &sortOrders, uint limit, uint offset) const
       
   247     
       
   248     Returns the \l{QMessageId}s of messages in the messaging store. If \a filter is not empty 
       
   249     only messages matching the parameters set by \a filter and with a body containing the 
       
   250     string \a body will be returned, otherwise identifiers for all messages with 
       
   251     a body containing \a body will be returned.
       
   252     If \a sortOrders is not empty, then the identifiers will be sorted by applying each
       
   253     sort order element in sequence.
       
   254     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   255     ids in the list returned.
       
   256     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   257     \a matchFlags specifies the matching method to use.
       
   258     
       
   259     The performance of querying messages is currently significantly less than 
       
   260     optimal for some querying criteria on some platforms.
       
   261     
       
   262     \sa error(), countMessages()
       
   263 */
       
   264 QMessageIdList QMessageManager::queryMessages(const QMessageFilter &filter, const QString &body, QMessageDataComparator::MatchFlags matchFlags, const QList<QMessageSortOrder> &sortOrders, uint limit, uint offset) const
       
   265 {
       
   266     // Collapse the list of sort orders down to single sort object
       
   267     QMessageSortOrder cumulativeOrder;
       
   268     if (!sortOrders.isEmpty()) {
       
   269         foreach (const QMessageSortOrder &sort, sortOrders) {
       
   270             cumulativeOrder += sort;
       
   271         }
       
   272     }
       
   273 
       
   274     return store->queryMessages(filter, body, matchFlags, cumulativeOrder, limit, offset);
       
   275 }
       
   276 
       
   277 /*!
       
   278     \fn QMessageManager::queryFolders(const QMessageFolderFilter &filter, const QMessageFolderSortOrder &sortOrder, uint limit, uint offset) const
       
   279     
       
   280     Returns the \l{QMessageFolderId}s of folders in the messaging store. If \a filter 
       
   281     is not empty only folders matching the parameters set by \a filter will be returned,
       
   282     otherwise identifiers for all folders will be returned.
       
   283     If \a sortOrder is not empty, then the identifiers will be sorted by the parameters 
       
   284     set by \a sortOrder.
       
   285     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   286     ids in the list returned.
       
   287     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   288     
       
   289     \sa error(), countFolders()
       
   290 */
       
   291 QMessageFolderIdList QMessageManager::queryFolders(const QMessageFolderFilter &filter, const QMessageFolderSortOrder &sortOrder, uint limit, uint offset) const
       
   292 {
       
   293     return store->queryFolders(filter, sortOrder, limit, offset);
       
   294 }
       
   295 
       
   296 /*!
       
   297     \fn QMessageManager::queryFolders(const QMessageFolderFilter &filter, const QList<QMessageFolderSortOrder> &sortOrders, uint limit, uint offset) const
       
   298     
       
   299     Returns the \l{QMessageFolderId}s of folders in the messaging store. If \a filter 
       
   300     is not empty only folders matching the parameters set by \a filter will be returned,
       
   301     otherwise identifiers for all folders will be returned.
       
   302     If \a sortOrders is not empty, then the identifiers will be sorted by applying each
       
   303     sort order element in sequence.
       
   304     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   305     ids in the list returned.
       
   306     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   307     
       
   308     \sa error(), countFolders()
       
   309 */
       
   310 QMessageFolderIdList QMessageManager::queryFolders(const QMessageFolderFilter &filter, const QList<QMessageFolderSortOrder> &sortOrders, uint limit, uint offset) const
       
   311 {
       
   312     // Collapse the list of sort orders down to single sort object
       
   313     QMessageFolderSortOrder cumulativeOrder;
       
   314     if (!sortOrders.isEmpty()) {
       
   315         foreach (const QMessageFolderSortOrder &sort, sortOrders) {
       
   316             cumulativeOrder += sort;
       
   317         }
       
   318     }
       
   319 
       
   320     return store->queryFolders(filter, cumulativeOrder, limit, offset);
       
   321 }
       
   322 
       
   323 /*!
       
   324     \fn QMessageManager::queryAccounts(const QMessageAccountFilter &filter, const QMessageAccountSortOrder &sortOrder, uint limit, uint offset) const
       
   325     
       
   326     Returns the \l{QMessageAccountId}s of accounts in the messaging store. If \a filter 
       
   327     is not empty only accounts matching the parameters set by \a filter will be returned, 
       
   328     otherwise identifiers for all accounts will be returned.
       
   329     If \a sortOrder is not empty, then the identifiers will be sorted by the parameters 
       
   330     set by \a sortOrder.
       
   331     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   332     ids in the list returned.
       
   333     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   334     
       
   335     \sa error(), countAccounts()
       
   336 */
       
   337 QMessageAccountIdList QMessageManager::queryAccounts(const QMessageAccountFilter &filter, const QMessageAccountSortOrder &sortOrder, uint limit, uint offset) const
       
   338 {
       
   339     return store->queryAccounts(filter, sortOrder, limit, offset);
       
   340 }
       
   341 
       
   342 /*!
       
   343     \fn QMessageManager::queryAccounts(const QMessageAccountFilter &filter, const QList<QMessageAccountSortOrder> &sortOrders, uint limit, uint offset) const
       
   344     
       
   345     Returns the \l{QMessageAccountId}s of accounts in the messaging store. If \a filter 
       
   346     is not empty only accounts matching the parameters set by \a filter will be returned, 
       
   347     otherwise identifiers for all accounts will be returned.
       
   348     If \a sortOrders is not empty, then the identifiers will be sorted by applying each
       
   349     sort order element in sequence.
       
   350     If \a limit is not zero, then \a limit places an upper bound on the number of 
       
   351     ids in the list returned.
       
   352     \a offset specifies how many ids to skip at the beginning of the list returned.
       
   353     
       
   354     \sa error(), countAccounts()
       
   355 */
       
   356 QMessageAccountIdList QMessageManager::queryAccounts(const QMessageAccountFilter &filter, const QList<QMessageAccountSortOrder> &sortOrders, uint limit, uint offset) const
       
   357 {
       
   358     // Currently, we do not support multiple account sort orderings
       
   359     QMessageAccountSortOrder cumulativeOrder;
       
   360     if (!sortOrders.isEmpty()) {
       
   361         cumulativeOrder = sortOrders.first();
       
   362     }
       
   363 
       
   364     return store->queryAccounts(filter, cumulativeOrder, limit, offset);
       
   365 }
       
   366 
       
   367 /*!
       
   368     \fn QMessageManager::countMessages(const QMessageFilter& filter) const
       
   369     
       
   370     Returns the number of messages which match the filtering criteria defined 
       
   371     in QMessageFilter \a filter. If \a filter is empty the count of all 
       
   372     available messages is returned.
       
   373     
       
   374     The performance of counting messages is currently significantly less than optimal 
       
   375     for some filters on some platforms.
       
   376     
       
   377     \sa error(), queryMessages()
       
   378 */
       
   379 int QMessageManager::countMessages(const QMessageFilter& filter) const
       
   380 {
       
   381     return store->countMessages(filter);
       
   382 }
       
   383 
       
   384 /*!
       
   385     \fn QMessageManager::countFolders(const QMessageFolderFilter& filter) const
       
   386     
       
   387     Returns the number of folders which match the filtering criteria defined 
       
   388     in QMessageFolderFilter \a filter. If \a filter is empty the count of all 
       
   389     available folders is returned.
       
   390     
       
   391     \sa error(), queryFolders()
       
   392 */
       
   393 int QMessageManager::countFolders(const QMessageFolderFilter& filter) const
       
   394 {
       
   395     return store->countFolders(filter);
       
   396 }
       
   397 
       
   398 /*!
       
   399     \fn QMessageManager::countAccounts(const QMessageAccountFilter& filter) const
       
   400     
       
   401     Returns the number of messages which match the filtering criteria defined 
       
   402     in QMessageAccountFilter \a filter. If \a filter is empty the count of all 
       
   403     available accounts is returned.
       
   404     
       
   405     \sa error(), queryAccounts()
       
   406 */
       
   407 int QMessageManager::countAccounts(const QMessageAccountFilter& filter) const
       
   408 {
       
   409     return store->countAccounts(filter);
       
   410 }
       
   411 
       
   412 /*!
       
   413     \fn QMessageManager::removeMessage(const QMessageId& id, RemovalOption option)
       
   414     
       
   415     Removes the message with QMessageId \a id from the messaging store. If \a option is 
       
   416     QMessageManager::RemoveOnOriginatingServer then when synchronization is performed the 
       
   417     message should be removed from both the local message store and the originating server  
       
   418     if any.
       
   419 
       
   420     Returns \c true if the operation successfully updates the store; otherwise returns \c false.
       
   421     
       
   422     To ensure the change is propagated to any affected external server
       
   423     QMessageService::exportUpdates() should be subsequently called.
       
   424     
       
   425     \a option is ignored on Windows mobile and desktop platforms.
       
   426 
       
   427     \sa removeMessages(), addMessage(), updateMessage(), QMessageService::exportUpdates()
       
   428 */
       
   429 bool QMessageManager::removeMessage(const QMessageId& id, QMessageManager::RemovalOption option)
       
   430 {
       
   431     return store->removeMessage(id, option);
       
   432 }
       
   433 
       
   434 /*!
       
   435     \fn QMessageManager::removeMessages(const QMessageFilter& filter, QMessageManager::RemovalOption option)
       
   436     
       
   437     Removes all messages identified by the filter \a filter from the messaging store.
       
   438     If \a option is QMessageManager::RemoveOnOriginatingServer then when synchronization is performed the 
       
   439     messages should be removed from both the local message store and the originating server if any.
       
   440 
       
   441     Returns \c true if the operation successfully updates the store; otherwise returns \c false. 
       
   442     
       
   443     To ensure the change is propagated to any affected external server
       
   444     QMessageService::exportUpdates() should be subsequently called.
       
   445 
       
   446     \a option is ignored on Windows mobile and desktop platforms.
       
   447 
       
   448     
       
   449     For example:
       
   450 
       
   451     To implement a function to remove a list messages identified by QMessageIds
       
   452     from the messaging store.
       
   453     \code
       
   454     bool removeMessages(const QMessageIdList& ids)
       
   455     {
       
   456         QMessageFilter idsFilter(ids);
       
   457         return QMessageManager().removeMessages(idsFilter);
       
   458     }
       
   459     \endcode
       
   460 
       
   461     \sa removeMessage(), addMessage(), updateMessage(), QMessageService::exportUpdates()
       
   462 */
       
   463 bool QMessageManager::removeMessages(const QMessageFilter& filter, QMessageManager::RemovalOption option)
       
   464 {
       
   465     return store->removeMessages(filter, option);
       
   466 }
       
   467 
       
   468 /*!
       
   469     \fn QMessageManager::addMessage(QMessage *message)
       
   470     
       
   471     Adds a copy of the message indicated by \a message to the messaging store 
       
   472     and modifies the message indicated by \a message to contain the identifier 
       
   473     of the created message.
       
   474 
       
   475     Returns \c true if the operation successfully updates the store; otherwise returns \c false. 
       
   476     
       
   477     To ensure the change is propagated to any affected external server
       
   478     QMessageService::exportUpdates() should be subsequently called.
       
   479     
       
   480     On the Maemo 5 (Fremantle) platform for SMS type messages this function is not yet 
       
   481     supported.
       
   482     
       
   483     Using this function to explicitly set a size or date is not currently supported on some platforms.
       
   484     
       
   485     \sa message(), updateMessage(), removeMessage(), QMessageService::exportUpdates()
       
   486 */
       
   487 bool QMessageManager::addMessage(QMessage *m)
       
   488 {
       
   489     return store->addMessage(m);
       
   490 }
       
   491 
       
   492 /*!
       
   493     \fn QMessageManager::updateMessage(QMessage *message)
       
   494     
       
   495     Updates the messaging store so that the message whose identifier is contained 
       
   496     by the message at \a message contains the content at \a message. If \a message
       
   497     does not contain a valid identifier, no changes will result.  Internal data
       
   498     of the QMessage object at \a message can be modified by this operation.
       
   499     
       
   500     Returns \c true if the operation successfully updates the store; otherwise returns \c false. 
       
   501 
       
   502     To ensure the change is propagated to any affected external server 
       
   503     QMessageService::exportUpdates() should be subsequently called.
       
   504 
       
   505     Using this function to explicitly set a size or date is not currently supported on some platforms.
       
   506     
       
   507     On the Maemo 5 (Fremantle) platform this function may only be used to update the priority and 
       
   508     status of email type messages.
       
   509     
       
   510     \sa addMessage(), removeMessage(), QMessageService::exportUpdates()
       
   511 */
       
   512 bool QMessageManager::updateMessage(QMessage *m)
       
   513 {
       
   514     return store->updateMessage(m);
       
   515 }
       
   516 
       
   517 /*!
       
   518     \fn QMessageManager::message(const QMessageId& id) const
       
   519     
       
   520     Returns the QMessage identified by \a id from the store.
       
   521 */
       
   522 QMessage QMessageManager::message(const QMessageId& id) const
       
   523 {
       
   524     return store->message(id);
       
   525 }
       
   526 
       
   527 /*!
       
   528     \fn QMessageManager::folder(const QMessageFolderId& id) const
       
   529     
       
   530     Returns the QMessageFolder identified by \a id from the store.
       
   531 */
       
   532 QMessageFolder QMessageManager::folder(const QMessageFolderId& id) const
       
   533 {
       
   534     return store->folder(id);
       
   535 }
       
   536 
       
   537 /*!
       
   538     \fn QMessageManager::account(const QMessageAccountId& id) const
       
   539     
       
   540     Returns the QMessageAccount identified by \a id from the store.
       
   541 */
       
   542 QMessageAccount QMessageManager::account(const QMessageAccountId& id) const
       
   543 {
       
   544     return store->account(id);
       
   545 }
       
   546 
       
   547 /*!
       
   548     \fn NotificationFilterId QMessageManager::registerNotificationFilter(const QMessageFilter &filter);
       
   549 
       
   550     Registers a message filter that will be used to generate messageAdded(), messageRemoved()
       
   551     and messageUpdated() signals.  Returns an identifier value that can be used to identify the 
       
   552     reason that a signal was emitted, and to unregister the filter at a later time.
       
   553 
       
   554     The \a filter is applied to the state of the data after the occurrence of the event for which 
       
   555     a notification may be emitted.
       
   556 
       
   557     \sa unregisterNotificationFilter(), messageAdded(), messageRemoved(), messageUpdated()
       
   558 */
       
   559 QMessageManager::NotificationFilterId QMessageManager::registerNotificationFilter(const QMessageFilter &filter)
       
   560 {
       
   561     return store->registerNotificationFilter(filter);
       
   562 }
       
   563 
       
   564 /*!
       
   565     \fn void QMessageManager::unregisterNotificationFilter(NotificationFilterId notificationFilterId);
       
   566 
       
   567     Removes the message filter associated with \a notificationFilterId from the set used 
       
   568     to generate message event signals.
       
   569 
       
   570     \sa registerNotificationFilter(), messageAdded(), messageRemoved(), messageUpdated()
       
   571 */
       
   572 void QMessageManager::unregisterNotificationFilter(NotificationFilterId notificationFilterId)
       
   573 {
       
   574     store->unregisterNotificationFilter(notificationFilterId);
       
   575 }
       
   576 
       
   577 /*!
       
   578     \fn void QMessageManager::messageAdded(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds);
       
   579 
       
   580     Signal that is emitted when the message identified by \a id is added to the message store.
       
   581     \a matchingFilterIds contains a set of values identifiying registered notification filters 
       
   582     that matched the message.
       
   583     
       
   584     \sa messageRemoved(), messageUpdated(), registerNotificationFilter()
       
   585 */
       
   586 
       
   587 /*!
       
   588     \fn void QMessageManager::messageRemoved(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds);
       
   589 
       
   590     Signal that is emitted when the message identified by \a id is removed from the message store.
       
   591     \a matchingFilterIds contains a set of values identifiying registered notification filters 
       
   592     that matched the message.
       
   593 
       
   594     Since the filters apply to the state of the data after the message removal, the only 
       
   595     data item that may be subject to filtration is the identifier of the removed message.
       
   596 
       
   597     \sa messageAdded(), messageUpdated(), registerNotificationFilter()
       
   598 */
       
   599 
       
   600 /*!
       
   601     \fn void QMessageManager::messageUpdated(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds);
       
   602 
       
   603     Signal that is emitted when the message identified by \a id is updated in the message store.
       
   604     \a matchingFilterIds contains a set of values identifiying registered notification filters 
       
   605     that matched the message.
       
   606 
       
   607     Since the filters apply to the state of the data after the message modification, updates 
       
   608     to messages which matched a given filter prior to modification but not afterwards will not 
       
   609     result in the emission of the messageUpdated signal.
       
   610 
       
   611     \sa messageAdded(), messageRemoved(), registerNotificationFilter()
       
   612 */
       
   613 
       
   614 static const int registrationId1 = qRegisterMetaType<QMessageManager::NotificationFilterId>();
       
   615 static const int registrationId2 = qRegisterMetaType<QMessageManager::NotificationFilterIdSet>();
       
   616 
       
   617 #include "moc_qmessagemanager.cpp"
       
   618 
       
   619 QTM_END_NAMESPACE