phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 57 94dc1107e8b2
parent 44 3c221667e687
child 58 40a3f856b14d
equal deleted inserted replaced
44:3c221667e687 57:94dc1107e8b2
    74 //
    74 //
    75 EXPORT_C CPhoneStateIdle::CPhoneStateIdle( 
    75 EXPORT_C CPhoneStateIdle::CPhoneStateIdle( 
    76     MPhoneStateMachine* aStateMachine, 
    76     MPhoneStateMachine* aStateMachine, 
    77     MPhoneViewCommandHandle* aViewCommandHandle,
    77     MPhoneViewCommandHandle* aViewCommandHandle,
    78     MPhoneCustomization* aCustomization ) : 
    78     MPhoneCustomization* aCustomization ) : 
    79     CPhoneState( aStateMachine, aViewCommandHandle, aCustomization )
    79     CPhoneState( aStateMachine, aViewCommandHandle, aCustomization ),
       
    80     iBubbleInitialized( EFalse )
    80     {
    81     {
    81     }
    82     }
    82 
    83 
    83 // Destructor
    84 // Destructor
    84 EXPORT_C CPhoneStateIdle::~CPhoneStateIdle()
    85 EXPORT_C CPhoneStateIdle::~CPhoneStateIdle()
   478 // -----------------------------------------------------------
   479 // -----------------------------------------------------------
   479 //
   480 //
   480 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   481 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   481     {
   482     {
   482     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   483     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   483 
   484     if( IsBubbleInitialized() )
       
   485         {
       
   486         UpdateCallBubbleL( aCallId );
       
   487         }
       
   488     else
       
   489         {
       
   490         ShowCallHandlingViewL( aCallId );
       
   491         }
       
   492     ChangeTo( EPhoneStateCallSetup );
       
   493     }
       
   494 
       
   495 // -----------------------------------------------------------
       
   496 // CPhoneStateIdle::ShowCallHandlingViewL
       
   497 // -----------------------------------------------------------
       
   498 //
       
   499 void CPhoneStateIdle::ShowCallHandlingViewL( TInt aCallId )
       
   500     {
       
   501     __LOGMETHODSTARTEND(EPhoneControl, 
       
   502             "CPhoneStateIdle::ShowCallHandlingViewL( ) ");
   484     BeginUiUpdateLC();
   503     BeginUiUpdateLC();
   485     
       
   486     SetNumberEntryVisibilityL(EFalse);
   504     SetNumberEntryVisibilityL(EFalse);
   487 
   505 
   488     // Show call setup buttons
   506     // Show call setup buttons
   489     SetTouchPaneButtons( EPhoneCallSetupButtons );
   507     SetTouchPaneButtons( EPhoneCallSetupButtons );
   490     SetTouchPaneButtonDisabled( EPhoneInCallCmdHold );    
   508     SetTouchPaneButtonDisabled( EPhoneInCallCmdHold );
   491 
   509     
   492     // Display call setup 
   510     // Display call setup 
   493     DisplayCallSetupL( aCallId );            
   511     DisplayCallSetupL( aCallId );
   494     
       
   495     EndUiUpdate();
   512     EndUiUpdate();
   496     
   513     
   497     // Remove any phone dialogs if they are displayed
   514     // Remove any phone dialogs if they are displayed
   498     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   515     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   499             
   516     
   500     // Go to call setup state
   517     // Go to call setup state
   501     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   518     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   502 
   519 
   503     SetToolbarDimming( ETrue );
   520     SetToolbarDimming( ETrue );
   504 
       
   505     SetToolbarButtonLoudspeakerEnabled();
   521     SetToolbarButtonLoudspeakerEnabled();
   506     SetToolbarButtonHandsetEnabled();
   522     SetToolbarButtonHandsetEnabled();
   507     
       
   508     ChangeTo( EPhoneStateCallSetup );
       
   509     }
   523     }
   510 
   524 
   511 // -----------------------------------------------------------
   525 // -----------------------------------------------------------
   512 // CPhoneStateIdle::HandleConnectedL
   526 // CPhoneStateIdle::HandleConnectedL
   513 // Message Handling function for message EPEMessageConnected
   527 // Message Handling function for message EPEMessageConnected
   829         &uidParam );
   843         &uidParam );
   830 
   844 
   831     // Set Phone as the top application
   845     // Set Phone as the top application
   832     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
   846     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
   833         &uidParam ); 
   847         &uidParam ); 
   834     
   848 
   835     if ( !UpdateCallBubbleL( aCallId ) )
   849     if( !IsBubbleInitialized() )
   836         {
   850         {
   837         // Create and Display call setup header if update was not done.
   851         // Create and Display call setup header if update was not done.
   838         DisplayHeaderForOutgoingCallL( aCallId );
   852         DisplayHeaderForOutgoingCallL( aCallId );
       
   853         }
       
   854     else 
       
   855         {
       
   856         /* Create and Display initializing call header, difference
       
   857         to DisplayHeaderForOutgoingCallL is that this doesnt load 
       
   858         CLI information to header.*/
       
   859         DisplayHeaderForInitializingCallL( aCallId );
   839         }
   860         }
   840     }
   861     }
   841 
   862 
   842 // -----------------------------------------------------------
   863 // -----------------------------------------------------------
   843 // CPhoneStateIdle::UpdateCallBubbleL
   864 // CPhoneStateIdle::UpdateCallBubbleL
   882     bubble shouldnt be shown.*/
   903     bubble shouldnt be shown.*/
   883     SetBubbleInitialized( ETrue );
   904     SetBubbleInitialized( ETrue );
   884     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageCheckEmergencyNumber );
   905     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageCheckEmergencyNumber );
   885     if ( IsBubbleInitialized() )
   906     if ( IsBubbleInitialized() )
   886         {
   907         {
   887         BeginUiUpdateLC();
   908         ShowCallHandlingViewL( aCallId );
   888         
       
   889         SetNumberEntryVisibilityL(EFalse);
       
   890         
       
   891         // Show call setup buttons
       
   892         SetTouchPaneButtons( EPhoneCallSetupButtons );
       
   893         
       
   894         // Close menu bar, if it is displayed
       
   895         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   896 
       
   897         // Capture keys when the phone is dialling
       
   898         CaptureKeysDuringCallNotificationL( ETrue );
       
   899         
       
   900         // Bring Phone app in the foreground
       
   901         TPhoneCmdParamInteger uidParam;
       
   902         uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   903         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
       
   904             &uidParam );
       
   905 
       
   906         // Set Phone as the top application
       
   907         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
       
   908             &uidParam ); 
       
   909         
       
   910         DisplayHeaderForInitializingCallL( aCallId );
       
   911             
       
   912         EndUiUpdate();
       
   913         
       
   914         // Remove any phone dialogs if they are displayed
       
   915         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
       
   916                 
       
   917         // Go to call setup state
       
   918         iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
       
   919 
       
   920         SetToolbarDimming( ETrue );
       
   921         }
   909         }
   922     }
   910     }
   923 
   911 
   924 // -----------------------------------------------------------
   912 // -----------------------------------------------------------
   925 // CPhoneStateIdle::HandleIdleForegroundEventL
   913 // CPhoneStateIdle::HandleIdleForegroundEventL
  1030     }
  1018     }
  1031  
  1019  
  1032 // -----------------------------------------------------------
  1020 // -----------------------------------------------------------
  1033 // CPhoneStateIdle::SpeedDialL
  1021 // CPhoneStateIdle::SpeedDialL
  1034 // -----------------------------------------------------------
  1022 // -----------------------------------------------------------
  1035 //   
  1023 //
  1036 EXPORT_C void CPhoneStateIdle::SpeedDialL( const TUint& aDigit, 
  1024 EXPORT_C void CPhoneStateIdle::SpeedDialL( const TUint& aDigit, 
  1037         TDialInitiationMethod aDialMethod )
  1025         TDialInitiationMethod aDialMethod )
  1038     {
  1026     {
  1039     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialL( ) ");
  1027     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialL( ) ");
  1040     
       
  1041     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1028     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
  1042     
  1029     
  1043     TPhoneCmdParamSpeedDial speedDialParam;
  1030     TPhoneCmdParamSpeedDial speedDialParam;
  1044     HBufC* phoneNumber = NumberForSpeedDialLocationL( aDigit, speedDialParam );
  1031     HBufC* phoneNumber = NumberForSpeedDialLocationL( aDigit, speedDialParam );
  1045 
  1032 
  1048     CleanupStack::PushL( phoneNumber );
  1035     CleanupStack::PushL( phoneNumber );
  1049     
  1036     
  1050     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
  1037     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
  1051         {
  1038         {
  1052         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
  1039         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
  1053         
  1040         RemoveNumberEntryAndSetIdleToBackgroundIfNeededL();
  1054         if ( IsNumberEntryUsedL()  ) 
       
  1055             {         
       
  1056             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  1057             
       
  1058             // Set Idle background, if still idle
       
  1059             if ( iStateMachine->State() == this )
       
  1060                 {
       
  1061                 SetupIdleScreenInBackgroundL();
       
  1062                 }
       
  1063             }
       
  1064         }
  1041         }
  1065     else
  1042     else
  1066         {
  1043         {
  1067         // User cancelled dialog or didn't give a valid number
  1044         // User cancelled dialog or didn't give a valid number
  1068         SpeedDialCanceledL( aDigit );
  1045         SpeedDialCanceledL( aDigit );
  1069         }
  1046         }
  1070     
       
  1071     CleanupStack::PopAndDestroy( phoneNumber );
  1047     CleanupStack::PopAndDestroy( phoneNumber );
  1072     }
  1048     }
  1073 
  1049 
  1074 // -----------------------------------------------------------
  1050 // -----------------------------------------------------------
  1075 // CPhoneStateIdle:SpeedDialCanceledL
  1051 // CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL
       
  1052 // -----------------------------------------------------------
       
  1053 //
       
  1054 void CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL()
       
  1055     {
       
  1056     __LOGMETHODSTARTEND(EPhoneControl, 
       
  1057     "CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL( ) ");
       
  1058     if ( IsNumberEntryUsedL() )
       
  1059         {
       
  1060         /*NE should be removed because if speeddial dial is interupted during
       
  1061         call setup phone should not return to NE/Dialler view.*/
       
  1062         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  1063         
       
  1064         /*It might be possible that some async operation was ongoing and 
       
  1065         state has already in that case do not set idle to background. If 
       
  1066         there is initialized call then do not set idle to background.*/
       
  1067         if ( ( iStateMachine->State() == this ) && 
       
  1068             ( !IsBubbleInitialized() ) )
       
  1069             {
       
  1070             SetupIdleScreenInBackgroundL();
       
  1071             }
       
  1072         }
       
  1073     }
       
  1074 
       
  1075 // -----------------------------------------------------------
       
  1076 // CPhoneStateIdle::SpeedDialCanceledL
  1076 // -----------------------------------------------------------
  1077 // -----------------------------------------------------------
  1077 //
  1078 //
  1078 EXPORT_C void CPhoneStateIdle::SpeedDialCanceledL( const TUint& aDigit )
  1079 EXPORT_C void CPhoneStateIdle::SpeedDialCanceledL( const TUint& aDigit )
  1079 
  1080 
  1080     {
  1081     {
  1607             "PhoneUIControl: CPhoneStateIdle::HandleErrorL - aErrorInfo.iErrorCode =%d ",
  1608             "PhoneUIControl: CPhoneStateIdle::HandleErrorL - aErrorInfo.iErrorCode =%d ",
  1608             aErrorInfo.iErrorCode );
  1609             aErrorInfo.iErrorCode );
  1609     __PHONELOG1( EBasic, EPhoneControl,
  1610     __PHONELOG1( EBasic, EPhoneControl,
  1610             "PhoneUIControl: CPhoneStateIdle::HandleErrorL - aErrorInfo.iCallId =%d ",
  1611             "PhoneUIControl: CPhoneStateIdle::HandleErrorL - aErrorInfo.iCallId =%d ",
  1611             aErrorInfo.iCallId );
  1612             aErrorInfo.iCallId );
  1612     if( ( ECCPErrorNone != aErrorInfo.iErrorCode ) &&
  1613     if( ( KErrNotFound < aErrorInfo.iCallId ) && 
  1613             IsBubbleInitialized() )
  1614         ( ECCPErrorNone != aErrorInfo.iErrorCode ) &&
       
  1615           IsBubbleInitialized() )
  1614         {
  1616         {
  1615         HandleInitializingCallErrorL( aErrorInfo.iCallId );
  1617         HandleInitializingCallErrorL( aErrorInfo.iCallId );
  1616         SetBubbleInitialized( EFalse );
  1618         SetBubbleInitialized( EFalse );
  1617         }
  1619         }
  1618     CPhoneState::HandleErrorL( aErrorInfo );
  1620     CPhoneState::HandleErrorL( aErrorInfo );