31
|
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 |
* Description: This is the implementation class for ConvergedMessage
|
|
14 |
*
|
|
15 |
*/
|
|
16 |
|
|
17 |
#ifndef CONVERGED_MESSAGE_IMPL_H
|
|
18 |
#define CONVERGED_MESSAGE_IMPL_H
|
|
19 |
|
|
20 |
|
|
21 |
#include "convergedmessageattachment.h"
|
|
22 |
#include "convergedmessage.h"
|
|
23 |
#include "convergedmessageid.h"
|
|
24 |
#include "convergedmessageaddress.h"
|
|
25 |
/**
|
|
26 |
* Implementation of ConvergedMessage interface.
|
|
27 |
* Encapsulates the message data for sending services.
|
|
28 |
*/
|
|
29 |
class ConvergedMessageImpl
|
|
30 |
{
|
|
31 |
public:
|
|
32 |
|
|
33 |
/**
|
|
34 |
* Constructor
|
|
35 |
*/
|
|
36 |
ConvergedMessageImpl(
|
|
37 |
|
|
38 |
ConvergedMessage::MessageType messageType = ConvergedMessage::None);
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Constructor
|
|
42 |
*/
|
|
43 |
ConvergedMessageImpl(const ConvergedMessageId &id);
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Copy Constructor
|
|
47 |
*/
|
|
48 |
ConvergedMessageImpl(const ConvergedMessage& msg);
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Destructor
|
|
52 |
*/
|
|
53 |
~ConvergedMessageImpl();
|
|
54 |
|
|
55 |
/**
|
|
56 |
* This shall return the convergedmessageid
|
|
57 |
* @return
|
|
58 |
*/
|
|
59 |
ConvergedMessageId* id() const;
|
|
60 |
|
|
61 |
/**
|
|
62 |
* sets the convergedmessage id
|
|
63 |
* @param id
|
|
64 |
*/
|
|
65 |
void setMessageId(ConvergedMessageId &id);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Get the message type
|
|
69 |
* @return message type
|
|
70 |
*/
|
|
71 |
ConvergedMessage::MessageType messageType() const;
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Set the message type
|
|
75 |
* @param type message type
|
|
76 |
*/
|
|
77 |
void setMessageType(ConvergedMessage::MessageType type);
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Get the message sub-type
|
|
81 |
* @return message sub-type
|
|
82 |
*/
|
|
83 |
ConvergedMessage::MessageSubType messageSubType() const;
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Set the message sub-type
|
|
87 |
* @param type message sub-type
|
|
88 |
*/
|
|
89 |
void setMessageSubType(ConvergedMessage::MessageSubType type);
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Get the message priority
|
|
93 |
* @return message priority
|
|
94 |
*/
|
|
95 |
ConvergedMessage::Priority priority() const;
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Set the message priority
|
|
99 |
* @param newPriority message priority
|
|
100 |
*/
|
|
101 |
void setPriority(ConvergedMessage::Priority newPriority);
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Get the message direction
|
|
105 |
* @return the direction
|
|
106 |
*/
|
|
107 |
ConvergedMessage::Direction direction() const;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Set the message direction
|
|
111 |
* @param direction direction of message
|
|
112 |
*/
|
|
113 |
void setDirection(ConvergedMessage::Direction direction);
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Get the message sending state
|
|
117 |
* @return the SendingState of message
|
|
118 |
*/
|
|
119 |
ConvergedMessage::SendingState sendingState() const;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Set the message sending state
|
|
123 |
* @param state message sending status
|
|
124 |
*/
|
|
125 |
void setSendingState(ConvergedMessage::SendingState state);
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Get the message status is Unread
|
|
129 |
* @return bool if the message Unread
|
|
130 |
*/
|
|
131 |
bool isUnread() const;
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Get the message attachment status
|
|
135 |
* @return bool if the message has attachment Unread
|
|
136 |
*/
|
|
137 |
bool hasAttachment() const;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Get the message location
|
|
141 |
* @return the MessageLocation
|
|
142 |
*/
|
|
143 |
ConvergedMessage::MessageLocation location() const;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Set the message location
|
|
147 |
* @param cation as message location
|
|
148 |
*/
|
|
149 |
void setLocation(ConvergedMessage::MessageLocation location);
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Set the message property
|
|
153 |
* @param property as message property
|
|
154 |
*/
|
|
155 |
void setProperty(ConvergedMessage::MessageProperty property);
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Returns the message properties
|
|
159 |
* @return integer for message property
|
|
160 |
*/
|
|
161 |
quint16 properties() const;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Get the subject
|
|
165 |
* @return message subject
|
|
166 |
*/
|
|
167 |
const QString& subject() const;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Set the message subject
|
|
171 |
* @param subject message subject
|
|
172 |
*/
|
|
173 |
void setSubject(const QString &subject);
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Get the message received/sent date
|
|
177 |
* @return The message timestamp
|
|
178 |
*/
|
|
179 |
qint64 timeStamp() const;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Set the message received date
|
|
183 |
* @param timeStamp The message timestamp
|
|
184 |
*/
|
|
185 |
void setTimeStamp(qint64 timeStamp);
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Set message body text
|
|
189 |
* @param bodyText message body text
|
|
190 |
*/
|
|
191 |
void setBodyText(const QString &bodyText);
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Returns message body text.
|
|
195 |
* @return Message body text.
|
|
196 |
*/
|
|
197 |
const QString& bodyText() const;
|
|
198 |
|
|
199 |
/**
|
|
200 |
* Add a recipient of type To
|
|
201 |
* @param recipient recipient address
|
|
202 |
*/
|
|
203 |
void addToRecipient(ConvergedMessageAddress &recipient);
|
|
204 |
/**
|
|
205 |
* Add recipients of type To
|
|
206 |
* This method takes the ownership of recipients array
|
|
207 |
*
|
|
208 |
* @param recipients array of recipient address
|
|
209 |
*/
|
|
210 |
void addToRecipients(ConvergedMessageAddressList &recipients);
|
|
211 |
/**
|
|
212 |
* Add a recipient of type Cc
|
|
213 |
* @param recipient recipient address
|
|
214 |
*/
|
|
215 |
void addCcRecipient(ConvergedMessageAddress &recipient);
|
|
216 |
|
|
217 |
/**
|
|
218 |
* Add recipients of type Cc
|
|
219 |
* This method takes the ownership of recipients array
|
|
220 |
*
|
|
221 |
* @param recipients array of recipient address
|
|
222 |
*/
|
|
223 |
void addCcRecipients(ConvergedMessageAddressList &recipients);
|
|
224 |
/**
|
|
225 |
* Add a recipient of type Bcc
|
|
226 |
* @param recipient recipient address
|
|
227 |
*/
|
|
228 |
void addBccRecipient(ConvergedMessageAddress &recipient);
|
|
229 |
/**
|
|
230 |
* Add recipients of type Bcc
|
|
231 |
* This method takes the ownership of recipients array
|
|
232 |
*
|
|
233 |
* @param recipients array of recipient address
|
|
234 |
*/
|
|
235 |
void addBccRecipients(ConvergedMessageAddressList &recipients);
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Add a recipient of type From
|
|
239 |
* @param recipient recipient address
|
|
240 |
*/
|
|
241 |
void addFromRecipient(ConvergedMessageAddress &recipient);
|
|
242 |
/**
|
|
243 |
* Returns array of To addresses and their aliases.
|
|
244 |
* @return Array of To addresses and their aliases.
|
|
245 |
*/
|
|
246 |
const ConvergedMessageAddressList toAddressList() const;
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Returns array of Cc addresses and their aliases.
|
|
250 |
* @return Array of Cc addresses and their aliases.
|
|
251 |
*/
|
|
252 |
const ConvergedMessageAddressList ccAddressList() const;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Returns array of Bcc addresses and aliases.
|
|
256 |
* @return Array of Bcc addresses and aliases.
|
|
257 |
*/
|
|
258 |
const ConvergedMessageAddressList bccAddressList() const;
|
|
259 |
/**
|
|
260 |
* Returns array of From addresses and aliases.
|
|
261 |
* @return Array of From addresses and aliases.
|
|
262 |
*/
|
|
263 |
ConvergedMessageAddress* fromAddress() const;
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Get the attachment list
|
|
267 |
* @return Attachment list
|
|
268 |
*/
|
|
269 |
ConvergedMessageAttachmentList attachments() const;
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Add a list of attachments to the message
|
|
273 |
* @param attachmentList List of attachments
|
|
274 |
*/
|
|
275 |
|
|
276 |
void addAttachments(ConvergedMessageAttachmentList attachmentList);
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Serialize the data memebers into the stream.
|
|
280 |
* @param stream data stream to which data is serialized.
|
|
281 |
*/
|
|
282 |
void serialize(QDataStream &stream) const;
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Deserialize the stream to data members.
|
|
286 |
* @param stream data stream from which data is deserialized.
|
|
287 |
*/
|
|
288 |
void deserialize(QDataStream &stream);
|
|
289 |
|
|
290 |
private:
|
|
291 |
/**
|
|
292 |
* Operator= overloading. Making it private with no implementation to prevent its usage
|
|
293 |
*/
|
|
294 |
ConvergedMessageImpl& operator=(const ConvergedMessage &msg);
|
|
295 |
|
|
296 |
private:
|
|
297 |
//data
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Converge MessageId
|
|
301 |
*/
|
|
302 |
ConvergedMessageId* mId;
|
|
303 |
|
|
304 |
/**
|
|
305 |
* Message Subject
|
|
306 |
*/
|
|
307 |
QString mSubject;
|
|
308 |
|
|
309 |
/**
|
|
310 |
* Message Body Text
|
|
311 |
*/
|
|
312 |
QString mBodyText;
|
|
313 |
|
|
314 |
/**
|
|
315 |
* Array of real addresses and aliases.
|
|
316 |
*/
|
|
317 |
ConvergedMessageAddressList mToAddresses;
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Array of real CC addresses and aliases.
|
|
321 |
*/
|
|
322 |
ConvergedMessageAddressList mCcAddresses;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Array of real BC addresses and aliases.
|
|
326 |
*/
|
|
327 |
ConvergedMessageAddressList mBccAddresses;
|
|
328 |
/**
|
|
329 |
* Array of real FROM addresses and aliases.
|
|
330 |
*/
|
|
331 |
ConvergedMessageAddressList mFromAddresses;
|
|
332 |
/**
|
|
333 |
* Message From Address
|
|
334 |
*/
|
|
335 |
ConvergedMessageAddress* mFromAddress;
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Message Attachments
|
|
339 |
*/
|
|
340 |
ConvergedMessageAttachmentList mAttachments;
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Message Timestamp
|
|
344 |
*/
|
|
345 |
qint64 mTimeStamp;
|
|
346 |
|
|
347 |
/**
|
|
348 |
* Message Attribute
|
|
349 |
*/
|
|
350 |
quint16 mProperty;
|
|
351 |
|
|
352 |
/**
|
|
353 |
* Message type
|
|
354 |
*/
|
|
355 |
quint8 mMessageType;
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Message type
|
|
359 |
*/
|
|
360 |
quint8 mMessageSubType;
|
|
361 |
|
|
362 |
/**
|
|
363 |
* Message priority
|
|
364 |
*/
|
|
365 |
quint8 mPriority;
|
|
366 |
|
|
367 |
/**
|
|
368 |
* Message location
|
|
369 |
*/
|
|
370 |
quint8 mLocation;
|
|
371 |
|
|
372 |
/**
|
|
373 |
* Message Direction
|
|
374 |
* as incoming/outgoing etc.
|
|
375 |
*/
|
|
376 |
quint8 mDirection;
|
|
377 |
|
|
378 |
/**
|
|
379 |
* Messaging sending states
|
|
380 |
*/
|
|
381 |
quint8 mSendingState;
|
|
382 |
};
|
|
383 |
|
|
384 |
#endif // CONVERGED_MESSAGE_IMPL_H
|