430 |
430 |
431 CNcsComposeView* composeView = |
431 CNcsComposeView* composeView = |
432 static_cast<CNcsComposeView*>( iAppUi->View(MailEditorId) ); |
432 static_cast<CNcsComposeView*>( iAppUi->View(MailEditorId) ); |
433 |
433 |
434 TFSMailMsgId nullId; |
434 TFSMailMsgId nullId; |
|
435 TInt err( KErrNone ); |
435 if ( composeView->NewMessage() ) |
436 if ( composeView->NewMessage() ) |
436 { |
437 { |
437 // use composeview NewMessage if available |
438 // use composeview NewMessage if available |
438 msgPart = composeView->NewMessage()->AddNewAttachmentL( filePath, nullId ); |
439 TRAP( err, msgPart = composeView->NewMessage()->AddNewAttachmentL( filePath, nullId )); |
439 } |
440 } |
440 else |
441 else |
441 { |
442 { |
442 // Open message from framework and append attachment |
443 // Open message from framework and append attachment |
443 CFSMailClient* mailClient = iAppUi->GetMailClient(); // not owned |
444 CFSMailClient* mailClient = iAppUi->GetMailClient(); // not owned |
445 iVisualiser->EditorParams().iMailboxId, |
446 iVisualiser->EditorParams().iMailboxId, |
446 iVisualiser->EditorParams().iFolderId, |
447 iVisualiser->EditorParams().iFolderId, |
447 iVisualiser->EditorParams().iMsgId, |
448 iVisualiser->EditorParams().iMsgId, |
448 EFSMsgDataStructure ); |
449 EFSMsgDataStructure ); |
449 CleanupStack::PushL( msg ); |
450 CleanupStack::PushL( msg ); |
450 msgPart = msg->AddNewAttachmentL( filePath, nullId ); |
451 TRAP( err, msgPart = msg->AddNewAttachmentL( filePath, nullId )); |
451 CleanupStack::PopAndDestroy( msg ); |
452 CleanupStack::PopAndDestroy( msg ); |
452 } |
453 } |
453 CleanupStack::PushL( msgPart ); |
454 CleanupStack::PushL( msgPart ); |
|
455 if( KErrNone != err) |
|
456 { |
|
457 if( iWaitNote ) |
|
458 { |
|
459 iWaitNote->ProcessFinishedL(); |
|
460 } |
|
461 iAttachmentAddingLocked = EFalse; |
|
462 User::Leave( err ); |
|
463 } |
454 msgPart->SaveL(); |
464 msgPart->SaveL(); |
455 |
465 |
456 // append file to list model |
466 // append file to list model |
457 const TPtrC fileName = TParsePtrC( filePath ).NameAndExt(); |
467 const TPtrC fileName = TParsePtrC( filePath ).NameAndExt(); |
458 TFileType fileType = TFsEmailUiUtility::GetFileType( fileName, msgPart->GetContentType() ); |
468 TFileType fileType = TFsEmailUiUtility::GetFileType( fileName, msgPart->GetContentType() ); |