132 _LIT( KETelCallEngPhCltResourceFile, "PhoneClient.rsc" ); |
132 _LIT( KETelCallEngPhCltResourceFile, "PhoneClient.rsc" ); |
133 //</cmail> |
133 //</cmail> |
134 _LIT( KMsgReaderFsDll,"freestylemessagescanner.dll"); // DLL provided by msg reader. |
134 _LIT( KMsgReaderFsDll,"freestylemessagescanner.dll"); // DLL provided by msg reader. |
135 _LIT( KPhoneModuleName, "Phonetsy.tsy"); |
135 _LIT( KPhoneModuleName, "Phonetsy.tsy"); |
136 _LIT( KPhoneName, "DefaultPhone"); |
136 _LIT( KPhoneName, "DefaultPhone"); |
137 // Message editor resources |
137 // Message editor resource file with wild cards |
138 _LIT( KMsgEditorAppUiResourceFileName, "z:msgeditorappui.rsc" ); |
138 _LIT( KMsgEditorAppUiResourceFileName, "msgeditorappui.r*" ); |
139 // FSMailServer resources |
139 // FSMailServer resource file with path and wild cards |
140 _LIT( KFSMailServerResourceFileName, "z:fsmailserver.rsc" ); |
140 _LIT( KFSMailServerResourceFileNameWithPath, "\\resource\\apps\\fsmailserver.r*" ); |
141 |
141 |
142 // 6 seconds |
142 // 6 seconds |
143 const TTimeIntervalMicroSeconds32 KIdleTimeInterval = 6000000; |
143 const TTimeIntervalMicroSeconds32 KIdleTimeInterval = 6000000; |
144 |
144 |
145 static TBool g_ApplicationExitOnGoing = EFalse; |
145 static TBool g_ApplicationExitOnGoing = EFalse; |
168 FUNC_LOG; |
170 FUNC_LOG; |
169 iEnv = &aEnv; |
171 iEnv = &aEnv; |
170 } |
172 } |
171 |
173 |
172 // --------------------------------------------------------------------------- |
174 // --------------------------------------------------------------------------- |
|
175 // Load specified resource file, file name may (and should) contain wild cards |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 TInt CFreestyleEmailUiAppUi::LoadResourceFileL( |
|
179 const TDesC& aFileName, |
|
180 const TDesC& aFilePath ) |
|
181 { |
|
182 FUNC_LOG; |
|
183 |
|
184 TFindFile search( iCoeEnv->FsSession() ); |
|
185 CDir* dirList = NULL; |
|
186 TInt err = search.FindWildByDir( aFileName, aFilePath, dirList ); |
|
187 |
|
188 if ( err == KErrNone ) |
|
189 { |
|
190 // After succesfull FindWildByDir; dirList contains list of found file |
|
191 // names and search.File() returns the drive and path of the file(s) |
|
192 if ( dirList->Count() > 0 ) |
|
193 { |
|
194 TParse parse; |
|
195 parse.Set( (*dirList)[0].iName, &search.File(), NULL ); |
|
196 TFileName nearestFile( parse.FullName() ); |
|
197 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), nearestFile ); |
|
198 delete dirList; |
|
199 |
|
200 INFO_1( "Load resource: %S", &nearestFile ); |
|
201 // Return the resource file offset if file loaded succesfully |
|
202 return iEikonEnv->AddResourceFileL( nearestFile ); |
|
203 } |
|
204 delete dirList; |
|
205 } |
|
206 |
|
207 // Leave if resource file is not found |
|
208 User::Leave( err ); |
|
209 return 0; // To avoid compiler warnings |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------------------------- |
173 // ConstructL is called by the application framework |
213 // ConstructL is called by the application framework |
174 // --------------------------------------------------------------------------- |
214 // --------------------------------------------------------------------------- |
175 // |
215 // |
176 void CFreestyleEmailUiAppUi::ConstructL() |
216 void CFreestyleEmailUiAppUi::ConstructL() |
177 { |
217 { |
178 FUNC_LOG; |
218 FUNC_LOG; |
179 |
219 |
180 // for debug builds create log file directory automatically |
220 // Load message editor resources (needed for ENote fetch) |
181 #ifdef _DEBUG |
221 iMsgEditorResourceOffset = LoadResourceFileL( |
182 _LIT( KDebugLogDir, "c:\\logs\\FreestyleEmailUi\\" ); |
222 KMsgEditorAppUiResourceFileName, |
183 BaflUtils::EnsurePathExistsL( iEikonEnv->FsSession(), KDebugLogDir ); |
223 KDC_RESOURCE_FILES_DIR ); |
184 #endif |
224 |
185 |
225 // Load FSMailServer resource file, search first the same drive from where |
186 // Add message editor resources (needed for ENote fetch) |
226 // our process is loaded as FSMailServer should be installed in same drive |
187 TParse parse; |
227 RProcess ownProcess; |
188 parse.Set( KMsgEditorAppUiResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
228 TFileName ownProcessName( ownProcess.FileName() ); |
189 TFileName fileName( parse.FullName() ); |
229 ownProcess.Close(); |
190 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
230 iFSMailServerResourceOffset = LoadResourceFileL( |
191 iMsgEditorResourceOffset = iEikonEnv->AddResourceFileL( fileName ); |
231 KFSMailServerResourceFileNameWithPath, |
192 // Add FSMailServer resources |
232 ownProcessName.LeftTPtr( KDriveDescLength ) ); |
193 parse.Set( KFSMailServerResourceFileName, &KDC_APP_RESOURCE_DIR, NULL ); |
|
194 fileName = parse.FullName(); |
|
195 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
196 iFSMailServerResourceOffset = iEikonEnv->AddResourceFileL( fileName ); |
|
197 |
233 |
198 // flag indicating whether we are in AppUi::ConstructL |
234 // flag indicating whether we are in AppUi::ConstructL |
199 // workaround for compose view loadbackgroundcontext sending skin changed events |
235 // workaround for compose view loadbackgroundcontext sending skin changed events |
200 // and causing texture manager to be reconstructed many times |
236 // and causing texture manager to be reconstructed many times |
201 iConstructComplete = EFalse; |
237 iConstructComplete = EFalse; |
214 |
250 |
215 // Initialize the flip state and the observer for listening to the flip |
251 // Initialize the flip state and the observer for listening to the flip |
216 // state changed events. The initial state will be reported in construction |
252 // state changed events. The initial state will be reported in construction |
217 iPropertySubscriber = |
253 iPropertySubscriber = |
218 CFreestyleEmailUiPropertySubscriber::NewL( KPSUidHWRM, KHWRMFlipStatus, *this ); |
254 CFreestyleEmailUiPropertySubscriber::NewL( KPSUidHWRM, KHWRMFlipStatus, *this ); |
219 |
255 |
220 // Create Document Handler instance |
256 // Create Document Handler instance |
221 iDocumentHandler = CDocumentHandler::NewL(); |
257 iDocumentHandler = CDocumentHandler::NewL(); |
222 iFileHandleShutter = CFsEmailFileHandleShutter::NewL(*iDocumentHandler); |
258 iFileHandleShutter = CFsEmailFileHandleShutter::NewL(*iDocumentHandler); |
223 |
259 |
224 CAlfDisplay& disp = iEnv->NewDisplayL( ClientRect(), CAlfEnv::ENewDisplayAsCoeControl ); // aAppUi-> |
260 CAlfDisplay& disp = iEnv->NewDisplayL( ClientRect(), CAlfEnv::ENewDisplayAsCoeControl ); // aAppUi-> |
233 //<cmail> |
269 //<cmail> |
234 |
270 |
235 // Set up layouthandler |
271 // Set up layouthandler |
236 iLayoutHandler = CFSEmailUiLayoutHandler::NewL( *iEnv ); |
272 iLayoutHandler = CFSEmailUiLayoutHandler::NewL( *iEnv ); |
237 iLayoutHandler->ScreenResolutionChanged(); |
273 iLayoutHandler->ScreenResolutionChanged(); |
238 |
274 |
239 // Create mail client, list mailboxes |
275 // Create mail client, list mailboxes |
240 iMailClient = CFSMailClient::NewL(); |
276 iMailClient = CFSMailClient::NewL(); |
241 |
277 |
242 // Connect to messaging server |
278 // Connect to messaging server |
243 iMsvSession = CMsvSession::OpenSyncL( *this ); |
279 iMsvSession = CMsvSession::OpenSyncL( *this ); |
246 iFsTextureManager = CFreestyleEmailUiTextureManager::NewL( *iEnv, this ); |
282 iFsTextureManager = CFreestyleEmailUiTextureManager::NewL( *iEnv, this ); |
247 CFsDelayedLoader::InstanceL()->Start(); |
283 CFsDelayedLoader::InstanceL()->Start(); |
248 |
284 |
249 // New mailbox query async callback |
285 // New mailbox query async callback |
250 iNewBoxQueryAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
286 iNewBoxQueryAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
251 iNewBoxQueryAsyncCallback->Set( TCallBack( DisplayCreateQueryL, this ) ); |
287 iNewBoxQueryAsyncCallback->Set( TCallBack( DisplayCreateQueryL, this ) ); |
252 |
288 |
253 iActionMenuHandler = CFSEmailUiActionMenu::NewL( this ); |
289 iActionMenuHandler = CFSEmailUiActionMenu::NewL( this ); |
254 |
290 |
255 // Create download info mediator |
291 // Create download info mediator |
256 iDwnldMediator = CFSEmailDownloadInfoMediator::NewL( *iMailClient ); |
292 iDwnldMediator = CFSEmailDownloadInfoMediator::NewL( *iMailClient ); |
332 // If we have no mailboxes yet start a setup wizard. Else, if this app has been launched |
368 // If we have no mailboxes yet start a setup wizard. Else, if this app has been launched |
333 // by a setup wizard then handle the mailbox data in central repository |
369 // by a setup wizard then handle the mailbox data in central repository |
334 iWizardObserver = CFSEmailUiWizardObserver::NewL( this, iMainUiGridVisualiser ); |
370 iWizardObserver = CFSEmailUiWizardObserver::NewL( this, iMainUiGridVisualiser ); |
335 iConstructComplete = ETrue; |
371 iConstructComplete = ETrue; |
336 |
372 |
|
373 iExitGuardian = CEUiExitGuardian::NewL( *this ); |
|
374 |
|
375 iConnectionStatusVisible = ETrue; |
|
376 // Create custom statuspane indicators object, which shows priority and followup flags |
|
377 CreateStatusPaneIndicatorsL(); |
|
378 iConnectionStatusIconAnimTimer = CFSEmailUiGenericTimer::NewL(this, CActive::EPriorityLow); |
|
379 |
337 // this includes a wait note where code running will be pending |
380 // this includes a wait note where code running will be pending |
338 // until a certain callback event is received |
381 // until a certain callback event is received |
339 // -> thus keep this last in this method! |
382 // -> thus keep this last in this method! |
340 iWizardObserver->DoWizardStartupActionsL(); |
383 iWizardObserver->DoWizardStartupActionsL(); |
341 |
384 } |
342 iExitGuardian = CEUiExitGuardian::NewL( *this ); |
|
343 |
|
344 iConnectionStatusVisible = ETrue; |
|
345 // Create custom statuspane indicators object, which shows priority and followup flags |
|
346 CreateStatusPaneIndicatorsL(); |
|
347 iConnectionStatusIconAnimTimer = CFSEmailUiGenericTimer::NewL(this, CActive::EPriorityLow); |
|
348 iFocusTimer = CPeriodic::New(CActive::EPriorityIdle); |
|
349 } |
|
350 |
385 |
351 // Functions loads some views as delayed to reduce startup time |
386 // Functions loads some views as delayed to reduce startup time |
352 TInt CFreestyleEmailUiAppUi::ViewLoadIdleCallbackFunctionL() |
387 TInt CFreestyleEmailUiAppUi::ViewLoadIdleCallbackFunctionL() |
353 { |
388 { |
354 FUNC_LOG; |
389 FUNC_LOG; |
490 TFsEmailUiUtility::DeleteStaticData(); |
525 TFsEmailUiUtility::DeleteStaticData(); |
491 |
526 |
492 // destroys the Download Information mediator |
527 // destroys the Download Information mediator |
493 // Destruction must be done here as other Tls data depends on it. |
528 // Destruction must be done here as other Tls data depends on it. |
494 CFSEmailDownloadInfoMediator::Destroy(); |
529 CFSEmailDownloadInfoMediator::Destroy(); |
495 |
530 |
496 delete iNaviDecorator2MailViewer; |
531 delete iNaviDecorator2MailViewer; |
497 |
532 |
498 delete iConnectionStatusIconAnimTimer; |
533 delete iConnectionStatusIconAnimTimer; |
499 |
|
500 if (iFocusTimer) |
|
501 { |
|
502 CancelFocusRemovalTimer(); |
|
503 delete iFocusTimer; |
|
504 } |
|
505 |
|
506 } |
534 } |
507 |
535 |
508 |
536 |
509 void CFreestyleEmailUiAppUi::EnterFsEmailViewL( TUid aViewId ) |
537 void CFreestyleEmailUiAppUi::EnterFsEmailViewL( TUid aViewId ) |
510 { |
538 { |
588 void CFreestyleEmailUiAppUi::ReturnFromPluginSettingsView() |
616 void CFreestyleEmailUiAppUi::ReturnFromPluginSettingsView() |
589 { |
617 { |
590 FUNC_LOG; |
618 FUNC_LOG; |
591 // Check if we just returned from a plugin settings view. In that case, the current active view |
619 // Check if we just returned from a plugin settings view. In that case, the current active view |
592 // and view history must be updated here (because RetrunToPreviousViewL() has not been used). |
620 // and view history must be updated here (because RetrunToPreviousViewL() has not been used). |
593 if ( iSettingsViewActive ) |
621 if ( iSettingsViewActive ) |
594 { |
622 { |
595 iSettingsViewActive = EFalse; |
623 iSettingsViewActive = EFalse; |
596 |
624 |
597 // Set the iCurrentActiveView pointer |
625 // Set the iCurrentActiveView pointer |
598 if ( iNavigationHistory->IsEmpty() ) |
626 if ( iNavigationHistory->IsEmpty() ) |
599 { |
627 { |
600 // Activate grid view if the view history stack is empty. This happens only |
628 // Activate grid view if the view history stack is empty. This happens only |
601 // if something has gone wrong. |
629 // if something has gone wrong. |
660 FUNC_LOG; |
688 FUNC_LOG; |
661 if ( aMessageWasDeleted ) |
689 if ( aMessageWasDeleted ) |
662 { |
690 { |
663 // Message deleted, remove mail viewer from the stack |
691 // Message deleted, remove mail viewer from the stack |
664 // => view returns directly mail list (or any other view where the viewer was started from) |
692 // => view returns directly mail list (or any other view where the viewer was started from) |
665 |
693 |
666 TMailListActivationData tmp; |
694 TMailListActivationData tmp; |
667 tmp.iRequestRefresh = ETrue; |
695 tmp.iRequestRefresh = ETrue; |
668 const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
696 const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
669 ReturnToPreviousViewL(pkgOut); |
697 ReturnToPreviousViewL(pkgOut); |
670 } |
698 } |
810 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
838 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
811 iFolderListControlGroup->SetAcceptInput( ETrue ); |
839 iFolderListControlGroup->SetAcceptInput( ETrue ); |
812 } |
840 } |
813 |
841 |
814 void CFreestyleEmailUiAppUi::ShowSortListInPopupL( |
842 void CFreestyleEmailUiAppUi::ShowSortListInPopupL( |
815 const TFSMailSortField aCurrentSortOrder, |
843 const TFSMailSortCriteria aCurrentSortCriteria, |
816 const TFSFolderType aFolderType, |
844 const TFSFolderType aFolderType, |
817 MFSEmailUiSortListCallback* aCallback, |
845 MFSEmailUiSortListCallback* aCallback, |
818 MFsControlButtonInterface* aButton ) |
846 MFsControlButtonInterface* aButton ) |
819 { |
847 { |
820 FUNC_LOG; |
848 FUNC_LOG; |
821 iFolderListVisualiser->ShowSortListPopupL( aCurrentSortOrder, aFolderType, aCallback, aButton ); |
849 iFolderListVisualiser->ShowSortListPopupL( aCurrentSortCriteria, aFolderType, aCallback, aButton ); |
822 |
850 |
823 iCurrentActiveView->ControlGroup().SetAcceptInput( EFalse ); |
851 iCurrentActiveView->ControlGroup().SetAcceptInput( EFalse ); |
824 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
852 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
825 iFolderListControlGroup->SetAcceptInput( ETrue ); |
853 iFolderListControlGroup->SetAcceptInput( ETrue ); |
826 } |
854 } |
834 } |
862 } |
835 |
863 |
836 void CFreestyleEmailUiAppUi::ProcessCommandL( TInt aCommand ) |
864 void CFreestyleEmailUiAppUi::ProcessCommandL( TInt aCommand ) |
837 { |
865 { |
838 FUNC_LOG; |
866 FUNC_LOG; |
839 |
867 |
840 // For a reason unknown compose view propagates a leave when the options |
868 // For a reason unknown compose view propagates a leave when the options |
841 // menu open -command is sent to it during the time when it has started |
869 // menu open -command is sent to it during the time when it has started |
842 // the view deactivation but not yet completed that. It causes unnecessay |
870 // the view deactivation but not yet completed that. It causes unnecessay |
843 // leave notes in a complete normal use cases in the emulator. To remove |
871 // leave notes in a complete normal use cases in the emulator. To remove |
844 // the notes but keep the regression risk at minimum (ie. not do any major |
872 // the notes but keep the regression risk at minimum (ie. not do any major |
845 // refactoring) trap the leave here. Propagate other leaves normally. |
873 // refactoring) trap the leave here. Propagate other leaves normally. |
846 TRAPD( err, CAknViewAppUi::ProcessCommandL( aCommand ) ); |
874 TRAPD( err, CAknViewAppUi::ProcessCommandL( aCommand ) ); |
847 |
875 |
848 if ( err != KErrNcsComposeViewNotReady ) |
876 if ( err != KErrNcsComposeViewNotReady ) |
849 { |
877 { |
850 User::LeaveIfError( err ); |
878 User::LeaveIfError( err ); |
851 } |
879 } |
852 } |
880 } |
897 // was already destoyed in this phase. Here in Exit() MailClient->Close |
925 // was already destoyed in this phase. Here in Exit() MailClient->Close |
898 // can finish safely before the environment gets destroyed. |
926 // can finish safely before the environment gets destroyed. |
899 |
927 |
900 // First, prepare viewer, search list and composer for exit, destroys mailbox object before |
928 // First, prepare viewer, search list and composer for exit, destroys mailbox object before |
901 // This exit preparation should be moved to base class in the future. |
929 // This exit preparation should be moved to base class in the future. |
902 if ( iMsgDetailsVisualiser ) |
930 if ( iMsgDetailsVisualiser ) |
903 { |
931 { |
904 iMsgDetailsVisualiser->PrepareForExit(); |
932 iMsgDetailsVisualiser->PrepareForExit(); |
905 } |
933 } |
906 if ( iMailListVisualiser ) |
934 if ( iMailListVisualiser ) |
907 { |
935 { |
1040 FUNC_LOG; |
1068 FUNC_LOG; |
1041 #ifndef KAknFullOrPartialForegroundGained |
1069 #ifndef KAknFullOrPartialForegroundGained |
1042 const TInt KAknFullOrPartialForegroundGained = 0x10281F36; |
1070 const TInt KAknFullOrPartialForegroundGained = 0x10281F36; |
1043 const TInt KAknFullOrPartialForegroundLost = 0x10281F37; |
1071 const TInt KAknFullOrPartialForegroundLost = 0x10281F37; |
1044 #endif |
1072 #endif |
1045 |
1073 |
1046 TBool closeMenu = EFalse; |
1074 TBool closeMenu = EFalse; |
1047 |
1075 |
1048 // Let folder list visualizer to handle event first because if the popup |
1076 // Let folder list visualizer to handle event first because if the popup |
1049 // is showed, that needs to be closed when pointer click happens outside of the |
1077 // is showed, that needs to be closed when pointer click happens outside of the |
1050 // popup rect and also following pointer up event has to be consumed |
1078 // popup rect and also following pointer up event has to be consumed |
1051 if ( iFolderListVisualiser && iFolderListVisualiser->HandleWsEventL( aEvent ) ) |
1079 if ( iFolderListVisualiser && iFolderListVisualiser->HandleWsEventL( aEvent ) ) |
1052 { |
1080 { |
1053 return; |
1081 return; |
1054 } |
1082 } |
1055 |
1083 |
1056 TInt key = aEvent.Key()->iScanCode; |
1084 TInt key = aEvent.Key()->iScanCode; |
1057 // <cmail> |
1085 // <cmail> |
1058 // to disable voice commands during creating new mail message |
1086 // to disable voice commands during creating new mail message |
1059 if (EStdKeyYes == key && aEvent.Type() == EEventKeyDown && iCurrentActiveView == iComposeView ) |
1087 if (EStdKeyYes == key && aEvent.Type() == EEventKeyDown && iCurrentActiveView == iComposeView ) |
1060 { |
1088 { |
1487 void CFreestyleEmailUiAppUi::SetActiveMailboxL( TFSMailMsgId aActiveMailboxId, TBool aAutoSync ) |
1515 void CFreestyleEmailUiAppUi::SetActiveMailboxL( TFSMailMsgId aActiveMailboxId, TBool aAutoSync ) |
1488 { |
1516 { |
1489 FUNC_LOG; |
1517 FUNC_LOG; |
1490 // Set flag |
1518 // Set flag |
1491 iAutomatedMailBoxOnline = EFalse; |
1519 iAutomatedMailBoxOnline = EFalse; |
1492 |
1520 |
1493 // Try to get the mailbox |
1521 // Try to get the mailbox |
1494 CFSMailBox* newActiveBox = iMailClient->GetMailBoxByUidL( aActiveMailboxId ); |
1522 CFSMailBox* newActiveBox = iMailClient->GetMailBoxByUidL( aActiveMailboxId ); |
1495 User::LeaveIfNull( newActiveBox ); |
1523 User::LeaveIfNull( newActiveBox ); |
1496 |
1524 |
1497 // Replace active mailbox of the application if getting the mailbox was succesful |
1525 // Replace active mailbox of the application if getting the mailbox was succesful |
1498 delete iActiveMailbox; |
1526 delete iActiveMailbox; |
1499 iActiveMailbox = newActiveBox; |
1527 iActiveMailbox = newActiveBox; |
1500 |
1528 |
1501 iActiveMailboxId = iActiveMailbox->GetId(); |
1529 iActiveMailboxId = iActiveMailbox->GetId(); |
1502 iActiveBoxInboxId = iActiveMailbox->GetStandardFolderId( EFSInbox ); |
1530 iActiveBoxInboxId = iActiveMailbox->GetStandardFolderId( EFSInbox ); |
1503 |
1531 |
1504 SubscribeMailboxL( iActiveMailboxId ); |
1532 SubscribeMailboxL( iActiveMailboxId ); |
1505 |
1533 |
1506 // Start connect automatically if asked by the caller |
1534 // Start connect automatically if asked by the caller |
1507 // Disabled if offline or roaming |
1535 // Disabled if offline or roaming |
1565 } |
1593 } |
1566 |
1594 |
1567 TBool CFreestyleEmailUiAppUi::MessageReaderSupportsFreestyle() |
1595 TBool CFreestyleEmailUiAppUi::MessageReaderSupportsFreestyle() |
1568 { |
1596 { |
1569 FUNC_LOG; |
1597 FUNC_LOG; |
1570 // Check availability of Reader if necessary. Msg reader cannot be installed |
1598 // Check availability of Reader if necessary. Msg reader cannot be installed |
1571 // from sisx so checking is done only once. KErrGeneral at startup. |
1599 // from sisx so checking is done only once. KErrGeneral at startup. |
1572 if ( iMsgReaderIsSupported == KErrGeneral ) |
1600 if ( iMsgReaderIsSupported == KErrGeneral ) |
1573 { |
1601 { |
1574 RLibrary freestyleMessageScannerLibrary; |
1602 RLibrary freestyleMessageScannerLibrary; |
1575 TUidType uidType( KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid( 0x10281C61 ) ); |
1603 TUidType uidType( KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid( 0x10281C61 ) ); |
1842 //If syncs were started by user, show the synchoronisation indicator |
1870 //If syncs were started by user, show the synchoronisation indicator |
1843 if(iManualMailBoxSyncAll) |
1871 if(iManualMailBoxSyncAll) |
1844 { |
1872 { |
1845 ManualMailBoxSyncAll(EFalse); |
1873 ManualMailBoxSyncAll(EFalse); |
1846 } |
1874 } |
1847 else if (iManualMailBoxSync) |
|
1848 { |
|
1849 TDesC* mbName(0); |
|
1850 CFSMailBox* mb = GetActiveMailbox(); |
|
1851 if ( mb ) |
|
1852 { |
|
1853 mbName = &mb->GetName(); |
|
1854 } |
|
1855 } |
|
1856 } |
1875 } |
1857 break; |
1876 break; |
1858 case SyncError: |
1877 case SyncError: |
1859 { |
1878 { |
1860 // error occured during "Connect" or "Send and receive" operation |
1879 // error occured during "Connect" or "Send and receive" operation |
1861 // check if user needs to be notified |
1880 // check if user needs to be notified |
1862 if ( iManualMailBoxSync ) |
1881 if ( iManualMailBoxSync ) |
1868 infoNote->ExecuteLD( *text ); |
1887 infoNote->ExecuteLD( *text ); |
1869 CleanupStack::PopAndDestroy( text ); |
1888 CleanupStack::PopAndDestroy( text ); |
1870 ManualMailBoxSync( EFalse ); |
1889 ManualMailBoxSync( EFalse ); |
1871 } |
1890 } |
1872 } |
1891 } |
1873 break; |
1892 break; |
1874 case FinishedSuccessfully: |
1893 case FinishedSuccessfully: |
1875 case SyncCancelled: |
1894 case SyncCancelled: |
1876 case Idle: |
1895 case Idle: |
1877 { |
1896 { |
1878 ManualMailBoxSync( EFalse ); |
1897 ManualMailBoxSync( EFalse ); |
1879 } |
1898 } |
1880 break; |
1899 break; |
1881 |
1900 |
1882 case PushChannelOffBecauseBatteryIsLow: |
1901 case PushChannelOffBecauseBatteryIsLow: |
1883 { |
1902 { |
1884 CFSMailBox* mb = iMailClient->GetMailBoxByUidL( aMailbox ); |
|
1885 CleanupStack::PushL( mb ); |
|
1886 TDesC* mbName = &mb->GetName(); |
|
1887 CleanupStack::PopAndDestroy( mb ); |
|
1888 } |
1903 } |
1889 break; |
1904 break; |
1890 } //switch |
1905 } //switch |
1891 } |
1906 } |
1892 UpdateTitlePaneConnectionStatus(); |
1907 UpdateTitlePaneConnectionStatus(); |
2191 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
2218 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
2192 { |
2219 { |
2193 CAknTitlePane* titlePane = NULL; |
2220 CAknTitlePane* titlePane = NULL; |
2194 TRAP_IGNORE( titlePane = |
2221 TRAP_IGNORE( titlePane = |
2195 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
2222 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
2196 |
2223 |
2197 // Set connection icon |
2224 // Set connection icon |
2198 iConnectionStatusIconAnimTimer->Stop(); |
2225 iConnectionStatusIconAnimTimer->Stop(); |
2199 iConnectionIconBitmap = 0; |
2226 iConnectionIconBitmap = 0; |
2200 iConnectionIconMask = 0; |
2227 iConnectionIconMask = 0; |
2201 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
2228 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
2215 } |
2242 } |
2216 else |
2243 else |
2217 { |
2244 { |
2218 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
2245 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
2219 EStatusTextureConnected, iConnectionIconBitmap, iConnectionIconMask ) ); |
2246 EStatusTextureConnected, iConnectionIconBitmap, iConnectionIconMask ) ); |
2220 } |
2247 } |
2221 } |
2248 } |
2222 else // EFSMailBoxOffline |
2249 else // EFSMailBoxOffline |
2223 { |
2250 { |
2224 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
2251 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
2225 EStatusTextureDisconnectedGeneral, iConnectionIconBitmap, iConnectionIconMask ) ); |
2252 EStatusTextureDisconnectedGeneral, iConnectionIconBitmap, iConnectionIconMask ) ); |
2226 } |
2253 } |
2227 |
2254 |
2228 if ( iConnectionIconBitmap ) |
2255 if ( iConnectionIconBitmap ) |
2229 { |
2256 { |
2230 AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved ); |
2257 AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved ); |
2231 } |
2258 } |
2232 titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconMask && iConnectionIconBitmap ); |
2259 titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconMask && iConnectionIconBitmap ); |
2489 TApaTaskList taskList( iEikonEnv->WsSession() ); |
2516 TApaTaskList taskList( iEikonEnv->WsSession() ); |
2490 TApaTask task = taskList.FindApp( KFSEmailUiUid ); |
2517 TApaTask task = taskList.FindApp( KFSEmailUiUid ); |
2491 if ( task.Exists() ) |
2518 if ( task.Exists() ) |
2492 { |
2519 { |
2493 // Send self to background |
2520 // Send self to background |
2494 task.SendToBackground(); |
2521 task.SendToBackground(); |
2495 } |
2522 } |
2496 |
2523 |
2497 iSwitchingToBackground = EFalse; |
2524 iSwitchingToBackground = EFalse; |
2498 } |
2525 } |
2499 |
2526 |
2500 // ----------------------------------------------------------------------------- |
2527 // ----------------------------------------------------------------------------- |
2501 // |
2528 // |
2502 // ----------------------------------------------------------------------------- |
2529 // ----------------------------------------------------------------------------- |
2503 void CFreestyleEmailUiAppUi::ConstructNaviPaneL() |
2530 void CFreestyleEmailUiAppUi::ConstructNaviPaneL() |
2504 { |
2531 { |
2505 FUNC_LOG; |
2532 FUNC_LOG; |
2506 |
2533 |
2507 CAknNavigationControlContainer* naviPaneContainer = |
2534 CAknNavigationControlContainer* naviPaneContainer = |
2508 static_cast<CAknNavigationControlContainer*>( |
2535 static_cast<CAknNavigationControlContainer*>( |
2509 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
2536 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
2510 |
2537 |
2511 // Following navipane is for mailviewer view |
2538 // Following navipane is for mailviewer view |
2512 if ( !iNaviDecorator2MailViewer ) |
2539 if ( !iNaviDecorator2MailViewer ) |
2513 { |
2540 { |
2514 // Constructing a decorator with own decorated control, |
2541 // Constructing a decorator with own decorated control, |
2515 // which is (currently an empty) container. |
2542 // which is (currently an empty) container. |
2516 CFreestyleEmailUiNaviPaneControlContainer2MailViewer* c = |
2543 CFreestyleEmailUiNaviPaneControlContainer2MailViewer* c = |
2517 CFreestyleEmailUiNaviPaneControlContainer2MailViewer::NewL(); |
2544 CFreestyleEmailUiNaviPaneControlContainer2MailViewer::NewL(); |
2518 c->SetContainerWindowL( *naviPaneContainer ); |
2545 c->SetContainerWindowL( *naviPaneContainer ); |
2519 iNaviDecorator2MailViewer = CAknNavigationDecorator::NewL( |
2546 iNaviDecorator2MailViewer = CAknNavigationDecorator::NewL( |
2520 naviPaneContainer, |
2547 naviPaneContainer, |
2521 c, |
2548 c, |
2522 CAknNavigationDecorator::ENotSpecified ); |
2549 CAknNavigationDecorator::ENotSpecified ); |
2523 |
2550 |
2524 // In order to get navi arrows visible, they must be set visible AND not dimmed... |
2551 // In order to get navi arrows visible, they must be set visible AND not dimmed... |
2525 iNaviDecorator2MailViewer->SetContainerWindowL( *naviPaneContainer ); |
2552 iNaviDecorator2MailViewer->SetContainerWindowL( *naviPaneContainer ); |
2526 iNaviDecorator2MailViewer->MakeScrollButtonVisible( ETrue ); |
2553 iNaviDecorator2MailViewer->MakeScrollButtonVisible( ETrue ); |
2527 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse ); |
2554 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse ); |
2528 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse ); |
2555 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse ); |
2529 |
2556 |
2530 iNaviDecorator2MailViewer->SetComponentsToInheritVisibility( ETrue ); |
2557 iNaviDecorator2MailViewer->SetComponentsToInheritVisibility( ETrue ); |
2531 naviPaneContainer->PushL( *iNaviDecorator2MailViewer ); |
2558 naviPaneContainer->PushL( *iNaviDecorator2MailViewer ); |
2532 } |
2559 } |
2533 } |
2560 } |
2534 |
2561 |
2535 // ----------------------------------------------------------------------------- |
2562 // ----------------------------------------------------------------------------- |
2536 // |
2563 // |
2537 // ----------------------------------------------------------------------------- |
2564 // ----------------------------------------------------------------------------- |
2538 CAknNavigationDecorator* CFreestyleEmailUiAppUi::NaviDecoratorL( const TUid aViewId ) |
2565 CAknNavigationDecorator* CFreestyleEmailUiAppUi::NaviDecoratorL( const TUid aViewId ) |
2539 { |
2566 { |
2540 FUNC_LOG; |
2567 FUNC_LOG; |
2541 CAknNavigationDecorator* decorator( NULL ); |
2568 CAknNavigationDecorator* decorator( NULL ); |
2564 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
2591 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
2565 { |
2592 { |
2566 CAknTitlePane* titlePane = NULL; |
2593 CAknTitlePane* titlePane = NULL; |
2567 TRAP_IGNORE( titlePane = |
2594 TRAP_IGNORE( titlePane = |
2568 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
2595 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
2569 |
2596 |
2570 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
2597 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
2571 iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount; |
2598 iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount; |
2572 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle); |
2599 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle); |
2573 titlePane->DrawNow(); |
2600 titlePane->DrawNow(); |
2574 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval); |
2601 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval); |
2576 } |
2603 } |
2577 } |
2604 } |
2578 } |
2605 } |
2579 |
2606 |
2580 // ----------------------------------------------------------------------------- |
2607 // ----------------------------------------------------------------------------- |
2581 // CFreestyleEmailUiAppUi::CancelFocusRemovalTimer |
2608 // CFreestyleEmailUiAppUi::SetFocusVisibility |
2582 // ----------------------------------------------------------------------------- |
2609 // ----------------------------------------------------------------------------- |
2583 |
2610 |
2584 void CFreestyleEmailUiAppUi::CancelFocusRemovalTimer() |
2611 TBool CFreestyleEmailUiAppUi::SetFocusVisibility( TBool aVisible ) |
2585 { |
2612 { |
2586 TBool wasActive = iFocusTimer->IsActive(); |
2613 FUNC_LOG; |
2587 iFocusTimer->Cancel(); |
2614 TBool oldFocusState( iFocusVisible ); |
2588 |
2615 iFocusVisible = aVisible; |
2589 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
2616 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
2590 if( wasActive && activeView ) |
2617 if ( /*oldFocusState != aVisible &&*/ activeView ) |
2591 { |
2618 { |
2592 activeView->HandleTimerFocusStateChange( EFalse ); |
2619 activeView->FocusVisibilityChange( aVisible ); |
2593 } |
2620 } |
|
2621 // If popup is visible inform it also. |
|
2622 if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() ) |
|
2623 { |
|
2624 iFolderListVisualiser->FocusVisibilityChange( aVisible ); |
|
2625 } |
|
2626 return oldFocusState; |
2594 } |
2627 } |
2595 |
2628 |
2596 // ----------------------------------------------------------------------------- |
2629 // ----------------------------------------------------------------------------- |
2597 // CFreestyleEmailUiAppUi::StartFocusRemovalTimer |
2630 // |
2598 // ----------------------------------------------------------------------------- |
2631 // ----------------------------------------------------------------------------- |
2599 |
2632 TBool CFreestyleEmailUiAppUi::IsFocusShown() const |
2600 TBool CFreestyleEmailUiAppUi::StartFocusRemovalTimer() |
2633 { |
2601 { |
2634 FUNC_LOG; |
2602 TBool wasActive = iFocusTimer->IsActive(); |
2635 return iFocusVisible; |
2603 iFocusTimer->Cancel(); |
2636 } |
2604 // Start the timer and calls FocusTimerCallBack when the timer expires |
2637 |
2605 iFocusTimer->Start(KIdleTimeInterval, KIdleTimeInterval, |
2638 // PUBLIC METHODS FROM MFREESTYLEEMAILUIPROPERTYCHANGEDOBSERVER |
2606 TCallBack(FocusTimerCallBack, this)); |
|
2607 |
|
2608 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
|
2609 if ( !wasActive && activeView ) |
|
2610 { |
|
2611 activeView->HandleTimerFocusStateChange( ETrue ); |
|
2612 } |
|
2613 |
|
2614 return wasActive; |
|
2615 } |
|
2616 |
|
2617 // ----------------------------------------------------------------------------- |
|
2618 // |
|
2619 // ----------------------------------------------------------------------------- |
|
2620 TInt CFreestyleEmailUiAppUi::FocusTimerCallBack(TAny* aAny) |
|
2621 { |
|
2622 CFreestyleEmailUiAppUi* self = |
|
2623 static_cast<CFreestyleEmailUiAppUi*>( aAny ); |
|
2624 |
|
2625 return self->DoFocusTimerCallBack(); |
|
2626 } |
|
2627 // ----------------------------------------------------------------------------- |
|
2628 // |
|
2629 // ----------------------------------------------------------------------------- |
|
2630 TInt CFreestyleEmailUiAppUi::DoFocusTimerCallBack() |
|
2631 { |
|
2632 iFocusTimer->Cancel(); |
|
2633 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
|
2634 |
|
2635 // Call the HandleTimerFocusStateChange of currently active so that it hides |
|
2636 // its focus. |
|
2637 if ( activeView ) |
|
2638 { |
|
2639 activeView->HandleTimerFocusStateChange( EFalse ); |
|
2640 } |
|
2641 |
|
2642 return KErrNone; |
|
2643 } |
|
2644 |
|
2645 // ----------------------------------------------------------------------------- |
|
2646 // |
|
2647 // ----------------------------------------------------------------------------- |
|
2648 TBool CFreestyleEmailUiAppUi::IsTimerFocusShown() const |
|
2649 { |
|
2650 return iFocusTimer->IsActive(); |
|
2651 } |
|
2652 |
|
2653 |
|
2654 // PUBLIC METHODS FROM MFREESTYLEEMAILUIPROPERTYCHANGEDOBSERVER |
|
2655 |
2639 |
2656 // ----------------------------------------------------------------------------- |
2640 // ----------------------------------------------------------------------------- |
2657 // From MFreestyleEmailUiPropertyChangedObserver. |
2641 // From MFreestyleEmailUiPropertyChangedObserver. |
2658 // ----------------------------------------------------------------------------- |
2642 // ----------------------------------------------------------------------------- |
2659 // |
2643 // |