emailuis/emailui/src/FreestyleEmailUiAppui.cpp
branchRCL_3
changeset 23 dcf0eedfc1a3
parent 22 d620048b4810
equal deleted inserted replaced
22:d620048b4810 23:dcf0eedfc1a3
    88 #include <data_caging_path_literals.hrh> // hardcoded paths removal from cmail
    88 #include <data_caging_path_literals.hrh> // hardcoded paths removal from cmail
    89 #include "cfsccontactactionmenu.h"
    89 #include "cfsccontactactionmenu.h"
    90 //</cmail>
    90 //</cmail>
    91 #include <layoutmetadata.cdl.h>         // for Layout_Meta_Data
    91 #include <layoutmetadata.cdl.h>         // for Layout_Meta_Data
    92 
    92 
       
    93 #include <AknPriv.hrh>
       
    94 #include "freestyleemailcenrepkeys.h"
       
    95 #include <centralrepository.h>
       
    96 
    93 // INTERNAL INCLUDE FILES
    97 // INTERNAL INCLUDE FILES
    94 #include "FreestyleEmailUiContactHandler.h"
    98 #include "FreestyleEmailUiContactHandler.h"
    95 #include "FreestyleEmailUiAppui.h"
    99 #include "FreestyleEmailUiAppui.h"
    96 #include "FreestyleEmailUi.hrh"
   100 #include "FreestyleEmailUi.hrh"
    97 #include "FreestyleEmailUiLauncherGrid.h"
   101 #include "FreestyleEmailUiLauncherGrid.h"
   369     iPreviousAppEmbedded( EFalse ),
   373     iPreviousAppEmbedded( EFalse ),
   370     iEditorStartedFromEmbeddedApp( EFalse )
   374     iEditorStartedFromEmbeddedApp( EFalse )
   371     {
   375     {
   372     FUNC_LOG;
   376     FUNC_LOG;
   373     iEnv = &aEnv;
   377     iEnv = &aEnv;
       
   378     iHtmlViewerViewId = TUid::Null();
   374     TIMESTAMP( "Application starting" );
   379     TIMESTAMP( "Application starting" );
   375     }
   380     }
   376 
   381 
   377 // ---------------------------------------------------------------------------
   382 // ---------------------------------------------------------------------------
   378 // Load specified resource file, file name may (and should) contain wild cards
   383 // Load specified resource file, file name may (and should) contain wild cards
   541 
   546 
   542     // Create html viewer
   547     // Create html viewer
   543     iHtmlViewerControlGroup = &iEnv->NewControlGroupL( KHtmlViewerDisplayGroup );
   548     iHtmlViewerControlGroup = &iEnv->NewControlGroupL( KHtmlViewerDisplayGroup );
   544     iHtmlViewerView = CFsEmailUiHtmlViewerView::NewL( *iEnv, *this, *iHtmlViewerControlGroup );
   549     iHtmlViewerView = CFsEmailUiHtmlViewerView::NewL( *iEnv, *this, *iHtmlViewerControlGroup );
   545     AddViewL( iHtmlViewerView );
   550     AddViewL( iHtmlViewerView );
       
   551     iHtmlViewerViewId = iHtmlViewerView->Id(); 
   546 
   552 
   547 	// Create mail list
   553 	// Create mail list
   548     iMailListVisualiser = CFSEmailUiMailListVisualiser::NewL(*iEnv, this, *iMailListControlGroup );
   554     iMailListVisualiser = CFSEmailUiMailListVisualiser::NewL(*iEnv, this, *iMailListControlGroup );
   549  	AddViewL( iMailListVisualiser );
   555  	AddViewL( iMailListVisualiser );
   550 
   556 
   734  		delete disp;
   740  		delete disp;
   735  		}
   741  		}
   736 
   742 
   737  	TFsEmailUiUtility::DeleteStaticData();
   743  	TFsEmailUiUtility::DeleteStaticData();
   738 
   744 
       
   745 	// Cannot rely on framework to delete HTMLVierView as it de-registers from CFSEmailDownloadInfoMediator
       
   746 	RemoveView(iHtmlViewerViewId);
   739     // destroys the Download Information mediator
   747     // destroys the Download Information mediator
   740     // Destruction must be done here as other Tls data depends on it.
   748     // Destruction must be done here as other Tls data depends on it.
   741     CFSEmailDownloadInfoMediator::Destroy();
   749     CFSEmailDownloadInfoMediator::Destroy();
   742 
   750 
   743     delete iNaviDecorator2MailViewer;
   751     delete iNaviDecorator2MailViewer;
   851         // Set the iCurrentActiveView pointer
   859         // Set the iCurrentActiveView pointer
   852         if ( iNavigationHistory->IsEmpty() )
   860         if ( iNavigationHistory->IsEmpty() )
   853             {
   861             {
   854             // Activate grid view if the view history stack is empty. This happens only
   862             // Activate grid view if the view history stack is empty. This happens only
   855             // if something has gone wrong.
   863             // if something has gone wrong.
       
   864             // Note that the grid view may need to be re-drawn, e.g. if the
       
   865             // current orientation is different from the last time it was
       
   866             // displayed.  This is because it will not have received dynamic
       
   867             // variant switch notifications while it was not in the history.
   856             iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
   868             iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
       
   869             iMainUiGridVisualiser->SetRefreshNeeded();
   857             }
   870             }
   858         else
   871         else
   859             {
   872             {
   860             iCurrentActiveView = iNavigationHistory->Pop();
   873             iCurrentActiveView = iNavigationHistory->Pop();
   861             }
   874             }
   879         }
   892         }
   880 
   893 
   881     // Do nothing if the externally activated view was already active
   894     // Do nothing if the externally activated view was already active
   882     if ( iCurrentActiveView->Id() != aViewId )
   895     if ( iCurrentActiveView->Id() != aViewId )
   883         {
   896         {
       
   897         // this function removes setting view from view stack so 
       
   898         // it cannot be active any more
       
   899         iSettingsViewActive = EFalse;
       
   900         
   884         iPreviousActiveView = iCurrentActiveView;
   901         iPreviousActiveView = iCurrentActiveView;
   885 
   902 
   886         // Check if the view is in the history stack. In that case, we don't
   903         // Check if the view is in the history stack. In that case, we don't
   887         // actually navigate forward but backward.
   904         // actually navigate forward but backward.
   888         if ( IsViewInHistoryStack( aViewId ) )
   905         if ( IsViewInHistoryStack( aViewId ) )
   945     // Set the iCurrentActiveView pointer
   962     // Set the iCurrentActiveView pointer
   946     if ( iNavigationHistory->IsEmpty() )
   963     if ( iNavigationHistory->IsEmpty() )
   947         {
   964         {
   948         // Activate grid view if the view history stack is empty. This happens only
   965         // Activate grid view if the view history stack is empty. This happens only
   949         // if something has gone wrong.
   966         // if something has gone wrong.
       
   967         // Note that the grid view may need to be re-drawn, e.g. if the
       
   968         // current orientation is different from the last time it was
       
   969         // displayed.  This is because it will not have received dynamic
       
   970         // variant switch notifications while it was not in the history.
   950         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
   971         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
       
   972         iMainUiGridVisualiser->SetRefreshNeeded();
   951         }
   973         }
   952     else
   974     else
   953         {
   975         {
   954         iCurrentActiveView = iNavigationHistory->Pop();
   976         iCurrentActiveView = iNavigationHistory->Pop();
   955         }
   977         }
  1044         {
  1066         {
  1045         iCurrentActiveView = iNavigationHistory->Pop();
  1067         iCurrentActiveView = iNavigationHistory->Pop();
  1046         }
  1068         }
  1047 
  1069 
  1048     // Return to grid in case the desired view was not found
  1070     // Return to grid in case the desired view was not found
  1049     if ( iCurrentActiveView->Id() != aViewId )
  1071     if ( iCurrentActiveView->Id() != aViewId && iCurrentActiveView->Id() != AppGridId )
  1050         {
  1072         {
       
  1073         // For some reason the launcher grid wasn't at the bottom of the
       
  1074         // stack.  Activate it now, but also tell it to refresh itself in
       
  1075         // case it wasn't in the stack at all and missed (e.g.) an
       
  1076         // orientation change notification.
  1051         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
  1077         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
       
  1078         iMainUiGridVisualiser->SetRefreshNeeded();
  1052         }
  1079         }
  1053 
  1080 
  1054     if ( aCustomMessageId != TUid::Null() || aCustomMessage.Length() )
  1081     if ( aCustomMessageId != TUid::Null() || aCustomMessage.Length() )
  1055         {
  1082         {
  1056         ActivateLocalViewL( iCurrentActiveView->Id(), aCustomMessageId, aCustomMessage );
  1083         ActivateLocalViewL( iCurrentActiveView->Id(), aCustomMessageId, aCustomMessage );
  1316 
  1343 
  1317     if (aEvent.Type() == EEventPointer)
  1344     if (aEvent.Type() == EEventPointer)
  1318         {
  1345         {
  1319         TAdvancedPointerEvent* pointerEvent(aEvent.Pointer());
  1346         TAdvancedPointerEvent* pointerEvent(aEvent.Pointer());
  1320         iLastPointerPosition = pointerEvent->iParentPosition;
  1347         iLastPointerPosition = pointerEvent->iParentPosition;
  1321         }
  1348         iLastWsEventType = EEventPointer;
  1322 
  1349         }
       
  1350 
       
  1351     if (aEvent.Type() == EEventKey)
       
  1352         {
       
  1353         iLastWsEventType = EEventKey;
       
  1354         }
  1323 	TInt key = aEvent.Key()->iScanCode;
  1355 	TInt key = aEvent.Key()->iScanCode;
  1324     // <cmail>
  1356     // <cmail>
  1325     // to disable voice commands during creating new mail message
  1357     // to disable voice commands during creating new mail message
  1326     if (EStdKeyYes == key && aEvent.Type() == EEventKeyDown  && iCurrentActiveView == iComposeView )
  1358     if (EStdKeyYes == key && aEvent.Type() == EEventKeyDown  && iCurrentActiveView == iComposeView )
  1327 	    {
  1359 	    {
  1463         }
  1495         }
  1464     */
  1496     */
  1465     // </cmail>
  1497     // </cmail>
  1466     CAknAppUi::HandleResourceChangeL( aType );
  1498     CAknAppUi::HandleResourceChangeL( aType );
  1467 
  1499 
       
  1500     if ( aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled ) 
       
  1501         { 
       
  1502         StatusPane()->MakeVisible( aType == KAknSplitInputDisabled );       
       
  1503         if ( iCurrentActiveView != NULL )
       
  1504             {
       
  1505             iCurrentActiveView->HandleStatusPaneSizeChange(); 
       
  1506             } 
       
  1507         }
       
  1508 
  1468     // Refresh mode is changed to manual to avoid any flickering during
  1509     // Refresh mode is changed to manual to avoid any flickering during
  1469     // resource change handling in list views. Trap any leaves so that we set
  1510     // resource change handling in list views. Trap any leaves so that we set
  1470     // the automatic refresh mode back on even in case of error.
  1511     // the automatic refresh mode back on even in case of error.
  1471     iEnv->SetRefreshMode( EAlfRefreshModeManual );
  1512     iEnv->SetRefreshMode( EAlfRefreshModeManual );
  1472     switch ( aType )
  1513     switch ( aType )
  1492     //if( aType == KAknsMessageSkinChange && iConstructComplete )
  1533     //if( aType == KAknsMessageSkinChange && iConstructComplete )
  1493     //    {
  1534     //    {
  1494     //    CAlfEnv::Static()->NotifySkinChangedL();
  1535     //    CAlfEnv::Static()->NotifySkinChangedL();
  1495     //    }
  1536     //    }
  1496 
  1537 
  1497     if ( aType == KEikDynamicLayoutVariantSwitch )
  1538     if( aType == KEikDynamicLayoutVariantSwitch
       
  1539         || aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled )
  1498     	{
  1540     	{
  1499         // Changing layout for status pane (just in case it is not switched
  1541         // Changing layout for status pane (just in case it is not switched
  1500         // correctly), fix for HMNN-82BAGR error
  1542         // correctly), fix for HMNN-82BAGR error
  1501         // it's not related with skin change so "moved up" TJOS-83DELP fix
  1543         // it's not related with skin change so "moved up" TJOS-83DELP fix
  1502         TBool landscape(Layout_Meta_Data::IsLandscapeOrientation());
  1544         TBool landscape(Layout_Meta_Data::IsLandscapeOrientation());
  1519 
  1561 
  1520     if( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange )
  1562     if( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange )
  1521         {
  1563         {
  1522 
  1564 
  1523 	  	TRect screenRect;
  1565 	  	TRect screenRect;
  1524 	 	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, screenRect );
  1566         screenRect = ClientRect();
  1525   		StatusPane()->DrawNow();
  1567   		StatusPane()->DrawNow();
  1526         if(iEnv)
  1568         if(iEnv)
  1527             {
  1569             {
  1528 			Display().SetVisibleArea( screenRect );
  1570 			Display().SetVisibleArea( screenRect );
  1529             }
  1571             }
  1537         switch (aType)
  1579         switch (aType)
  1538             {
  1580             {
  1539             case KAknsMessageSkinChange:
  1581             case KAknsMessageSkinChange:
  1540                 type = CFsEmailUiViewBase::ESkinChanged;
  1582                 type = CFsEmailUiViewBase::ESkinChanged;
  1541                 break;
  1583                 break;
       
  1584             case KAknSplitInputEnabled:  // fall though
       
  1585             case KAknSplitInputDisabled: // fall though
  1542             case KEikDynamicLayoutVariantSwitch:
  1586             case KEikDynamicLayoutVariantSwitch:
  1543                 type = CFsEmailUiViewBase::EScreenLayoutChanged;
  1587                 type = CFsEmailUiViewBase::EScreenLayoutChanged;
  1544                 break;
  1588                 break;
  1545             default:
  1589             default:
  1546                 break;
  1590                 break;
  2976     {
  3020     {
  2977     return iLastPointerPosition;
  3021     return iLastPointerPosition;
  2978     }
  3022     }
  2979 
  3023 
  2980 // -----------------------------------------------------------------------------
  3024 // -----------------------------------------------------------------------------
       
  3025 // CFreestyleEmailUiAppUi::LastSeenWsEventType
       
  3026 // -----------------------------------------------------------------------------
       
  3027 TInt CFreestyleEmailUiAppUi::LastSeenWsEventType()
       
  3028     {
       
  3029     return iLastWsEventType;
       
  3030     }
  2981 // CFreestyleEmailUiAppUi::RunFakeSyncAnimL
  3031 // CFreestyleEmailUiAppUi::RunFakeSyncAnimL
  2982 // -----------------------------------------------------------------------------
  3032 // -----------------------------------------------------------------------------
  2983 void CFreestyleEmailUiAppUi::RunFakeSyncAnimL()
  3033 void CFreestyleEmailUiAppUi::RunFakeSyncAnimL()
  2984     {
  3034     {
  2985     FUNC_LOG;
  3035     FUNC_LOG;
  3096                 CAknTitlePane* titlePane = NULL;
  3146                 CAknTitlePane* titlePane = NULL;
  3097                 TRAP_IGNORE( titlePane =
  3147                 TRAP_IGNORE( titlePane =
  3098                     (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) );
  3148                     (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) );
  3099 
  3149 
  3100                 TSize iconSize = LayoutHandler()->statusPaneIconSize();
  3150                 TSize iconSize = LayoutHandler()->statusPaneIconSize();
  3101                 iConnectionStatusIconAngle -= KConnectionStatusIconRotationAmount;
  3151                 iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount;
  3102                 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
  3152                 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
  3103                 titlePane->DrawNow();
  3153                 titlePane->DrawNow();
  3104                 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval);
  3154                 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval);
  3105                 }
  3155                 }
  3106             }
  3156             }