|
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 #ifndef QMESSAGEWINHELPERPRIVATE_H |
|
42 #define QMESSAGEWINHELPERPRIVATE_H |
|
43 |
|
44 #include <QHash> |
|
45 #include <QMap> |
|
46 #include <QPair> |
|
47 #include <QSharedPointer> |
|
48 #include <QString> |
|
49 #include <QByteArray> |
|
50 #include <MAPIUtil.h> |
|
51 #include <qmessagemanager.h> |
|
52 #include <QVector> |
|
53 #include <QQueue> |
|
54 #include <QEvent> |
|
55 |
|
56 QTM_BEGIN_NAMESPACE |
|
57 |
|
58 QTM_END_NAMESPACE |
|
59 |
|
60 #ifndef _WIN32_WCE |
|
61 |
|
62 #define USES_IID_IMAPIForm |
|
63 #define USES_IID_IMAPIMessageSite |
|
64 #define USES_IID_IPersistMessage |
|
65 |
|
66 #include <initguid.h> |
|
67 #include <mapiguid.h> |
|
68 #include <mapiform.h> |
|
69 |
|
70 #endif |
|
71 |
|
72 |
|
73 // As per http://support.microsoft.com/kb/816477 |
|
74 #ifndef PR_MSG_EDITOR_FORMAT |
|
75 #define PR_MSG_EDITOR_FORMAT PROP_TAG( PT_LONG, 0x5909 ) |
|
76 #define EDITOR_FORMAT_DONTKNOW ((ULONG)0) |
|
77 #define EDITOR_FORMAT_PLAINTEXT ((ULONG)1) |
|
78 #define EDITOR_FORMAT_HTML ((ULONG)2) |
|
79 #ifndef _WIN32_WCE |
|
80 #define EDITOR_FORMAT_RTF ((ULONG)3) |
|
81 #else |
|
82 // Not a real definition, but useful for us: |
|
83 #define EDITOR_FORMAT_MIME ((ULONG)3) |
|
84 #endif |
|
85 #endif |
|
86 |
|
87 #ifndef PR_ATTACH_CONTENT_ID |
|
88 // This is not available in my SDK version... |
|
89 #define PR_ATTACH_CONTENT_ID PROP_TAG( PT_UNICODE, 0x3712 ) |
|
90 #endif |
|
91 |
|
92 #ifndef PR_BODY_HTML |
|
93 #define PR_BODY_HTML PROP_TAG( PT_TSTRING, 0x1013 ) |
|
94 #endif |
|
95 |
|
96 #define mapiRelease(a) if(a){a->Release();a=0;} |
|
97 |
|
98 |
|
99 QTM_BEGIN_NAMESPACE |
|
100 |
|
101 class MapiEntryId : public QByteArray |
|
102 { |
|
103 public: |
|
104 MapiEntryId():QByteArray(){} |
|
105 MapiEntryId(LPENTRYID mapiEntryId, ULONG entryIdLength) |
|
106 : |
|
107 QByteArray(reinterpret_cast<const char*>(mapiEntryId),entryIdLength){} |
|
108 |
|
109 MapiEntryId(LPBYTE mapiEntryId, ULONG entryIdLength) |
|
110 : |
|
111 QByteArray(reinterpret_cast<const char*>(mapiEntryId),entryIdLength){} |
|
112 }; |
|
113 |
|
114 class MapiRecordKey : public QByteArray |
|
115 { |
|
116 public: |
|
117 MapiRecordKey():QByteArray(){} |
|
118 MapiRecordKey(LPENTRYID mapiRecordKey, ULONG entryIdLength) |
|
119 : |
|
120 QByteArray(reinterpret_cast<const char*>(mapiRecordKey),entryIdLength){} |
|
121 |
|
122 MapiRecordKey(LPBYTE mapiRecordKey, ULONG entryIdLength) |
|
123 : |
|
124 QByteArray(reinterpret_cast<const char*>(mapiRecordKey),entryIdLength){} |
|
125 }; |
|
126 |
|
127 class MapiFolder; |
|
128 class MapiStore; |
|
129 class MapiSession; |
|
130 typedef QSharedPointer<MapiFolder> MapiFolderPtr; |
|
131 typedef QSharedPointer<MapiStore> MapiStorePtr; |
|
132 typedef QSharedPointer<MapiSession> MapiSessionPtr; |
|
133 |
|
134 namespace WinHelpers { |
|
135 |
|
136 |
|
137 enum SavePropertyOption { DontSavePropertyChanges = 0, SavePropertyChanges }; |
|
138 |
|
139 QString QStringFromLpctstr(LPCTSTR lpszValue); |
|
140 void LptstrFromQString(const QString &value, LPTSTR *lpsz); |
|
141 |
|
142 typedef QPair<QMessageId, ULONG> AttachmentLocator; |
|
143 QMessageContentContainer fromLocator(const WinHelpers::AttachmentLocator &l); |
|
144 |
|
145 ULONG createNamedProperty(IMAPIProp *object, const QString &name); |
|
146 ULONG getNamedPropertyTag(IMAPIProp *object, const QString &name); |
|
147 |
|
148 bool setNamedProperty(IMAPIProp *object, ULONG tag, const QString &value); |
|
149 QString getNamedProperty(IMAPIProp *object, ULONG tag); |
|
150 |
|
151 QByteArray contentTypeFromExtension(const QString &extension); |
|
152 |
|
153 class Lptstr : public QVector<TCHAR> |
|
154 { |
|
155 public: |
|
156 Lptstr():QVector<TCHAR>(){} |
|
157 Lptstr(int length) : QVector<TCHAR>(length){} |
|
158 operator TCHAR* (){ return QVector<TCHAR>::data(); } |
|
159 }; |
|
160 |
|
161 Lptstr LptstrFromQString(const QString &src); |
|
162 |
|
163 class MapiInitializer; |
|
164 |
|
165 typedef QSharedPointer<MapiInitializer> MapiInitializationToken; |
|
166 |
|
167 MapiInitializationToken initializeMapi(); |
|
168 |
|
169 class MapiInitializer |
|
170 { |
|
171 friend MapiInitializationToken WinHelpers::initializeMapi(); |
|
172 |
|
173 private: |
|
174 MapiInitializer(); |
|
175 MapiInitializer &operator=(const MapiInitializer &); |
|
176 |
|
177 public: |
|
178 ~MapiInitializer(); |
|
179 |
|
180 bool _initialized; |
|
181 }; |
|
182 |
|
183 bool getMapiProperty(IMAPIProp *object, ULONG tag, ULONG *value); |
|
184 bool getMapiProperty(IMAPIProp *object, ULONG tag, LONG *value); |
|
185 bool getMapiProperty(IMAPIProp *object, ULONG tag, QByteArray *value); |
|
186 bool getMapiProperty(IMAPIProp *object, ULONG tag, QString value); |
|
187 |
|
188 bool setMapiProperty(IMAPIProp *object, ULONG tag, const QString &value); |
|
189 bool setMapiProperty(IMAPIProp *object, ULONG tag, LONG value); |
|
190 bool setMapiProperty(IMAPIProp *object, ULONG tag, ULONG value); |
|
191 bool setMapiProperty(IMAPIProp *object, ULONG tag, bool value); |
|
192 bool setMapiProperty(IMAPIProp *object, ULONG tag, FILETIME value); |
|
193 bool setMapiProperty(IMAPIProp *object, ULONG tag, MapiEntryId value); |
|
194 |
|
195 } |
|
196 |
|
197 /* Note on links: |
|
198 - Session must close at exit for correct cleanup |
|
199 Session must be a singleton |
|
200 Stores must have weak ref to session |
|
201 - Stores must remain open after opening to enable notifications |
|
202 Session holds strong ref to stores |
|
203 - Folders should not remain open |
|
204 Store holds weak ref to folders |
|
205 Folder can have strong ref to store |
|
206 |
|
207 * Session keeps stores open |
|
208 * Folders keep store open |
|
209 */ |
|
210 |
|
211 class MapiFolder { |
|
212 |
|
213 public: |
|
214 static MapiFolderPtr createFolder(QMessageManager::Error *error, const MapiStorePtr &store, IMAPIFolder *folder, const MapiRecordKey &recordKey, const QString &name, const MapiEntryId &entryId, bool hasSubFolders, uint messageCount); |
|
215 |
|
216 ~MapiFolder(); |
|
217 |
|
218 MapiFolderPtr nextSubFolder(QMessageManager::Error *error); |
|
219 |
|
220 LPMAPITABLE queryBegin(QMessageManager::Error *error, const QMessageFilter &filter, const QMessageSortOrder &sortOrder); |
|
221 QMessageIdList queryNext(QMessageManager::Error *error, LPMAPITABLE messagesTable, const QMessageFilter &filter); |
|
222 void queryEnd(LPMAPITABLE messagesTable); |
|
223 |
|
224 uint countMessages(QMessageManager::Error *error, const QMessageFilter &filter = QMessageFilter()) const; |
|
225 |
|
226 void removeMessages(QMessageManager::Error *error, const QMessageIdList &ids); |
|
227 |
|
228 MapiEntryId messageEntryId(QMessageManager::Error *error, const MapiRecordKey &messagekey); |
|
229 |
|
230 QMessageFolderId id() const; |
|
231 |
|
232 QMessageAccountId accountId() const; |
|
233 QMessageFolderId parentId() const; |
|
234 QList<QMessageFolderId> ancestorIds() const; |
|
235 |
|
236 bool isValid() const { return _valid; } |
|
237 IMAPIFolder* folder() const { return _folder; } |
|
238 MapiRecordKey recordKey() const { return _key; } |
|
239 MapiRecordKey storeKey() const; |
|
240 #ifdef _WIN32_WCE |
|
241 MapiEntryId storeEntryId() const; |
|
242 #endif |
|
243 QString name() const { return _name; } |
|
244 MapiEntryId entryId() const { return _entryId; } |
|
245 bool hasSubFolders() const { return _hasSubFolders; } |
|
246 uint messageCount() const { return _messageCount; } |
|
247 |
|
248 IMessage *createMessage(QMessageManager::Error* error); |
|
249 IMessage *createMessage(QMessageManager::Error* error, const QMessage& source, const MapiSessionPtr &session, WinHelpers::SavePropertyOption saveOption = WinHelpers::SavePropertyChanges ); |
|
250 |
|
251 IMessage *openMessage(QMessageManager::Error *error, const MapiEntryId &entryId); |
|
252 |
|
253 QMessageFolder folder(QMessageManager::Error *error, const QMessageFolderId& id) const; |
|
254 QMessage message(QMessageManager::Error *error, const QMessageId& id) const; |
|
255 |
|
256 QMessage::StandardFolder standardFolder() const; |
|
257 |
|
258 private: |
|
259 MapiFolder(); |
|
260 MapiFolder(const MapiStorePtr &store, IMAPIFolder *folder, const MapiRecordKey &recordKey, const QString &name, const MapiEntryId &entryId, bool hasSubFolders, uint messageCount); |
|
261 |
|
262 void findSubFolders(QMessageManager::Error *error); |
|
263 |
|
264 friend class MapiStore; |
|
265 |
|
266 QWeakPointer<MapiFolder> _self; |
|
267 MapiStorePtr _store; |
|
268 bool _valid; |
|
269 IMAPIFolder* _folder; |
|
270 MapiRecordKey _key; |
|
271 QString _name; |
|
272 MapiEntryId _entryId; |
|
273 bool _hasSubFolders; |
|
274 uint _messageCount; |
|
275 bool _init; |
|
276 QList<MapiEntryId> _subFolders; |
|
277 }; |
|
278 |
|
279 class MapiStore { |
|
280 public: |
|
281 static MapiStorePtr createStore(QMessageManager::Error *error, const MapiSessionPtr &session, IMsgStore *store, const MapiRecordKey &key, const MapiEntryId &entryId, const QString &name, bool cachedMode); |
|
282 |
|
283 ~MapiStore(); |
|
284 |
|
285 MapiFolderPtr findFolder(QMessageManager::Error *error, QMessage::StandardFolder sf); |
|
286 |
|
287 QMessageFolderIdList folderIds(QMessageManager::Error *error) const; |
|
288 QMessageFolder folderFromId(QMessageManager::Error *error, const QMessageFolderId &folderId); |
|
289 |
|
290 QList<MapiFolderPtr> filterFolders(QMessageManager::Error *error, const QMessageFolderFilter &filter) const; |
|
291 |
|
292 MapiEntryId messageEntryId(QMessageManager::Error *error, const MapiRecordKey &folderKey, const MapiRecordKey &messageKey); |
|
293 |
|
294 MapiFolderPtr openFolder(QMessageManager::Error *error, const MapiEntryId& id) const; |
|
295 MapiFolderPtr openFolderWithKey(QMessageManager::Error *error, const MapiRecordKey& key) const; |
|
296 |
|
297 bool supports(ULONG featureFlag) const; |
|
298 |
|
299 bool isValid() const { return _valid; } |
|
300 QMessageAccountId id() const; |
|
301 MapiEntryId entryId() const { return _entryId; } |
|
302 QString name() const { return _name; } |
|
303 IMsgStore* store() const { return _store; } |
|
304 MapiRecordKey recordKey() const { return _key; } |
|
305 QMessage::TypeFlags types() const; |
|
306 QMessageAddress address() const; |
|
307 |
|
308 MapiSessionPtr session() const; |
|
309 |
|
310 MapiFolderPtr rootFolder(QMessageManager::Error *error) const; |
|
311 MapiFolderPtr receiveFolder(QMessageManager::Error *error) const; |
|
312 |
|
313 IMessage *openMessage(QMessageManager::Error *error, const MapiEntryId &entryId); |
|
314 |
|
315 QMessageFolder folder(QMessageManager::Error *error, const QMessageFolderId& id) const; |
|
316 QMessage message(QMessageManager::Error *error, const QMessageId& id) const; |
|
317 |
|
318 QMessage::StandardFolder standardFolder(const MapiEntryId &entryId) const; |
|
319 |
|
320 void notifyEvents(ULONG mask); |
|
321 |
|
322 #ifdef _WIN32_WCE |
|
323 QString transportName() const; |
|
324 #endif |
|
325 |
|
326 private: |
|
327 MapiStore(); |
|
328 MapiStore(const MapiSessionPtr &session, IMsgStore *store, const MapiRecordKey &key, const MapiEntryId &entryId, const QString &name, bool cachedMode); |
|
329 |
|
330 MapiEntryId standardFolderId(QMessageManager::Error *error, QMessage::StandardFolder sf) const; |
|
331 MapiEntryId rootFolderId(QMessageManager::Error *error) const; |
|
332 MapiEntryId receiveFolderId(QMessageManager::Error *error) const; |
|
333 |
|
334 IMAPIFolder *openMapiFolder(QMessageManager::Error *error, const MapiEntryId &entryId) const; |
|
335 |
|
336 bool setAdviseSink(ULONG mask, IMAPIAdviseSink *sink); |
|
337 |
|
338 class AdviseSink : public IMAPIAdviseSink |
|
339 { |
|
340 MapiStore *_store; |
|
341 LONG _refCount; |
|
342 |
|
343 public: |
|
344 AdviseSink(MapiStore *store) : _store(store), _refCount(0) {} |
|
345 |
|
346 STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR* ppvObj); |
|
347 STDMETHOD_(ULONG, AddRef)(); |
|
348 STDMETHOD_(ULONG, Release)(); |
|
349 |
|
350 STDMETHOD_(ULONG, OnNotify)(ULONG cNotification, LPNOTIFICATION lpNotifications); |
|
351 }; |
|
352 |
|
353 QWeakPointer<MapiStore> _self; |
|
354 QWeakPointer<MapiSession> _session; |
|
355 bool _valid; |
|
356 IMsgStore* _store; |
|
357 MapiRecordKey _key; |
|
358 MapiEntryId _entryId; |
|
359 QString _name; |
|
360 bool _cachedMode; |
|
361 ULONG _adviseConnection; |
|
362 QMap<QMessage::StandardFolder, MapiEntryId> _standardFolderId; |
|
363 |
|
364 mutable QHash<MapiEntryId, QWeakPointer<MapiFolder> > _folderMap; |
|
365 }; |
|
366 |
|
367 class MapiSession : public QObject |
|
368 { |
|
369 Q_OBJECT |
|
370 |
|
371 public: |
|
372 enum NotifyType { Added = 1, Removed, Updated }; |
|
373 |
|
374 class NotifyEvent : public QEvent |
|
375 { |
|
376 public: |
|
377 static QEvent::Type eventType(); |
|
378 |
|
379 NotifyEvent(MapiStore *store, const QMessageId &id, MapiSession::NotifyType type); |
|
380 |
|
381 virtual Type type(); |
|
382 |
|
383 MapiStore *_store; |
|
384 QMessageId _id; |
|
385 NotifyType _notifyType; |
|
386 }; |
|
387 |
|
388 static MapiSessionPtr createSession(QMessageManager::Error *error); |
|
389 |
|
390 ~MapiSession(); |
|
391 |
|
392 bool isValid() const { return (_mapiSession != 0); } |
|
393 |
|
394 MapiStorePtr findStore(QMessageManager::Error *error, const QMessageAccountId &id = QMessageAccountId(), bool cachedMode = true) const; |
|
395 MapiStorePtr defaultStore(QMessageManager::Error *error, bool cachedMode = true) const { return findStore(error,QMessageAccountId(),cachedMode); } |
|
396 |
|
397 QList<MapiStorePtr> filterStores(QMessageManager::Error *error, const QMessageAccountFilter &filter, const QMessageAccountSortOrder &sortOrder = QMessageAccountSortOrder(), uint limit = 0, uint offset = 0, bool cachedMode = true) const; |
|
398 |
|
399 QList<MapiStorePtr> allStores(QMessageManager::Error *error, bool cachedMode = true) const; |
|
400 |
|
401 QList<MapiFolderPtr> filterFolders(QMessageManager::Error *error, const QMessageFolderFilter &filter, const QMessageFolderSortOrder &sortOrder = QMessageFolderSortOrder(), uint limit = 0, uint offset = 0, bool cachedMode = true) const; |
|
402 |
|
403 MapiStorePtr openStore(QMessageManager::Error *error, const MapiEntryId& id, bool cachedMode = true) const; |
|
404 MapiStorePtr openStoreWithKey(QMessageManager::Error *error, const MapiRecordKey& key, bool cachedMode = true) const; |
|
405 |
|
406 QMessageAccountId defaultAccountId(QMessageManager::Error *error, QMessage::Type type) const; |
|
407 |
|
408 MapiEntryId messageEntryId(QMessageManager::Error *error, const MapiRecordKey &storeKey, const MapiRecordKey &folderKey, const MapiRecordKey &messageKey); |
|
409 |
|
410 MapiRecordKey messageRecordKey(QMessageManager::Error *error, const QMessageId &id); |
|
411 MapiRecordKey folderRecordKey(QMessageManager::Error *error, const QMessageId &id); |
|
412 |
|
413 #ifdef _WIN32_WCE |
|
414 MapiEntryId folderEntryId(QMessageManager::Error *error, const QMessageId &id); |
|
415 #endif |
|
416 |
|
417 bool equal(const MapiEntryId &lhs, const MapiEntryId &rhs) const; |
|
418 |
|
419 QMessageFolder folder(QMessageManager::Error *error, const QMessageFolderId& id) const; |
|
420 QMessage message(QMessageManager::Error *error, const QMessageId& id) const; |
|
421 |
|
422 bool updateMessageProperties(QMessageManager::Error *error, QMessage *msg) const; |
|
423 bool updateMessageRecipients(QMessageManager::Error *error, QMessage *msg) const; |
|
424 bool updateMessageBody(QMessageManager::Error *error, QMessage *msg) const; |
|
425 bool updateMessageAttachments(QMessageManager::Error *error, QMessage *msg) const; |
|
426 |
|
427 bool haveAttachmentData(QMessageManager::Error* error, const QMessageId& id, ULONG number) const; |
|
428 QByteArray attachmentData(QMessageManager::Error *error, const QMessageId& id, ULONG number) const; |
|
429 |
|
430 QMessageIdList queryMessages(QMessageManager::Error *error, const QMessageFilter &filter, const QMessageSortOrder &sortOrder = QMessageSortOrder(), uint limit = 0, uint offset = 0, const QString &body = QString(), QMessageDataComparator::MatchFlags matchFlags = 0) const; |
|
431 |
|
432 void updateMessage(QMessageManager::Error* error, const QMessage& source); |
|
433 |
|
434 void removeMessages(QMessageManager::Error *error, const QMessageIdList &ids); |
|
435 |
|
436 IMAPISession* session() const { return _mapiSession; } |
|
437 |
|
438 QMessageManager::NotificationFilterId registerNotificationFilter(QMessageManager::Error *error, const QMessageFilter &filter); |
|
439 void unregisterNotificationFilter(QMessageManager::Error *error, QMessageManager::NotificationFilterId filterId); |
|
440 |
|
441 static QMessagePrivate *messageImpl(const QMessage &message); |
|
442 static QMessageContentContainerPrivate *containerImpl(const QMessageContentContainer &); |
|
443 |
|
444 void addToNotifyQueue(const NotifyEvent& e); |
|
445 void flushNotifyQueue(); |
|
446 |
|
447 signals: |
|
448 void messageAdded(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds); |
|
449 void messageRemoved(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds); |
|
450 void messageUpdated(const QMessageId &id, const QMessageManager::NotificationFilterIdSet &matchingFilterIds); |
|
451 |
|
452 public slots: |
|
453 void dispatchNotifications(); |
|
454 void processNotifyQueue(); |
|
455 |
|
456 private: |
|
457 MapiSession(); |
|
458 MapiSession(QMessageManager::Error *error); |
|
459 |
|
460 IMsgStore *openMapiStore(QMessageManager::Error *error, const MapiEntryId &entryId, bool cachedMode = true) const; |
|
461 IMessage *openMapiMessage(QMessageManager::Error *error, const QMessageId &id, MapiStorePtr *storePtr = 0) const; |
|
462 |
|
463 void addRecipients(LPMESSAGE message, const QMessageAddressList& addressList, unsigned long mapiAddressType); |
|
464 void addAttachment(LPMESSAGE message, const QMessageContentContainer& attachmentContainer); |
|
465 |
|
466 bool event(QEvent *e); |
|
467 |
|
468 void notify(MapiStore *store, const QMessageId &id, NotifyType notifyType); |
|
469 |
|
470 template<typename Predicate, typename Ordering> |
|
471 QList<MapiStorePtr> filterStores(QMessageManager::Error *error, Predicate predicate, Ordering sortOrder, uint limit, uint offset, bool cachedMode) const; |
|
472 |
|
473 private: |
|
474 friend class SessionManager; |
|
475 |
|
476 QWeakPointer<MapiSession> _self; |
|
477 WinHelpers::MapiInitializationToken _token; |
|
478 IMAPISession* _mapiSession; |
|
479 QMessageManager::NotificationFilterId _filterId; |
|
480 QMap<QMessageManager::NotificationFilterId, QMessageFilter> _filters; |
|
481 bool _registered; |
|
482 QQueue<NotifyEvent> _notifyEventQueue; |
|
483 |
|
484 mutable QHash<MapiEntryId, MapiStorePtr> _storeMap; |
|
485 }; |
|
486 |
|
487 #ifndef _WIN32_WCE |
|
488 |
|
489 class MapiForm : public IMAPIMessageSite |
|
490 { |
|
491 public: |
|
492 MapiForm(IMsgStore* mapiStore, |
|
493 IMAPISession* mapiSession, |
|
494 IMAPIFolder* mapiFolder, |
|
495 IMessage* mapiMessage); |
|
496 |
|
497 virtual ~MapiForm(); |
|
498 |
|
499 // IUnknown interface |
|
500 STDMETHODIMP QueryInterface (REFIID riid, void** ppvObj); |
|
501 STDMETHODIMP_(ULONG) AddRef(); |
|
502 STDMETHODIMP_(ULONG) Release(); |
|
503 STDMETHODIMP GetLastError(HRESULT hResult, ulong flags, LPMAPIERROR FAR * lppMAPIError); |
|
504 |
|
505 // IMAPIMessageSite interface |
|
506 STDMETHODIMP GetSession(IMAPISession* FAR * mapiSession); |
|
507 STDMETHODIMP GetStore(IMsgStore* FAR * mapiStore); |
|
508 STDMETHODIMP GetFolder(IMAPIFolder* FAR * mapiFolder); |
|
509 STDMETHODIMP GetMessage(IMessage* FAR * mapiMessage); |
|
510 STDMETHODIMP GetFormManager(IMAPIFormMgr* FAR * ppFormMgr); |
|
511 STDMETHODIMP NewMessage(ULONG fComposeInFolder, |
|
512 IMAPIFolder* mapiFolder, |
|
513 IPersistMessage* pPersistMessage, |
|
514 IMessage* FAR * mapiMessage, |
|
515 IMAPIMessageSite* FAR * ppMessageSite, |
|
516 LPMAPIVIEWCONTEXT FAR * ppViewContext); |
|
517 STDMETHODIMP CopyMessage(IMAPIFolder* pFolderDestination); |
|
518 STDMETHODIMP MoveMessage(IMAPIFolder* pFolderDestination, |
|
519 LPMAPIVIEWCONTEXT pViewContext, |
|
520 LPCRECT prcPosRect); |
|
521 STDMETHODIMP DeleteMessage(LPMAPIVIEWCONTEXT pViewContext, LPCRECT prcPosRect); |
|
522 STDMETHODIMP SaveMessage(); |
|
523 STDMETHODIMP SubmitMessage(ulong flags); |
|
524 STDMETHODIMP GetSiteStatus(ulong* status); |
|
525 |
|
526 bool show(); |
|
527 |
|
528 private: |
|
529 HRESULT setPersistMessage(LPMAPIFORM lpForm, IPersistMessage* mapiPersistMessage); |
|
530 void releasePersistMessage(); |
|
531 void releaseAll(); |
|
532 |
|
533 private: |
|
534 long m_referenceCount; |
|
535 IMAPIFolder* m_mapiFolder; |
|
536 IMessage* m_mapiMessage; |
|
537 IMsgStore* m_mapiStore; |
|
538 IMAPISession* m_mapiSession; |
|
539 IPersistMessage* m_mapiPersistMessage; |
|
540 }; |
|
541 |
|
542 #endif |
|
543 |
|
544 QTM_END_NAMESPACE |
|
545 |
|
546 #endif |