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