equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include "emailtrace.h" |
|
19 |
18 #include "nmmessage.h" |
20 #include "nmmessage.h" |
19 #include "nmmessageenvelope.h" |
21 #include "nmmessageenvelope.h" |
20 |
22 |
21 /*! |
23 /*! |
22 |
24 |
23 */ |
25 */ |
24 NmMessagePrivate::NmMessagePrivate() : mEnvelope(0) |
26 NmMessagePrivate::NmMessagePrivate() : mEnvelope(0) |
25 { |
27 { |
26 |
28 NM_FUNCTION; |
27 } |
29 } |
28 |
30 |
29 /*! |
31 /*! |
30 |
32 |
31 */ |
33 */ |
32 NmMessagePrivate::~NmMessagePrivate() |
34 NmMessagePrivate::~NmMessagePrivate() |
33 { |
35 { |
34 |
36 NM_FUNCTION; |
35 } |
37 } |
36 |
38 |
37 /*! |
39 /*! |
38 \class NmMessage |
40 \class NmMessage |
39 \brief Data model for mail message |
41 \brief Data model for mail message |
42 /*! |
44 /*! |
43 Constructor |
45 Constructor |
44 */ |
46 */ |
45 NmMessage::NmMessage() |
47 NmMessage::NmMessage() |
46 { |
48 { |
|
49 NM_FUNCTION; |
|
50 |
47 d = new NmMessagePrivate(); |
51 d = new NmMessagePrivate(); |
48 } |
52 } |
49 |
53 |
50 /*! |
54 /*! |
51 Constructs message with id \a id, parent id and mailbox id is set to null id |
55 Constructs message with id \a id, parent id and mailbox id is set to null id |
52 */ |
56 */ |
53 NmMessage::NmMessage(const NmId &messageId) : NmMessagePart(0) |
57 NmMessage::NmMessage(const NmId &messageId) : NmMessagePart(0) |
54 { |
58 { |
|
59 NM_FUNCTION; |
|
60 |
55 d = new NmMessagePrivate(); |
61 d = new NmMessagePrivate(); |
56 d->mEnvelope.setMessageId(messageId); |
62 d->mEnvelope.setMessageId(messageId); |
57 } |
63 } |
58 |
64 |
59 /*! |
65 /*! |
61 mailbox id is set to null id |
67 mailbox id is set to null id |
62 */ |
68 */ |
63 NmMessage::NmMessage(const NmId &messageId, const NmId &folderId) |
69 NmMessage::NmMessage(const NmId &messageId, const NmId &folderId) |
64 : NmMessagePart(0) |
70 : NmMessagePart(0) |
65 { |
71 { |
|
72 NM_FUNCTION; |
|
73 |
66 d = new NmMessagePrivate(); |
74 d = new NmMessagePrivate(); |
67 d->mEnvelope.setMessageId(messageId); |
75 d->mEnvelope.setMessageId(messageId); |
68 d->mEnvelope.setFolderId(folderId); |
76 d->mEnvelope.setFolderId(folderId); |
69 } |
77 } |
70 |
78 |
75 NmMessage::NmMessage(const NmId &messageId, |
83 NmMessage::NmMessage(const NmId &messageId, |
76 const NmId &folderId, |
84 const NmId &folderId, |
77 const NmId &mailboxId) |
85 const NmId &mailboxId) |
78 :NmMessagePart(0) |
86 :NmMessagePart(0) |
79 { |
87 { |
|
88 NM_FUNCTION; |
|
89 |
80 d = new NmMessagePrivate(); |
90 d = new NmMessagePrivate(); |
81 d->mEnvelope.setMessageId(messageId); |
91 d->mEnvelope.setMessageId(messageId); |
82 d->mEnvelope.setFolderId(folderId); |
92 d->mEnvelope.setFolderId(folderId); |
83 d->mEnvelope.setMailboxId(mailboxId); |
93 d->mEnvelope.setMailboxId(mailboxId); |
84 } |
94 } |
86 /*! |
96 /*! |
87 Constructs message from envelope |
97 Constructs message from envelope |
88 */ |
98 */ |
89 NmMessage::NmMessage(const NmMessageEnvelope &envelope) |
99 NmMessage::NmMessage(const NmMessageEnvelope &envelope) |
90 { |
100 { |
|
101 NM_FUNCTION; |
|
102 |
91 d = new NmMessagePrivate(); |
103 d = new NmMessagePrivate(); |
92 d->mEnvelope = envelope; |
104 d->mEnvelope = envelope; |
93 // set message id same as envelope id |
105 // set message id same as envelope id |
94 //this->setMessageId(envelope.messageId()); |
106 //this->setMessageId(envelope.messageId()); |
95 } |
107 } |
99 */ |
111 */ |
100 NmMessage::NmMessage(const NmMessageEnvelope &envelope, |
112 NmMessage::NmMessage(const NmMessageEnvelope &envelope, |
101 QExplicitlySharedDataPointer<NmMessagePartPrivate> nmPrivateMessagePart) |
113 QExplicitlySharedDataPointer<NmMessagePartPrivate> nmPrivateMessagePart) |
102 : NmMessagePart(nmPrivateMessagePart) |
114 : NmMessagePart(nmPrivateMessagePart) |
103 { |
115 { |
|
116 NM_FUNCTION; |
|
117 |
104 d = new NmMessagePrivate(); |
118 d = new NmMessagePrivate(); |
105 d->mEnvelope = envelope; |
119 d->mEnvelope = envelope; |
106 // set message id same as envelope id |
120 // set message id same as envelope id |
107 //this->setMessageId(envelope.messageId()); |
121 //this->setMessageId(envelope.messageId()); |
108 } |
122 } |
110 /*! |
124 /*! |
111 Copy constructor |
125 Copy constructor |
112 */ |
126 */ |
113 NmMessage::NmMessage(const NmMessagePart& message):NmMessagePart(message) |
127 NmMessage::NmMessage(const NmMessagePart& message):NmMessagePart(message) |
114 { |
128 { |
|
129 NM_FUNCTION; |
|
130 |
115 d = new NmMessagePrivate(); |
131 d = new NmMessagePrivate(); |
116 } |
132 } |
117 |
133 |
118 NmMessage::NmMessage(const NmMessage& message):NmMessagePart(message), d(message.d) |
134 NmMessage::NmMessage(const NmMessage& message):NmMessagePart(message), d(message.d) |
119 { |
135 { |
122 /*! |
138 /*! |
123 Assignment operator |
139 Assignment operator |
124 */ |
140 */ |
125 NmMessage &NmMessage::operator=(const NmMessage &message) |
141 NmMessage &NmMessage::operator=(const NmMessage &message) |
126 { |
142 { |
|
143 NM_FUNCTION; |
|
144 |
127 if (this != &message) { |
145 if (this != &message) { |
128 d = message.d; |
146 d = message.d; |
129 } |
147 } |
130 return *this; |
148 return *this; |
131 } |
149 } |
133 /*! |
151 /*! |
134 Destructor |
152 Destructor |
135 */ |
153 */ |
136 NmMessage::~NmMessage() |
154 NmMessage::~NmMessage() |
137 { |
155 { |
|
156 NM_FUNCTION; |
138 } |
157 } |
139 |
158 |
140 /*! |
159 /*! |
141 Returns pointer to plain text body, if plain text body is not found |
160 Returns pointer to plain text body, if plain text body is not found |
142 returns null pointer. Ownership of message part object is not transferred. |
161 returns null pointer. Ownership of message part object is not transferred. |
143 Do not delete returned pointer. Non-modifying version. |
162 Do not delete returned pointer. Non-modifying version. |
144 */ |
163 */ |
145 const NmMessagePart *NmMessage::plainTextBodyPart() const |
164 const NmMessagePart *NmMessage::plainTextBodyPart() const |
146 { |
165 { |
|
166 NM_FUNCTION; |
|
167 |
147 const NmMessagePart *ret = NULL; |
168 const NmMessagePart *ret = NULL; |
148 ret = findContentPart(NmContentTypeTextPlain); |
169 ret = findContentPart(NmContentTypeTextPlain); |
149 return ret; |
170 return ret; |
150 } |
171 } |
151 |
172 |
154 returns null pointer. Ownership of message part object is not transferred. |
175 returns null pointer. Ownership of message part object is not transferred. |
155 Do not delete returned pointer. |
176 Do not delete returned pointer. |
156 */ |
177 */ |
157 NmMessagePart *NmMessage::plainTextBodyPart() |
178 NmMessagePart *NmMessage::plainTextBodyPart() |
158 { |
179 { |
|
180 NM_FUNCTION; |
|
181 |
159 NmMessagePart *ret = NULL; |
182 NmMessagePart *ret = NULL; |
160 ret = findContentPart(NmContentTypeTextPlain); |
183 ret = findContentPart(NmContentTypeTextPlain); |
161 return ret; |
184 return ret; |
162 } |
185 } |
163 |
186 |
166 returns null pointer. Ownership of message part object is not transferred. |
189 returns null pointer. Ownership of message part object is not transferred. |
167 Do not delete returned pointer. Non-modifying version. |
190 Do not delete returned pointer. Non-modifying version. |
168 */ |
191 */ |
169 const NmMessagePart *NmMessage::htmlBodyPart() const |
192 const NmMessagePart *NmMessage::htmlBodyPart() const |
170 { |
193 { |
|
194 NM_FUNCTION; |
|
195 |
171 const NmMessagePart *ret = NULL; |
196 const NmMessagePart *ret = NULL; |
172 ret = findContentPart(NmContentTypeTextHtml); |
197 ret = findContentPart(NmContentTypeTextHtml); |
173 return ret; |
198 return ret; |
174 } |
199 } |
175 |
200 |
178 returns null pointer. Ownership of message part object is not transferred. |
203 returns null pointer. Ownership of message part object is not transferred. |
179 Do not delete returned pointer. |
204 Do not delete returned pointer. |
180 */ |
205 */ |
181 NmMessagePart *NmMessage::htmlBodyPart() |
206 NmMessagePart *NmMessage::htmlBodyPart() |
182 { |
207 { |
|
208 NM_FUNCTION; |
|
209 |
183 NmMessagePart *ret = NULL; |
210 NmMessagePart *ret = NULL; |
184 ret = findContentPart(NmContentTypeTextHtml); |
211 ret = findContentPart(NmContentTypeTextHtml); |
185 return ret; |
212 return ret; |
186 } |
213 } |
187 |
214 |
188 /*! |
215 /*! |
189 Returns reference to message envelope |
216 Returns reference to message envelope |
190 */ |
217 */ |
191 NmMessageEnvelope &NmMessage::envelope() |
218 NmMessageEnvelope &NmMessage::envelope() |
192 { |
219 { |
|
220 NM_FUNCTION; |
|
221 |
193 return d->mEnvelope; |
222 return d->mEnvelope; |
194 } |
223 } |
195 |
224 |
196 /*! |
225 /*! |
197 Returns reference to message envelope |
226 Returns reference to message envelope |
198 */ |
227 */ |
199 const NmMessageEnvelope &NmMessage::envelope() const |
228 const NmMessageEnvelope &NmMessage::envelope() const |
200 { |
229 { |
|
230 NM_FUNCTION; |
|
231 |
201 return d->mEnvelope; |
232 return d->mEnvelope; |
202 } |
233 } |
203 |
234 |
204 /** |
235 /** |
205 * Returns a flat list of message parts that can be handled as attachments. |
236 * Returns a flat list of message parts that can be handled as attachments. |
208 * |
239 * |
209 * @param flat list of attachments to be filled |
240 * @param flat list of attachments to be filled |
210 */ |
241 */ |
211 void NmMessage::attachmentList(QList<NmMessagePart*> &parts) const |
242 void NmMessage::attachmentList(QList<NmMessagePart*> &parts) const |
212 { |
243 { |
|
244 NM_FUNCTION; |
|
245 |
213 parts.clear(); |
246 parts.clear(); |
214 appendAttachments(parts); |
247 appendAttachments(parts); |
215 |
248 |
216 // special case, if single part content type is not given, |
249 // special case, if single part content type is not given, |
217 // default type is text/plain |
250 // default type is text/plain |