|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is the domain header API for message data used |
|
15 * in sending and receiving services |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CONVERGED_MESSAGE_H |
|
20 #define CONVERGED_MESSAGE_H |
|
21 |
|
22 #include <QString> |
|
23 #include <QDataStream> |
|
24 #include "convergedmessageaddress.h" |
|
25 #include "convergedmessageattachment.h" |
|
26 #include "msgutilsapidefines.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class ConvergedMessageId; |
|
30 class ConvergedMessageImpl; |
|
31 |
|
32 /** |
|
33 * ConvergedMessage data object. |
|
34 * Encapsulates the message data for sending and receiving services. |
|
35 */ |
|
36 class MSG_UTILS_API_EXPORT ConvergedMessage |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Enum defining possible Message types |
|
43 * Ex. Sms, MMs etc. |
|
44 * @attention This enum can have values from 0 to 255 only. |
|
45 */ |
|
46 enum MessageType // keep the value's equal to server enums (ccsdefs.h) |
|
47 { |
|
48 Sms = 0x00, |
|
49 Mms = 0x01, |
|
50 MmsNotification = 0x02, |
|
51 BioMsg = 0x03, |
|
52 BT = 0x04, |
|
53 None = 0x50, |
|
54 IM = 0x51 |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Enum defining possible Message sub-types |
|
59 * Ex. vCard, vCal etc.. |
|
60 */ |
|
61 enum MessageSubType |
|
62 { |
|
63 RingingTone = 0x00, |
|
64 Provisioning = 0x01, |
|
65 VCard = 0x02, |
|
66 VCal = 0x03, |
|
67 Audio = 0x04 |
|
68 }; |
|
69 |
|
70 /** |
|
71 |
|
72 * Enum defining priority |
|
73 * @attention This enum can have values from 0 to 255 only. |
|
74 */ |
|
75 enum Priority |
|
76 { |
|
77 Normal = 0x00, |
|
78 High = 0x01, |
|
79 Low = 0x02 |
|
80 }; |
|
81 |
|
82 /** |
|
83 * Enum defining Message Location |
|
84 * @attention these are values range from |
|
85 * 0 to FFFF |
|
86 */ |
|
87 enum MessageLocation |
|
88 { |
|
89 Delete = 0x00, |
|
90 Inbox = 0x01, |
|
91 Outbox = 0x02, |
|
92 Draft = 0x03, |
|
93 Sent = 0x04, |
|
94 MyFolder = 0x05 |
|
95 }; |
|
96 /** |
|
97 * Enum defining MessageProperty |
|
98 * @attention these are bitmask values range from |
|
99 * 0 to FFFF |
|
100 */ |
|
101 enum MessageProperty |
|
102 { |
|
103 Unread = 0x0001, |
|
104 Attachment = 0x0002 |
|
105 }; |
|
106 |
|
107 /** |
|
108 * Enum defining Message Direction |
|
109 * @attention This enum can have values from 0 to 255 only. |
|
110 */ |
|
111 enum Direction |
|
112 { |
|
113 Incoming = 0x00, |
|
114 Outgoing = 0x01, |
|
115 Missed = 0x02 |
|
116 }; |
|
117 |
|
118 /** |
|
119 * Enum defining Message Sending State |
|
120 * @attention This enum can have values from 0 to 255 only. |
|
121 */ |
|
122 enum SendingState |
|
123 { |
|
124 Unknown = 0x00, |
|
125 UponRequest = 0x01, |
|
126 Waiting = 0x02, |
|
127 Sending = 0x03, |
|
128 Scheduled = 0x04, |
|
129 Resend = 0x05, |
|
130 Suspended = 0x06, |
|
131 Failed = 0x07, |
|
132 SentState = 0x08, |
|
133 NotApplicable = 0x09 |
|
134 }; |
|
135 |
|
136 /** |
|
137 * Enum defining MMS Notification's Msg State |
|
138 * @attention This enum can have values from 0 to 255 only |
|
139 * Add any new states only at the bottom of this enum |
|
140 */ |
|
141 enum MmsNotificationState |
|
142 { |
|
143 NotifNull = 0x00, // unknown status |
|
144 NotifReadyForFetching = 0x01, // first state when received in inbox |
|
145 NotifRetrieving = 0x02, // when MM is fetching ongoin |
|
146 NotifForwarding = 0x03, // forwarding without retrival |
|
147 NotifForwarded = 0x04, // state after successful forwarding |
|
148 NotifWaiting = 0x05, // when settings changed manual->automatic |
|
149 NotifExpired = 0x06, // expired time has exceed |
|
150 NotifFailed = 0x07, // when fetching has failed (forwarding?) |
|
151 NotifDeleted = 0x08 // when msg deleted from server |
|
152 }; |
|
153 |
|
154 public: |
|
155 |
|
156 /** |
|
157 * Constructor |
|
158 */ |
|
159 |
|
160 ConvergedMessage(ConvergedMessage::MessageType messageType |
|
161 = ConvergedMessage::None); |
|
162 |
|
163 /** |
|
164 * Constructor |
|
165 */ |
|
166 ConvergedMessage(const ConvergedMessageId &id); |
|
167 |
|
168 /** |
|
169 * Copy Constructor |
|
170 */ |
|
171 ConvergedMessage(const ConvergedMessage& msg); |
|
172 |
|
173 /** |
|
174 * Destructor |
|
175 */ |
|
176 ~ConvergedMessage(); |
|
177 |
|
178 /** |
|
179 * Get the message id |
|
180 * @return message id |
|
181 */ |
|
182 ConvergedMessageId* id() const; |
|
183 |
|
184 /** |
|
185 * Set the message id |
|
186 * @param id message id |
|
187 */ |
|
188 void setMessageId(ConvergedMessageId &id); |
|
189 |
|
190 /** |
|
191 * Get the message type |
|
192 * @return message type |
|
193 */ |
|
194 MessageType messageType() const; |
|
195 |
|
196 /** |
|
197 * Set the message type |
|
198 * @param type message type |
|
199 */ |
|
200 void setMessageType(MessageType type); |
|
201 |
|
202 /** |
|
203 * Get the message sub-type |
|
204 * @return message sub-type |
|
205 */ |
|
206 MessageSubType messageSubType() const; |
|
207 |
|
208 /** |
|
209 * Set the message sub-type |
|
210 * @param type message sub-type |
|
211 */ |
|
212 void setMessageSubType(MessageSubType type); |
|
213 |
|
214 /** |
|
215 * Get the message priority |
|
216 * @return the message priority |
|
217 */ |
|
218 Priority priority() const; |
|
219 |
|
220 /** |
|
221 * Set the message priority |
|
222 * @param newPriority the message priority |
|
223 */ |
|
224 void setPriority(Priority newPriority); |
|
225 |
|
226 /** |
|
227 * Get the message direction |
|
228 * @return the direction |
|
229 */ |
|
230 Direction direction() const; |
|
231 |
|
232 /** |
|
233 * Set the message direction |
|
234 * @param direction direction of message |
|
235 */ |
|
236 void setDirection(Direction direction); |
|
237 |
|
238 /** |
|
239 * Get the message sending state |
|
240 * @return the SendingState of message |
|
241 */ |
|
242 SendingState sendingState() const; |
|
243 |
|
244 /** |
|
245 * Set the message sending state |
|
246 * @param state message sending status |
|
247 */ |
|
248 void setSendingState(SendingState state); |
|
249 |
|
250 /** |
|
251 * Get the message status is Unread |
|
252 * @return bool if the message Unread |
|
253 */ |
|
254 bool isUnread() const; |
|
255 |
|
256 /** |
|
257 |
|
258 * Get the message attachment status |
|
259 * @return bool if the message has attachment Unread |
|
260 */ |
|
261 bool hasAttachment() const; |
|
262 |
|
263 /** |
|
264 * Get the message location |
|
265 * @return the MessageLocation of message |
|
266 */ |
|
267 MessageLocation location() const; |
|
268 |
|
269 /** |
|
270 * Set the message location |
|
271 * @param attribute specifying message location |
|
272 */ |
|
273 void setLocation ( |
|
274 ConvergedMessage::MessageLocation location); |
|
275 |
|
276 /** |
|
277 * Set the message property |
|
278 * @param attribute specifying message property |
|
279 */ |
|
280 void setProperty (ConvergedMessage::MessageProperty property); |
|
281 |
|
282 /** |
|
283 * Get the message status is Oubox message |
|
284 * @return integer for the message attribute set |
|
285 */ |
|
286 quint16 properties() const; |
|
287 /** |
|
288 * Get the subject |
|
289 * @return message subject |
|
290 */ |
|
291 const QString& subject() const; |
|
292 |
|
293 /** |
|
294 * Set the message subject |
|
295 * @param subject message subject |
|
296 */ |
|
297 void setSubject(const QString &subject); |
|
298 |
|
299 /** |
|
300 * Get the message received/sent date |
|
301 * @return The message timestamp |
|
302 */ |
|
303 qint64 timeStamp() const; |
|
304 |
|
305 /** |
|
306 * Set the message received date |
|
307 * @param timeStamp The message timestamp |
|
308 */ |
|
309 void setTimeStamp(qint64 timeStamp); |
|
310 |
|
311 /** |
|
312 * Returns message body text. |
|
313 * @return QString Message body text. |
|
314 */ |
|
315 //TODO:OPEN: Should we use QString? as no formatting is there |
|
316 const QString& bodyText() const; |
|
317 |
|
318 /** |
|
319 * Set message body |
|
320 * @param bodyText message body text |
|
321 */ |
|
322 void setBodyText(const QString &bodyText); |
|
323 |
|
324 /** |
|
325 * Add a recipient |
|
326 * @param recipient recipient address |
|
327 */ |
|
328 void addToRecipient(ConvergedMessageAddress &recipient); |
|
329 /** |
|
330 * Add recipients |
|
331 * This method takes the ownership of recipients array |
|
332 * @param recipients array of recipient address |
|
333 */ |
|
334 void addToRecipients(ConvergedMessageAddressList &recipientList); |
|
335 /** |
|
336 * Add a recipient |
|
337 * @param recipient recipient address |
|
338 */ |
|
339 void addCcRecipient(ConvergedMessageAddress &recipient); |
|
340 |
|
341 /** |
|
342 * Add recipients |
|
343 * This method takes the ownership of recipients array |
|
344 * @param recipients array of recipient address |
|
345 */ |
|
346 void addCcRecipients(ConvergedMessageAddressList &recipientList); |
|
347 /** |
|
348 * Add a recipient |
|
349 * @param recipient recipient address |
|
350 */ |
|
351 void addBccRecipient(ConvergedMessageAddress &recipient); |
|
352 /** |
|
353 * Add recipients |
|
354 * This method takes the ownership of recipients array |
|
355 * @param recipients array of recipient address |
|
356 */ |
|
357 void addBccRecipients(ConvergedMessageAddressList &recipientList); |
|
358 |
|
359 /** |
|
360 * Add a recipient |
|
361 * @param recipient recipient address |
|
362 */ |
|
363 void addFromRecipient(ConvergedMessageAddress &recipient); |
|
364 /** |
|
365 * Returns array of To addresses and their aliases. |
|
366 * @return Array of To addresses and their aliases. |
|
367 */ |
|
368 const ConvergedMessageAddressList toAddressList() const; |
|
369 |
|
370 /** |
|
371 * Returns array of Cc addresses and their aliases. |
|
372 * @return Array of Cc addresses and their aliases. |
|
373 */ |
|
374 const ConvergedMessageAddressList ccAddressList() const; |
|
375 |
|
376 /** |
|
377 * Returns array of Bcc addresses and aliases. |
|
378 * @return Array of Bcc addresses and aliases. |
|
379 */ |
|
380 const ConvergedMessageAddressList bccAddressList() const; |
|
381 |
|
382 /** |
|
383 * Returns array of From addresses and aliases. |
|
384 * @return Array of From addresses and aliases. |
|
385 */ |
|
386 ConvergedMessageAddress* fromAddress() const; |
|
387 |
|
388 /** |
|
389 * Get the attachment list |
|
390 * @return Attachment list |
|
391 */ |
|
392 ConvergedMessageAttachmentList attachments() const; |
|
393 |
|
394 /** |
|
395 * Add a list of attachments to the message |
|
396 * @param attachmentList List of attachments |
|
397 */ |
|
398 void addAttachments( |
|
399 ConvergedMessageAttachmentList &attachmentList); |
|
400 |
|
401 /** |
|
402 |
|
403 * Serialize the data memebers into the stream. |
|
404 * @param stream data stream to which data is serialized. |
|
405 */ |
|
406 void serialize(QDataStream &stream) const; |
|
407 |
|
408 /** |
|
409 * Deserialize the stream to data members. |
|
410 * @param stream data stream from which data is deserialized. |
|
411 */ |
|
412 void deserialize(QDataStream &stream); |
|
413 |
|
414 private: |
|
415 /** |
|
416 * Operator= overloading. Making it private with no implementation to prevent its usage |
|
417 */ |
|
418 ConvergedMessage& operator=(const ConvergedMessage &msg); |
|
419 |
|
420 private: |
|
421 |
|
422 /** |
|
423 * Converged Message implementation |
|
424 * Own |
|
425 */ |
|
426 ConvergedMessageImpl* mConvergedMessageImpl; |
|
427 }; |
|
428 |
|
429 #endif // CONVERGED_MESSAGE_H |