50 #include "FreestyleEmailUiSendAttachmentsListModel.h" |
50 #include "FreestyleEmailUiSendAttachmentsListModel.h" |
51 #include "FreestyleEmailUiUtilities.h" |
51 #include "FreestyleEmailUiUtilities.h" |
52 #include "FreestyleEmailUiConstants.h" |
52 #include "FreestyleEmailUiConstants.h" |
53 #include "FSAutoSaver.h" |
53 #include "FSAutoSaver.h" |
54 #include "FSEmail.pan" |
54 #include "FSEmail.pan" |
|
55 #include "cmailmessageext.h" |
55 |
56 |
56 |
57 |
57 // line separators that should not appear in Subject |
58 // line separators that should not appear in Subject |
58 _LIT(KLineSeparators, "\u2029"); |
59 _LIT(KLineSeparators, "\u2029"); |
59 const TChar KReplacementChar = ' '; |
60 const TChar KReplacementChar = ' '; |
708 void CNcsComposeView::RefreshToolbar() |
712 void CNcsComposeView::RefreshToolbar() |
709 { |
713 { |
710 FUNC_LOG; |
714 FUNC_LOG; |
711 if ( iContainer ) |
715 if ( iContainer ) |
712 { |
716 { |
713 // DimAllOptions if remotesearch is in progress, |
717 // Hide toolbar if remotesearch is in progress, |
714 // because it takes you into a different view |
718 // because it takes you into a different view |
715 TBool dimAllOptions = iContainer->IsRemoteSearchInprogress(); |
719 TBool hideToolbar = iContainer->IsRemoteSearchInprogress(); |
716 SetToolbarItemDimmed( EFsEmailUiTbCmdExpandActions, dimAllOptions ); |
720 SetToolbarItemDimmed( EFsEmailUiTbCmdSend, iContainer->AreAddressFieldsEmpty() ); |
717 SetToolbarItemDimmed( EFsEmailUiTbCmdExpandInsert, dimAllOptions ); |
721 |
718 SetToolbarItemDimmed( EFsEmailUiTbCmdSend, dimAllOptions |
722 CAknToolbar* toolbar(Toolbar()); |
719 || iContainer->AreAddressFieldsEmpty() ); |
723 if (toolbar) |
720 } |
724 { |
721 } |
725 toolbar->SetToolbarVisibility(!hideToolbar); |
722 |
726 } |
|
727 } |
|
728 } |
723 |
729 |
724 // ----------------------------------------------------------------------------- |
730 // ----------------------------------------------------------------------------- |
725 // CNcsComposeView::ChildDoDeactivate() |
731 // CNcsComposeView::ChildDoDeactivate() |
726 // Deactivate the Compose view |
732 // Deactivate the Compose view |
727 // ----------------------------------------------------------------------------- |
733 // ----------------------------------------------------------------------------- |
1344 attachmentControl = self->AttachmentsListControl(); |
1350 attachmentControl = self->AttachmentsListControl(); |
1345 |
1351 |
1346 // show file dialog and get file name |
1352 // show file dialog and get file name |
1347 TBool ok = EFalse; |
1353 TBool ok = EFalse; |
1348 TInt error = KErrNone; |
1354 TInt error = KErrNone; |
1349 if( ! self->Toolbar()->IsDimmed()) |
1355 CAknToolbar* toolbar = self->Toolbar(); |
1350 { |
1356 if ( !toolbar->IsDimmed() ) |
1351 self->Toolbar()->SetDimmed(ETrue); |
1357 { |
1352 } |
1358 toolbar->SetDimmed(ETrue); |
1353 |
1359 } |
|
1360 |
1354 self->iContainer->SwitchChangeMskOff( ETrue ); |
1361 self->iContainer->SwitchChangeMskOff( ETrue ); |
1355 TRAP( error, ok = attachmentControl->AppendAttachmentToListL( |
1362 TRAP( error, ok = attachmentControl->AppendAttachmentToListL( |
1356 self->iAttachmentAddType) ); |
1363 self->iAttachmentAddType) ); |
1357 self->iContainer->SwitchChangeMskOff( EFalse ); |
1364 self->iContainer->SwitchChangeMskOff( EFalse ); |
1358 |
1365 |
1359 if ( ok && error == KErrNone ) |
1366 if ( ok && error == KErrNone ) |
1360 { |
1367 { |
1361 TRAP( error, self->SetAttachmentLabelContentL() ); |
1368 TRAP( error, self->SetAttachmentLabelContentL() ); |
1362 } |
1369 } |
1363 |
1370 |
1364 if(! attachmentControl->IsAttachmentAddingLocked()) |
1371 if ( !attachmentControl->IsAttachmentAddingLocked() ) |
1365 { |
1372 { |
1366 self->Toolbar()->SetDimmed(EFalse); |
1373 toolbar->SetDimmed(EFalse); |
1367 TRAP( error, self->UpdateToolbarL()); |
1374 self->RefreshToolbar(); |
1368 } |
1375 toolbar->DrawDeferred(); |
1369 return error; |
1376 } |
|
1377 return error; |
1370 } |
1378 } |
1371 |
1379 |
1372 // ----------------------------------------------------------------------------- |
1380 // ----------------------------------------------------------------------------- |
1373 // RunFollowUpFlagDlgL() |
1381 // RunFollowUpFlagDlgL() |
1374 // Query user for followup flag |
1382 // Query user for followup flag |
2020 // CNcsComposeView::CommitL() |
2028 // CNcsComposeView::CommitL() |
2021 // |
2029 // |
2022 // ----------------------------------------------------------------------------- |
2030 // ----------------------------------------------------------------------------- |
2023 // |
2031 // |
2024 void CNcsComposeView::CommitL( TBool aParseAddresses, |
2032 void CNcsComposeView::CommitL( TBool aParseAddresses, |
2025 TFieldToCommit aFieldToCommit, TBool aSaveNow ) |
2033 TFieldToCommit aFieldToCommit, TBool aSaveNow, TCommitType aType ) |
2026 { |
2034 { |
2027 FUNC_LOG; |
2035 FUNC_LOG; |
2028 __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) ); |
2036 __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) ); |
2029 __ASSERT_DEBUG( iNewMessageTextPart, Panic( ENcsBasicUi ) ); |
2037 __ASSERT_DEBUG( iNewMessageTextPart, Panic( ENcsBasicUi ) ); |
2030 |
2038 |
2116 RefreshToolbar(); |
2124 RefreshToolbar(); |
2117 |
2125 |
2118 if ( aSaveNow ) |
2126 if ( aSaveNow ) |
2119 { |
2127 { |
2120 SaveMessageL(); |
2128 SaveMessageL(); |
|
2129 |
|
2130 // If this is final commit, then inform it via extension |
|
2131 if ( aType == EFinal ) |
|
2132 { |
|
2133 CMailMessageExtension* messageExtension = |
|
2134 static_cast<CMailMessageExtension*> |
|
2135 ( iNewMessage->ExtensionL( KEmailMessageExtensionUid ) ); |
|
2136 if ( messageExtension ) |
|
2137 { |
|
2138 messageExtension->CommitL( *iNewMessage ) ; |
|
2139 iNewMessage->ReleaseExtension( messageExtension ); |
|
2140 } |
|
2141 } |
2121 } |
2142 } |
2122 } |
2143 } |
2123 |
2144 |
2124 TInt CNcsComposeView::SaveMessage() |
2145 TInt CNcsComposeView::SaveMessage() |
2125 { |
2146 { |
2752 FUNC_LOG; |
2773 FUNC_LOG; |
2753 if ( iFirstStartCompleted ) // Safety check |
2774 if ( iFirstStartCompleted ) // Safety check |
2754 { |
2775 { |
2755 AppUi()->AddToStackL( iContainer ); |
2776 AppUi()->AddToStackL( iContainer ); |
2756 iContainer->SetMenuBar( Cba() ); |
2777 iContainer->SetMenuBar( Cba() ); |
2757 iContainer->UpdateScrollBarL(); |
2778 iContainer->UpdateScrollBar(); |
2758 |
2779 |
2759 // Set title pane text |
2780 // Set title pane text |
2760 const TDesC& mbName = iMailBox->GetName(); |
2781 const TDesC& mbName = iMailBox->GetName(); |
2761 iAppUi.SetTitlePaneTextL( mbName ); |
2782 iAppUi.SetTitlePaneTextL( mbName ); |
2762 |
2783 |
2887 { |
2908 { |
2888 __ASSERT_DEBUG( iMailBox, Panic( ENcsBasicUi ) ); |
2909 __ASSERT_DEBUG( iMailBox, Panic( ENcsBasicUi ) ); |
2889 __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) ); |
2910 __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) ); |
2890 |
2911 |
2891 iFakeSyncGoingOn = ETrue; |
2912 iFakeSyncGoingOn = ETrue; |
2892 TRAPD( error, CommitL( aParseAddresses, EAllFields, ETrue ) ); |
2913 TRAPD( error, CommitL( aParseAddresses, EAllFields, ETrue, EFinal ) ); |
2893 iFakeSyncGoingOn = EFalse; |
2914 iFakeSyncGoingOn = EFalse; |
2894 User::LeaveIfError( error ); |
2915 User::LeaveIfError( error ); |
2895 |
2916 |
2896 iFakeSyncGoingOn = ETrue; |
2917 iFakeSyncGoingOn = ETrue; |
2897 TRAP( error, TFsEmailUiUtility::MoveMessageToDraftsL( |
2918 TRAP( error, TFsEmailUiUtility::MoveMessageToDraftsL( |