36 |
39 |
37 // ================= MEMBER FUNCTIONS ========================================== |
40 // ================= MEMBER FUNCTIONS ========================================== |
38 // ----------------------------------------------------------------------------- |
41 // ----------------------------------------------------------------------------- |
39 // CFSMailMessagePart::NewLC |
42 // CFSMailMessagePart::NewLC |
40 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
41 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC( |
44 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC( TFSMailMsgId aMessageId, |
42 TFSMailMsgId aMessageId, TFSMailMsgId aMessagePartId ) |
45 TFSMailMsgId aMessagePartId ) |
43 { |
46 { |
44 FUNC_LOG; |
47 FUNC_LOG; |
45 CFSMailMessagePart* self = new (ELeave) CFSMailMessagePart(); |
48 CFSMailMessagePart* adr = new (ELeave) CFSMailMessagePart(); |
46 CleanupStack::PushL(self); |
49 CleanupStack::PushL(adr); |
47 self->ConstructL( aMessageId, aMessagePartId ); |
50 adr->ConstructL( aMessageId, aMessagePartId ); |
48 return self; |
51 return adr; |
49 } |
52 } |
50 |
53 |
51 // ----------------------------------------------------------------------------- |
54 // ----------------------------------------------------------------------------- |
52 // CFSMailMessagePart::NewL |
55 // CFSMailMessagePart::NewL |
53 // ----------------------------------------------------------------------------- |
56 // ----------------------------------------------------------------------------- |
54 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewL( |
57 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewL( TFSMailMsgId aMessageId, |
55 TFSMailMsgId aMessageId, TFSMailMsgId aMessagePartId ) |
58 TFSMailMsgId aMessagePartId ) |
56 { |
59 { |
57 FUNC_LOG; |
60 FUNC_LOG; |
58 CFSMailMessagePart* self = |
61 CFSMailMessagePart* adr = CFSMailMessagePart::NewLC( aMessageId, aMessagePartId ); |
59 CFSMailMessagePart::NewLC( aMessageId, aMessagePartId ); |
62 CleanupStack::Pop(adr); |
60 CleanupStack::Pop(self); |
63 return adr; |
61 return self; |
64 } |
62 } |
65 |
63 |
66 //<qmail> |
64 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
65 // CFSMailMessagePart::NewLC |
68 // CFSMailMessagePart::NewLC |
66 // ----------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
67 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC(const NmId &aNmMessageId, |
70 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC(const NmId &aNmMessageId, |
68 const NmMessagePart& aNmMessage ) |
71 const NmMessagePart& aNmMessage ) |
69 { |
72 { |
70 FUNC_LOG; |
73 FUNC_LOG; |
71 CFSMailMessagePart* self = new (ELeave) CFSMailMessagePart(); |
74 CFSMailMessagePart* self = new (ELeave) CFSMailMessagePart(); |
72 CleanupStack::PushL(self); |
75 CleanupStack::PushL(self); |
73 self->ConstructL( aNmMessageId,aNmMessage ); |
76 self->ConstructL( aNmMessageId,aNmMessage ); |
74 return self; |
77 return self; |
75 } |
78 } |
|
79 //</qmail> |
76 |
80 |
77 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
78 // CFSMailMessagePart::ConstructL |
82 // CFSMailMessagePart::ConstructL |
79 // ----------------------------------------------------------------------------- |
83 // ----------------------------------------------------------------------------- |
80 void CFSMailMessagePart::ConstructL( TFSMailMsgId aMessageId, |
84 void CFSMailMessagePart::ConstructL( TFSMailMsgId aMessageId, |
81 TFSMailMsgId aMessagePartId ) |
85 TFSMailMsgId aMessagePartId ) |
82 { |
86 { |
83 FUNC_LOG; |
87 FUNC_LOG; |
84 // Base class initialization |
88 //<qmail> |
|
89 // Base class initialization |
85 CFSMailMessageBase::ConstructL(aMessageId); |
90 CFSMailMessageBase::ConstructL(aMessageId); |
86 |
91 |
87 iNmPrivateMessagePart = new NmMessagePartPrivate(); |
92 iNmPrivateMessagePart = new NmMessagePartPrivate(); |
88 |
93 |
89 iNmPrivateMessagePart->mOwnId.setId32(aMessagePartId.Id()); |
94 iNmPrivateMessagePart->mOwnId.setId32(aMessagePartId.Id()); |
90 iNmPrivateMessagePart->mOwnId.setPluginId32((quint32)aMessagePartId.PluginId().iUid); |
95 iNmPrivateMessagePart->mOwnId.setPluginId32((quint32)aMessagePartId.PluginId().iUid); |
91 |
96 |
92 iMessagePartsStatus = EFSDefault; |
97 iMessagePartsStatus = EFSDefault; |
93 |
98 |
94 // set request handler pointer |
|
95 iRequestHandler = static_cast<CFSMailRequestHandler*>(Dll::Tls()); |
|
96 |
|
97 iContentTypeParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
99 iContentTypeParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
98 iContentDispositionParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
100 iContentDispositionParams = new (ELeave)CDesCArrayFlat( KArrayGranularity ); |
99 } |
101 //</qmail> |
100 |
102 } |
|
103 |
|
104 //<qmail> |
101 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
102 // CFSMailMessagePart::ConstructL |
106 // CFSMailMessagePart::ConstructL |
103 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
104 void CFSMailMessagePart::ConstructL( const NmId &aNmMessageId,const NmMessagePart& aNmMessage ) |
108 void CFSMailMessagePart::ConstructL( const NmId &aNmMessageId,const NmMessagePart& aNmMessage ) |
105 { |
109 { |
201 // CFSMailMessagePart::GetContentType |
203 // CFSMailMessagePart::GetContentType |
202 // ----------------------------------------------------------------------------- |
204 // ----------------------------------------------------------------------------- |
203 EXPORT_C const TDesC& CFSMailMessagePart::GetContentType() const |
205 EXPORT_C const TDesC& CFSMailMessagePart::GetContentType() const |
204 { |
206 { |
205 FUNC_LOG; |
207 FUNC_LOG; |
|
208 //<qmail> |
206 iContentTypePtr.Set(reinterpret_cast<const TUint16*> (iNmPrivateMessagePart->mContentType.utf16()), |
209 iContentTypePtr.Set(reinterpret_cast<const TUint16*> (iNmPrivateMessagePart->mContentType.utf16()), |
207 iNmPrivateMessagePart->mContentType.length()); |
210 iNmPrivateMessagePart->mContentType.length()); |
208 return iContentTypePtr; |
211 return iContentTypePtr; |
|
212 //</qmail> |
209 } |
213 } |
210 |
214 |
211 // ----------------------------------------------------------------------------- |
215 // ----------------------------------------------------------------------------- |
212 // CFSMailMessagePart::SetContentType |
216 // CFSMailMessagePart::SetContentType |
213 // ----------------------------------------------------------------------------- |
217 // ----------------------------------------------------------------------------- |
214 EXPORT_C void CFSMailMessagePart::SetContentType( const TDesC& aContentType ) |
218 EXPORT_C void CFSMailMessagePart::SetContentType(const TDesC& aContentType) |
215 { |
219 { |
216 FUNC_LOG; |
220 FUNC_LOG; |
|
221 //<qmail> |
217 QString qtContentType = QString::fromUtf16(aContentType.Ptr(), aContentType.Length()); |
222 QString qtContentType = QString::fromUtf16(aContentType.Ptr(), aContentType.Length()); |
218 iNmPrivateMessagePart->mContentType = qtContentType; |
223 iNmPrivateMessagePart->mContentType = qtContentType; |
|
224 //</qmail> |
219 } |
225 } |
220 |
226 |
221 // ----------------------------------------------------------------------------- |
227 // ----------------------------------------------------------------------------- |
222 // CFSMailMessagePart::GetPartId |
228 // CFSMailMessagePart::GetPartId |
223 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
224 EXPORT_C TFSMailMsgId CFSMailMessagePart::GetPartId() const |
230 EXPORT_C TFSMailMsgId CFSMailMessagePart::GetPartId() const |
225 { |
231 { |
226 FUNC_LOG; |
232 FUNC_LOG; |
|
233 //<qmail> |
227 return TFSMailMsgId(iNmPrivateMessagePart->mOwnId); |
234 return TFSMailMsgId(iNmPrivateMessagePart->mOwnId); |
228 } |
235 //</qmail> |
229 |
236 } |
|
237 |
|
238 //<qmail> |
230 // ----------------------------------------------------------------------------- |
239 // ----------------------------------------------------------------------------- |
231 // CFSMailMessagePart::ChildPartsL |
240 // CFSMailMessagePart::ChildPartsL |
232 // ----------------------------------------------------------------------------- |
241 // ----------------------------------------------------------------------------- |
233 EXPORT_C void CFSMailMessagePart::ChildPartsL( RPointerArray<CFSMailMessagePart>& aParts, |
242 EXPORT_C void CFSMailMessagePart::ChildPartsL( RPointerArray<CFSMailMessagePart>& aParts, |
234 TFSMailMessagePartDataSource aDataSource) |
243 TFSMailMessagePartDataSource aDataSource) |
235 { |
244 { |
236 FUNC_LOG; |
245 FUNC_LOG; |
237 |
246 |
238 if (aDataSource == EDataSourceMessageStore) |
247 if (aDataSource == EDataSourceMessageStore) |
239 { |
248 { |
240 if (CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
249 if (CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
252 NmConverter::mailMsgIdToNmId(GetMessageId()), |
261 NmConverter::mailMsgIdToNmId(GetMessageId()), |
253 *iNmPrivateMessagePart->mChildParts[i]); |
262 *iNmPrivateMessagePart->mChildParts[i]); |
254 aParts.AppendL(part); |
263 aParts.AppendL(part); |
255 CleanupStack::Pop(part); |
264 CleanupStack::Pop(part); |
256 } |
265 } |
257 } |
266 } |
258 } |
267 } |
|
268 //</qmail> |
259 |
269 |
260 // ----------------------------------------------------------------------------- |
270 // ----------------------------------------------------------------------------- |
261 // CFSMailMessagePart::ChildPartL |
271 // CFSMailMessagePart::ChildPartL |
262 // ----------------------------------------------------------------------------- |
272 // ----------------------------------------------------------------------------- |
263 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::ChildPartL( TFSMailMsgId aPartId ) |
273 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::ChildPartL(TFSMailMsgId aPartId) |
264 { |
274 { |
265 FUNC_LOG; |
275 FUNC_LOG; |
266 |
276 |
267 CFSMailMessagePart* part = NULL; |
277 CFSMailMessagePart* part = NULL; |
268 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
278 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
269 { |
279 { |
270 part = plugin->MessagePartL(GetMailBoxId(), |
280 part = plugin->MessagePartL(GetMailBoxId(), |
271 GetFolderId(), |
281 GetFolderId(), |
272 GetMessageId(), |
282 GetMessageId(), |
273 aPartId); |
283 aPartId); |
274 } |
284 } |
275 return part; |
285 return part; |
276 } |
286 } |
277 |
287 |
278 // ----------------------------------------------------------------------------- |
288 // ----------------------------------------------------------------------------- |
279 // CFSMailMessagePart::IsMessageL |
289 // CFSMailMessagePart::IsMessageL |
280 // ----------------------------------------------------------------------------- |
290 // ----------------------------------------------------------------------------- |
281 EXPORT_C TBool CFSMailMessagePart::IsMessageL() const |
291 EXPORT_C TBool CFSMailMessagePart::IsMessageL() const |
282 { |
292 { |
283 FUNC_LOG; |
293 FUNC_LOG; |
284 |
294 |
285 TBuf<KMaxDataTypeLength> ptr; |
295 TBuf<KMaxDataTypeLength> ptr; |
286 if ( !iNmPrivateMessagePart->mContentType.isNull() ) { |
296 //<qmail> |
|
297 if ( !iNmPrivateMessagePart->mContentType.isNull() ) |
|
298 { |
287 ptr.Copy(GetContentType()); |
299 ptr.Copy(GetContentType()); |
288 TInt length = ptr.Locate(';'); |
300 //</qmail> |
289 if(length >= 0) { |
301 TInt length = ptr.Locate(';'); |
|
302 if(length >= 0) |
|
303 { |
290 ptr.SetLength(length); |
304 ptr.SetLength(length); |
291 } |
305 } |
292 if( !ptr.Compare(KFSMailContentTypeMessage) ) { |
306 |
|
307 if( !ptr.CompareF(KFSMailContentTypeMessage) ) |
|
308 { |
293 return ETrue; |
309 return ETrue; |
294 } |
310 } |
295 } |
311 } |
296 return EFalse; |
312 return EFalse; |
297 } |
313 } |
298 |
314 |
299 // ----------------------------------------------------------------------------- |
315 // ----------------------------------------------------------------------------- |
300 // CFSMailMessagePart::NewChildPartL |
316 // CFSMailMessagePart::NewChildPartL |
301 // ----------------------------------------------------------------------------- |
317 // ----------------------------------------------------------------------------- |
302 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewChildPartL( const TFSMailMsgId aInsertBefore, |
318 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewChildPartL( const TFSMailMsgId aInsertBefore, |
303 const TDesC& aContentType ) |
319 const TDesC& aContentType ) |
304 { |
320 { |
305 FUNC_LOG; |
321 FUNC_LOG; |
306 |
322 |
307 CFSMailMessagePart* part = NULL; |
323 CFSMailMessagePart* part = NULL; |
308 |
324 |
309 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
325 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) |
310 { |
326 { |
311 part = plugin->NewChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
327 part = plugin->NewChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
312 GetPartId(), aInsertBefore, aContentType ); |
328 GetPartId(), aInsertBefore, aContentType ); |
313 } |
329 } |
314 return part; |
330 return part; |
315 } |
331 } |
316 |
332 |
317 // ----------------------------------------------------------------------------- |
333 // ----------------------------------------------------------------------------- |
318 // CFSMailMessagePart::RemoveChildPartL |
334 // CFSMailMessagePart::RemoveChildPartL |
319 // ----------------------------------------------------------------------------- |
335 // ----------------------------------------------------------------------------- |
320 EXPORT_C void CFSMailMessagePart::RemoveChildPartL( TFSMailMsgId aPartId ) |
336 EXPORT_C void CFSMailMessagePart::RemoveChildPartL(TFSMailMsgId aPartId) |
321 { |
337 { |
322 FUNC_LOG; |
338 FUNC_LOG; |
|
339 // get plugin pointer |
|
340 TFSMailMsgId id = GetPartId(); |
|
341 if(id.IsNullId()) |
|
342 { |
|
343 id = GetMessageId(); |
|
344 } |
|
345 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(id); |
|
346 |
|
347 if(plugin) |
|
348 { |
|
349 plugin->RemoveChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), GetPartId(), aPartId ); |
|
350 } |
|
351 } |
|
352 |
|
353 // <qmail> |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CFSMailMessagePart::RemoveChildPartL |
|
356 // ----------------------------------------------------------------------------- |
|
357 EXPORT_C TInt CFSMailMessagePart::RemoveChildPartL( TFSMailMsgId aPartId, |
|
358 MFSMailRequestObserver& aOperationObserver) |
|
359 { |
|
360 FUNC_LOG; |
|
361 TFSPendingRequest request; |
323 // get plugin pointer |
362 // get plugin pointer |
324 TFSMailMsgId id = GetPartId(); |
363 TFSMailMsgId id = GetPartId(); |
325 if(id.IsNullId()) |
364 if(id.IsNullId()) |
326 { |
365 { |
327 id = GetMessageId(); |
366 id = GetMessageId(); |
328 } |
367 } |
329 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(id); |
368 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(id); |
330 |
369 |
331 if(plugin) |
370 if(plugin) |
332 { |
371 { |
333 plugin->RemoveChildPartL( GetMailBoxId(), GetFolderId(), GetMessageId(), GetPartId(), aPartId ); |
372 request = iRequestHandler->InitAsyncRequestL( id.PluginId(), |
|
373 aOperationObserver ); |
|
374 |
|
375 MFSMailRequestObserver* observer = request.iObserver; |
|
376 |
|
377 TRAPD(err, plugin->RemoveChildPartL( GetMailBoxId(), |
|
378 GetFolderId(), |
|
379 GetMessageId(), |
|
380 GetPartId(), |
|
381 aPartId, |
|
382 *observer, |
|
383 request.iRequestId)); |
|
384 |
|
385 if( err != KErrNone ) |
|
386 { |
|
387 iRequestHandler->CompleteRequest( request.iRequestId ); |
|
388 User::Leave( err ); |
|
389 } |
334 } |
390 } |
335 } |
391 else |
|
392 { |
|
393 User::Leave( KErrNotFound ); |
|
394 } |
|
395 |
|
396 return request.iRequestId; |
|
397 } |
|
398 // </qmail> |
336 |
399 |
337 // ----------------------------------------------------------------------------- |
400 // ----------------------------------------------------------------------------- |
338 // CFSMailMessagePart::GetContentClass |
401 // CFSMailMessagePart::GetContentClass |
339 // ----------------------------------------------------------------------------- |
402 // ----------------------------------------------------------------------------- |
340 EXPORT_C const TDesC& CFSMailMessagePart::GetContentClass() |
403 EXPORT_C const TDesC& CFSMailMessagePart::GetContentClass() |
341 { |
404 { |
342 FUNC_LOG; |
405 FUNC_LOG; |
343 return *iContentClass; |
406 return *iContentClass; |
344 } |
407 } |
345 |
408 |
346 // ----------------------------------------------------------------------------- |
409 // ----------------------------------------------------------------------------- |
347 // CFSMailMessagePart::SetContentClass |
410 // CFSMailMessagePart::SetContentClass |
348 // ----------------------------------------------------------------------------- |
411 // ----------------------------------------------------------------------------- |
349 EXPORT_C void CFSMailMessagePart::SetContentClass( const TDesC& aContentClass ) |
412 EXPORT_C void CFSMailMessagePart::SetContentClass( const TDesC& aContentClass ) |
350 { |
413 { |
351 FUNC_LOG; |
414 FUNC_LOG; |
352 |
415 |
353 HBufC* contentClass = HBufC::New(aContentClass.Length()); |
416 // |
354 |
417 HBufC* contentClass = HBufC::New(aContentClass.Length()); |
355 // store new mailbox name |
418 |
356 if(contentClass) |
419 // store new mailbox name |
357 { |
420 if(contentClass) |
358 delete iContentClass; |
421 { |
359 iContentClass = contentClass; |
422 delete iContentClass; |
360 iContentClass->Des().Copy(aContentClass); |
423 iContentClass = contentClass; |
361 } |
424 iContentClass->Des().Copy(aContentClass); |
362 iContentClass->ReAlloc(aContentClass.Length()); |
425 } |
363 if(iContentClass) |
426 iContentClass->ReAlloc(aContentClass.Length()); |
364 { |
427 if(iContentClass) |
365 iContentClass->Des().Copy(aContentClass); |
428 { |
366 } |
429 iContentClass->Des().Copy(aContentClass); |
367 } |
430 } |
|
431 } |
368 |
432 |
369 // ----------------------------------------------------------------------------- |
433 // ----------------------------------------------------------------------------- |
370 // CFSMailMessagePart::ContentSize |
434 // CFSMailMessagePart::ContentSize |
371 // ----------------------------------------------------------------------------- |
435 // ----------------------------------------------------------------------------- |
372 EXPORT_C TUint CFSMailMessagePart::ContentSize() const |
436 EXPORT_C TUint CFSMailMessagePart::ContentSize() const |
373 { |
437 { |
374 FUNC_LOG; |
438 FUNC_LOG; |
|
439 //<qmail> |
375 return (TUint)iNmPrivateMessagePart->mSize; |
440 return (TUint)iNmPrivateMessagePart->mSize; |
|
441 //</qmail> |
376 } |
442 } |
377 |
443 |
378 // ----------------------------------------------------------------------------- |
444 // ----------------------------------------------------------------------------- |
379 // CFSMailMessagePart::SetContentSize |
445 // CFSMailMessagePart::SetContentSize |
380 // ----------------------------------------------------------------------------- |
446 // ----------------------------------------------------------------------------- |
381 EXPORT_C void CFSMailMessagePart::SetContentSize( TUint aContentSize ) |
447 EXPORT_C void CFSMailMessagePart::SetContentSize( TUint aContentSize ) |
382 { |
448 { |
383 FUNC_LOG; |
449 FUNC_LOG; |
|
450 //<qmail> |
384 iNmPrivateMessagePart->mSize = quint32(aContentSize); |
451 iNmPrivateMessagePart->mSize = quint32(aContentSize); |
|
452 //</qmail> |
385 } |
453 } |
386 |
454 |
387 // ----------------------------------------------------------------------------- |
455 // ----------------------------------------------------------------------------- |
388 // CFSMailMessagePart::ContentID |
456 // CFSMailMessagePart::ContentID |
389 // ----------------------------------------------------------------------------- |
457 // ----------------------------------------------------------------------------- |
390 EXPORT_C const TDesC& CFSMailMessagePart::ContentID() |
458 EXPORT_C const TDesC& CFSMailMessagePart::ContentID() |
391 { |
459 { |
392 FUNC_LOG; |
460 FUNC_LOG; |
393 |
461 //<qmail> |
394 iContentIDPtr.Set(reinterpret_cast<const TUint16*> (iNmPrivateMessagePart->mContentId.utf16()), |
462 iContentIDPtr.Set(reinterpret_cast<const TUint16*> (iNmPrivateMessagePart->mContentId.utf16()), |
395 iNmPrivateMessagePart->mContentId.length()); |
463 iNmPrivateMessagePart->mContentId.length()); |
396 return iContentIDPtr; |
464 return iContentIDPtr; |
397 |
465 //</qmail> |
398 } |
466 } |
399 |
467 |
400 // ----------------------------------------------------------------------------- |
468 // ----------------------------------------------------------------------------- |
401 // CFSMailMessagePart::SetContentIDL |
469 // CFSMailMessagePart::SetContentIDL |
402 // ----------------------------------------------------------------------------- |
470 // ----------------------------------------------------------------------------- |
403 EXPORT_C void CFSMailMessagePart::SetContentIDL( const TDesC& aContentID ) |
471 EXPORT_C void CFSMailMessagePart::SetContentIDL(const TDesC& aContentID) |
404 { |
472 { |
405 FUNC_LOG; |
473 FUNC_LOG; |
406 |
474 //<qmail> |
407 QString qtContentID = QString::fromUtf16(aContentID.Ptr(), aContentID.Length()); |
475 QString qtContentID = QString::fromUtf16(aContentID.Ptr(), aContentID.Length()); |
408 iNmPrivateMessagePart->mContentId = qtContentID; |
476 iNmPrivateMessagePart->mContentId = qtContentID; |
409 |
477 //</qmail> |
410 } |
478 } |
411 |
479 |
412 // ----------------------------------------------------------------------------- |
480 // ----------------------------------------------------------------------------- |
413 // CFSMailMessagePart::CopyMessageAsChildPartL |
481 // CFSMailMessagePart::CopyMessageAsChildPartL |
414 // ----------------------------------------------------------------------------- |
482 // ----------------------------------------------------------------------------- |
415 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::CopyMessageAsChildPartL( |
483 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::CopyMessageAsChildPartL( |
416 TFSMailMsgId aInsertBefore, |
484 TFSMailMsgId aInsertBefore, |
417 CFSMailMessage* aMessage ) |
485 CFSMailMessage* aMessage) |
418 { |
486 { |
419 FUNC_LOG; |
487 FUNC_LOG; |
420 |
488 |
421 CFSMailMessagePart* part = NULL; |
489 CFSMailMessagePart* part = NULL; |
422 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
490 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
423 { |
491 { |
424 part = plugin->CopyMessageAsChildPartL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(), |
492 part = plugin->CopyMessageAsChildPartL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(), |
425 aInsertBefore, *aMessage); |
493 aInsertBefore, *aMessage); |
426 } |
494 } |
427 return part; |
495 return part; |
428 } |
496 } |
429 |
497 |
430 // ----------------------------------------------------------------------------- |
498 // ----------------------------------------------------------------------------- |
431 // CFSMailMessagePart::RemoveContentL |
499 // CFSMailMessagePart::RemoveContentL |
432 // ----------------------------------------------------------------------------- |
500 // ----------------------------------------------------------------------------- |
433 EXPORT_C void CFSMailMessagePart::RemoveContentL() |
501 EXPORT_C void CFSMailMessagePart::RemoveContentL() |
434 { |
502 { |
435 FUNC_LOG; |
503 FUNC_LOG; |
436 |
504 |
|
505 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
506 if(plugin == NULL) |
|
507 { |
|
508 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
509 } |
|
510 |
|
511 if(plugin != NULL) |
|
512 { |
|
513 RPointerArray<CFSMailMessagePart> parts; |
|
514 RArray<TFSMailMsgId> partIds; |
|
515 plugin->ChildPartsL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(),parts); |
|
516 for(TInt i=0;i<parts.Count();i++) |
|
517 { |
|
518 partIds.Append(parts[i]->GetMessageId()); |
|
519 } |
|
520 partIds.Append(GetPartId()); |
|
521 plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), partIds); |
|
522 parts.ResetAndDestroy(); |
|
523 partIds.Reset(); |
|
524 } |
|
525 } |
|
526 |
|
527 // ----------------------------------------------------------------------------- |
|
528 // CFSMailMessagePart::RemoveDownLoadedAttachmentsL |
|
529 // ----------------------------------------------------------------------------- |
|
530 EXPORT_C void CFSMailMessagePart::RemoveDownLoadedAttachmentsL() |
|
531 { |
|
532 FUNC_LOG; |
|
533 |
437 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
534 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
438 // <qmail> |
535 if(plugin == NULL) |
439 if(!plugin) |
|
440 // </qmail> |
|
441 { |
536 { |
442 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
537 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
443 } |
538 } |
444 // <qmail> |
539 |
445 if(plugin) |
540 if(plugin != NULL) |
446 // </qmail> |
|
447 { |
|
448 RPointerArray<CFSMailMessagePart> parts; |
|
449 RArray<TFSMailMsgId> partIds; |
|
450 plugin->ChildPartsL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(),parts); |
|
451 for(TInt i=0;i<parts.Count();i++) |
|
452 { |
|
453 partIds.Append(parts[i]->GetMessageId()); |
|
454 } |
|
455 partIds.Append(GetPartId()); |
|
456 plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), partIds); |
|
457 parts.ResetAndDestroy(); |
|
458 partIds.Reset(); |
|
459 } |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CFSMailMessagePart::RemoveDownLoadedAttachmentsL |
|
464 // ----------------------------------------------------------------------------- |
|
465 EXPORT_C void CFSMailMessagePart::RemoveDownLoadedAttachmentsL() |
|
466 { |
|
467 FUNC_LOG; |
|
468 |
|
469 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
470 // <qmail> |
|
471 if(!plugin) |
|
472 // </qmail> |
|
473 { |
|
474 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
475 } |
|
476 // <qmail> |
|
477 if(plugin) |
|
478 // </qmail> |
|
479 { |
541 { |
480 // get attachment list |
542 // get attachment list |
481 RPointerArray<CFSMailMessagePart> attachments; |
543 RPointerArray<CFSMailMessagePart> attachments; |
482 attachments.Reset(); |
544 attachments.Reset(); |
483 DoAttachmentListL(attachments); |
545 DoAttachmentListL(attachments); |
498 |
560 |
499 // clean tables |
561 // clean tables |
500 attachments.ResetAndDestroy(); |
562 attachments.ResetAndDestroy(); |
501 ids.Reset(); |
563 ids.Reset(); |
502 } |
564 } |
503 } |
565 } |
504 |
566 |
505 // ----------------------------------------------------------------------------- |
567 // ----------------------------------------------------------------------------- |
506 // CFSMailMessagePart::GetContentFileL |
568 // CFSMailMessagePart::GetContentFileL |
507 // ----------------------------------------------------------------------------- |
569 // ----------------------------------------------------------------------------- |
508 EXPORT_C RFile CFSMailMessagePart::GetContentFileL() |
570 EXPORT_C RFile CFSMailMessagePart::GetContentFileL() |
509 { |
571 { |
510 FUNC_LOG; |
572 FUNC_LOG; |
511 |
573 |
512 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
574 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
513 { |
575 { |
514 TInt rcode = plugin->GetMessagePartFileL( GetMailBoxId(), GetFolderId(), |
576 TInt rcode = plugin->GetMessagePartFileL( GetMailBoxId(), GetFolderId(), |
515 GetMessageId(), GetPartId(), |
577 GetMessageId(), GetPartId(), |
516 iFile ); |
578 iFile ); |
517 // if content is encrypted, use temp dir files |
579 // if content is encrypted, use temp dir files |
518 if(rcode == KErrNotSupported) |
580 if(rcode == KErrNotSupported) |
519 { |
581 { |
520 // temp directory C:\Private\<uid> |
582 // temp directory C:\Private\<uid> |
521 TFileName fileName; |
583 TFileName fileName; |
522 iFile = iRequestHandler->GetTempFileL(GetPartId(),fileName); |
584 iFile = iRequestHandler->GetTempFileL(GetPartId(),fileName); |
523 plugin->CopyMessagePartFileL(GetMailBoxId(), GetFolderId(), |
585 plugin->CopyMessagePartFileL(GetMailBoxId(), GetFolderId(), |
524 GetMessageId(), GetPartId(), |
586 GetMessageId(), GetPartId(), |
525 fileName); |
587 fileName); |
526 } |
588 } |
527 } |
589 } |
528 return iFile; |
590 |
529 } |
591 return iFile; |
530 |
592 } |
|
593 |
531 // ----------------------------------------------------------------------------- |
594 // ----------------------------------------------------------------------------- |
532 // CFSMailMessagePart::SetContentFromFileL |
595 // CFSMailMessagePart::SetContentFromFileL |
533 // ----------------------------------------------------------------------------- |
596 // ----------------------------------------------------------------------------- |
534 EXPORT_C void CFSMailMessagePart::SetContentFromFileL( const TDesC& aFilePath ) |
597 EXPORT_C void CFSMailMessagePart::SetContentFromFileL(const TDesC& aFilePath) |
535 { |
598 { |
536 FUNC_LOG; |
599 FUNC_LOG; |
537 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
600 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
538 { |
601 { |
539 plugin->SetPartContentFromFileL(GetMailBoxId(), GetFolderId(), |
602 plugin->SetPartContentFromFileL(GetMailBoxId(), GetFolderId(), |
540 GetMessageId(), GetPartId(), aFilePath ); |
603 GetMessageId(), GetPartId(), aFilePath ); |
541 } |
604 } |
542 } |
605 } |
543 |
606 |
544 // ----------------------------------------------------------------------------- |
607 // ----------------------------------------------------------------------------- |
545 // CFSMailMessagePart::CopyContentFileL |
608 // CFSMailMessagePart::CopyContentFileL |
546 // ----------------------------------------------------------------------------- |
609 // ----------------------------------------------------------------------------- |
547 EXPORT_C void CFSMailMessagePart::CopyContentFileL( const TDesC& aFilePath ) |
610 EXPORT_C void CFSMailMessagePart::CopyContentFileL( const TDesC& aFilePath ) |
548 { |
611 { |
549 FUNC_LOG; |
612 FUNC_LOG; |
550 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
613 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
551 { |
614 { |
552 plugin->CopyMessagePartFileL( GetMailBoxId(), GetFolderId(), |
615 plugin->CopyMessagePartFileL( GetMailBoxId(), GetFolderId(), |
553 GetMessageId(), GetPartId(), aFilePath); |
616 GetMessageId(), GetPartId(), aFilePath); |
554 } |
617 } |
555 } |
618 } |
556 |
619 |
557 // ----------------------------------------------------------------------------- |
620 // ----------------------------------------------------------------------------- |
558 // CFSMailMessagePart::GetContentToBufferL |
621 // CFSMailMessagePart::GetContentToBufferL |
559 // ----------------------------------------------------------------------------- |
622 // ----------------------------------------------------------------------------- |
560 EXPORT_C void CFSMailMessagePart::GetContentToBufferL( TDes16& aBuffer, TUint aStartOffset ) |
623 EXPORT_C void CFSMailMessagePart::GetContentToBufferL(TDes16& aBuffer, TUint aStartOffset) |
561 { |
624 { |
562 FUNC_LOG; |
625 FUNC_LOG; |
563 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
626 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
564 { |
627 { |
565 plugin->GetContentToBufferL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
628 plugin->GetContentToBufferL( GetMailBoxId(), GetFolderId(), GetMessageId(), |
566 GetPartId(), aBuffer, aStartOffset ); |
629 GetPartId(), aBuffer, aStartOffset ); |
567 } |
630 } |
568 } |
631 } |
569 |
632 |
570 // ----------------------------------------------------------------------------- |
633 // ----------------------------------------------------------------------------- |
571 // CFSMailMessagePart::SetContent |
634 // CFSMailMessagePart::SetContent |
572 // ----------------------------------------------------------------------------- |
635 // ----------------------------------------------------------------------------- |
573 EXPORT_C void CFSMailMessagePart::SetContent( TDes16& aBuffer ) |
636 EXPORT_C void CFSMailMessagePart::SetContent( TDes16& aBuffer ) |
574 { |
637 { |
575 FUNC_LOG; |
638 FUNC_LOG; |
576 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
639 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
577 { |
640 { |
578 // <qmail> |
641 // <qmail> |
579 TRAP_IGNORE(plugin->SetContentL( aBuffer, GetMailBoxId(), GetFolderId(), |
642 TRAP_IGNORE(plugin->SetContentL( aBuffer, GetMailBoxId(), GetFolderId(), |
580 GetMessageId(), GetPartId() )); |
643 GetMessageId(), GetPartId() )); |
581 // </qmail> |
644 // </qmail> |
582 } |
645 } |
583 } |
646 } |
584 |
647 |
585 // ----------------------------------------------------------------------------- |
648 // ----------------------------------------------------------------------------- |
586 // CFSMailMessagePart::ContentDescription |
649 // CFSMailMessagePart::ContentDescription |
587 // ----------------------------------------------------------------------------- |
650 // ----------------------------------------------------------------------------- |
588 EXPORT_C const TDesC& CFSMailMessagePart::ContentDescription() |
651 EXPORT_C const TDesC& CFSMailMessagePart::ContentDescription() |
589 { |
652 { |
590 FUNC_LOG; |
653 FUNC_LOG; |
|
654 //<qmail> |
591 iContentDescriptionPtr.Set(reinterpret_cast<const TUint16*> ( |
655 iContentDescriptionPtr.Set(reinterpret_cast<const TUint16*> ( |
592 iNmPrivateMessagePart->mContentDescription.utf16()), |
656 iNmPrivateMessagePart->mContentDescription.utf16()), |
593 iNmPrivateMessagePart->mContentDescription.length()); |
657 iNmPrivateMessagePart->mContentDescription.length()); |
594 |
658 |
595 return iContentDescriptionPtr; |
659 return iContentDescriptionPtr; |
|
660 //</qmail> |
596 } |
661 } |
597 |
662 |
598 // ----------------------------------------------------------------------------- |
663 // ----------------------------------------------------------------------------- |
599 // CFSMailMessagePart::SetContentDescription |
664 // CFSMailMessagePart::SetContentDescription |
600 // ----------------------------------------------------------------------------- |
665 // ----------------------------------------------------------------------------- |
601 EXPORT_C void CFSMailMessagePart::SetContentDescription( const TDesC& aContentDescription ) |
666 EXPORT_C void CFSMailMessagePart::SetContentDescription( const TDesC& aContentDescription ) |
602 { |
667 { |
603 FUNC_LOG; |
668 FUNC_LOG; |
|
669 //<qmail> |
604 QString qtContentDescription = QString::fromUtf16( |
670 QString qtContentDescription = QString::fromUtf16( |
605 aContentDescription.Ptr(), aContentDescription.Length()); |
671 aContentDescription.Ptr(), aContentDescription.Length()); |
606 iNmPrivateMessagePart->mContentDescription = qtContentDescription; |
672 iNmPrivateMessagePart->mContentDescription = qtContentDescription; |
|
673 //</qmail> |
607 } |
674 } |
608 // ----------------------------------------------------------------------------- |
675 // ----------------------------------------------------------------------------- |
609 // CFSMailMessagePart::ContentDisposition |
676 // CFSMailMessagePart::ContentDisposition |
610 // ----------------------------------------------------------------------------- |
677 // ----------------------------------------------------------------------------- |
611 EXPORT_C const TDesC& CFSMailMessagePart::ContentDisposition() |
678 EXPORT_C const TDesC& CFSMailMessagePart::ContentDisposition() |
612 { |
679 { |
613 FUNC_LOG; |
680 FUNC_LOG; |
|
681 //<qmail> |
614 iContentDispositionPtr.Set(reinterpret_cast<const TUint16*> ( |
682 iContentDispositionPtr.Set(reinterpret_cast<const TUint16*> ( |
615 iNmPrivateMessagePart->mContentDisposition.utf16()), |
683 iNmPrivateMessagePart->mContentDisposition.utf16()), |
616 iNmPrivateMessagePart->mContentDisposition.length()); |
684 iNmPrivateMessagePart->mContentDisposition.length()); |
617 return iContentDispositionPtr; |
685 return iContentDispositionPtr; |
|
686 //</qmail> |
618 } |
687 } |
619 |
688 |
620 // ----------------------------------------------------------------------------- |
689 // ----------------------------------------------------------------------------- |
621 // CFSMailMessagePart::SetContentDisposition |
690 // CFSMailMessagePart::SetContentDisposition |
622 // ----------------------------------------------------------------------------- |
691 // ----------------------------------------------------------------------------- |
623 EXPORT_C void CFSMailMessagePart::SetContentDisposition( const TDesC& aContentDisposition ) |
692 EXPORT_C void CFSMailMessagePart::SetContentDisposition( const TDesC& aContentDisposition ) |
624 { |
693 { |
625 FUNC_LOG; |
694 FUNC_LOG; |
|
695 //<qmail> |
626 QString qtContentDisposition = QString::fromUtf16( |
696 QString qtContentDisposition = QString::fromUtf16( |
627 aContentDisposition.Ptr(), aContentDisposition.Length()); |
697 aContentDisposition.Ptr(), aContentDisposition.Length()); |
628 iNmPrivateMessagePart->mContentDisposition = qtContentDisposition; |
698 iNmPrivateMessagePart->mContentDisposition = qtContentDisposition; |
|
699 //</qmail> |
629 } |
700 } |
630 |
701 |
631 // ----------------------------------------------------------------------------- |
702 // ----------------------------------------------------------------------------- |
632 // CFSMailMessagePart::ContentTypeParameters |
703 // CFSMailMessagePart::ContentTypeParameters |
633 // ----------------------------------------------------------------------------- |
704 // ----------------------------------------------------------------------------- |
634 EXPORT_C CDesCArray& CFSMailMessagePart::ContentTypeParameters() |
705 EXPORT_C CDesCArray& CFSMailMessagePart::ContentTypeParameters() |
635 { |
706 { |
636 FUNC_LOG; |
707 FUNC_LOG; |
637 |
708 //<qmail> |
638 if (iNmPrivateMessagePart->mContentType.isNull()) |
709 if (iNmPrivateMessagePart->mContentType.isNull()) |
639 { |
710 { |
640 return *iContentTypeParams; |
711 return *iContentTypeParams; |
641 } |
712 } |
642 |
713 |
854 // CFSMailMessagePart::GetMRInfo |
934 // CFSMailMessagePart::GetMRInfo |
855 // ----------------------------------------------------------------------------- |
935 // ----------------------------------------------------------------------------- |
856 EXPORT_C MMRInfoObject& CFSMailMessagePart::GetMRInfo() |
936 EXPORT_C MMRInfoObject& CFSMailMessagePart::GetMRInfo() |
857 { |
937 { |
858 FUNC_LOG; |
938 FUNC_LOG; |
859 return *iMeetingRequest; |
939 return *iMeetingRequest; |
860 } |
940 } |
861 |
941 |
862 // ----------------------------------------------------------------------------- |
942 // ----------------------------------------------------------------------------- |
863 // CFSMailMessagePart::IsMRInfoSet |
943 // CFSMailMessagePart::IsMRInfoSet |
864 // ----------------------------------------------------------------------------- |
944 // ----------------------------------------------------------------------------- |
865 EXPORT_C TBool CFSMailMessagePart::IsMRInfoSet() |
945 EXPORT_C TBool CFSMailMessagePart::IsMRInfoSet() |
866 { |
946 { |
867 FUNC_LOG; |
947 FUNC_LOG; |
868 if(iMeetingRequest) |
948 if(iMeetingRequest) |
869 { |
949 { |
870 return ETrue; |
950 return ETrue; |
871 } |
951 } |
872 else |
952 else |
873 { |
953 { |
874 return EFalse; |
954 return EFalse; |
875 } |
955 } |
876 } |
956 } |
877 |
957 |
878 // ----------------------------------------------------------------------------- |
958 // ----------------------------------------------------------------------------- |
879 // CFSMailMessagePart::SetMRInfo |
959 // CFSMailMessagePart::SetMRInfo |
880 // ----------------------------------------------------------------------------- |
960 // ----------------------------------------------------------------------------- |
881 EXPORT_C void CFSMailMessagePart::SetMRInfo( MMRInfoObject* aMeetingRequest ) |
961 EXPORT_C void CFSMailMessagePart::SetMRInfo(MMRInfoObject* aMeetingRequest) |
882 { |
962 { |
883 FUNC_LOG; |
963 FUNC_LOG; |
884 if(iMeetingRequest) |
964 if(iMeetingRequest) |
885 { |
965 { |
886 delete iMeetingRequest; |
966 delete iMeetingRequest; |
887 } |
967 } |
888 iMeetingRequest = aMeetingRequest; |
968 iMeetingRequest = aMeetingRequest; |
889 } |
|
890 |
|
891 // ----------------------------------------------------------------------------- |
|
892 // CFSMailMessagePart::RequestHandler |
|
893 // ----------------------------------------------------------------------------- |
|
894 EXPORT_C CFSMailRequestHandler& CFSMailMessagePart::RequestHandler( ) |
|
895 { |
|
896 return *iRequestHandler; |
|
897 } |
969 } |
898 |
970 |
899 // ----------------------------------------------------------------------------- |
971 // ----------------------------------------------------------------------------- |
900 // CFSMailMessagePart::SaveL |
972 // CFSMailMessagePart::SaveL |
901 // ----------------------------------------------------------------------------- |
973 // ----------------------------------------------------------------------------- |
902 EXPORT_C void CFSMailMessagePart::SaveL() |
974 EXPORT_C void CFSMailMessagePart::SaveL() |
903 { |
975 { |
904 FUNC_LOG; |
976 FUNC_LOG; |
905 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
977 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
906 { |
978 { |
907 plugin->StoreMessagePartL( GetMailBoxId(), GetFolderId(), GetMessageId(), *this ); |
979 plugin->StoreMessagePartL( GetMailBoxId(), GetFolderId(), GetMessageId(), *this ); |
908 } |
980 } |
909 } |
981 } |
910 |
982 |
911 |
983 |
912 // ----------------------------------------------------------------------------- |
984 // ----------------------------------------------------------------------------- |
913 // CFSMailMessagePart::SetAttachmentNameL |
985 // CFSMailMessagePart::SetAttachmentNameL |
914 // ----------------------------------------------------------------------------- |
986 // ----------------------------------------------------------------------------- |
915 EXPORT_C void CFSMailMessagePart::SetAttachmentNameL( const TDesC& aFilePath ) |
987 EXPORT_C void CFSMailMessagePart::SetAttachmentNameL(const TDesC& aFilePath) |
916 { |
988 { |
917 FUNC_LOG; |
989 FUNC_LOG; |
918 // Parse file name in case full path is given |
990 // Parse file name in case full path is given |
919 TPtrC name; |
991 TPtrC name; |
920 for(TInt i=0;i<aFilePath.Length();) |
992 for(TInt i=0;i<aFilePath.Length();) |
921 { |
993 { |
925 else i += skip + 1; |
997 else i += skip + 1; |
926 } |
998 } |
927 |
999 |
928 // Set Content-Type param "name" = filename |
1000 // Set Content-Type param "name" = filename |
929 TUint length = KFSMailContentTypeParamName.iTypeLength + name.Length() + 5; |
1001 TUint length = KFSMailContentTypeParamName.iTypeLength + name.Length() + 5; |
930 if (!iNmPrivateMessagePart->mContentType.isNull()) { |
1002 //<qmail> |
|
1003 if (!iNmPrivateMessagePart->mContentType.isNull()) |
|
1004 { |
931 length += GetContentType().Length(); |
1005 length += GetContentType().Length(); |
932 } |
1006 } |
933 |
1007 |
934 HBufC* buffer = HBufC::NewL(length); |
1008 HBufC* buffer = HBufC::NewL(length); |
935 if (!iNmPrivateMessagePart->mContentType.isNull()) { |
1009 if (!iNmPrivateMessagePart->mContentType.isNull()) |
|
1010 { |
936 buffer->Des().Append(GetContentType()); |
1011 buffer->Des().Append(GetContentType()); |
937 } |
1012 } |
|
1013 //</qmail> |
|
1014 |
938 buffer->Des().Append(_L("; ")); |
1015 buffer->Des().Append(_L("; ")); |
939 buffer->Des().Append(KFSMailContentTypeParamName); |
1016 buffer->Des().Append(KFSMailContentTypeParamName); |
940 buffer->Des().Append('"'); |
1017 buffer->Des().Append('"'); |
941 buffer->Des().Append(name); |
1018 buffer->Des().Append(name); |
942 buffer->Des().Append('"'); |
1019 buffer->Des().Append('"'); |
943 |
1020 |
|
1021 //<qmail> |
944 SetContentType(*buffer); |
1022 SetContentType(*buffer); |
945 delete buffer; |
1023 delete buffer; |
|
1024 //</qmail> |
946 |
1025 |
947 // Set Content-Disposition as "attachment" and |
1026 // Set Content-Disposition as "attachment" and |
948 // Content-Disposition param "filename" = filename and |
1027 // Content-Disposition param "filename" = filename and |
949 length = KFSMailContentDispAttachment.iTypeLength + |
1028 length = KFSMailContentDispAttachment.iTypeLength + |
950 KFSMailContentDispParamFilename.iTypeLength + name.Length() + 4; |
1029 KFSMailContentDispParamFilename.iTypeLength + name.Length() + 4; |
951 |
1030 |
|
1031 //<qmail> |
952 buffer = HBufC::NewL(length); |
1032 buffer = HBufC::NewL(length); |
953 buffer->Des().Append(KFSMailContentDispAttachment); |
1033 buffer->Des().Append(KFSMailContentDispAttachment); |
954 buffer->Des().Append(_L("; ")); |
1034 buffer->Des().Append(_L("; ")); |
955 buffer->Des().Append(KFSMailContentDispParamFilename); |
1035 buffer->Des().Append(KFSMailContentDispParamFilename); |
956 buffer->Des().Append('"'); |
1036 buffer->Des().Append('"'); |
957 buffer->Des().Append(name); |
1037 buffer->Des().Append(name); |
958 buffer->Des().Append('"'); |
1038 buffer->Des().Append('"'); |
959 |
|
960 SetContentDisposition(*buffer); |
1039 SetContentDisposition(*buffer); |
961 delete buffer; |
1040 delete buffer; |
962 |
1041 |
963 // set content description |
1042 // set content description |
964 SetContentDescription(name); |
1043 SetContentDescription(name); |
965 |
1044 //</qmail> |
966 } |
1045 } |
967 |
1046 |
968 // ----------------------------------------------------------------------------- |
1047 // ----------------------------------------------------------------------------- |
969 // CFSMailMessagePart::AttachmentNameL |
1048 // CFSMailMessagePart::AttachmentNameL |
970 // ----------------------------------------------------------------------------- |
1049 // ----------------------------------------------------------------------------- |
971 EXPORT_C TDesC& CFSMailMessagePart::AttachmentNameL() |
1050 EXPORT_C TDesC& CFSMailMessagePart::AttachmentNameL() |
972 { |
1051 { |
973 FUNC_LOG; |
1052 FUNC_LOG; |
974 // Look first from Content-Type param "name" |
1053 //<qmail> |
975 TInt ptr = GetContentType().Find(KFSMailContentTypeParamName); |
1054 // Look first from Content-Type param "name" |
976 if(ptr >= 0) |
1055 TInt ptr = GetContentType().Find(KFSMailContentTypeParamName); |
977 { |
1056 if(ptr >= 0) |
978 ptr = GetContentType().Locate('='); |
1057 { |
979 TInt length = GetContentType().Length()-ptr-3; |
1058 ptr = GetContentType().Locate('='); |
980 TPtrC name = GetContentType().Mid((ptr+2),length); |
1059 TInt length = GetContentType().Length()-ptr-3; |
981 if(iAttachmentName) |
1060 TPtrC name = GetContentType().Mid((ptr+2),length); |
982 { |
1061 if(iAttachmentName) |
983 delete iAttachmentName; |
1062 { |
984 iAttachmentName = NULL; |
1063 delete iAttachmentName; |
985 } |
1064 iAttachmentName = NULL; |
|
1065 } |
|
1066 iAttachmentName = HBufC::New(name.Length()); |
|
1067 iAttachmentName->Des().Copy(name); |
|
1068 return *iAttachmentName; |
|
1069 } |
|
1070 // then if Content-Disposition is "attachment" look from Content-Disposition param "filename" and |
|
1071 TDesC contentDisposition = ContentDisposition(); |
|
1072 ptr = contentDisposition.Find(KFSMailContentDispAttachment); |
|
1073 if(ptr >= 0) |
|
1074 { |
|
1075 ptr = contentDisposition.Find(KFSMailContentDispParamFilename); |
|
1076 if(ptr > 0) |
|
1077 { |
|
1078 ptr = contentDisposition.Locate('='); |
|
1079 TInt length = contentDisposition.Length()-ptr-3; |
|
1080 TPtrC name = contentDisposition.Mid(ptr+2,length); |
|
1081 if(iAttachmentName) |
|
1082 { |
|
1083 delete iAttachmentName; |
|
1084 iAttachmentName = NULL; |
|
1085 } |
986 iAttachmentName = HBufC::New(name.Length()); |
1086 iAttachmentName = HBufC::New(name.Length()); |
987 iAttachmentName->Des().Copy(name); |
1087 iAttachmentName->Des().Copy(name); |
988 return *iAttachmentName; |
1088 return *iAttachmentName; |
989 } |
|
990 // then if Content-Disposition is "attachment" look from Content-Disposition param "filename" and |
|
991 TDesC contentDisposition = ContentDisposition(); |
|
992 ptr = contentDisposition.Find(KFSMailContentDispAttachment); |
|
993 if(ptr >= 0) |
|
994 { |
|
995 ptr = contentDisposition.Find(KFSMailContentDispParamFilename); |
|
996 if(ptr > 0) |
|
997 { |
|
998 ptr = contentDisposition.Locate('='); |
|
999 TInt length = contentDisposition.Length()-ptr-3; |
|
1000 TPtrC name = contentDisposition.Mid(ptr+2,length); |
|
1001 if(iAttachmentName) |
|
1002 { |
|
1003 delete iAttachmentName; |
|
1004 iAttachmentName = NULL; |
|
1005 } |
|
1006 iAttachmentName = HBufC::New(name.Length()); |
|
1007 iAttachmentName->Des().Copy(name); |
|
1008 return *iAttachmentName; |
|
1009 } |
|
1010 } |
1089 } |
1011 // finally look if there is Content-Description. |
1090 } |
1012 return iContentDescriptionPtr; |
1091 // finally look if there is Content-Description. |
1013 |
1092 return iContentDescriptionPtr; |
1014 } |
1093 //</qmail> |
1015 |
1094 } |
|
1095 |
|
1096 //<qmail> |
1016 // ----------------------------------------------------------------------------- |
1097 // ----------------------------------------------------------------------------- |
1017 // CFSMailMessagePart::FindBodyPartL |
1098 // CFSMailMessagePart::FindBodyPartL |
1018 // ----------------------------------------------------------------------------- |
1099 // ----------------------------------------------------------------------------- |
1019 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::FindBodyPartL( |
1100 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::FindBodyPartL( |
1020 const TDesC& aContentType, |
1101 const TDesC& aContentType, |
1126 } |
1199 } |
1127 } |
1200 } |
1128 } |
1201 } |
1129 return messagePart; |
1202 return messagePart; |
1130 } |
1203 } |
|
1204 //</qmail> |
|
1205 |
|
1206 // ----------------------------------------------------------------------------- |
|
1207 // CFSMailMessagePart::ContentTypeMatches |
|
1208 // ----------------------------------------------------------------------------- |
|
1209 EXPORT_C TBool CFSMailMessagePart::ContentTypeMatches( const TDesC& aContentType ) |
|
1210 { |
|
1211 FUNC_LOG; |
|
1212 |
|
1213 TBuf<KMaxDataTypeLength> ptr; |
|
1214 TBool result(EFalse); |
|
1215 //<qmail> |
|
1216 if ( !iNmPrivateMessagePart->mContentType.isNull() ) |
|
1217 { |
|
1218 ptr.Copy(GetContentType()); |
|
1219 //</qmail> |
|
1220 TInt length = ptr.Locate(';'); |
|
1221 if(length >= 0) |
|
1222 { |
|
1223 ptr.SetLength(length); |
|
1224 } |
|
1225 |
|
1226 if( !ptr.CompareF(aContentType) ) // case-insensitive comparision |
|
1227 { |
|
1228 result = ETrue; |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 return result; |
|
1233 } |
1131 |
1234 |
1132 // ----------------------------------------------------------------------------- |
1235 // ----------------------------------------------------------------------------- |
1133 // CFSMailMessagePart::AppendAttachmentsL |
1236 // CFSMailMessagePart::AppendAttachmentsL |
1134 // ----------------------------------------------------------------------------- |
1237 // ----------------------------------------------------------------------------- |
1135 EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( |
1238 EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( |
1136 RPointerArray<CFSMailMessagePart>& aParts ) |
1239 RPointerArray<CFSMailMessagePart>& aParts) |
1137 { |
1240 { |
1138 FUNC_LOG; |
1241 FUNC_LOG; |
1139 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
1242 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
1140 if ( plugin ) |
1243 if ( plugin ) |
1141 { |
1244 { |
1142 RPointerArray<CFSMailMessagePart> messageParts; |
1245 RPointerArray<CFSMailMessagePart> messageParts; |
1143 CleanupResetAndDestroyPushL( messageParts ); |
1246 CleanupResetAndDestroyPushL( messageParts ); |
1144 plugin->ChildPartsL( GetMailBoxId(), GetFolderId(), |
1247 plugin->ChildPartsL( GetMailBoxId(), GetFolderId(), |
1145 GetMessageId(), GetPartId(), messageParts ); |
1248 GetMessageId(), GetPartId(), messageParts ); |
1146 |
1249 |
1147 const TInt messagePartCount = messageParts.Count(); |
1250 const TInt messagePartCount = messageParts.Count(); |
1148 for ( TInt i = 0; i < messagePartCount; i++ ) |
1251 for ( TInt i = 0; i < messagePartCount; i++ ) |
1149 { |
1252 { |
1150 const TDesC& contentType = messageParts[i]->GetContentType(); |
1253 const TDesC& contentType = messageParts[i]->GetContentType(); |
1151 if (!contentType.Compare(KFSMailContentTypeMultipartMixed) || |
1254 if (!contentType.CompareF(KFSMailContentTypeMultipartMixed) || |
1152 !contentType.Compare(KFSMailContentTypeMultipartAlternative) || |
1255 !contentType.CompareF(KFSMailContentTypeMultipartAlternative) || |
1153 !contentType.Compare(KFSMailContentTypeMultipartDigest) || |
1256 !contentType.CompareF(KFSMailContentTypeMultipartDigest) || |
1154 !contentType.Compare(KFSMailContentTypeMultipartRelated) || |
1257 !contentType.CompareF(KFSMailContentTypeMultipartRelated) || |
1155 !contentType.Compare(KFSMailContentTypeMultipartParallel)) |
1258 !contentType.CompareF(KFSMailContentTypeMultipartParallel)) |
1156 { |
1259 { |
1157 // get multipart message subparts |
1260 // get multipart message subparts |
1158 messageParts[i]->AppendAttachmentsL( aParts ); |
1261 messageParts[i]->AppendAttachmentsL( aParts ); |
1159 } |
1262 } |
1160 else |
1263 else |
1210 } |
1317 } |
1211 else |
1318 else |
1212 { |
1319 { |
1213 return EFSFull; |
1320 return EFSFull; |
1214 } |
1321 } |
|
1322 //</qmail> |
1215 } |
1323 } |
1216 |
1324 |
1217 // ----------------------------------------------------------------------------- |
1325 // ----------------------------------------------------------------------------- |
1218 // CFSMailMessagePart::FetchMessagePartL |
1326 // CFSMailMessagePart::FetchMessagePartL |
1219 // ----------------------------------------------------------------------------- |
1327 // ----------------------------------------------------------------------------- |
1220 EXPORT_C TInt CFSMailMessagePart::FetchMessagePartL( const TFSMailMsgId /*aMessagePartId*/, |
1328 EXPORT_C TInt CFSMailMessagePart::FetchMessagePartL( const TFSMailMsgId /*aMessagePartId*/, |
1221 MFSMailRequestObserver& aOperationObserver, |
1329 MFSMailRequestObserver& aOperationObserver, |
1222 const TUint aPreferredByteCount ) |
1330 const TUint aPreferredByteCount) |
1223 { |
1331 { |
1224 FUNC_LOG; |
1332 FUNC_LOG; |
1225 |
1333 |
1226 TInt requestId(0); |
1334 TInt requestId(0); |
1227 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
1335 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
1228 { |
1336 { |
1229 RArray<TFSMailMsgId> messageList; |
1337 |
1230 messageList.Append(GetPartId()); |
1338 RArray<TFSMailMsgId> messageList; |
|
1339 messageList.Append(GetPartId()); |
|
1340 |
|
1341 // init async request |
|
1342 TFSPendingRequest request = iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
|
1343 aOperationObserver); |
|
1344 |
|
1345 requestId = request.iRequestId; |
|
1346 MFSMailRequestObserver* observer = request.iObserver; |
|
1347 |
|
1348 // fetch message parts |
|
1349 TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
|
1350 GetFolderId(), |
|
1351 GetMessageId(), |
|
1352 messageList, |
|
1353 *observer, |
|
1354 requestId, |
|
1355 aPreferredByteCount )); |
|
1356 messageList.Reset(); |
|
1357 if(err != KErrNone) |
|
1358 { |
|
1359 iRequestHandler->CompleteRequest(requestId); |
|
1360 User::Leave(err); |
|
1361 } |
|
1362 } |
|
1363 return requestId; |
|
1364 } |
1231 |
1365 |
1232 // init async request |
1366 // ----------------------------------------------------------------------------- |
1233 TFSPendingRequest request = iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
1367 // CFSMailMessagePart::FetchMessagesPartsL |
1234 aOperationObserver); |
1368 // ----------------------------------------------------------------------------- |
1235 |
1369 EXPORT_C TInt CFSMailMessagePart::FetchMessagesPartsL( |
1236 requestId = request.iRequestId; |
1370 const RArray<TFSMailMsgId>& aMessagePartIds, |
1237 MFSMailRequestObserver* observer = request.iObserver; |
1371 MFSMailRequestObserver& aOperationObserver, |
1238 |
1372 const TUint aPreferredByteCount) |
1239 // fetch message parts |
1373 { |
1240 TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
1374 FUNC_LOG; |
1241 GetFolderId(), |
1375 |
1242 GetMessageId(), |
1376 TInt requestId(0); |
1243 messageList, |
1377 |
1244 *observer, |
1378 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
1245 requestId, |
1379 { |
1246 aPreferredByteCount )); |
1380 |
1247 messageList.Reset(); |
1381 // get async request id |
1248 if(err != KErrNone) |
1382 TFSPendingRequest request = |
1249 { |
1383 iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
1250 iRequestHandler->CompleteRequest(requestId); |
1384 aOperationObserver); |
1251 User::Leave(err); |
1385 |
1252 } |
1386 requestId = request.iRequestId; |
1253 } |
1387 MFSMailRequestObserver* observer = request.iObserver; |
|
1388 |
|
1389 // fetch message parts |
|
1390 TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
|
1391 GetFolderId(), |
|
1392 GetMessageId(), |
|
1393 aMessagePartIds, |
|
1394 *observer, |
|
1395 requestId, |
|
1396 aPreferredByteCount )); |
|
1397 |
|
1398 if(err != KErrNone) |
|
1399 { |
|
1400 iRequestHandler->CompleteRequest(requestId); |
|
1401 User::Leave(err); |
|
1402 } |
|
1403 } |
|
1404 else |
|
1405 { |
|
1406 User::Leave(KErrArgument); |
|
1407 } |
1254 return requestId; |
1408 return requestId; |
1255 } |
1409 } |
1256 |
|
1257 // ----------------------------------------------------------------------------- |
|
1258 // CFSMailMessagePart::FetchMessagesPartsL |
|
1259 // ----------------------------------------------------------------------------- |
|
1260 EXPORT_C TInt CFSMailMessagePart::FetchMessagesPartsL( |
|
1261 const RArray<TFSMailMsgId>& aMessagePartIds, |
|
1262 MFSMailRequestObserver& aOperationObserver, |
|
1263 const TUint aPreferredByteCount ) |
|
1264 { |
|
1265 FUNC_LOG; |
|
1266 |
|
1267 TInt requestId(0); |
|
1268 |
|
1269 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
1270 { |
|
1271 // get async request id |
|
1272 TFSPendingRequest request = |
|
1273 iRequestHandler->InitAsyncRequestL( GetPartId().PluginId(), |
|
1274 aOperationObserver); |
|
1275 |
|
1276 requestId = request.iRequestId; |
|
1277 MFSMailRequestObserver* observer = request.iObserver; |
|
1278 |
|
1279 // fetch message parts |
|
1280 TRAPD(err,plugin->FetchMessagePartsL( GetMailBoxId(), |
|
1281 GetFolderId(), |
|
1282 GetMessageId(), |
|
1283 aMessagePartIds, |
|
1284 *observer, |
|
1285 requestId, |
|
1286 aPreferredByteCount )); |
|
1287 |
|
1288 if(err != KErrNone) |
|
1289 { |
|
1290 iRequestHandler->CompleteRequest(requestId); |
|
1291 User::Leave(err); |
|
1292 } |
|
1293 } |
|
1294 else |
|
1295 { |
|
1296 User::Leave(KErrArgument); |
|
1297 } |
|
1298 return requestId; |
|
1299 } |
|
1300 |
1410 |
1301 // ----------------------------------------------------------------------------- |
1411 // ----------------------------------------------------------------------------- |
1302 // CFSMailMessagePart::SetMessagePartsStatus |
1412 // CFSMailMessagePart::SetMessagePartsStatus |
1303 // ----------------------------------------------------------------------------- |
1413 // ----------------------------------------------------------------------------- |
1304 EXPORT_C void CFSMailMessagePart::SetMessagePartsStatus( TFSPartFetchState aMessagePartStatus ) |
1414 EXPORT_C void CFSMailMessagePart::SetMessagePartsStatus(TFSPartFetchState aMessagePartStatus) |
1305 { |
1415 { |
1306 FUNC_LOG; |
1416 FUNC_LOG; |
1307 iMessagePartsStatus = aMessagePartStatus; |
1417 iMessagePartsStatus = aMessagePartStatus; |
1308 } |
1418 } |
1309 |
1419 |
1310 // ----------------------------------------------------------------------------- |
1420 // ----------------------------------------------------------------------------- |
1311 // CFSMailMessagePart::AddNewAttachmentL |
1421 // CFSMailMessagePart::AddNewAttachmentL |
1312 // ----------------------------------------------------------------------------- |
1422 // ----------------------------------------------------------------------------- |
1313 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::AddNewAttachmentL( const TDesC& aFilePath, |
1423 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::AddNewAttachmentL( const TDesC& aFilePath, |
1314 const TFSMailMsgId /*aInsertBefore*/, |
1424 const TFSMailMsgId /*aInsertBefore*/, |
1315 const TDesC& aContentType ) |
1425 const TDesC& aContentType ) |
1316 { |
1426 { |
1317 FUNC_LOG; |
1427 FUNC_LOG; |
1318 CFSMailMessagePart* newPart = NULL; |
1428 CFSMailMessagePart* newPart = NULL; |
1319 |
1429 |
1320 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
1430 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); |
1321 if ( plugin ) |
1431 if ( plugin ) |