|
1 /* |
|
2 * Copyright (c) 2008 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMSMESSAGEINFORMATION_H |
|
20 #define CMMSMESSAGEINFORMATION_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32std.h> |
|
24 #include <mmsconst.h> |
|
25 #include <msvstd.h> |
|
26 #include "cmmsmessageattachment.h" |
|
27 |
|
28 namespace java |
|
29 { |
|
30 namespace wma |
|
31 { |
|
32 |
|
33 /** |
|
34 * Class to store the MMS messages in the native side |
|
35 * 1. Meessage Time |
|
36 * 2. ApplicationId |
|
37 * 3. ReplyToApplicationId |
|
38 * 4. Addresses (To, Cc, Bcc) count |
|
39 * 5. Addresses (To, Cc, Bcc) |
|
40 * 6. Subject |
|
41 * 7. Message Priority |
|
42 * 8. Attchment count |
|
43 * 9. Attachments |
|
44 * |
|
45 * @lib hmidpS60v30.lib on wins/winscw and midp2.exe |
|
46 */ |
|
47 class CMMSMessageInformation: public CBase |
|
48 { |
|
49 |
|
50 public: |
|
51 /** |
|
52 * Create the Java counter part of MultipartMessage. |
|
53 * @param aFromAddress: From address of received message |
|
54 * @param aDate: date When the message is created |
|
55 * @param aApplicationID8: ApplicationId |
|
56 * @param aReceivedMsvId: Id of the received message |
|
57 * |
|
58 * @return newly created CMidMessageInformation |
|
59 */ |
|
60 static CMMSMessageInformation* NewL(const TDesC& aFromAddress, |
|
61 TInt64 aDate, const TDesC8& aApplicationID8, TMsvId aReceivedMsvId); |
|
62 |
|
63 /** |
|
64 * Get the TMsvId of received message. |
|
65 * |
|
66 * @return TMsvId (Received message Id) |
|
67 */ |
|
68 inline TMsvId MessageMsvId(); |
|
69 |
|
70 /** |
|
71 * Get the from address of received message |
|
72 * |
|
73 * @return TDesC8 |
|
74 */ |
|
75 TDesC8& MessageFromAddressL(); |
|
76 |
|
77 /** |
|
78 * Get the creation time of message |
|
79 * |
|
80 * @return TInt64 |
|
81 */ |
|
82 inline TInt64 MessageTime(); |
|
83 |
|
84 /** |
|
85 * Set the applicationId from TDesC16 |
|
86 * @param aAppId set the application Id in message. |
|
87 * |
|
88 * @return |
|
89 */ |
|
90 void SetApplicationIdL(const TDesC16& aAppId); |
|
91 |
|
92 /** |
|
93 * Set the applicationId from TDesC8 |
|
94 * @param aAppId set the application Id in message. |
|
95 * |
|
96 * @return |
|
97 */ |
|
98 void SetApplicationIdL(const TDesC8& aAppId); |
|
99 |
|
100 /** |
|
101 * Get the application Id |
|
102 * |
|
103 * @return TDesC8& |
|
104 */ |
|
105 TDesC8& ApplicationIdL(); |
|
106 |
|
107 /** |
|
108 * Set the ReplyToApplicationId from TDesC16 |
|
109 * @param aReplyAppId: ReplyToApplication Id as TDesC16 |
|
110 * |
|
111 * @return |
|
112 */ |
|
113 void SetReplyToApplicationIdL(const TDesC16& aReplyAppId); |
|
114 |
|
115 /** |
|
116 * Set the ReplyToApplicationId from TDesC8 |
|
117 * @param aReplyAppId: ReplyToApplication Id as TDesC8 |
|
118 * |
|
119 * @return |
|
120 */ |
|
121 void SetReplyToApplicationIdL(const TDesC8& aReplyAppId); |
|
122 |
|
123 /** |
|
124 * Get the ReplyToApplicationId |
|
125 * |
|
126 * @return TDesC8 |
|
127 */ |
|
128 TDesC8& ReplyToApplicationIdL(); |
|
129 |
|
130 /** |
|
131 * Get the address count in given address type |
|
132 * @param aAddressType: Address type to, cc, bcc |
|
133 * |
|
134 * @return TInt |
|
135 */ |
|
136 TInt AddressesCount(TMsvRecipientTypeValues aAddressType); |
|
137 |
|
138 /** |
|
139 * Get the address by type and index |
|
140 * @param aAddressType: address type |
|
141 * @param aIndex: |
|
142 * |
|
143 * @return TDesC |
|
144 */ |
|
145 TDesC& MessageAddressL(TMsvRecipientTypeValues aAddressType, TInt aIndex); |
|
146 |
|
147 /** |
|
148 * Add the address by type in CMidMessageInformation. Owner ship is |
|
149 * transfered. |
|
150 * @param aAddressType: is TDesC16 |
|
151 * @param aAddress: owner ship will transfer to CMidMessageInformation |
|
152 * |
|
153 * @return |
|
154 */ |
|
155 void AddAddressL(TMsvRecipientTypeValues aAddressType, TDesC16* aAddress); |
|
156 |
|
157 /** |
|
158 * Add the address by type in CMidMessageInformation. |
|
159 * @param aAddressType: is TDesC8 |
|
160 * @param aAddress: |
|
161 * |
|
162 * @return |
|
163 */ |
|
164 void AddAddressL(TMsvRecipientTypeValues aAddressType, TDesC8& aAddress8); |
|
165 |
|
166 /** |
|
167 * Set the priority of CMidMessageInformation |
|
168 * @param aPriority: set the message priority |
|
169 * |
|
170 * @return |
|
171 */ |
|
172 void SetMessagePriority(TMmsMessagePriority aPriority); |
|
173 |
|
174 /** |
|
175 * Get the priority of CMidMessageInformation |
|
176 * |
|
177 * @return |
|
178 */ |
|
179 inline TMmsMessagePriority MessagePriority(); |
|
180 |
|
181 /** |
|
182 * Set the subject of CMidMessageInformation |
|
183 * @param aSubject as TDesC16& |
|
184 * |
|
185 * @return |
|
186 */ |
|
187 void SetMessageSubjectL(TDesC16& aSubject); |
|
188 |
|
189 /** |
|
190 * Set the subject of CMidMessageInformation |
|
191 * @param aSubject as TDesC8& |
|
192 * |
|
193 * @return |
|
194 */ |
|
195 void SetMessageSubjectL(TDesC8& aSubject); |
|
196 |
|
197 /** |
|
198 * Get the subject of CMidMessageInformation |
|
199 * |
|
200 * @return TDesC8& (Subject) |
|
201 */ |
|
202 TDesC8& MessageSubjectL() const; |
|
203 |
|
204 /** |
|
205 * Set the size of CMidMessageInformation |
|
206 * @param aIndex |
|
207 * |
|
208 * @return |
|
209 */ |
|
210 void SetMessageSize(TInt aSize); |
|
211 |
|
212 /** |
|
213 * Get the size of CMidMessageInformation |
|
214 * @param aIndex |
|
215 * |
|
216 * @return TInt (the message size) |
|
217 */ |
|
218 inline TInt MessageSize() const; |
|
219 |
|
220 /** |
|
221 * Inser CMMSMessageAttachment. Owner ship is transfer to |
|
222 * CMidMessageInformation |
|
223 * @param aIndex |
|
224 * |
|
225 * @return CMMSMessageAttachment |
|
226 */ |
|
227 void InsertAttachmentL(CMMSMessageAttachment* aMessageAttachment); |
|
228 |
|
229 /** |
|
230 * Get CMMSMessageAttachment count. |
|
231 * @param aIndex |
|
232 * |
|
233 * @return TInt (attachment count) |
|
234 */ |
|
235 inline TInt AttachmentCount() const; |
|
236 |
|
237 /** |
|
238 * Get CMMSMessageAttachment by index. |
|
239 * Index should not exced the attachment cout. |
|
240 * @param aIndex |
|
241 * |
|
242 * @return CMMSMessageAttachment or return null |
|
243 * if there is not more attachement |
|
244 */ |
|
245 CMMSMessageAttachment& Attachment(TInt aIndex); |
|
246 |
|
247 /** |
|
248 * Destructor |
|
249 * |
|
250 * @return |
|
251 */ |
|
252 ~CMMSMessageInformation(); |
|
253 |
|
254 private: |
|
255 /** |
|
256 * C++ default constructor. |
|
257 * |
|
258 * @return |
|
259 */ |
|
260 CMMSMessageInformation(); |
|
261 |
|
262 /** |
|
263 * default Symbian 2nd phase constructor. |
|
264 * @param aFromAddress |
|
265 * @param aDate: date when the message is created |
|
266 * @param aApplicationID8: (Optional) Destination applicationId |
|
267 * @param aReceivedMsvId: If the message is received in the device |
|
268 * then the received message Id. |
|
269 * @return |
|
270 */ |
|
271 void ConstructL(const TDesC& aFromAddress, TInt64 aDate, |
|
272 const TDesC8& aApplicationID8, TMsvId aReceivedMsvId); |
|
273 |
|
274 /** |
|
275 * Add the "to" destination address. |
|
276 * @param aAddress |
|
277 * |
|
278 * @return |
|
279 */ |
|
280 void AddToAddressL(TDesC* aAddress); |
|
281 |
|
282 /** |
|
283 * Add the "cc" destination address. |
|
284 * @param aAddress |
|
285 * |
|
286 * @return |
|
287 */ |
|
288 void AddCcAddressL(TDesC* aAddress); |
|
289 |
|
290 /** |
|
291 * Add the "bcc" destination address. |
|
292 * @param aAddress |
|
293 * |
|
294 * @return |
|
295 */ |
|
296 void AddBccAddressL(TDesC* aAddress); |
|
297 |
|
298 private: |
|
299 // private members |
|
300 TInt mMessageSize; |
|
301 |
|
302 TInt64 mDateTime; // Send/Receive message date |
|
303 /** |
|
304 * own the mFromAddress8 |
|
305 */ |
|
306 HBufC8* mFromAddress8; // Address from where the message arrive |
|
307 /** |
|
308 * own the mApplicationID8 |
|
309 */ |
|
310 HBufC8* mApplicationID8; // ApplicationID (on receiving device) |
|
311 /** |
|
312 * own the mReplyToApplicationID8 |
|
313 */ |
|
314 HBufC8* mReplyToApplicationID8; |
|
315 /** |
|
316 * own the mMessageSubject8 |
|
317 */ |
|
318 HBufC8* mMessageSubject8;// Message Subject |
|
319 |
|
320 TMsvId mReceivedMsvId; |
|
321 |
|
322 TMmsMessagePriority mMessagePriority; |
|
323 /** |
|
324 * own the mToAddressArray |
|
325 */ |
|
326 CArrayPtrSeg<TDesC>* mToAddressArray; |
|
327 /** |
|
328 * own the mBccAddressArray |
|
329 */ |
|
330 CArrayPtrSeg<TDesC>* mBccAddressArray; |
|
331 /** |
|
332 * own the mCcAddressArray |
|
333 */ |
|
334 CArrayPtrSeg<TDesC>* mCcAddressArray; |
|
335 /** |
|
336 * own the mAttachmentArray |
|
337 */ |
|
338 CArrayPtrSeg<CMMSMessageAttachment>* mAttachmentArray; |
|
339 }; |
|
340 |
|
341 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
342 TMmsMessagePriority CMMSMessageInformation::MessagePriority() |
|
343 { |
|
344 return mMessagePriority; |
|
345 } |
|
346 //-------------------------------------------------------------------------------------------- |
|
347 // Get the received message Id |
|
348 //-------------------------------------------------------------------------------------------- |
|
349 TMsvId CMMSMessageInformation::MessageMsvId() |
|
350 { |
|
351 return mReceivedMsvId; |
|
352 } |
|
353 //-------------------------------------------------------------------------------------------- |
|
354 // MessageTime |
|
355 // It return the TIn64 (received/created message date) |
|
356 //-------------------------------------------------------------------------------------------- |
|
357 TInt64 CMMSMessageInformation::MessageTime() |
|
358 { |
|
359 return mDateTime; |
|
360 } |
|
361 //-------------------------------------------------------------------------------------------- |
|
362 // Get Attachment Count |
|
363 //-------------------------------------------------------------------------------------------- |
|
364 TInt CMMSMessageInformation::AttachmentCount() const |
|
365 { |
|
366 return mAttachmentArray->Count(); |
|
367 } |
|
368 //////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
369 } //namespace wma |
|
370 } //namespace java |
|
371 #endif // CMMSMESSAGEINFORMATION_H |
|
372 // End of File |