emailuis/emailui/src/FreestyleEmailUiAppui.cpp
changeset 2 5253a20d2a1e
parent 1 12c456ceeff2
child 3 a4d6f1ea0416
equal deleted inserted replaced
1:12c456ceeff2 2:5253a20d2a1e
   174 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   175 // Load specified resource file, file name may (and should) contain wild cards
   175 // Load specified resource file, file name may (and should) contain wild cards
   176 // ---------------------------------------------------------------------------
   176 // ---------------------------------------------------------------------------
   177 //
   177 //
   178 TInt CFreestyleEmailUiAppUi::LoadResourceFileL(
   178 TInt CFreestyleEmailUiAppUi::LoadResourceFileL(
   179     const TDesC& aFileName, 
   179     const TDesC& aFileName,
   180     const TDesC& aFilePath )
   180     const TDesC& aFilePath )
   181     {
   181     {
   182     FUNC_LOG;
   182     FUNC_LOG;
   183 
   183 
   184     TFindFile search( iCoeEnv->FsSession() );
   184     TFindFile search( iCoeEnv->FsSession() );
   194             TParse parse;
   194             TParse parse;
   195             parse.Set( (*dirList)[0].iName, &search.File(), NULL );
   195             parse.Set( (*dirList)[0].iName, &search.File(), NULL );
   196             TFileName nearestFile( parse.FullName() );
   196             TFileName nearestFile( parse.FullName() );
   197             BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), nearestFile );
   197             BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), nearestFile );
   198             delete dirList;
   198             delete dirList;
   199             
   199 
   200             INFO_1( "Load resource: %S", &nearestFile );
   200             INFO_1( "Load resource: %S", &nearestFile );
   201             // Return the resource file offset if file loaded succesfully
   201             // Return the resource file offset if file loaded succesfully
   202             return iEikonEnv->AddResourceFileL( nearestFile );
   202             return iEikonEnv->AddResourceFileL( nearestFile );
   203             }
   203             }
   204         delete dirList;
   204         delete dirList;
   205         }
   205         }
   206 	
   206 
   207     // Leave if resource file is not found
   207     // Leave if resource file is not found
   208     User::Leave( err );
   208     User::Leave( err );
   209     return 0; // To avoid compiler warnings
   209     return 0; // To avoid compiler warnings
   210     }
   210     }
   211     
   211 
   212 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   213 // ConstructL is called by the application framework
   213 // ConstructL is called by the application framework
   214 // ---------------------------------------------------------------------------
   214 // ---------------------------------------------------------------------------
   215 //
   215 //
   216 void CFreestyleEmailUiAppUi::ConstructL()
   216 void CFreestyleEmailUiAppUi::ConstructL()
   219 
   219 
   220     // Load message editor resources (needed for ENote fetch)
   220     // Load message editor resources (needed for ENote fetch)
   221     iMsgEditorResourceOffset = LoadResourceFileL(
   221     iMsgEditorResourceOffset = LoadResourceFileL(
   222                                    KMsgEditorAppUiResourceFileName,
   222                                    KMsgEditorAppUiResourceFileName,
   223                                    KDC_RESOURCE_FILES_DIR );
   223                                    KDC_RESOURCE_FILES_DIR );
   224     
   224 
   225     // Load FSMailServer resource file, search first the same drive from where
   225     // Load FSMailServer resource file, search first the same drive from where
   226     // our process is loaded as FSMailServer should be installed in same drive
   226     // our process is loaded as FSMailServer should be installed in same drive
   227     RProcess ownProcess;
   227     RProcess ownProcess;
   228     TFileName ownProcessName( ownProcess.FileName() );
   228     TFileName ownProcessName( ownProcess.FileName() );
   229     ownProcess.Close();
   229     ownProcess.Close();
   230     iFSMailServerResourceOffset = LoadResourceFileL(
   230     iFSMailServerResourceOffset = LoadResourceFileL(
   231                                       KFSMailServerResourceFileNameWithPath,
   231                                       KFSMailServerResourceFileNameWithPath,
   232                                       ownProcessName.LeftTPtr( KDriveDescLength ) );
   232                                       ownProcessName.LeftTPtr( KDriveDescLength ) );
   233     
   233 
   234 	// flag indicating whether we are in AppUi::ConstructL
   234 	// flag indicating whether we are in AppUi::ConstructL
   235 	// workaround for compose view loadbackgroundcontext sending skin changed events
   235 	// workaround for compose view loadbackgroundcontext sending skin changed events
   236 	// and causing texture manager to be reconstructed many times
   236 	// and causing texture manager to be reconstructed many times
   237 	iConstructComplete = EFalse;
   237 	iConstructComplete = EFalse;
   238 
   238 
  1118         }
  1118         }
  1119 
  1119 
  1120     switch ( aEvent.Type() )
  1120     switch ( aEvent.Type() )
  1121         {
  1121         {
  1122         case KAknFullOrPartialForegroundLost:
  1122         case KAknFullOrPartialForegroundLost:
       
  1123             {
       
  1124             if( iCurrentActiveView )
       
  1125                 {
       
  1126                 iCurrentActiveView->HandleAppForegroundEventL( EFalse );
       
  1127                 }
  1123             break;
  1128             break;
       
  1129             }
  1124         case KAknFullOrPartialForegroundGained:
  1130         case KAknFullOrPartialForegroundGained:
  1125             {
  1131             {
  1126             if ( iCurrentActiveView && !iSettingsViewActive )
  1132             if ( iCurrentActiveView && !iSettingsViewActive )
  1127                 {
  1133                 {
  1128                 iCurrentActiveView->HandleAppForegroundEventL( ETrue );
  1134                 iCurrentActiveView->HandleAppForegroundEventL( ETrue );
  2067 	    {
  2073 	    {
  2068 	    iNavigationHistory->Head()->MoveToPreviousMsgL( aCurrentMsgId, aFoundPreviousMsgId );
  2074 	    iNavigationHistory->Head()->MoveToPreviousMsgL( aCurrentMsgId, aFoundPreviousMsgId );
  2069 	    }
  2075 	    }
  2070 	return ret;
  2076 	return ret;
  2071 	}
  2077 	}
  2072 	
  2078 
  2073 // Move to previous message when the current message is deleted in viewer
  2079 // Move to previous message when the current message is deleted in viewer
  2074 TInt CFreestyleEmailUiAppUi::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId )
  2080 TInt CFreestyleEmailUiAppUi::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId )
  2075 	{
  2081 	{
  2076 	FUNC_LOG;
  2082 	FUNC_LOG;
  2077 	TInt ret(KErrNotFound);
  2083 	TInt ret(KErrNotFound);
  2078 	if ( !iNavigationHistory->IsEmpty() )
  2084 	if ( !iNavigationHistory->IsEmpty() )
  2079 		{
  2085 		{
  2080 		iNavigationHistory->Head()->MoveToPreviousMsgAfterDeleteL( aFoundPreviousMsgId );
  2086 		iNavigationHistory->Head()->MoveToPreviousMsgAfterDeleteL( aFoundPreviousMsgId );
  2081 		}
  2087 		}
  2082 	return ret;		
  2088 	return ret;
  2083 	}
  2089 	}
  2084 	
  2090 
  2085 CDocumentHandler& CFreestyleEmailUiAppUi::DocumentHandler()
  2091 CDocumentHandler& CFreestyleEmailUiAppUi::DocumentHandler()
  2086 	{
  2092 	{
  2087     FUNC_LOG;
  2093     FUNC_LOG;
  2088 	return *iDocumentHandler;
  2094 	return *iDocumentHandler;
  2089 	}
  2095 	}
  2612 	{
  2618 	{
  2613 	FUNC_LOG;
  2619 	FUNC_LOG;
  2614 	TBool oldFocusState( iFocusVisible );
  2620 	TBool oldFocusState( iFocusVisible );
  2615 	iFocusVisible = aVisible;
  2621 	iFocusVisible = aVisible;
  2616 	CFsEmailUiViewBase* activeView = CurrentActiveView();
  2622 	CFsEmailUiViewBase* activeView = CurrentActiveView();
  2617 	if ( /*oldFocusState != aVisible &&*/ activeView )
  2623 	if ( activeView )
  2618 		{
  2624 		{
  2619 		activeView->FocusVisibilityChange( aVisible );
  2625 		activeView->FocusVisibilityChange( aVisible );
  2620 		}
  2626 		}
  2621 	// If popup is visible inform it also.
  2627 	// If popup is visible inform it also.
  2622 	if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() )
  2628 	if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() )