|
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 QMESSAGE_P_H |
|
42 #define QMESSAGE_P_H |
|
43 |
|
44 #include "qmessage.h" |
|
45 #include "qmessageaddress.h" |
|
46 #include <QMap> |
|
47 |
|
48 #ifdef USE_QMF_IMPLEMENTATION |
|
49 #include "qmfhelpers_p.h" |
|
50 #endif |
|
51 |
|
52 |
|
53 |
|
54 QTM_BEGIN_NAMESPACE |
|
55 |
|
56 class QMessagePrivate |
|
57 { |
|
58 #ifdef USE_QMF_IMPLEMENTATION |
|
59 public: |
|
60 QMessagePrivate() |
|
61 { |
|
62 _message.setStatus(QMailMessage::LocalOnly); |
|
63 } |
|
64 |
|
65 QMailMessage _message; |
|
66 |
|
67 typedef QMap<QMessage::StandardFolder, QMessageFolderId> StandardFolderMap; |
|
68 Q_SCOPED_STATIC_DECLARE(StandardFolderMap,standardFolderMap); |
|
69 |
|
70 static QMessageFolderId standardFolderId(QMessage::StandardFolder folder); |
|
71 static QMessage::StandardFolder standardFolder(QMessageFolderId folderId); |
|
72 |
|
73 static QMessage convert(const QMailMessage &message); |
|
74 static QMailMessage convert(const QMessage &message); |
|
75 static QMailMessage *convert(QMessage *message); |
|
76 |
|
77 //static const QMailMessage *convert(const QMessage *message); |
|
78 #else |
|
79 Q_DECLARE_PUBLIC(QMessage) |
|
80 |
|
81 public: |
|
82 |
|
83 QMessagePrivate(QMessage *message) |
|
84 :q_ptr(message), |
|
85 #if defined(Q_OS_WIN) |
|
86 _hasAttachments(false), |
|
87 _rtfInSync(false), |
|
88 _contentFormat(0), |
|
89 #endif |
|
90 _size(0), |
|
91 _standardFolder(QMessage::DraftsFolder), |
|
92 _type(QMessage::NoType), |
|
93 _status(0), |
|
94 _priority(QMessage::NormalPriority), |
|
95 _modified(false) |
|
96 { |
|
97 #if defined(Q_OS_WIN) |
|
98 _elementsPresent.properties = 1; |
|
99 _elementsPresent.recipients = 1; |
|
100 _elementsPresent.body = 1; |
|
101 _elementsPresent.attachments = 1; |
|
102 #endif |
|
103 } |
|
104 |
|
105 QMessage *q_ptr; |
|
106 #if defined(Q_OS_WIN) |
|
107 struct { |
|
108 unsigned properties : 1; |
|
109 unsigned recipients : 1; |
|
110 unsigned body : 1; |
|
111 unsigned attachments : 1; |
|
112 } _elementsPresent; |
|
113 bool _hasAttachments; |
|
114 bool _rtfInSync; |
|
115 LONG _contentFormat; |
|
116 #endif |
|
117 |
|
118 QMessageId _id; |
|
119 int _size; |
|
120 QMessageAccountId _parentAccountId; |
|
121 QMessageFolderId _parentFolderId; |
|
122 QMessage::StandardFolder _standardFolder; |
|
123 |
|
124 QMessage::Type _type; |
|
125 QMessageAddress _from; |
|
126 QString _senderName; |
|
127 QMessageAddressList _to; |
|
128 QMessageAddressList _cc; |
|
129 QMessageAddressList _bcc; |
|
130 QMessage::StatusFlags _status; |
|
131 QMessage::Priority _priority; |
|
132 QString _subject; |
|
133 QDateTime _date; |
|
134 QDateTime _receivedDate; |
|
135 bool _modified; |
|
136 QMessageContentContainerId _bodyId; |
|
137 |
|
138 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) |
|
139 QString _url; |
|
140 |
|
141 static QMessagePrivate* implementation(const QMessage &message); |
|
142 static QMessageContentContainerPrivate* containerImplementation(const QMessage &message); |
|
143 #endif |
|
144 |
|
145 static QMessage from(const QMessageId &id); |
|
146 static QString senderName(const QMessage &message); |
|
147 static void setSenderName(const QMessage &message, const QString &senderName); |
|
148 static void setSize(const QMessage &message, int size); |
|
149 static void setParentFolderId(QMessage& message, const QMessageFolderId& id); |
|
150 |
|
151 #if defined(Q_OS_WIN) |
|
152 void ensurePropertiesPresent(QMessage *msg) const; |
|
153 void ensureRecipientsPresent(QMessage *msg) const; |
|
154 void ensureBodyPresent(QMessage *msg) const; |
|
155 void ensureAttachmentsPresent(QMessage *msg) const; |
|
156 #endif |
|
157 #endif |
|
158 |
|
159 public: |
|
160 static void setStandardFolder(QMessage& message, QMessage::StandardFolder sf); |
|
161 }; |
|
162 |
|
163 |
|
164 QTM_END_NAMESPACE |
|
165 #endif |