85 : CFsEmailUiViewBase( aSendAttachmentControlGroup, aAppUi ), |
85 : CFsEmailUiViewBase( aSendAttachmentControlGroup, aAppUi ), |
86 iMailClient( aMailClient ), iOrigMessage( NULL ), iNewMessage( NULL ), |
86 iMailClient( aMailClient ), iOrigMessage( NULL ), iNewMessage( NULL ), |
87 iMsvSession( aMsvSession ), iEnv( aEnv ), |
87 iMsvSession( aMsvSession ), iEnv( aEnv ), |
88 iFakeSyncGoingOn(EFalse), iFetchDialogCancelled(EFalse), |
88 iFakeSyncGoingOn(EFalse), iFetchDialogCancelled(EFalse), |
89 iExecutingDoExitL( EFalse ), |
89 iExecutingDoExitL( EFalse ), |
90 iMessageTextPartModified( EFalse ), iMessageModified( EFalse ) |
90 iMessageTextPartModified( EFalse ), iMessageModified( EFalse ), |
91 { |
91 iIncludeMessageTextAsync( EFalse ), iChildActivationState( EChildActivationDeactivated ) |
92 FUNC_LOG; |
92 { |
|
93 FUNC_LOG; |
93 |
94 |
94 iAttachmentListSaveDraft = EFalse; |
95 iAttachmentListSaveDraft = EFalse; |
95 |
96 |
96 } |
97 } |
97 |
98 |
287 // |
288 // |
288 void CNcsComposeView::ChildDoActivateL( const TVwsViewId& aPrevViewId, |
289 void CNcsComposeView::ChildDoActivateL( const TVwsViewId& aPrevViewId, |
289 TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
290 TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
290 { |
291 { |
291 FUNC_LOG; |
292 FUNC_LOG; |
292 |
293 iChildActivationState = EChildActivationStarted; |
293 // needed when "Opening" (replying/forwarding)note is shown and |
294 // needed when "Opening" (replying/forwarding)note is shown and |
294 // we receive incoming call- Email application goes to background. |
295 // we receive incoming call- Email application goes to background. |
295 // When coming back to application the view is activated and reseted. |
296 // When coming back to application the view is activated and reseted. |
296 // That's why we prevent activation and the same is done in ChildDoDeactivate |
297 // That's why we prevent activation and the same is done in ChildDoDeactivate |
297 if ( iIncludeMessageTextAsync ) |
298 if ( iIncludeMessageTextAsync ) |
433 iContainer->SetMskL(); |
434 iContainer->SetMskL(); |
434 iViewReady = ETrue; |
435 iViewReady = ETrue; |
435 Toolbar()->SetDimmed( EFalse ); |
436 Toolbar()->SetDimmed( EFalse ); |
436 RefreshToolbar(); |
437 RefreshToolbar(); |
437 iContainer->ActivateL(); |
438 iContainer->ActivateL(); |
438 } |
439 |
439 |
440 |
440 // if there is a embedded app in FSEmail. |
441 // if there is a embedded app in FSEmail. |
441 if( iAppUi.EmbeddedApp() ) |
442 if( iAppUi.EmbeddedApp() ) |
442 { |
443 { |
443 // Set email editor started from embedded app flag to true |
444 // Set email editor started from embedded app flag to true |
444 // so that we can switch view correct when sent email. |
445 // so that we can switch view correct when sent email. |
445 iAppUi.SetEditorStartedFromEmbeddedApp( ETrue ); |
446 iAppUi.SetEditorStartedFromEmbeddedApp( ETrue ); |
446 |
447 |
447 RWsSession rwsSession; |
448 RWsSession rwsSession; |
448 User::LeaveIfError( rwsSession.Connect() ); |
449 User::LeaveIfError( rwsSession.Connect() ); |
449 CleanupClosePushL( rwsSession ); |
450 CleanupClosePushL( rwsSession ); |
450 |
451 |
451 // Simulate a back key to exit embedded app |
452 // Simulate a back key to exit embedded app |
452 // so that email editor could show on the top level. |
453 // so that email editor could show on the top level. |
453 TKeyEvent KeyEvent = TKeyEvent(); |
454 TKeyEvent KeyEvent = TKeyEvent(); |
454 // this is neccesary for photogalery image viewer (don't remove) |
455 // this is neccesary for photogalery image viewer (don't remove) |
455 KeyEvent.iScanCode = EStdKeyUpArrow; |
456 KeyEvent.iScanCode = EStdKeyUpArrow; |
456 rwsSession.SimulateKeyEvent( KeyEvent ); |
457 rwsSession.SimulateKeyEvent( KeyEvent ); |
457 KeyEvent.iCode = EKeyCBA2; |
458 KeyEvent.iCode = EKeyCBA2; |
458 rwsSession.SimulateKeyEvent( KeyEvent ); |
459 rwsSession.SimulateKeyEvent( KeyEvent ); |
459 |
460 |
460 rwsSession.Close(); |
461 rwsSession.Close(); |
461 CleanupStack::PopAndDestroy( &rwsSession ); |
462 CleanupStack::PopAndDestroy( &rwsSession ); |
462 } |
463 } |
463 |
464 |
464 if ( iIncludeMessageTextAsync ) |
465 if ( iIncludeMessageTextAsync ) |
465 { |
466 { |
466 // including message body in async way |
467 // including message body in async way |
467 IncludeMessageTextAsyncL( ETrue ); |
468 IncludeMessageTextAsyncL( ETrue ); |
468 } |
469 } |
469 |
470 |
470 iViewFullyActivated = ETrue; |
471 iViewFullyActivated = ETrue; |
|
472 iChildActivationState = EChildActivationProcessed; |
471 |
473 |
472 TIMESTAMP( "Editor launched" ); |
474 TIMESTAMP( "Editor launched" ); |
|
475 return; // ok |
|
476 } |
|
477 // problems with init close the view asynchronously |
|
478 iViewFullyActivated = EFalse; |
|
479 iChildActivationState = EChildActivationExitRequired; |
|
480 // iFakeSyncGoingOn = EFalse; iExecutingDoExitL = EFalse; |
|
481 iActiveHelper->Start(); // calls AsyncExit() |
|
482 TIMESTAMP( "Editor NOT launched" ); |
|
483 return; |
473 } |
484 } |
474 |
485 |
475 // ----------------------------------------------------------------------------- |
486 // ----------------------------------------------------------------------------- |
476 // Initialises toolbar items. |
487 // Initialises toolbar items. |
477 // ----------------------------------------------------------------------------- |
488 // ----------------------------------------------------------------------------- |
1058 SetAttachmentLabelContentL(); |
1075 SetAttachmentLabelContentL(); |
1059 } |
1076 } |
1060 break; |
1077 break; |
1061 case ENcsCmdPriorityHigh: |
1078 case ENcsCmdPriorityHigh: |
1062 { |
1079 { |
1063 iNewMessage->ResetFlag( EFSMsgFlag_Low ); |
1080 if ( iNewMessage ) |
1064 iNewMessage->SetFlag( EFSMsgFlag_Important ); |
1081 { |
1065 iNewMessage->SaveMessageL(); |
1082 iNewMessage->ResetFlag( EFSMsgFlag_Low ); |
1066 iMessageModified = EFalse; |
1083 iNewMessage->SetFlag( EFSMsgFlag_Important ); |
1067 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityHigh ); |
1084 iNewMessage->SaveMessageL(); |
|
1085 iMessageModified = EFalse; |
|
1086 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityHigh ); |
|
1087 } |
1068 } |
1088 } |
1069 break; |
1089 break; |
1070 case ENcsCmdPriorityNormal: |
1090 case ENcsCmdPriorityNormal: |
1071 { |
1091 { |
1072 iNewMessage->ResetFlag( EFSMsgFlag_Low ); |
1092 if ( iNewMessage ) |
1073 iNewMessage->ResetFlag( EFSMsgFlag_Important ); |
1093 { |
1074 iNewMessage->SaveMessageL(); |
1094 iNewMessage->ResetFlag( EFSMsgFlag_Low ); |
1075 iMessageModified = EFalse; |
1095 iNewMessage->ResetFlag( EFSMsgFlag_Important ); |
1076 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityNormal ); |
1096 iNewMessage->SaveMessageL(); |
|
1097 iMessageModified = EFalse; |
|
1098 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityNormal ); |
|
1099 } |
1077 } |
1100 } |
1078 break; |
1101 break; |
1079 case ENcsCmdPriorityLow: |
1102 case ENcsCmdPriorityLow: |
1080 { |
1103 { |
1081 iNewMessage->ResetFlag( EFSMsgFlag_Important ); |
1104 if ( iNewMessage ) |
1082 iNewMessage->SetFlag( EFSMsgFlag_Low ); |
1105 { |
1083 iNewMessage->SaveMessageL(); |
1106 iNewMessage->ResetFlag( EFSMsgFlag_Important ); |
1084 iMessageModified = EFalse; |
1107 iNewMessage->SetFlag( EFSMsgFlag_Low ); |
1085 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityLow ); |
1108 iNewMessage->SaveMessageL(); |
|
1109 iMessageModified = EFalse; |
|
1110 iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityLow ); |
|
1111 } |
1086 } |
1112 } |
1087 break; |
1113 break; |
1088 case ENcsCmdShowCc: |
1114 case ENcsCmdShowCc: |
1089 { |
1115 { |
1090 iContainer->SetCcFieldVisibleL( ETrue ); |
1116 iContainer->SetCcFieldVisibleL( ETrue ); |
1202 if ( iContainer->AreAddressFieldsEmpty() ) |
1229 if ( iContainer->AreAddressFieldsEmpty() ) |
1203 { |
1230 { |
1204 User::Leave( KErrNotFound ); |
1231 User::Leave( KErrNotFound ); |
1205 } |
1232 } |
1206 |
1233 |
1207 CommitL( ETrue, EAllFields, ETrue ); |
1234 TRAPD( commitErr, CommitL( ETrue, EAllFields, ETrue ) ); |
|
1235 if ( KErrNone != commitErr ) |
|
1236 { |
|
1237 iMailSendFailed = ETrue; |
|
1238 User::Leave( commitErr ); |
|
1239 } |
1208 |
1240 |
1209 TRAPD(r, iMailBox->SendMessageL( *iNewMessage ) ); |
1241 TRAPD(r, iMailBox->SendMessageL( *iNewMessage ) ); |
1210 if ( KErrNone != r ) |
1242 if ( KErrNone != r ) |
1211 { |
1243 { |
1212 iMailSendFailed = ETrue; |
1244 iMailSendFailed = ETrue; |
2242 break; |
2274 break; |
2243 default: |
2275 default: |
2244 break; |
2276 break; |
2245 } |
2277 } |
2246 |
2278 |
2247 if ( commitToField ) |
2279 if ( iNewMessage ) |
2248 { |
|
2249 RPointerArray<CFSMailAddress>& recipients = |
|
2250 iNewMessage->GetToRecipients(); |
|
2251 recipients.ResetAndDestroy(); |
|
2252 NcsUtility::ConvertAddressArrayL( |
|
2253 iContainer->GetToFieldAddressesL( aParseAddresses ), recipients ); |
|
2254 } |
|
2255 |
|
2256 if ( commitCcField ) |
|
2257 { |
|
2258 RPointerArray<CFSMailAddress>& recipients = |
|
2259 iNewMessage->GetCCRecipients(); |
|
2260 recipients.ResetAndDestroy(); |
|
2261 NcsUtility::ConvertAddressArrayL( |
|
2262 iContainer->GetCcFieldAddressesL( aParseAddresses ), recipients ); |
|
2263 } |
|
2264 |
|
2265 if ( commitBccField ) |
|
2266 { |
|
2267 RPointerArray<CFSMailAddress>& recipients = |
|
2268 iNewMessage->GetBCCRecipients(); |
|
2269 recipients.ResetAndDestroy(); |
|
2270 NcsUtility::ConvertAddressArrayL( |
|
2271 iContainer->GetBccFieldAddressesL( aParseAddresses ), recipients ); |
|
2272 } |
|
2273 |
|
2274 if ( commitSubjectField ) |
|
2275 { |
2280 { |
2276 // get subject from UI to MSG object |
2281 if ( commitToField ) |
2277 HBufC* subject = iContainer->GetSubjectLC(); |
2282 { |
2278 TPtr ptr = subject->Des(); |
2283 RPointerArray<CFSMailAddress>& recipients = |
2279 // replace new line characters with spaces as Subject is normally |
2284 iNewMessage->GetToRecipients(); |
2280 // one line only |
2285 recipients.ResetAndDestroy(); |
2281 AknTextUtils::ReplaceCharacters( |
2286 NcsUtility::ConvertAddressArrayL( |
2282 ptr, KLineSeparators, KReplacementChar ); |
2287 iContainer->GetToFieldAddressesL( aParseAddresses ), recipients ); |
2283 iNewMessage->SetSubject( *subject ); |
2288 } |
2284 CleanupStack::PopAndDestroy( subject ); |
2289 |
|
2290 if ( commitCcField ) |
|
2291 { |
|
2292 RPointerArray<CFSMailAddress>& recipients = |
|
2293 iNewMessage->GetCCRecipients(); |
|
2294 recipients.ResetAndDestroy(); |
|
2295 NcsUtility::ConvertAddressArrayL( |
|
2296 iContainer->GetCcFieldAddressesL( aParseAddresses ), recipients ); |
|
2297 } |
|
2298 |
|
2299 if ( commitBccField ) |
|
2300 { |
|
2301 RPointerArray<CFSMailAddress>& recipients = |
|
2302 iNewMessage->GetBCCRecipients(); |
|
2303 recipients.ResetAndDestroy(); |
|
2304 NcsUtility::ConvertAddressArrayL( |
|
2305 iContainer->GetBccFieldAddressesL( aParseAddresses ), recipients ); |
|
2306 } |
|
2307 |
|
2308 if ( commitSubjectField ) |
|
2309 { |
|
2310 // get subject from UI to MSG object |
|
2311 HBufC* subject = iContainer->GetSubjectLC(); |
|
2312 TPtr ptr = subject->Des(); |
|
2313 // replace new line characters with spaces as Subject is normally |
|
2314 // one line only |
|
2315 AknTextUtils::ReplaceCharacters( |
|
2316 ptr, KLineSeparators, KReplacementChar ); |
|
2317 iNewMessage->SetSubject( *subject ); |
|
2318 CleanupStack::PopAndDestroy( subject ); |
|
2319 } |
|
2320 } |
|
2321 else // iNewMessage is still NULL |
|
2322 { |
|
2323 User::Leave( KErrNotFound ); |
|
2324 } |
|
2325 |
|
2326 if ( iNewMessageTextPart ) |
|
2327 { |
|
2328 if ( commitBodyField ) |
|
2329 { |
|
2330 HBufC* body = iContainer->GetBodyContentLC(); |
|
2331 TPtr bodyPtr = body->Des(); // this TPtr is needed only because of |
|
2332 // incorrect argument type in FW API, can be removed when API fixed |
|
2333 iNewMessageTextPart->SetContent( bodyPtr ); |
|
2334 CleanupStack::PopAndDestroy( body ); |
|
2335 iMessageTextPartModified = ETrue; |
|
2336 } |
2285 } |
2337 } |
2286 |
2338 else // iNewMessageTextPart is still NULL |
2287 if ( commitBodyField ) |
2339 { |
2288 { |
2340 User::Leave( KErrNotFound ); |
2289 HBufC* body = iContainer->GetBodyContentLC(); |
2341 } |
2290 TPtr bodyPtr = body->Des(); // this TPtr is needed only because of |
2342 |
2291 // incorrect argument type in FW API, can be removed when API fixed |
|
2292 iNewMessageTextPart->SetContent( bodyPtr ); |
|
2293 CleanupStack::PopAndDestroy( body ); |
|
2294 iMessageTextPartModified = ETrue; |
|
2295 } |
|
2296 |
|
2297 iMessageModified = ETrue; |
2343 iMessageModified = ETrue; |
2298 RefreshToolbar(); |
2344 RefreshToolbar(); |
2299 |
2345 |
2300 if ( aSaveNow ) |
2346 if ( aSaveNow ) |
2301 { |
2347 { |
2870 iNewMessage->SaveMessageL(); |
2916 iNewMessage->SaveMessageL(); |
2871 iMessageModified = EFalse; |
2917 iMessageModified = EFalse; |
2872 } |
2918 } |
2873 |
2919 |
2874 TFsEmailUiUtility::CreatePlainTextPartL( *iNewMessage, iNewMessageTextPart ); |
2920 TFsEmailUiUtility::CreatePlainTextPartL( *iNewMessage, iNewMessageTextPart ); |
|
2921 if (NULL == iNewMessageTextPart) // problems with creating |
|
2922 { |
|
2923 User::Leave( KErrUnknown ); |
|
2924 } |
2875 } |
2925 } |
2876 |
2926 |
2877 // ----------------------------------------------------------------------------- |
2927 // ----------------------------------------------------------------------------- |
2878 // CNcsComposeView::GenerateForwardMessageL |
2928 // CNcsComposeView::GenerateForwardMessageL |
2879 // ----------------------------------------------------------------------------- |
2929 // ----------------------------------------------------------------------------- |