30 #include <apgcli.h> |
30 #include <apgcli.h> |
31 #include <FreestyleEmailUi.rsg> |
31 #include <FreestyleEmailUi.rsg> |
32 #include <fsmailserver.rsg> |
32 #include <fsmailserver.rsg> |
33 #include <StringLoader.h> |
33 #include <StringLoader.h> |
34 //<cmail> |
34 //<cmail> |
35 #include "CFSMailClient.h" |
35 #include "cfsmailclient.h" |
36 #include "CFSMailBox.h" |
36 #include "cfsmailbox.h" |
37 #include "CFSMailFolder.h" |
37 #include "cfsmailfolder.h" |
38 #include "CFSMailMessage.h" |
38 #include "cfsmailmessage.h" |
39 #include "CFSMailAddress.h" |
39 #include "cfsmailaddress.h" |
40 #include "CFSMailCommon.h" |
40 #include "cfsmailcommon.h" |
41 //</cmail> |
41 //</cmail> |
42 #include <freestyleemailui.mbg> |
42 #include <freestyleemailui.mbg> |
43 #include <AknQueryDialog.h> |
43 #include <AknQueryDialog.h> |
44 #include <AknBidiTextUtils.h> |
44 #include <AknBidiTextUtils.h> |
45 #include <gdi.h> |
45 #include <gdi.h> |
167 iMsgReaderIsSupported( KErrGeneral ), |
167 iMsgReaderIsSupported( KErrGeneral ), |
168 iSwitchingToBackground( EFalse ) |
168 iSwitchingToBackground( EFalse ) |
169 { |
169 { |
170 FUNC_LOG; |
170 FUNC_LOG; |
171 iEnv = &aEnv; |
171 iEnv = &aEnv; |
|
172 TIMESTAMP( "Application starting" ); |
172 } |
173 } |
173 |
174 |
174 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
175 // Load specified resource file, file name may (and should) contain wild cards |
176 // Load specified resource file, file name may (and should) contain wild cards |
176 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
379 |
380 |
380 // this includes a wait note where code running will be pending |
381 // this includes a wait note where code running will be pending |
381 // until a certain callback event is received |
382 // until a certain callback event is received |
382 // -> thus keep this last in this method! |
383 // -> thus keep this last in this method! |
383 iWizardObserver->DoWizardStartupActionsL(); |
384 iWizardObserver->DoWizardStartupActionsL(); |
|
385 TIMESTAMP( "Application started" ); |
384 } |
386 } |
385 |
387 |
386 // Functions loads some views as delayed to reduce startup time |
388 // Functions loads some views as delayed to reduce startup time |
387 TInt CFreestyleEmailUiAppUi::ViewLoadIdleCallbackFunctionL() |
389 TInt CFreestyleEmailUiAppUi::ViewLoadIdleCallbackFunctionL() |
388 { |
390 { |
632 else |
635 else |
633 { |
636 { |
634 iCurrentActiveView = iNavigationHistory->Pop(); |
637 iCurrentActiveView = iNavigationHistory->Pop(); |
635 } |
638 } |
636 } |
639 } |
|
640 // may be tricky; added here to handle activation of composer view from external app when email is plugin settings view |
|
641 // in this case also duplictaed view needs to be poped up, but iSettingsViewActive is already set to EFalse |
|
642 // other solution would need to expand api of this class to handle directly this case |
|
643 else |
|
644 if ( iPreviousActiveView->Id() == SettingsViewId || iPreviousActiveView->Id() == MailListId ) |
|
645 { |
|
646 iCurrentActiveView = iNavigationHistory->Pop(); |
|
647 } |
637 } |
648 } |
638 |
649 |
639 void CFreestyleEmailUiAppUi::ViewActivatedExternallyL( TUid aViewId ) |
650 void CFreestyleEmailUiAppUi::ViewActivatedExternallyL( TUid aViewId ) |
640 { |
651 { |
641 FUNC_LOG; |
652 FUNC_LOG; |
723 |
735 |
724 // Activate the proper view |
736 // Activate the proper view |
725 if ( viewId == AppGridId ) |
737 if ( viewId == AppGridId ) |
726 { |
738 { |
727 ActivateLocalViewL( AppGridId ); |
739 ActivateLocalViewL( AppGridId ); |
|
740 TIMESTAMP( "Return to application grid view" ); |
728 } |
741 } |
729 else if ( viewId == MailListId ) |
742 else if ( viewId == MailListId ) |
730 { |
743 { |
731 if ( aCustomMessage.Length() ) |
744 if ( aCustomMessage.Length() ) |
732 { |
745 { |
735 else |
748 else |
736 { |
749 { |
737 const TPckgBuf<TMailListActivationData> pkgOut; |
750 const TPckgBuf<TMailListActivationData> pkgOut; |
738 ActivateLocalViewL( MailListId, KStartListReturnToPreviousFolder, pkgOut ); |
751 ActivateLocalViewL( MailListId, KStartListReturnToPreviousFolder, pkgOut ); |
739 } |
752 } |
|
753 TIMESTAMP( "Return to message list view" ); |
740 } |
754 } |
741 else if ( viewId == SearchListViewId ) |
755 else if ( viewId == SearchListViewId ) |
742 { |
756 { |
743 TSearchListActivationData tmp; |
757 TSearchListActivationData tmp; |
744 tmp.iMailBoxId = GetActiveMailbox()->GetId(); |
758 tmp.iMailBoxId = GetActiveMailbox()->GetId(); |
753 else if ( viewId == HtmlViewerId ) |
767 else if ( viewId == HtmlViewerId ) |
754 { |
768 { |
755 // launch html viewer |
769 // launch html viewer |
756 const TPckgBuf<THtmlViewerActivationData> pkgOut; |
770 const TPckgBuf<THtmlViewerActivationData> pkgOut; |
757 ActivateLocalViewL( HtmlViewerId, KHtmlViewerReturnToPrevious, pkgOut ); |
771 ActivateLocalViewL( HtmlViewerId, KHtmlViewerReturnToPrevious, pkgOut ); |
|
772 TIMESTAMP( "Return to html viewer view" ); |
758 } |
773 } |
759 else if ( viewId == MailEditorId ) |
774 else if ( viewId == MailEditorId ) |
760 { |
775 { |
761 ActivateLocalViewL( MailEditorId, TUid::Uid(KEditorCmdReturnToPrevious), aCustomMessage ); |
776 ActivateLocalViewL( MailEditorId, TUid::Uid(KEditorCmdReturnToPrevious), aCustomMessage ); |
|
777 TIMESTAMP( "Return to email editor view" ); |
762 } |
778 } |
763 else if ( viewId == MsgDetailsViewId ) |
779 else if ( viewId == MsgDetailsViewId ) |
764 { |
780 { |
765 ActivateLocalViewL( MsgDetailsViewId, KStartMsgDetailsReturnToPrevious, aCustomMessage ); |
781 ActivateLocalViewL( MsgDetailsViewId, KStartMsgDetailsReturnToPrevious, aCustomMessage ); |
766 } |
782 } |
822 } |
839 } |
823 else |
840 else |
824 { |
841 { |
825 ActivateLocalViewL( iCurrentActiveView->Id() ); |
842 ActivateLocalViewL( iCurrentActiveView->Id() ); |
826 } |
843 } |
|
844 TIMESTAMP( "Return to earlier view" ); |
827 } |
845 } |
828 |
846 |
829 void CFreestyleEmailUiAppUi::ShowFolderListInPopupL( |
847 void CFreestyleEmailUiAppUi::ShowFolderListInPopupL( |
830 const TFSMailMsgId aFolderId, |
848 const TFSMailMsgId aFolderId, |
831 MFSEmailUiFolderListCallback* aCallback, |
849 MFSEmailUiFolderListCallback* aCallback, |
1739 |
1758 |
1740 } |
1759 } |
1741 |
1760 |
1742 // Force Sync on active mailbox. |
1761 // Force Sync on active mailbox. |
1743 void CFreestyleEmailUiAppUi::SyncActiveMailBoxL() |
1762 void CFreestyleEmailUiAppUi::SyncActiveMailBoxL() |
1744 { |
1763 { |
1745 FUNC_LOG; |
1764 FUNC_LOG; |
1746 if ( iActiveMailbox ) |
1765 if( iActiveMailbox ) |
1747 { |
1766 { |
1748 iSyncStatusReqId = iActiveMailbox->RefreshNowL( *this ); |
1767 // Start sync automatically if not syncing already |
1749 } |
1768 TSSMailSyncState latestSyncstate = iActiveMailbox->CurrentSyncState(); |
1750 } |
1769 if( latestSyncstate != InboxSyncing && latestSyncstate != StartingSync && latestSyncstate != EmailSyncing ) |
1751 |
1770 { |
|
1771 iSyncStatusReqId = iActiveMailbox->RefreshNowL( *this ); |
|
1772 } |
|
1773 } |
|
1774 } |
1752 void CFreestyleEmailUiAppUi::StopActiveMailBoxSyncL() |
1775 void CFreestyleEmailUiAppUi::StopActiveMailBoxSyncL() |
1753 { |
1776 { |
1754 FUNC_LOG; |
1777 FUNC_LOG; |
1755 if ( iActiveMailbox ) |
1778 if ( iActiveMailbox && iActiveMailbox->GetMailBoxStatus()==EFSMailBoxOnline) |
1756 { |
1779 { |
1757 iActiveMailbox->CancelSyncL(); |
1780 TSSMailSyncState latestSyncstate = iActiveMailbox->CurrentSyncState(); |
1758 } |
1781 if(latestSyncstate == InboxSyncing || |
1759 } |
1782 latestSyncstate == EmailSyncing || |
1760 |
1783 latestSyncstate == OutboxSyncing || |
|
1784 latestSyncstate == SentItemsSyncing || |
|
1785 latestSyncstate == DraftsSyncing || |
|
1786 latestSyncstate == CalendarSyncing || |
|
1787 latestSyncstate == ContactsSyncing || |
|
1788 latestSyncstate == TasksSyncing || |
|
1789 latestSyncstate == NotesSyncing || |
|
1790 latestSyncstate == FilesSyncing || |
|
1791 latestSyncstate == DataSyncStarting ) |
|
1792 { |
|
1793 iActiveMailbox->CancelSyncL(); |
|
1794 } |
|
1795 } |
|
1796 } |
1761 |
1797 |
1762 MCoeMessageObserver::TMessageResponse CFreestyleEmailUiAppUi::HandleMessageL( |
1798 MCoeMessageObserver::TMessageResponse CFreestyleEmailUiAppUi::HandleMessageL( |
1763 TUint32 aClientHandleOfTargetWindowGroup, |
1799 TUint32 aClientHandleOfTargetWindowGroup, |
1764 TUid aMessageUid, |
1800 TUid aMessageUid, |
1765 const TDesC8& aMessageParameters ) |
1801 const TDesC8& aMessageParameters ) |
1881 { |
1917 { |
1882 switch ( *newSyncState ) |
1918 switch ( *newSyncState ) |
1883 { |
1919 { |
1884 case StartingSync: |
1920 case StartingSync: |
1885 { |
1921 { |
|
1922 TIMESTAMP( "Starting sync" ); |
1886 //If syncs were started by user, show the synchoronisation indicator |
1923 //If syncs were started by user, show the synchoronisation indicator |
|
1924 TIMESTAMP( "Sync error" ); |
1887 if(iManualMailBoxSyncAll) |
1925 if(iManualMailBoxSyncAll) |
1888 { |
1926 { |
1889 ManualMailBoxSyncAll(EFalse); |
1927 ManualMailBoxSyncAll(EFalse); |
1890 } |
1928 } |
1891 } |
1929 } |