429 |
429 |
430 // |
430 // |
431 HBufC* contentClass = HBufC::New(aContentClass.Length()); |
431 HBufC* contentClass = HBufC::New(aContentClass.Length()); |
432 |
432 |
433 // store new mailbox name |
433 // store new mailbox name |
434 if(contentClass) |
434 delete iContentClass; |
435 { |
435 iContentClass = contentClass; |
436 delete iContentClass; |
436 iContentClass->Des().Copy(aContentClass); |
437 iContentClass = contentClass; |
437 iContentClass->ReAlloc(aContentClass.Length()); |
438 iContentClass->Des().Copy(aContentClass); |
438 iContentClass->Des().Copy(aContentClass); |
439 } |
|
440 iContentClass->ReAlloc(aContentClass.Length()); |
|
441 if(iContentClass) |
|
442 { |
|
443 iContentClass->Des().Copy(aContentClass); |
|
444 } |
|
445 } |
439 } |
446 |
440 |
447 // ----------------------------------------------------------------------------- |
441 // ----------------------------------------------------------------------------- |
448 // CFSMailMessagePart::ContentSize |
442 // CFSMailMessagePart::ContentSize |
449 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
493 QString qtContentID = QString::fromUtf16(aContentID.Ptr(), aContentID.Length()); |
487 QString qtContentID = QString::fromUtf16(aContentID.Ptr(), aContentID.Length()); |
494 iNmPrivateMessagePart->mContentId = qtContentID; |
488 iNmPrivateMessagePart->mContentId = qtContentID; |
495 //</qmail> |
489 //</qmail> |
496 } |
490 } |
497 |
491 |
498 // ----------------------------------------------------------------------------- |
|
499 // CFSMailMessagePart::CopyMessageAsChildPartL |
|
500 // ----------------------------------------------------------------------------- |
|
501 EXPORT_C CFSMailMessagePart* CFSMailMessagePart::CopyMessageAsChildPartL( |
|
502 TFSMailMsgId aInsertBefore, |
|
503 CFSMailMessage* aMessage) |
|
504 { |
|
505 NM_FUNCTION; |
|
506 |
|
507 CFSMailMessagePart* part = NULL; |
|
508 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
509 { |
|
510 part = plugin->CopyMessageAsChildPartL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(), |
|
511 aInsertBefore, *aMessage); |
|
512 } |
|
513 return part; |
|
514 } |
|
515 |
|
516 // ----------------------------------------------------------------------------- |
|
517 // CFSMailMessagePart::RemoveContentL |
|
518 // ----------------------------------------------------------------------------- |
|
519 EXPORT_C void CFSMailMessagePart::RemoveContentL() |
|
520 { |
|
521 NM_FUNCTION; |
|
522 |
|
523 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
524 if(plugin == NULL) |
|
525 { |
|
526 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
527 } |
|
528 |
|
529 if(plugin != NULL) |
|
530 { |
|
531 RPointerArray<CFSMailMessagePart> parts; |
|
532 CleanupResetAndDestroyPushL( parts ); |
|
533 plugin->ChildPartsL(GetMailBoxId(),GetFolderId(),GetMessageId(),GetPartId(),parts); |
|
534 RArray<TFSMailMsgId> partIds; |
|
535 CleanupClosePushL( partIds ); |
|
536 partIds.ReserveL( 1 + parts.Count() ); |
|
537 for(TInt i=0;i<parts.Count();i++) |
|
538 { |
|
539 partIds.AppendL( parts[i]->GetMessageId() ); |
|
540 } |
|
541 partIds.AppendL( GetPartId() ); |
|
542 plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), partIds); |
|
543 CleanupStack::PopAndDestroy( &partIds ); |
|
544 CleanupStack::PopAndDestroy( &parts ); |
|
545 } |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // CFSMailMessagePart::RemoveDownLoadedAttachmentsL |
|
550 // ----------------------------------------------------------------------------- |
|
551 EXPORT_C void CFSMailMessagePart::RemoveDownLoadedAttachmentsL() |
|
552 { |
|
553 NM_FUNCTION; |
|
554 |
|
555 CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); |
|
556 if(plugin == NULL) |
|
557 { |
|
558 plugin = iRequestHandler->GetPluginByUid(GetMessageId()); |
|
559 } |
|
560 |
|
561 if(plugin != NULL) |
|
562 { |
|
563 // get attachment list |
|
564 RPointerArray<CFSMailMessagePart> attachments; |
|
565 CleanupResetAndDestroyPushL( attachments ); |
|
566 DoAttachmentListL(attachments); |
|
567 |
|
568 // copy attachment part ids |
|
569 RArray<TFSMailMsgId> ids; |
|
570 CleanupClosePushL( ids ); |
|
571 for(TInt i=0;i<attachments.Count();i++) |
|
572 { |
|
573 ids.AppendL(attachments[i]->GetPartId()); |
|
574 } |
|
575 |
|
576 // remove attachment fetched contents |
|
577 if(ids.Count()) |
|
578 { |
|
579 TRAP_IGNORE(plugin->RemovePartContentL(GetMailBoxId(), GetFolderId(), GetMessageId(), ids)); |
|
580 } |
|
581 |
|
582 // clean tables |
|
583 CleanupStack::PopAndDestroy( &ids ); |
|
584 CleanupStack::PopAndDestroy( &attachments ); |
|
585 } |
|
586 } |
|
587 |
492 |
588 // ----------------------------------------------------------------------------- |
493 // ----------------------------------------------------------------------------- |
589 // CFSMailMessagePart::GetContentFileL |
494 // CFSMailMessagePart::GetContentFileL |
590 // ----------------------------------------------------------------------------- |
495 // ----------------------------------------------------------------------------- |
591 EXPORT_C RFile CFSMailMessagePart::GetContentFileL() |
496 EXPORT_C RFile CFSMailMessagePart::GetContentFileL() |
609 } |
514 } |
610 } |
515 } |
611 |
516 |
612 return iFile; |
517 return iFile; |
613 } |
518 } |
614 |
519 |
615 // ----------------------------------------------------------------------------- |
|
616 // CFSMailMessagePart::SetContentFromFileL |
|
617 // ----------------------------------------------------------------------------- |
|
618 EXPORT_C void CFSMailMessagePart::SetContentFromFileL(const TDesC& aFilePath) |
|
619 { |
|
620 NM_FUNCTION; |
|
621 |
|
622 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
623 { |
|
624 plugin->SetPartContentFromFileL(GetMailBoxId(), GetFolderId(), |
|
625 GetMessageId(), GetPartId(), aFilePath ); |
|
626 } |
|
627 } |
|
628 |
|
629 // ----------------------------------------------------------------------------- |
|
630 // CFSMailMessagePart::CopyContentFileL |
|
631 // ----------------------------------------------------------------------------- |
|
632 EXPORT_C void CFSMailMessagePart::CopyContentFileL( const TDesC& aFilePath ) |
|
633 { |
|
634 NM_FUNCTION; |
|
635 |
|
636 if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) |
|
637 { |
|
638 plugin->CopyMessagePartFileL( GetMailBoxId(), GetFolderId(), |
|
639 GetMessageId(), GetPartId(), aFilePath); |
|
640 } |
|
641 } |
|
642 |
520 |
643 // ----------------------------------------------------------------------------- |
521 // ----------------------------------------------------------------------------- |
644 // CFSMailMessagePart::GetContentToBufferL |
522 // CFSMailMessagePart::GetContentToBufferL |
645 // ----------------------------------------------------------------------------- |
523 // ----------------------------------------------------------------------------- |
646 EXPORT_C void CFSMailMessagePart::GetContentToBufferL(TDes16& aBuffer, TUint aStartOffset) |
524 EXPORT_C void CFSMailMessagePart::GetContentToBufferL(TDes16& aBuffer, TUint aStartOffset) |
1246 return messagePart; |
1123 return messagePart; |
1247 } |
1124 } |
1248 //</qmail> |
1125 //</qmail> |
1249 |
1126 |
1250 // ----------------------------------------------------------------------------- |
1127 // ----------------------------------------------------------------------------- |
1251 // CFSMailMessagePart::ContentTypeMatches |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 EXPORT_C TBool CFSMailMessagePart::ContentTypeMatches( const TDesC& aContentType ) |
|
1254 { |
|
1255 NM_FUNCTION; |
|
1256 |
|
1257 TBuf<KMaxDataTypeLength> ptr; |
|
1258 TBool result(EFalse); |
|
1259 //<qmail> |
|
1260 if ( !iNmPrivateMessagePart->mContentType.isNull() ) |
|
1261 { |
|
1262 ptr.Copy(GetContentType()); |
|
1263 //</qmail> |
|
1264 TInt length = ptr.Locate(';'); |
|
1265 if(length >= 0) |
|
1266 { |
|
1267 ptr.SetLength(length); |
|
1268 } |
|
1269 |
|
1270 if( !ptr.CompareF(aContentType) ) // case-insensitive comparision |
|
1271 { |
|
1272 result = ETrue; |
|
1273 } |
|
1274 } |
|
1275 |
|
1276 return result; |
|
1277 } |
|
1278 |
|
1279 // ----------------------------------------------------------------------------- |
|
1280 // CFSMailMessagePart::AppendAttachmentsL |
1128 // CFSMailMessagePart::AppendAttachmentsL |
1281 // ----------------------------------------------------------------------------- |
1129 // ----------------------------------------------------------------------------- |
1282 EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( |
1130 EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( |
1283 RPointerArray<CFSMailMessagePart>& aParts) |
1131 RPointerArray<CFSMailMessagePart>& aParts) |
1284 { |
1132 { |
1337 //<qmail> |
1184 //<qmail> |
1338 iNmPrivateMessagePart->mFetchedSize = quint32(aContentSize); |
1185 iNmPrivateMessagePart->mFetchedSize = quint32(aContentSize); |
1339 //</qmail> |
1186 //</qmail> |
1340 } |
1187 } |
1341 |
1188 |
1342 // ----------------------------------------------------------------------------- |
1189 |
1343 // CFSMailMessagePart::FetchLoadState |
|
1344 // ----------------------------------------------------------------------------- |
|
1345 EXPORT_C TFSPartFetchState CFSMailMessagePart::FetchLoadState() const |
|
1346 { |
|
1347 NM_FUNCTION; |
|
1348 |
|
1349 //<qmail> |
|
1350 if(iMessagePartsStatus != EFSDefault) |
|
1351 { |
|
1352 return iMessagePartsStatus; |
|
1353 } |
|
1354 else if (iNmPrivateMessagePart->mSize == 0) |
|
1355 { |
|
1356 return EFSFull; |
|
1357 } |
|
1358 else if(iNmPrivateMessagePart->mFetchedSize == 0) |
|
1359 { |
|
1360 return EFSNone; |
|
1361 } |
|
1362 else if (iNmPrivateMessagePart->mFetchedSize < iNmPrivateMessagePart->mSize) |
|
1363 { |
|
1364 return EFSPartial; |
|
1365 } |
|
1366 else |
|
1367 { |
|
1368 return EFSFull; |
|
1369 } |
|
1370 //</qmail> |
|
1371 } |
|
1372 |
|
1373 // ----------------------------------------------------------------------------- |
1190 // ----------------------------------------------------------------------------- |
1374 // CFSMailMessagePart::FetchMessagePartL |
1191 // CFSMailMessagePart::FetchMessagePartL |
1375 // ----------------------------------------------------------------------------- |
1192 // ----------------------------------------------------------------------------- |
1376 EXPORT_C TInt CFSMailMessagePart::FetchMessagePartL( const TFSMailMsgId /*aMessagePartId*/, |
1193 EXPORT_C TInt CFSMailMessagePart::FetchMessagePartL( const TFSMailMsgId /*aMessagePartId*/, |
1377 MFSMailRequestObserver& aOperationObserver, |
1194 MFSMailRequestObserver& aOperationObserver, |