author | Fionntina Carville <fionntinac@symbian.org> |
Mon, 15 Nov 2010 10:30:54 +0000 | |
branch | RCL_3 |
changeset 82 | 28205c20df94 |
parent 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2007-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: common email part object |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "emailtrace.h" |
|
19 |
#include <apgcli.h> |
|
20 |
#include <apmrec.h> |
|
21 |
#include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroy |
|
22 |
||
23 |
//<cmail> |
|
24 |
#include "cfsmailmessagepart.h" |
|
25 |
#include "cfsmailplugin.h" |
|
26 |
//</cmail> |
|
27 |
||
28 |
#include "cfsmailrequestobserver.h" |
|
29 |
||
30 |
||
31 |
// ================= MEMBER FUNCTIONS ========================================== |
|
32 |
// ----------------------------------------------------------------------------- |
|
33 |
// CFSMailMessagePart::NewLC |
|
34 |
// ----------------------------------------------------------------------------- |
|
35 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC( TFSMailMsgId aMessageId, |
|
36 |
TFSMailMsgId aMessagePartId ) |
|
37 |
{ |
|
38 |
FUNC_LOG; |
|
39 |
CFSMailMessagePart* adr = new (ELeave) CFSMailMessagePart(); |
|
40 |
CleanupStack::PushL(adr); |
|
41 |
adr->ConstructL( aMessageId, aMessagePartId ); |
|
42 |
return adr; |
|
43 |
} |
|
44 |
||
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// CFSMailMessagePart::NewL |
|
47 |
// ----------------------------------------------------------------------------- |
|
48 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewL( TFSMailMsgId aMessageId, |
|
49 |
TFSMailMsgId aMessagePartId ) |
|
50 |
{ |
|
51 |
FUNC_LOG; |
|
52 |
CFSMailMessagePart* adr = CFSMailMessagePart::NewLC( aMessageId, aMessagePartId ); |
|
53 |
CleanupStack::Pop(adr); |
|
54 |
return adr; |
|
55 |
} |
|
56 |
||
57 |
// ----------------------------------------------------------------------------- |
|
58 |
// CFSMailMessagePart::ConstructL |
|
59 |
// ----------------------------------------------------------------------------- |
|
60 |
void CFSMailMessagePart::ConstructL( TFSMailMsgId aMessageId, |
|
61 |
TFSMailMsgId aMessagePartId ) |
|
62 |
{ |
|
63 |
FUNC_LOG; |
|
64 |
iMessageId = aMessageId; |
|
65 |
iMessagePartId = aMessagePartId; |
|
66 |
iMessagePartsStatus = EFSDefault; |
|
67 |
||
68 |
iContentTypeParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
|
69 |
iContentDispositionParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
|
70 |
||
71 |
} |
|
72 |
||
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// CFSMailMessagePart::~CFSMailMessagePart |
|
75 |
// ----------------------------------------------------------------------------- |
|
76 |
EXPORT_C CFSMailMessagePart::~CFSMailMessagePart() |
|
77 |
{ |
|
78 |
FUNC_LOG; |
|
79 |
if(iContentType) |
|
80 |
{ |
|
81 |
delete iContentType; |
|
82 |
} |
|
83 |
iContentType = NULL; |
|
84 |
||
85 |
if(iContentDescription) |
|
86 |
{ |
|
87 |
delete iContentDescription; |
|
88 |
} |
|
89 |
iContentDescription = NULL; |
|
90 |
||
91 |
if(iContentDisposition) |
|
92 |
{ |
|
93 |
delete iContentDisposition; |
|
94 |
} |
|
95 |
iContentDisposition = NULL; |
|
96 |
||
97 |
if(iAttachmentName) |
|
98 |
{ |
|
99 |
delete iAttachmentName; |
|
100 |
} |
|
101 |
iAttachmentName = NULL; |
|
102 |
||
103 |
if(iContentClass) |
|
104 |
{ |
|
105 |
delete iContentClass; |
|
106 |
} |
|
107 |
iContentClass = NULL; |
|
108 |
||
109 |
if(iContentID) |
|
110 |
{ |
|
111 |
delete iContentID; |
|
112 |
} |
|
113 |
iContentID = NULL; |
|
114 |
||
115 |
if(iMeetingRequest) |
|
116 |
{ |
|
117 |
delete iMeetingRequest; |
|
118 |
} |
|
119 |
iMeetingRequest = NULL; |
|
120 |
||
121 |
if(iContentDispositionParams) |
|
122 |
{ |
|
123 |
iContentDispositionParams->Reset(); |
|
124 |
delete iContentDispositionParams; |
|
125 |
} |
|
126 |
if(iContentTypeParams) |
|
127 |
{ |
|
128 |
iContentTypeParams->Reset(); |
|
129 |
delete iContentTypeParams; |
|
130 |
} |
|
131 |
||
132 |
iMessageParts.ResetAndDestroy(); |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CFSMailMessagePart::CFSMailMessagePart |
|
137 |
// ----------------------------------------------------------------------------- |
|
138 |
CFSMailMessagePart::CFSMailMessagePart() : CFSMailMessageBase() |
|
139 |
{ |
|
140 |
FUNC_LOG; |
|
141 |
||
142 |
iContentType = HBufC::New(1); |
|
143 |
iContentType->Des().Copy(KNullDesC()); |
|
144 |
||
145 |
iContentDescription = HBufC::New(1); |
|
146 |
iContentDescription->Des().Copy(KNullDesC()); |
|
147 |
||
148 |
iContentDisposition = HBufC::New(1); |
|
149 |
iContentDisposition->Des().Copy(KNullDesC()); |
|
150 |
||
151 |
iContentClass = HBufC::New(1); |
|
152 |
iContentClass->Des().Copy(KNullDesC()); |
|
153 |
||
154 |
iContentID = HBufC::New(1); |
|
155 |
iContentID->Des().Copy(KNullDesC()); |
|
156 |
||
157 |
iAttachmentName = HBufC::New(1); |
|
158 |
iAttachmentName->Des().Copy(KNullDesC()); |
|
159 |
||
160 |
iReadMessageParts = ETrue; |
|
161 |
} |
|
162 |
||
163 |
// ----------------------------------------------------------------------------- |
|
164 |
// CFSMailMessagePart::GetContentType |
|
165 |
// ----------------------------------------------------------------------------- |
|
166 |
EXPORT_C const TDesC& CFSMailMessagePart::GetContentType() |
|
167 |
{ |
|
168 |
FUNC_LOG; |
|
169 |
return *iContentType; |
|
170 |
} |
|
171 |
||
172 |
// ----------------------------------------------------------------------------- |
|
173 |
// CFSMailMessagePart::SetContentType |
|
174 |
// ----------------------------------------------------------------------------- |
|
175 |
EXPORT_C void CFSMailMessagePart::SetContentType(const TDesC& aContentType) |
|
176 |
{ |
|
177 |
FUNC_LOG; |
|
178 |
||
179 |
HBufC* contentType = HBufC::New(aContentType.Length()); |
|
180 |
||
181 |
// store new mailbox name |
|
182 |
if(contentType) |
|
183 |
{ |
|
184 |
delete iContentType; |
|
185 |
iContentType = contentType; |
|
186 |
iContentType->Des().Copy(aContentType); |
|
187 |
} |
|
188 |
} |
|
189 |
||
190 |
// ----------------------------------------------------------------------------- |
|
191 |
// CFSMailMessagePart::GetPartId |
|
192 |
// ----------------------------------------------------------------------------- |
|
193 |
EXPORT_C TFSMailMsgId CFSMailMessagePart::GetPartId() const |
|
194 |
{ |
|
195 |
FUNC_LOG; |
|
196 |
return iMessagePartId; |
|
197 |
} |
|
198 |
||
199 |
// ----------------------------------------------------------------------------- |
|
200 |
// CFSMailMessagePart::ChildPartsL |
|
201 |
// ----------------------------------------------------------------------------- |
|
202 |
EXPORT_C void CFSMailMessagePart::ChildPartsL(RPointerArray<CFSMailMessagePart>& aParts) |
|
203 |
{ |
|
204 |
FUNC_LOG; |
|
205 |
||
206 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
|
207 |
{ |
|
208 |
plugin->ChildPartsL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(),aParts); |
|
209 |
} |
|
210 |
} |
|
211 |
||
212 |
// ----------------------------------------------------------------------------- |
|
213 |
// CFSMailMessagePart::ChildPartL |
|
214 |
// ----------------------------------------------------------------------------- |
|
215 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::ChildPartL(TFSMailMsgId aPartId) |
|
216 |
{ |
|
217 |
FUNC_LOG; |
|
218 |
||
219 |
CFSMailMessagePart* part = NULL; |
|
220 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
|
221 |
{ |
|
222 |
part = plugin->MessagePartL(GetMailBoxId(), |
|
223 |
GetFolderId(), |
|
224 |
GetMessageId(), |
|
225 |
aPartId); |
|
226 |
} |
|
227 |
return part; |
|
228 |
} |
|
229 |
||
230 |
// ----------------------------------------------------------------------------- |
|
231 |
// CFSMailMessagePart::IsMessageL |
|
232 |
// ----------------------------------------------------------------------------- |
|
233 |
EXPORT_C TBool CFSMailMessagePart::IsMessageL() const |
|
234 |
{ |
|
235 |
FUNC_LOG; |
|
236 |
||
237 |
TBuf<KMaxDataTypeLength> ptr; |
|
238 |
if ( iContentType ) |
|
239 |
{ |
|
240 |
ptr.Copy(iContentType->Des()); |
|
241 |
TInt length = ptr.Locate(';'); |
|
242 |
if(length >= 0) |
|
243 |
{ |
|
244 |
ptr.SetLength(length); |
|
245 |
} |
|
246 |
||
247 |
if( !ptr.CompareF(KFSMailContentTypeMessage) ) |
|
248 |
{ |
|
249 |
return ETrue; |
|
250 |
} |
|
251 |
} |
|
252 |
return EFalse; |
|
253 |
} |
|
254 |
||
255 |
// ----------------------------------------------------------------------------- |
|
256 |
// CFSMailMessagePart::NewChildPartL |
|
257 |
// ----------------------------------------------------------------------------- |
|
258 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewChildPartL( const TFSMailMsgId aInsertBefore, |
|
259 |
const TDesC& aContentType ) |
|
260 |
{ |
|
261 |
FUNC_LOG; |
|
262 |
||
263 |
CFSMailMessagePart* part = NULL; |
|
264 |
||
265 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
|
266 |
{ |
|
267 |
part = plugin->NewChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
|
268 |
GetPartId(), aInsertBefore, aContentType ); |
|
269 |
} |
|
270 |
return part; |
|
271 |
} |
|
272 |
||
273 |
// ----------------------------------------------------------------------------- |
|
274 |
// CFSMailMessagePart::RemoveChildPartL |
|
275 |
// ----------------------------------------------------------------------------- |
|
276 |
EXPORT_C void CFSMailMessagePart::RemoveChildPartL(TFSMailMsgId aPartId) |
|
277 |
{ |
|
278 |
FUNC_LOG; |
|
279 |
// get plugin pointer |
|
280 |
TFSMailMsgId id = GetPartId(); |
|
281 |
if(id.IsNullId()) |
|
282 |
{ |
|
283 |
id = GetMessageId(); |
|
284 |
} |
|
285 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(id); |
|
286 |
||
287 |
if(plugin) |
|
288 |
{ |
|
289 |
plugin->RemoveChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), GetPartId(), aPartId ); |
|
290 |
} |
|
291 |
} |
|
292 |
||
293 |
// ----------------------------------------------------------------------------- |
|
294 |
// CFSMailMessagePart::GetContentClass |
|
295 |
// ----------------------------------------------------------------------------- |
|
296 |
EXPORT_C const TDesC& CFSMailMessagePart::GetContentClass() |
|
297 |
{ |
|
298 |
FUNC_LOG; |
|
299 |
return *iContentClass; |
|
300 |
} |
|
301 |
||
302 |
// ----------------------------------------------------------------------------- |
|
303 |
// CFSMailMessagePart::SetContentClass |
|
304 |
// ----------------------------------------------------------------------------- |
|
305 |
EXPORT_C void CFSMailMessagePart::SetContentClass( const TDesC& aContentClass ) |
|
306 |
{ |
|
307 |
FUNC_LOG; |
|
308 |
||
309 |
// |
|
310 |
HBufC* contentClass = HBufC::New(aContentClass.Length()); |
|
311 |
||
312 |
// store new mailbox name |
|
313 |
if(contentClass) |
|
314 |
{ |
|
315 |
delete iContentClass; |
|
316 |
iContentClass = contentClass; |
|
317 |
iContentClass->Des().Copy(aContentClass); |
|
318 |
} |
|
319 |
iContentClass->ReAlloc(aContentClass.Length()); |
|
320 |
if(iContentClass) |
|
321 |
{ |
|
322 |
iContentClass->Des().Copy(aContentClass); |
|
323 |
} |
|
324 |
} |
|
325 |
||
326 |
// ----------------------------------------------------------------------------- |
|
327 |
// CFSMailMessagePart::ContentSize |
|
328 |
// ----------------------------------------------------------------------------- |
|
329 |
EXPORT_C TUint CFSMailMessagePart::ContentSize() const |
|
330 |
{ |
|
331 |
FUNC_LOG; |
|
332 |
return iContentSize; |
|
333 |
} |
|
334 |
||
335 |
// ----------------------------------------------------------------------------- |
|
336 |
// CFSMailMessagePart::SetContentSize |
|
337 |
// ----------------------------------------------------------------------------- |
|
338 |
EXPORT_C void CFSMailMessagePart::SetContentSize( TUint aContentSize ) |
|
339 |
{ |
|
340 |
FUNC_LOG; |
|
341 |
iContentSize = aContentSize; |
|
342 |
} |
|
343 |
||
344 |
// ----------------------------------------------------------------------------- |
|
345 |
// CFSMailMessagePart::ContentID |
|
346 |
// ----------------------------------------------------------------------------- |
|
347 |
EXPORT_C const TDesC& CFSMailMessagePart::ContentID() |
|
348 |
{ |
|
349 |
FUNC_LOG; |
|
350 |
return *iContentID; |
|
351 |
} |
|
352 |
||
353 |
// ----------------------------------------------------------------------------- |
|
354 |
// CFSMailMessagePart::SetContentIDL |
|
355 |
// ----------------------------------------------------------------------------- |
|
356 |
EXPORT_C void CFSMailMessagePart::SetContentIDL(const TDesC& aContentID) |
|
357 |
{ |
|
358 |
FUNC_LOG; |
|
359 |
// init mailbox name |
|
360 |
HBufC* id = HBufC::New(aContentID.Length()); |
|
361 |
||
362 |
// store new mailbox name |
|
363 |
if(id) |
|
364 |
{ |
|
365 |
delete iContentID; |
|
366 |
iContentID = id; |
|
367 |
iContentID->Des().Copy(aContentID); |
|
368 |
} |
|
369 |
} |
|
370 |
||
371 |
// ----------------------------------------------------------------------------- |
|
372 |
// CFSMailMessagePart::CopyMessageAsChildPartL |
|
373 |
// ----------------------------------------------------------------------------- |
|
374 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::CopyMessageAsChildPartL( |
|
375 |
TFSMailMsgId aInsertBefore, |
|
376 |
CFSMailMessage* aMessage) |
|
377 |
{ |
|
378 |
FUNC_LOG; |
|
379 |
||
380 |
CFSMailMessagePart* part = NULL; |
|
381 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
382 |
{ |
|
383 |
part = plugin->CopyMessageAsChildPartL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(), |
|
384 |
aInsertBefore, *aMessage); |
|
385 |
} |
|
386 |
return part; |
|
387 |
} |
|
388 |
||
389 |
// ----------------------------------------------------------------------------- |
|
390 |
// CFSMailMessagePart::RemoveContentL |
|
391 |
// ----------------------------------------------------------------------------- |
|
392 |
EXPORT_C void CFSMailMessagePart::RemoveContentL() |
|
393 |
{ |
|
394 |
FUNC_LOG; |
|
395 |
||
396 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
397 |
if(plugin == NULL) |
|
398 |
{ |
|
399 |
plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
400 |
} |
|
401 |
||
402 |
if(plugin != NULL) |
|
403 |
{ |
|
404 |
RPointerArray<CFSMailMessagePart> parts; |
|
405 |
CleanupResetAndDestroyPushL( parts ); |
|
406 |
plugin->ChildPartsL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(),parts); |
|
407 |
RArray<TFSMailMsgId> partIds; |
|
408 |
CleanupClosePushL( partIds ); |
|
409 |
partIds.ReserveL( 1 + parts.Count() ); |
|
410 |
for(TInt i=0;i<parts.Count();i++) |
|
411 |
{ |
|
412 |
partIds.AppendL( parts[i]->GetMessageId() ); |
|
413 |
} |
|
414 |
partIds.AppendL( GetPartId() ); |
|
415 |
plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), partIds); |
|
416 |
CleanupStack::PopAndDestroy( &partIds ); |
|
417 |
CleanupStack::PopAndDestroy( &parts ); |
|
418 |
} |
|
419 |
} |
|
420 |
||
421 |
// ----------------------------------------------------------------------------- |
|
422 |
// CFSMailMessagePart::RemoveDownLoadedAttachmentsL |
|
423 |
// ----------------------------------------------------------------------------- |
|
424 |
EXPORT_C void CFSMailMessagePart::RemoveDownLoadedAttachmentsL() |
|
425 |
{ |
|
426 |
FUNC_LOG; |
|
427 |
||
428 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
429 |
if(plugin == NULL) |
|
430 |
{ |
|
431 |
plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
432 |
} |
|
433 |
||
434 |
if(plugin != NULL) |
|
435 |
{ |
|
436 |
// get attachment list |
|
437 |
RPointerArray<CFSMailMessagePart> attachments; |
|
438 |
CleanupResetAndDestroyPushL( attachments ); |
|
439 |
DoAttachmentListL(attachments); |
|
440 |
||
441 |
// copy attachment part ids |
|
442 |
RArray<TFSMailMsgId> ids; |
|
443 |
CleanupClosePushL( ids ); |
|
444 |
for(TInt i=0;i<attachments.Count();i++) |
|
445 |
{ |
|
446 |
ids.Append(attachments[i]->GetPartId()); |
|
447 |
} |
|
448 |
||
449 |
// remove attachment fetched contents |
|
450 |
if(ids.Count()) |
|
451 |
{ |
|
452 |
TRAP_IGNORE(plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), ids)); |
|
453 |
} |
|
454 |
||
455 |
// clean tables |
|
456 |
CleanupStack::PopAndDestroy( &ids ); |
|
457 |
CleanupStack::PopAndDestroy( &attachments ); |
|
458 |
} |
|
459 |
} |
|
460 |
||
461 |
// ----------------------------------------------------------------------------- |
|
462 |
// CFSMailMessagePart::GetContentFileL |
|
463 |
// ----------------------------------------------------------------------------- |
|
464 |
EXPORT_C RFile CFSMailMessagePart::GetContentFileL() |
|
465 |
{ |
|
466 |
FUNC_LOG; |
|
467 |
||
468 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
469 |
{ |
|
470 |
TInt rcode = plugin->GetMessagePartFileL( GetMailBoxId(), GetFolderId(), |
|
471 |
GetMessageId(), GetPartId(), |
|
472 |
iFile ); |
|
473 |
// if content is encrypted, use temp dir files |
|
474 |
if(rcode == KErrNotSupported) |
|
475 |
{ |
|
476 |
// temp directory C:\Private\<uid> |
|
477 |
TFileName fileName; |
|
478 |
iFile = iRequestHandler->GetTempFileL(GetPartId(),fileName); |
|
479 |
plugin->CopyMessagePartFileL(GetMailBoxId(), GetFolderId(), |
|
480 |
GetMessageId(), GetPartId(), |
|
481 |
fileName); |
|
482 |
} |
|
483 |
} |
|
484 |
||
485 |
return iFile; |
|
486 |
} |
|
487 |
||
488 |
// ----------------------------------------------------------------------------- |
|
489 |
// CFSMailMessagePart::SetContentFromFileL |
|
490 |
// ----------------------------------------------------------------------------- |
|
491 |
EXPORT_C void CFSMailMessagePart::SetContentFromFileL(const TDesC& aFilePath) |
|
492 |
{ |
|
493 |
FUNC_LOG; |
|
494 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
495 |
{ |
|
496 |
plugin->SetPartContentFromFileL(GetMailBoxId(), GetFolderId(), |
|
497 |
GetMessageId(), GetPartId(), aFilePath ); |
|
498 |
} |
|
499 |
} |
|
500 |
||
501 |
// ----------------------------------------------------------------------------- |
|
502 |
// CFSMailMessagePart::CopyContentFileL |
|
503 |
// ----------------------------------------------------------------------------- |
|
504 |
EXPORT_C void CFSMailMessagePart::CopyContentFileL( const TDesC& aFilePath ) |
|
505 |
{ |
|
506 |
FUNC_LOG; |
|
507 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
508 |
{ |
|
509 |
plugin->CopyMessagePartFileL( GetMailBoxId(), GetFolderId(), |
|
510 |
GetMessageId(), GetPartId(), aFilePath); |
|
511 |
} |
|
512 |
} |
|
513 |
||
514 |
// ----------------------------------------------------------------------------- |
|
515 |
// CFSMailMessagePart::GetContentToBufferL |
|
516 |
// ----------------------------------------------------------------------------- |
|
517 |
EXPORT_C void CFSMailMessagePart::GetContentToBufferL(TDes16& aBuffer, TUint aStartOffset) |
|
518 |
{ |
|
519 |
FUNC_LOG; |
|
520 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
521 |
{ |
|
522 |
plugin->GetContentToBufferL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
|
523 |
GetPartId(), aBuffer, aStartOffset ); |
|
524 |
} |
|
525 |
} |
|
526 |
||
527 |
// ----------------------------------------------------------------------------- |
|
528 |
// CFSMailMessagePart::SetContent |
|
529 |
// ----------------------------------------------------------------------------- |
|
530 |
EXPORT_C void CFSMailMessagePart::SetContent( TDes16& aBuffer ) |
|
531 |
{ |
|
532 |
FUNC_LOG; |
|
533 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
534 |
{ |
|
535 |
TRAPD(err,plugin->SetContentL( aBuffer, GetMailBoxId(), GetFolderId(), |
|
536 |
GetMessageId(), GetPartId() )); |
|
537 |
if(err) |
|
538 |
{ |
|
539 |
return; |
|
540 |
} |
|
541 |
} |
|
542 |
} |
|
543 |
||
544 |
// ----------------------------------------------------------------------------- |
|
545 |
// CFSMailMessagePart::ContentDescription |
|
546 |
// ----------------------------------------------------------------------------- |
|
547 |
EXPORT_C const TDesC& CFSMailMessagePart::ContentDescription() |
|
548 |
{ |
|
549 |
FUNC_LOG; |
|
550 |
return *iContentDescription; |
|
551 |
} |
|
552 |
||
553 |
// ----------------------------------------------------------------------------- |
|
554 |
// CFSMailMessagePart::SetContentDescription |
|
555 |
// ----------------------------------------------------------------------------- |
|
556 |
EXPORT_C void CFSMailMessagePart::SetContentDescription( const TDesC& aContentDescription ) |
|
557 |
{ |
|
558 |
FUNC_LOG; |
|
559 |
// init mailbox name |
|
560 |
HBufC* description = HBufC::New(aContentDescription.Length()); |
|
561 |
||
562 |
// store new mailbox name |
|
563 |
if(description) |
|
564 |
{ |
|
565 |
delete iContentDescription; |
|
566 |
iContentDescription = description; |
|
567 |
iContentDescription->Des().Copy(aContentDescription); |
|
568 |
} |
|
569 |
} |
|
570 |
// ----------------------------------------------------------------------------- |
|
571 |
// CFSMailMessagePart::ContentDisposition |
|
572 |
// ----------------------------------------------------------------------------- |
|
573 |
EXPORT_C const TDesC& CFSMailMessagePart::ContentDisposition() |
|
574 |
{ |
|
575 |
FUNC_LOG; |
|
576 |
return *iContentDisposition; |
|
577 |
} |
|
578 |
||
579 |
// ----------------------------------------------------------------------------- |
|
580 |
// CFSMailMessagePart::SetContentDisposition |
|
581 |
// ----------------------------------------------------------------------------- |
|
582 |
EXPORT_C void CFSMailMessagePart::SetContentDisposition( const TDesC& aContentDisposition ) |
|
583 |
{ |
|
584 |
FUNC_LOG; |
|
585 |
// init mailbox name |
|
586 |
HBufC* disposition = HBufC::New(aContentDisposition.Length()); |
|
587 |
||
588 |
// store new mailbox name |
|
589 |
if(disposition) |
|
590 |
{ |
|
591 |
delete iContentDisposition; |
|
592 |
iContentDisposition = disposition; |
|
593 |
iContentDisposition->Des().Copy(aContentDisposition); |
|
594 |
} |
|
595 |
} |
|
596 |
||
597 |
// ----------------------------------------------------------------------------- |
|
598 |
// CFSMailMessagePart::ContentTypeParameters |
|
599 |
// ----------------------------------------------------------------------------- |
|
600 |
EXPORT_C CDesCArray& CFSMailMessagePart::ContentTypeParameters() |
|
601 |
{ |
|
602 |
FUNC_LOG; |
|
603 |
||
604 |
if(!iContentType) |
|
605 |
{ |
|
606 |
return *iContentTypeParams; |
|
607 |
} |
|
608 |
||
609 |
// clear parameter table |
|
610 |
iContentTypeParams->Reset(); |
|
611 |
TInt ret = KErrNone; |
|
612 |
||
613 |
// check content type parameters existence |
|
614 |
TInt index = iContentType->Locate(';'); |
|
615 |
if(index >= 0) |
|
616 |
{ |
|
617 |
TInt attLength(0); |
|
618 |
TInt valueLength(0); |
|
619 |
while(index >= 0) |
|
620 |
{ |
|
621 |
TPtrC attribute; |
|
622 |
TPtrC value; |
|
623 |
HBufC* buf; |
|
624 |
||
625 |
// set pointer to first parameter |
|
626 |
TPtrC parameter = iContentType->Mid(index+1); |
|
627 |
attLength = parameter.Locate('='); |
|
628 |
if(attLength >= 0) |
|
629 |
{ |
|
630 |
attribute.Set(parameter.Left(attLength)); |
|
631 |
valueLength = parameter.Locate(';'); |
|
632 |
if(valueLength < 0) |
|
633 |
{ |
|
634 |
value.Set( parameter.Right(parameter.Length()-attLength-1) ); |
|
635 |
index = -1; |
|
636 |
} |
|
637 |
else |
|
638 |
{ |
|
639 |
value.Set(parameter.Mid(attLength+1,(valueLength-attLength-1))); |
|
640 |
index += valueLength + 1; |
|
641 |
} |
|
642 |
} |
|
643 |
else |
|
644 |
{ |
|
645 |
attLength = parameter.Locate(';'); |
|
646 |
if(attLength < 0) |
|
647 |
{ |
|
648 |
attribute.Set(parameter); |
|
649 |
index = -1; |
|
650 |
} |
|
651 |
else |
|
652 |
{ |
|
653 |
attribute.Set(parameter.Left(attLength)); |
|
654 |
index += attLength + 1; |
|
655 |
} |
|
656 |
} |
|
657 |
||
658 |
if(attribute.Length()) |
|
659 |
{ |
|
660 |
buf = HBufC::New(attribute.Length()); |
|
661 |
buf->Des().Copy(attribute); |
|
662 |
TRAPD(err,iContentTypeParams->AppendL(buf->Des())); |
|
663 |
if(value.Length() && err == KErrNone) |
|
664 |
{ |
|
665 |
buf = HBufC::New(value.Length()); |
|
666 |
buf->Des().Copy(value); |
|
667 |
TRAP(err,iContentTypeParams->AppendL(buf->Des())); |
|
668 |
ret = err; |
|
669 |
} |
|
670 |
else |
|
671 |
{ |
|
672 |
TBufC<1> empty(KNullDesC); |
|
673 |
HBufC* buf = HBufC::New(empty.Des().Length()); |
|
674 |
buf->Des().Copy(empty); |
|
675 |
TRAP(err,iContentTypeParams->AppendL(buf->Des())); |
|
676 |
ret = err; |
|
677 |
} |
|
678 |
} |
|
679 |
} |
|
680 |
} |
|
681 |
||
682 |
if(ret != KErrNone) |
|
683 |
{ |
|
684 |
// clear parameter table |
|
685 |
iContentTypeParams->Reset(); |
|
686 |
} |
|
687 |
||
688 |
return *iContentTypeParams; |
|
689 |
} |
|
690 |
||
691 |
// ----------------------------------------------------------------------------- |
|
692 |
// CFSMailMessagePart::ContentDispositionParameters |
|
693 |
// ----------------------------------------------------------------------------- |
|
694 |
EXPORT_C CDesCArray& CFSMailMessagePart::ContentDispositionParameters() |
|
695 |
{ |
|
696 |
FUNC_LOG; |
|
697 |
||
698 |
if(!iContentDisposition) |
|
699 |
{ |
|
700 |
return *iContentDispositionParams; |
|
701 |
} |
|
702 |
||
703 |
// clear parameter array |
|
704 |
iContentDispositionParams->Reset(); |
|
705 |
TInt ret = KErrNone; |
|
706 |
||
707 |
// check content disposition parameters existence |
|
708 |
TInt index = iContentDisposition->Locate(';'); |
|
709 |
if( index >= 0 ) |
|
710 |
{ |
|
711 |
TInt attLength(0); |
|
712 |
TInt valueLength(0); |
|
713 |
while(index >= 0) |
|
714 |
{ |
|
715 |
TPtrC attribute; |
|
716 |
TPtrC value; |
|
717 |
||
718 |
// set pointer to first parameter |
|
719 |
TPtrC parameter = iContentDisposition->Mid(index+1); |
|
720 |
attLength = parameter.Locate('='); |
|
721 |
if( attLength >= 0 ) |
|
722 |
{ |
|
723 |
attribute.Set(parameter.Left(attLength)); |
|
724 |
valueLength = parameter.Locate(';'); |
|
725 |
if( valueLength < 0 ) |
|
726 |
{ |
|
727 |
value.Set( parameter.Right(parameter.Length()-attLength-1) ); |
|
728 |
index = -1; |
|
729 |
} |
|
730 |
else |
|
731 |
{ |
|
732 |
value.Set( parameter.Mid(attLength+1,(valueLength-attLength-1)) ); |
|
733 |
index += valueLength + 1; |
|
734 |
} |
|
735 |
} |
|
736 |
else |
|
737 |
{ |
|
738 |
attLength = parameter.Locate(';'); |
|
739 |
if(attLength < 0) |
|
740 |
{ |
|
741 |
attribute.Set(parameter); |
|
742 |
index = -1; |
|
743 |
} |
|
744 |
else |
|
745 |
{ |
|
746 |
attribute.Set(parameter.Left(attLength)); |
|
747 |
index += attLength + 1; |
|
748 |
} |
|
749 |
} |
|
750 |
||
751 |
if(attribute.Length()) |
|
752 |
{ |
|
753 |
HBufC* attBuf = HBufC::New(attribute.Length()); |
|
754 |
attBuf->Des().Copy(attribute); |
|
755 |
// let's trim the attribute before adding to array |
|
756 |
TPtr attTrim( attBuf->Des() ); |
|
757 |
attTrim.Trim(); |
|
758 |
||
759 |
if ( attTrim.Length() ) |
|
760 |
{ |
|
761 |
// add trimmed attribute to the array |
|
762 |
TRAPD(err,iContentDispositionParams->AppendL( attTrim )); |
|
763 |
||
764 |
if(value.Length() && err == KErrNone) |
|
765 |
{ |
|
766 |
HBufC* valueBuf = HBufC::New(value.Length()); |
|
767 |
valueBuf->Des().Copy(value); |
|
768 |
// let's trim also the value before adding to array |
|
769 |
TPtr valueTrim( valueBuf->Des() ); |
|
770 |
valueTrim.Trim(); |
|
771 |
||
772 |
if ( valueTrim.Length() ) |
|
773 |
{ |
|
774 |
// add trimmed value to the array |
|
775 |
TRAPD(err,iContentDispositionParams->AppendL( valueTrim )); |
|
776 |
ret = err; |
|
777 |
} |
|
778 |
else |
|
779 |
{ |
|
780 |
delete valueBuf; |
|
781 |
valueBuf = NULL; |
|
782 |
||
783 |
TBufC<1> empty(KNullDesC); |
|
784 |
HBufC* emptyBuf = HBufC::New(empty.Des().Length()); |
|
785 |
emptyBuf->Des().Copy(empty); |
|
786 |
TRAPD(err,iContentDispositionParams->AppendL(emptyBuf->Des())); |
|
787 |
ret = err; |
|
788 |
} |
|
789 |
} |
|
790 |
else |
|
791 |
{ |
|
792 |
TBufC<1> empty(KNullDesC); |
|
793 |
HBufC* emptyBuf = HBufC::New(empty.Des().Length()); |
|
794 |
emptyBuf->Des().Copy(empty); |
|
795 |
TRAPD(err,iContentDispositionParams->AppendL(emptyBuf->Des())); |
|
796 |
ret = err; |
|
797 |
} |
|
798 |
} |
|
799 |
else |
|
800 |
{ |
|
801 |
delete attBuf; |
|
802 |
attBuf = NULL; |
|
803 |
} |
|
804 |
} |
|
805 |
} // while |
|
806 |
} |
|
807 |
||
808 |
if(ret != KErrNone) |
|
809 |
{ |
|
810 |
// clear parameter table |
|
811 |
iContentDispositionParams->Reset(); |
|
812 |
} |
|
813 |
||
814 |
return *iContentDispositionParams; |
|
815 |
} |
|
816 |
||
817 |
// ----------------------------------------------------------------------------- |
|
818 |
// CFSMailMessagePart::GetMRInfo |
|
819 |
// ----------------------------------------------------------------------------- |
|
820 |
EXPORT_C MMRInfoObject& CFSMailMessagePart::GetMRInfo() |
|
821 |
{ |
|
822 |
FUNC_LOG; |
|
823 |
return *iMeetingRequest; |
|
824 |
} |
|
825 |
||
826 |
// ----------------------------------------------------------------------------- |
|
827 |
// CFSMailMessagePart::IsMRInfoSet |
|
828 |
// ----------------------------------------------------------------------------- |
|
829 |
EXPORT_C TBool CFSMailMessagePart::IsMRInfoSet() |
|
830 |
{ |
|
831 |
FUNC_LOG; |
|
832 |
if(iMeetingRequest) |
|
833 |
{ |
|
834 |
return ETrue; |
|
835 |
} |
|
836 |
else |
|
837 |
{ |
|
838 |
return EFalse; |
|
839 |
} |
|
840 |
} |
|
841 |
||
842 |
// ----------------------------------------------------------------------------- |
|
843 |
// CFSMailMessagePart::SetMRInfo |
|
844 |
// ----------------------------------------------------------------------------- |
|
845 |
EXPORT_C void CFSMailMessagePart::SetMRInfo(MMRInfoObject* aMeetingRequest) |
|
846 |
{ |
|
847 |
FUNC_LOG; |
|
848 |
if(iMeetingRequest) |
|
849 |
{ |
|
850 |
delete iMeetingRequest; |
|
851 |
} |
|
852 |
iMeetingRequest = aMeetingRequest; |
|
853 |
} |
|
854 |
||
855 |
// ----------------------------------------------------------------------------- |
|
856 |
// CFSMailMessagePart::SaveL |
|
857 |
// ----------------------------------------------------------------------------- |
|
858 |
EXPORT_C void CFSMailMessagePart::SaveL() |
|
859 |
{ |
|
860 |
FUNC_LOG; |
|
861 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
862 |
{ |
|
863 |
plugin->StoreMessagePartL( GetMailBoxId(), GetFolderId(), GetMessageId(), *this ); |
|
864 |
} |
|
865 |
} |
|
866 |
||
867 |
||
868 |
// ----------------------------------------------------------------------------- |
|
869 |
// CFSMailMessagePart::SetAttachmentNameL |
|
870 |
// ----------------------------------------------------------------------------- |
|
871 |
EXPORT_C void CFSMailMessagePart::SetAttachmentNameL(const TDesC& aFilePath) |
|
872 |
{ |
|
873 |
FUNC_LOG; |
|
874 |
// Parse file name in case full path is given |
|
875 |
TPtrC name; |
|
876 |
for(TInt i=0;i<aFilePath.Length();) |
|
877 |
{ |
|
878 |
name.Set(aFilePath.Mid(i,(aFilePath.Length()-i))); |
|
879 |
TInt skip = name.Locate(KPathDelimiter); |
|
880 |
if(skip < 0) break; |
|
881 |
else i += skip + 1; |
|
882 |
} |
|
883 |
||
884 |
// Set Content-Type param "name" = filename |
|
885 |
TUint length = KFSMailContentTypeParamName.iTypeLength + name.Length() + 5; |
|
886 |
if(iContentType) |
|
887 |
{ |
|
888 |
length += iContentType->Des().Length(); |
|
889 |
} |
|
890 |
||
891 |
HBufC* buffer = HBufC::NewL(length); |
|
892 |
if(iContentType) |
|
893 |
{ |
|
894 |
buffer->Des().Append(*iContentType); |
|
895 |
} |
|
896 |
buffer->Des().Append(_L("; ")); |
|
897 |
buffer->Des().Append(KFSMailContentTypeParamName); |
|
898 |
buffer->Des().Append('"'); |
|
899 |
buffer->Des().Append(name); |
|
900 |
buffer->Des().Append('"'); |
|
901 |
||
902 |
// remove old value |
|
903 |
if(iContentType) |
|
904 |
{ |
|
905 |
delete iContentType; |
|
906 |
} |
|
907 |
iContentType = buffer; |
|
908 |
||
909 |
// Set Content-Disposition as "attachment" and |
|
910 |
// Content-Disposition param "filename" = filename and |
|
911 |
// remove old value |
|
912 |
if(iContentDisposition) |
|
913 |
{ |
|
914 |
delete iContentDisposition; |
|
915 |
iContentDisposition = NULL; |
|
916 |
} |
|
917 |
length = KFSMailContentDispAttachment.iTypeLength + |
|
918 |
KFSMailContentDispParamFilename.iTypeLength + name.Length() + 4; |
|
919 |
iContentDisposition = HBufC::NewL(length); |
|
920 |
iContentDisposition->Des().Append(KFSMailContentDispAttachment); |
|
921 |
iContentDisposition->Des().Append(_L("; ")); |
|
922 |
iContentDisposition->Des().Append(KFSMailContentDispParamFilename); |
|
923 |
iContentDisposition->Des().Append('"'); |
|
924 |
iContentDisposition->Des().Append(name); |
|
925 |
iContentDisposition->Des().Append('"'); |
|
926 |
||
927 |
// set content description |
|
928 |
// remove old value |
|
929 |
if(iContentDescription) |
|
930 |
{ |
|
931 |
delete iContentDescription; |
|
932 |
iContentDescription = NULL; |
|
933 |
} |
|
934 |
iContentDescription = HBufC::NewL(name.Length()); |
|
935 |
iContentDescription->Des().Append(name); |
|
936 |
||
937 |
} |
|
938 |
||
939 |
// ----------------------------------------------------------------------------- |
|
940 |
// CFSMailMessagePart::AttachmentNameL |
|
941 |
// ----------------------------------------------------------------------------- |
|
942 |
EXPORT_C TDesC& CFSMailMessagePart::AttachmentNameL() |
|
943 |
{ |
|
944 |
FUNC_LOG; |
|
945 |
// Look first from Content-Type param "name" |
|
946 |
TInt ptr = iContentType->Find(KFSMailContentTypeParamName); |
|
947 |
if(ptr >= 0) |
|
948 |
{ |
|
949 |
ptr = iContentType->Locate('='); |
|
950 |
TInt length = iContentType->Length()-ptr-3; |
|
951 |
TPtrC name = iContentType->Mid((ptr+2),length); |
|
952 |
if(iAttachmentName) |
|
953 |
{ |
|
954 |
delete iAttachmentName; |
|
955 |
iAttachmentName = NULL; |
|
956 |
} |
|
957 |
iAttachmentName = HBufC::New(name.Length()); |
|
958 |
iAttachmentName->Des().Copy(name); |
|
959 |
return *iAttachmentName; |
|
960 |
} |
|
961 |
// then if Content-Disposition is "attachment" look from Content-Disposition param "filename" and |
|
962 |
ptr = iContentDisposition->Find(KFSMailContentDispAttachment); |
|
963 |
if(ptr >= 0) |
|
964 |
{ |
|
965 |
ptr = iContentDisposition->Find(KFSMailContentDispParamFilename); |
|
966 |
if(ptr > 0) |
|
967 |
{ |
|
968 |
ptr = iContentDisposition->Locate('='); |
|
969 |
TInt length = iContentDisposition->Length()-ptr-3; |
|
970 |
TPtrC name = iContentDisposition->Mid(ptr+2,length); |
|
971 |
if(iAttachmentName) |
|
972 |
{ |
|
973 |
delete iAttachmentName; |
|
974 |
iAttachmentName = NULL; |
|
975 |
} |
|
976 |
iAttachmentName = HBufC::New(name.Length()); |
|
977 |
iAttachmentName->Des().Copy(name); |
|
978 |
return *iAttachmentName; |
|
979 |
} |
|
980 |
} |
|
981 |
// finally look if there is Content-Description. |
|
982 |
return *iContentDescription; |
|
983 |
} |
|
984 |
||
985 |
// ----------------------------------------------------------------------------- |
|
986 |
// CFSMailMessagePart::FindBodyPartL |
|
987 |
// ----------------------------------------------------------------------------- |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
988 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::FindBodyPartL( |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
989 |
const TDesC& aContentType ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
990 |
{ |
64 | 991 |
FUNC_LOG; |
992 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
993 |
TBuf<KMaxDataTypeLength> ptr; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
994 |
if ( iContentType ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
995 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
996 |
ptr.Copy( iContentType->Des() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
997 |
TInt length = ptr.Locate(';'); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
998 |
if( length >= 0 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
999 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1000 |
ptr.SetLength( length ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1001 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1002 |
if( !ptr.CompareF( aContentType ) ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1003 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1004 |
return this; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1005 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1006 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1007 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1008 |
CFSMailMessagePart* messagePart = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1009 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1010 |
if( plugin ) |
64 | 1011 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1012 |
if( iReadMessageParts ) |
64 | 1013 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1014 |
plugin->ChildPartsL( GetMailBoxId(), |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1015 |
GetFolderId(), |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1016 |
GetMessageId(), |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1017 |
GetPartId(), |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1018 |
iMessageParts ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1019 |
iReadMessageParts = EFalse; |
64 | 1020 |
} |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1021 |
if( iMessageParts.Count() ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1022 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1023 |
if( !ptr.CompareF( KFSMailContentTypeMultipartAlternative ) ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1024 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1025 |
// multipart / alternative |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1026 |
for( TInt i=0; i<iMessageParts.Count(); i++ ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1027 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1028 |
ptr.Copy( iMessageParts[i]->GetContentType() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1029 |
TInt length = ptr.Locate(';'); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1030 |
if( length >= 0 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1031 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1032 |
ptr.SetLength( length ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1033 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1034 |
if( !ptr.CompareF( aContentType ) ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1035 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1036 |
messagePart = iMessageParts[i]; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1037 |
// remove part from table |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1038 |
iMessageParts.Remove( i ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1039 |
break; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1040 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1041 |
else if( !ptr.CompareF( KFSMailContentTypeMultipartRelated ) || |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1042 |
!ptr.CompareF( KFSMailContentTypeMultipartMixed ) || |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1043 |
!ptr.CompareF( KFSMailContentTypeMultipartAlternative ) || |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1044 |
!ptr.CompareF( KFSMailContentTypeMultipartDigest ) || |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1045 |
!ptr.CompareF( KFSMailContentTypeMultipartParallel ) ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1046 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1047 |
// multipart, check child parts |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1048 |
messagePart = iMessageParts[i]; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1049 |
// remove part from table |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1050 |
messagePart = |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1051 |
messagePart->FindBodyPartL( aContentType ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1052 |
if( messagePart && messagePart->GetPartId() == |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1053 |
iMessageParts[i]->GetPartId() ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1054 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1055 |
iMessageParts.Remove( i ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1056 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1057 |
break; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1058 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1059 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1060 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1061 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1062 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1063 |
// all other cases |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1064 |
const TInt count = iMessageParts.Count(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1065 |
for ( TInt i = 0; i < count && !messagePart; i++ ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1066 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1067 |
messagePart = iMessageParts[i]; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1068 |
// remove part from table |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1069 |
messagePart = messagePart->FindBodyPartL( aContentType ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1070 |
if( messagePart && messagePart->GetPartId() == |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1071 |
iMessageParts[i]->GetPartId() ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1072 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1073 |
iMessageParts.Remove( i ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1074 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1075 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1076 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1077 |
} |
64 | 1078 |
} |
1079 |
return messagePart; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1080 |
} |
64 | 1081 |
|
1082 |
||
1083 |
// ----------------------------------------------------------------------------- |
|
1084 |
// CFSMailMessagePart::ContentTypeMatches |
|
1085 |
// ----------------------------------------------------------------------------- |
|
1086 |
EXPORT_C TBool CFSMailMessagePart::ContentTypeMatches( const TDesC& aContentType ) |
|
1087 |
{ |
|
1088 |
FUNC_LOG; |
|
1089 |
||
1090 |
TBuf<KMaxDataTypeLength> ptr; |
|
1091 |
TBool result(EFalse); |
|
1092 |
if ( iContentType ) |
|
1093 |
{ |
|
1094 |
ptr.Copy(iContentType->Des()); |
|
1095 |
TInt length = ptr.Locate(';'); |
|
1096 |
if(length >= 0) |
|
1097 |
{ |
|
1098 |
ptr.SetLength(length); |
|
1099 |
} |
|
1100 |
||
1101 |
if( !ptr.CompareF(aContentType) ) // case-insensitive comparision |
|
1102 |
{ |
|
1103 |
result = ETrue; |
|
1104 |
} |
|
1105 |
} |
|
1106 |
||
1107 |
return result; |
|
1108 |
} |
|
1109 |
||
1110 |
||
1111 |
// ----------------------------------------------------------------------------- |
|
1112 |
// CFSMailMessagePart::AppendAttachmentsL |
|
1113 |
// ----------------------------------------------------------------------------- |
|
1114 |
EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( |
|
1115 |
RPointerArray<CFSMailMessagePart>& aParts) |
|
1116 |
{ |
|
1117 |
FUNC_LOG; |
|
1118 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
|
1119 |
if ( plugin ) |
|
1120 |
{ |
|
1121 |
RPointerArray<CFSMailMessagePart> messageParts; |
|
1122 |
CleanupResetAndDestroyPushL( messageParts ); |
|
1123 |
plugin->ChildPartsL( GetMailBoxId(), GetFolderId(), |
|
1124 |
GetMessageId(), GetPartId(), messageParts ); |
|
1125 |
||
1126 |
const TInt messagePartCount = messageParts.Count(); |
|
1127 |
for ( TInt i = 0; i < messagePartCount; i++ ) |
|
1128 |
{ |
|
1129 |
const TDesC& contentType = messageParts[i]->GetContentType(); |
|
1130 |
if (!contentType.CompareF(KFSMailContentTypeMultipartMixed) || |
|
1131 |
!contentType.CompareF(KFSMailContentTypeMultipartAlternative) || |
|
1132 |
!contentType.CompareF(KFSMailContentTypeMultipartDigest) || |
|
1133 |
!contentType.CompareF(KFSMailContentTypeMultipartRelated) || |
|
1134 |
!contentType.CompareF(KFSMailContentTypeMultipartParallel)) |
|
1135 |
{ |
|
1136 |
// get multipart message subparts |
|
1137 |
messageParts[i]->AppendAttachmentsL( aParts ); |
|
1138 |
} |
|
1139 |
else |
|
1140 |
{ |
|
1141 |
aParts.AppendL( messageParts[i] ); |
|
1142 |
messageParts[i] = NULL; |
|
1143 |
} |
|
1144 |
} |
|
1145 |
CleanupStack::PopAndDestroy( &messageParts ); |
|
1146 |
} |
|
1147 |
} |
|
1148 |
||
1149 |
// ----------------------------------------------------------------------------- |
|
1150 |
// CFSMailMessagePart::FetchedContentSize |
|
1151 |
// ----------------------------------------------------------------------------- |
|
1152 |
EXPORT_C TUint CFSMailMessagePart::FetchedContentSize() const |
|
1153 |
{ |
|
1154 |
FUNC_LOG; |
|
1155 |
return iFetchedContentSize; |
|
1156 |
} |
|
1157 |
||
1158 |
// ----------------------------------------------------------------------------- |
|
1159 |
// CFSMailMessagePart::SetFetchedContentSize |
|
1160 |
// ----------------------------------------------------------------------------- |
|
1161 |
EXPORT_C void CFSMailMessagePart::SetFetchedContentSize(TUint aContentSize) |
|
1162 |
{ |
|
1163 |
FUNC_LOG; |
|
1164 |
iFetchedContentSize = aContentSize; |
|
1165 |
} |
|
1166 |
||
1167 |
// ----------------------------------------------------------------------------- |
|
1168 |
// CFSMailMessagePart::FetchLoadState |
|
1169 |
// ----------------------------------------------------------------------------- |
|
1170 |
EXPORT_C TFSPartFetchState CFSMailMessagePart::FetchLoadState() const |
|
1171 |
{ |
|
1172 |
FUNC_LOG; |
|
1173 |
||
1174 |
if(iMessagePartsStatus != EFSDefault) |
|
1175 |
{ |
|
1176 |
return iMessagePartsStatus; |
|
1177 |
} |
|
1178 |
else if(iContentSize == 0) |
|
1179 |
{ |
|
1180 |
return EFSFull; |
|
1181 |
} |
|
1182 |
else if(iFetchedContentSize == 0) |
|
1183 |
{ |
|
1184 |
return EFSNone; |
|
1185 |
} |
|
1186 |
else if (iFetchedContentSize < iContentSize) |
|
1187 |
{ |
|
1188 |
return EFSPartial; |
|
1189 |
} |
|
1190 |
else |
|
1191 |
{ |
|
1192 |
return EFSFull; |
|
1193 |
} |
|
1194 |
} |
|
1195 |
||
1196 |
// ----------------------------------------------------------------------------- |
|
1197 |
// CFSMailMessagePart::FetchMessagePartL |
|
1198 |
// ----------------------------------------------------------------------------- |
|
1199 |
EXPORT_C TInt CFSMailMessagePart::FetchMessagePartL( const TFSMailMsgId /*aMessagePartId*/, |
|
1200 |
MFSMailRequestObserver& aOperationObserver, |
|
1201 |
const TUint aPreferredByteCount) |
|
1202 |
{ |
|
1203 |
FUNC_LOG; |
|
1204 |
||
1205 |
TInt requestId(0); |
|
1206 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
1207 |
{ |
|
1208 |
||
1209 |
RArray<TFSMailMsgId> messageList; |
|
1210 |
messageList.Append(GetPartId()); |
|
1211 |
||
1212 |
// init async request |
|
1213 |
TFSPendingRequest request = iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
|
1214 |
aOperationObserver); |
|
1215 |
||
1216 |
requestId = request.iRequestId; |
|
1217 |
MFSMailRequestObserver* observer = request.iObserver; |
|
1218 |
||
1219 |
// fetch message parts |
|
1220 |
TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
|
1221 |
GetFolderId(), |
|
1222 |
GetMessageId(), |
|
1223 |
messageList, |
|
1224 |
*observer, |
|
1225 |
requestId, |
|
1226 |
aPreferredByteCount )); |
|
1227 |
messageList.Reset(); |
|
1228 |
if(err != KErrNone) |
|
1229 |
{ |
|
1230 |
iRequestHandler->CompleteRequest(requestId); |
|
1231 |
User::Leave(err); |
|
1232 |
} |
|
1233 |
} |
|
1234 |
return requestId; |
|
1235 |
} |
|
1236 |
||
1237 |
// ----------------------------------------------------------------------------- |
|
1238 |
// CFSMailMessagePart::FetchMessagesPartsL |
|
1239 |
// ----------------------------------------------------------------------------- |
|
1240 |
EXPORT_C TInt CFSMailMessagePart::FetchMessagesPartsL( |
|
1241 |
const RArray<TFSMailMsgId>& aMessagePartIds, |
|
1242 |
MFSMailRequestObserver& aOperationObserver, |
|
1243 |
const TUint aPreferredByteCount) |
|
1244 |
{ |
|
1245 |
FUNC_LOG; |
|
1246 |
||
1247 |
TInt requestId(0); |
|
1248 |
||
1249 |
if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
1250 |
{ |
|
1251 |
||
1252 |
// get async request id |
|
1253 |
TFSPendingRequest request = |
|
1254 |
iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
|
1255 |
aOperationObserver); |
|
1256 |
||
1257 |
requestId = request.iRequestId; |
|
1258 |
MFSMailRequestObserver* observer = request.iObserver; |
|
1259 |
||
1260 |
// fetch message parts |
|
1261 |
TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
|
1262 |
GetFolderId(), |
|
1263 |
GetMessageId(), |
|
1264 |
aMessagePartIds, |
|
1265 |
*observer, |
|
1266 |
requestId, |
|
1267 |
aPreferredByteCount )); |
|
1268 |
||
1269 |
if(err != KErrNone) |
|
1270 |
{ |
|
1271 |
iRequestHandler->CompleteRequest(requestId); |
|
1272 |
User::Leave(err); |
|
1273 |
} |
|
1274 |
} |
|
1275 |
else |
|
1276 |
{ |
|
1277 |
User::Leave(KErrArgument); |
|
1278 |
} |
|
1279 |
return requestId; |
|
1280 |
} |
|
1281 |
||
1282 |
// ----------------------------------------------------------------------------- |
|
1283 |
// CFSMailMessagePart::SetMessagePartsStatus |
|
1284 |
// ----------------------------------------------------------------------------- |
|
1285 |
EXPORT_C void CFSMailMessagePart::SetMessagePartsStatus(TFSPartFetchState aMessagePartStatus) |
|
1286 |
{ |
|
1287 |
FUNC_LOG; |
|
1288 |
iMessagePartsStatus = aMessagePartStatus; |
|
1289 |
} |
|
1290 |
||
1291 |
// ----------------------------------------------------------------------------- |
|
1292 |
// CFSMailMessagePart::AddNewAttachmentL |
|
1293 |
// ----------------------------------------------------------------------------- |
|
1294 |
EXPORT_C CFSMailMessagePart* CFSMailMessagePart::AddNewAttachmentL( const TDesC& aFilePath, |
|
1295 |
const TFSMailMsgId /*aInsertBefore*/, |
|
1296 |
const TDesC& aContentType ) |
|
1297 |
{ |
|
1298 |
FUNC_LOG; |
|
1299 |
CFSMailMessagePart* newPart = NULL; |
|
1300 |
||
1301 |
CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
|
1302 |
if ( plugin ) |
|
1303 |
{ |
|
1304 |
newPart = plugin->NewChildPartFromFileL( GetMailBoxId(), |
|
1305 |
GetFolderId(), |
|
1306 |
GetMessageId(), |
|
1307 |
GetPartId(), |
|
1308 |
aContentType, //contentType, |
|
1309 |
aFilePath ); |
|
1310 |
||
1311 |
CleanupStack::PushL( newPart ); |
|
1312 |
||
1313 |
// Set attachment name |
|
1314 |
newPart->SetAttachmentNameL( aFilePath ); |
|
1315 |
||
1316 |
// save message part |
|
1317 |
newPart->SaveL(); |
|
1318 |
||
1319 |
CleanupStack::Pop( newPart ); |
|
1320 |
} |
|
1321 |
||
1322 |
return newPart; |
|
1323 |
} |
|
1324 |
||
1325 |
// ----------------------------------------------------------------------------- |
|
1326 |
// CFSMailMessagePart::ReadOnlyPartSize |
|
1327 |
// ----------------------------------------------------------------------------- |
|
1328 |
EXPORT_C TUint CFSMailMessagePart::ReadOnlyPartSize() const |
|
1329 |
{ |
|
1330 |
FUNC_LOG; |
|
1331 |
return iReadOnlyPartSize; |
|
1332 |
} |
|
1333 |
||
1334 |
// ----------------------------------------------------------------------------- |
|
1335 |
// CFSMailMessagePart::SetReadOnlyPartSize |
|
1336 |
// ----------------------------------------------------------------------------- |
|
1337 |
EXPORT_C void CFSMailMessagePart::SetReadOnlyPartSize(const TUint aReadOnlyPartSize) |
|
1338 |
{ |
|
1339 |
FUNC_LOG; |
|
1340 |
iReadOnlyPartSize = aReadOnlyPartSize; |
|
1341 |
} |
|
1342 |
// ----------------------------------------------------------------------------- |
|
1343 |
// CFSMailMessagePart::DoAttachmentListL |
|
1344 |
// ----------------------------------------------------------------------------- |
|
1345 |
void CFSMailMessagePart::DoAttachmentListL( RPointerArray<CFSMailMessagePart>& /*aParts*/ ) |
|
1346 |
{ |
|
1347 |
FUNC_LOG; |
|
1348 |
||
1349 |
} |
|
1350 |