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