phoneapp/phoneuicontrol/src/cphonestateincoming.cpp
changeset 50 377c906a8701
parent 37 ba76fc04e6c2
child 65 2a5d4ab426d3
equal deleted inserted replaced
46:bc5a64e5bc3c 50:377c906a8701
   151     {
   151     {
   152     __LOGMETHODSTARTEND(EPhoneControl,
   152     __LOGMETHODSTARTEND(EPhoneControl,
   153         "CPhoneStateIncoming::HandleNumberEntryClearedL ()" );
   153         "CPhoneStateIncoming::HandleNumberEntryClearedL ()" );
   154     // Set incoming call CBA when number entry is cleared
   154     // Set incoming call CBA when number entry is cleared
   155     iCbaManager->UpdateIncomingCbaL( iRingingCallId );
   155     iCbaManager->UpdateIncomingCbaL( iRingingCallId );
   156     UpdateSilenceButtonDimming();
       
   157     }
   156     }
   158 
   157 
   159 // -----------------------------------------------------------
   158 // -----------------------------------------------------------
   160 // CPhoneStateIncoming::HandleKeyMessageL
   159 // CPhoneStateIncoming::HandleKeyMessageL
   161 // -----------------------------------------------------------
   160 // -----------------------------------------------------------
   217             if ( aMessage == EPhoneKeyLongPress )
   216             if ( aMessage == EPhoneKeyLongPress )
   218                 {
   217                 {
   219                 // Answer the call if long press of selection key
   218                 // Answer the call if long press of selection key
   220                 AnswerCallL();
   219                 AnswerCallL();
   221                 }
   220                 }
   222             else if ( CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported(
       
   223                         KTelephonyLVFlagCoverHideSendEndKey ))
       
   224                 {
       
   225                 // Open number entry OK menubar
       
   226                 OpenMenuBarL();
       
   227                 }
       
   228             break;
   221             break;
   229 
   222 
   230         case EKeyDeviceF:
   223         case EKeyDeviceF:
   231                 {
   224                 {
   232                 __PHONELOG( EBasic, EPhoneUIStates,
   225                 __PHONELOG( EBasic, EPhoneUIStates,
   385         TPhoneCmdParamBoolean booleanParam;
   378         TPhoneCmdParamBoolean booleanParam;
   386         booleanParam.SetBoolean( EFalse );
   379         booleanParam.SetBoolean( EFalse );
   387         iViewCommandHandle->ExecuteCommandL(
   380         iViewCommandHandle->ExecuteCommandL(
   388             EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   381             EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   389         }
   382         }
   390     
       
   391     BeginTransEffectLC( ENumberEntryOpen );
       
   392 
   383 
   393     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   384     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   394          && iStateMachine->PhoneStorage()->IsScreenLocked() )
   385          && iStateMachine->PhoneStorage()->IsScreenLocked() )
   395         {
   386         {
   396         EnableCallUIL();
   387         EnableCallUIL();
   403     
   394     
   404     // Update single call
   395     // Update single call
   405     UpdateSingleActiveCallL( aCallId );
   396     UpdateSingleActiveCallL( aCallId );
   406 
   397 
   407     SetTouchPaneButtons( EPhoneIncallButtons );
   398     SetTouchPaneButtons( EPhoneIncallButtons );
   408     SetToolbarDimming( EFalse );
       
   409     SetBackButtonActive(ETrue);
   399     SetBackButtonActive(ETrue);
   410             
   400             
   411     EndUiUpdate();
   401     EndUiUpdate();
   412     EndTransEffect();
       
   413 
   402 
   414     // Go to single state
   403     // Go to single state
   415     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   404     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   416 
   405 
   417     iStateMachine->ChangeState( EPhoneStateSingle );
   406     iStateMachine->ChangeState( EPhoneStateSingle );
   423 //
   412 //
   424 EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL()
   413 EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL()
   425     {
   414     {
   426     __LOGMETHODSTARTEND(EPhoneControl,
   415     __LOGMETHODSTARTEND(EPhoneControl,
   427         "CPhoneStateIncoming::HandleAudioPlayStoppedL ()" );
   416         "CPhoneStateIncoming::HandleAudioPlayStoppedL ()" );
   428     // Update the CBA
       
   429     
       
   430     // Set the ringtone silenced status
   417     // Set the ringtone silenced status
   431     iCbaManager->SetRingtoneSilencedStatus( ETrue );
   418     iCbaManager->SetRingtoneSilencedStatus( ETrue );
   432     TInt resourceId = EPhoneCallHandlingIncomingRejectCBA;
   419     TInt resourceId = EPhoneCallHandlingIncomingRejectCBA;
   433     // Get the soft reject flag status
       
   434     TPhoneCmdParamBoolean softRejectParam;
       
   435     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSoftRejectFlag,
       
   436         &softRejectParam );
       
   437 
       
   438     if ( IsNumberEntryVisibleL() && !iOnScreenDialer )
       
   439         {
       
   440         resourceId = EPhoneNumberAcqCBA;
       
   441         }
       
   442     else if ( softRejectParam.Boolean() )
       
   443         {
       
   444         resourceId = EPhoneCallHandlingIncomingSoftRejectCBA;
       
   445         }
       
   446     iCbaManager->SetCbaL( resourceId );
   420     iCbaManager->SetCbaL( resourceId );
   447     }
   421     }
   448 
   422 
   449 // -----------------------------------------------------------
   423 // -----------------------------------------------------------
   450 // CPhoneStateIncoming::HandleIdleL
   424 // CPhoneStateIncoming::HandleIdleL
   452 //
   426 //
   453 void CPhoneStateIncoming::HandleIdleL( TInt aCallId )
   427 void CPhoneStateIncoming::HandleIdleL( TInt aCallId )
   454     {
   428     {
   455     __LOGMETHODSTARTEND(EPhoneControl,
   429     __LOGMETHODSTARTEND(EPhoneControl,
   456         "CPhoneStateIncoming::HandleIdleL ()" );
   430         "CPhoneStateIncoming::HandleIdleL ()" );
   457 
       
   458     BeginTransEffectLC( ENumberEntryOpen );
       
   459     BeginUiUpdateLC();
   431     BeginUiUpdateLC();
   460 
   432 
   461     // Enable call UI
   433     // Enable call UI
   462     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   434     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   463         && iStateMachine->PhoneStorage()->IsScreenLocked() )
   435         && iStateMachine->PhoneStorage()->IsScreenLocked() )
   468     // Reset blocked keys list
   440     // Reset blocked keys list
   469     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   441     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   470     
   442     
   471     // Remove call
   443     // Remove call
   472     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   444     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   473     // Close menu bar, if it is displayed
       
   474     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   475     // Stop tone playing, if necessary
   445     // Stop tone playing, if necessary
   476     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   446     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   477     
   447     
   478     TPhoneCmdParamBoolean globalNotifierParam;
   448     TPhoneCmdParamBoolean globalNotifierParam;
   479     globalNotifierParam.SetBoolean( EFalse );
   449     globalNotifierParam.SetBoolean( EFalse );
   486         {
   456         {
   487         if ( NeedToSendToBackgroundL() )
   457         if ( NeedToSendToBackgroundL() )
   488             {
   458             {
   489             // Return phone to the background if send to background is needed.
   459             // Return phone to the background if send to background is needed.
   490             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   460             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   491 
       
   492             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
       
   493 
   461 
   494             // Set Number Entry CBA
   462             // Set Number Entry CBA
   495             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   463             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   496             }
   464             }
   497         else
   465         else
   498             {
   466             {
   499             // Show the number entry if it exists.
   467             // Show the number entry if it exists.
   500             SetNumberEntryVisibilityL(ETrue);
   468             SetNumberEntryVisibilityL(ETrue);
   501             }
   469             }
   502         }
   470         }
   503     else if ( NeedToSendToBackgroundL() ||
   471     else if ( NeedToSendToBackgroundL() )
   504         SoftRejectMessageEditorIsDisplayedL() )
       
   505         {
   472         {
   506         // Continue displaying current app but set up the
   473         // Continue displaying current app but set up the
   507         // idle screen in the background
   474         // idle screen in the background
   508         SetupIdleScreenInBackgroundL();
   475         SetupIdleScreenInBackgroundL();
   509         }
   476         }
   515  
   482  
   516     DeleteTouchPaneButtons();
   483     DeleteTouchPaneButtons();
   517     SetBackButtonActive(ETrue);
   484     SetBackButtonActive(ETrue);
   518     
   485     
   519     EndUiUpdate();
   486     EndUiUpdate();
   520     EndTransEffect();
       
   521     // Go to idle state   
   487     // Go to idle state   
   522     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   488     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   523     iStateMachine->ChangeState( EPhoneStateIdle );
   489     iStateMachine->ChangeState( EPhoneStateIdle );
   524     }
   490     }
   525 
   491 
   537         {
   503         {
   538         case EPhoneCmdOptions:
   504         case EPhoneCmdOptions:
   539             // Stop tone playing, if necessary.
   505             // Stop tone playing, if necessary.
   540             // And stop vibrating, if it is active.
   506             // And stop vibrating, if it is active.
   541             iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   507             iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   542             // Open the menu bar
       
   543             OpenMenuBarL();
       
   544             break;
   508             break;
   545 
   509 
   546         case EPhoneCallComingCmdAnswer:
   510         case EPhoneCallComingCmdAnswer:
   547             AnswerCallL();
   511             AnswerCallL();
   548             break;
   512             break;
   561             break;
   525             break;
   562 
   526 
   563         case EPhoneCallComingCmdSilent:
   527         case EPhoneCallComingCmdSilent:
   564             // Silence the ringer. And stop vibrating, if it is active.
   528             // Silence the ringer. And stop vibrating, if it is active.
   565             iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingTone );
   529             iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingTone );
   566             // Dim silence button
       
   567             SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
       
   568             HandleAudioPlayStoppedL();
   530             HandleAudioPlayStoppedL();
   569             iStateMachine->SendPhoneEngineMessage(
   531             iStateMachine->SendPhoneEngineMessage(
   570                 MPEPhoneModel::EPEMessageStopTonePlay );
   532                 MPEPhoneModel::EPEMessageStopTonePlay );
   571             break;
   533             break;
   572 
   534 
   575             OpenSoftRejectMessageL();
   537             OpenSoftRejectMessageL();
   576             break;
   538             break;
   577 
   539 
   578         case EPhoneNumberAcqCmdSendCommand:
   540         case EPhoneNumberAcqCmdSendCommand:
   579             HandleSendL();
   541             HandleSendL();
   580             break;
       
   581 
       
   582         case EPhoneInCallCmdHelp:
       
   583             {
       
   584             TPtrC contextName;
       
   585             if( IsVideoCall( iRingingCallId ) )
       
   586                 {
       
   587                 contextName.Set( KINCAL_HLP_VIDEOCALL() );
       
   588                 }
       
   589             else
       
   590                 {
       
   591                 contextName.Set( KINCAL_HLP_CALL_HANDLING() );
       
   592                 }
       
   593             iViewCommandHandle->ExecuteCommandL(
       
   594                 EPhoneViewLaunchHelpApplication, 0, contextName );
       
   595             }
       
   596             break;
   542             break;
   597 
   543 
   598         default:
   544         default:
   599             commandStatus = CPhoneState::HandleCommandL( aCommand );
   545             commandStatus = CPhoneState::HandleCommandL( aCommand );
   600             break;
   546             break;
   673 //
   619 //
   674 void CPhoneStateIncoming::OpenSoftRejectMessageL()
   620 void CPhoneStateIncoming::OpenSoftRejectMessageL()
   675     {
   621     {
   676     __LOGMETHODSTARTEND(EPhoneControl,
   622     __LOGMETHODSTARTEND(EPhoneControl,
   677         "CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" );
   623         "CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" );
   678     // Clear the soft reject flag
       
   679     TPhoneCmdParamBoolean softRejectParam;
       
   680     softRejectParam.SetBoolean( EFalse );
       
   681     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSoftRejectFlag,
       
   682         &softRejectParam );
       
   683 
       
   684     // Dim silence button
       
   685     SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
       
   686     
   624     
   687     // Silence the vibrating
   625     // Silence the vibrating
   688     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   626     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   689     iStateMachine->SendPhoneEngineMessage(
   627     iStateMachine->SendPhoneEngineMessage(
   690         MPEPhoneModel::EPEMessageStopTonePlay );
   628         MPEPhoneModel::EPEMessageStopTonePlay );
   714 
   652 
   715     iViewCommandHandle->ExecuteCommandL(
   653     iViewCommandHandle->ExecuteCommandL(
   716         EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
   654         EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
   717     }
   655     }
   718 
   656 
   719 // -----------------------------------------------------------
   657 
   720 // CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL
   658 // -----------------------------------------------------------
   721 // -----------------------------------------------------------
   659 // CPhoneStateIncoming::GetNumberEntryVisibleMenuBar
   722 //
   660 // -----------------------------------------------------------
   723 TBool CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() const
   661 //
   724     {
   662 TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar()
   725     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL () ");
   663     {
   726     // Get the foreground application window group id
   664     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
   727     TPhoneCmdParamInteger foregroundAppParam;
   665         {
   728     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetForegroundApplication,
   666         return EPhoneIncomingVideoCallMenubarWithNumberEntry;
   729         &foregroundAppParam );
       
   730 
       
   731     // Get the soft reject message editor window group id
       
   732     TPhoneCmdParamInteger softRejectMessageEditorWgId;
       
   733     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSoftRejectWindowGroupId,
       
   734         &softRejectMessageEditorWgId );
       
   735 
       
   736     __PHONELOG1(
       
   737         EBasic,
       
   738         EPhoneControl,
       
   739         "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() SoftRejectGroupId %d",
       
   740         softRejectMessageEditorWgId.Integer() );
       
   741     __PHONELOG1(
       
   742         EBasic,
       
   743         EPhoneControl,
       
   744         "CPhoneStateIncoming::SoftRejectMessageEditorIsDisplayedL() ForegroundAppGroupId %d",
       
   745         foregroundAppParam.Integer() );
       
   746     // Return ETrue if soft reject message editor is displayed
       
   747     return softRejectMessageEditorWgId.Integer() == foregroundAppParam.Integer();
       
   748     }
       
   749 
       
   750 // -----------------------------------------------------------
       
   751 // CPhoneStateIncoming::OpenMenuBarL
       
   752 // -----------------------------------------------------------
       
   753 //
       
   754 void CPhoneStateIncoming::OpenMenuBarL()
       
   755     {
       
   756     __LOGMETHODSTARTEND(EPhoneControl,
       
   757         "CPhoneStateIncoming::OpenMenuBarL ()" );
       
   758     TInt resourceId;
       
   759 
       
   760     // Determine the correct menu bar to display
       
   761     if ( CPhoneState::IsNumberEntryVisibleL() )
       
   762         {
       
   763         resourceId = GetNumberEntryVisibleMenuBar();
       
   764         }
   667         }
   765     else
   668     else
   766         {
   669         {
   767         resourceId = GetNumberEntryNotVisibleMenuBar();
   670         return EPhoneIncomingCallMenubarWithNumberEntry;
   768         }
   671         }
   769 
   672     }
   770     // Silence the ringer. And stop vibrating, if it is active.
   673 
   771     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   674 // -----------------------------------------------------------
   772     iStateMachine->SendPhoneEngineMessage(
   675 // CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar
   773         MPEPhoneModel::EPEMessageStopTonePlay );
   676 // -----------------------------------------------------------
   774 
   677 //
   775     //Set correct cba
   678 TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar()
   776     HandleAudioPlayStoppedL();
       
   777     
       
   778     // Dim button
       
   779     SetTouchPaneButtonDisabled( EPhoneCallComingCmdSilent );
       
   780 
       
   781     // Open the menu bar
       
   782     TPhoneCmdParamInteger integerParam;
       
   783     integerParam.SetInteger(
       
   784         CPhoneMainResourceResolver::Instance()->
       
   785         ResolveResourceID( resourceId ) );
       
   786     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
       
   787         &integerParam );
       
   788     }
       
   789 
       
   790 // -----------------------------------------------------------
       
   791 // CPhoneStateIncoming::GetNumberEntryVisibleMenuBar
       
   792 // -----------------------------------------------------------
       
   793 //
       
   794 TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar()
       
   795     {
   679     {
   796     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
   680     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
   797         {
   681         {
   798         return EPhoneIncomingVideoCallMenubarWithNumberEntry;
   682         return EPhoneIncomingVideoCallMenubar;
   799         }
   683         }
   800     else
   684     else
   801         {
   685         {
   802         return EPhoneIncomingCallMenubarWithNumberEntry;
       
   803         }
       
   804     }
       
   805 
       
   806 // -----------------------------------------------------------
       
   807 // CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar
       
   808 // -----------------------------------------------------------
       
   809 //
       
   810 TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar()
       
   811     {
       
   812     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
       
   813         {
       
   814         return EPhoneIncomingVideoCallMenubar;
       
   815         }
       
   816     else
       
   817         {
       
   818         return EPhoneIncomingCallMenubar;
   686         return EPhoneIncomingCallMenubar;
   819         }
   687         }
   820     }
       
   821 
       
   822 // -----------------------------------------------------------
       
   823 // CPhoneStateIncoming::DynInitMenuPaneL
       
   824 // -----------------------------------------------------------
       
   825 //
       
   826 EXPORT_C void CPhoneStateIncoming::DynInitMenuPaneL(
       
   827     TInt aResourceId,
       
   828     CEikMenuPane* aMenuPane )
       
   829     {
       
   830     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::DynInitMenuPaneL() ");
       
   831     __ASSERT_DEBUG( aMenuPane && aResourceId,
       
   832         Panic( EPhoneCtrlParameterNotInitialized ) );
       
   833 
       
   834     // Save the number of digits in the number entry before processing
       
   835     // the menu pane
       
   836     if ( IsNumberEntryUsedL() )
       
   837         {
       
   838         TPhoneCmdParamBoolean serviceCodeParam;
       
   839         serviceCodeParam.SetBoolean( ETrue );
       
   840         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetServiceCodeFlag,
       
   841             &serviceCodeParam );
       
   842         }
       
   843 
       
   844     if ( iCustomization )
       
   845         {
       
   846         iCustomization->CustomizeMenuPaneL(aResourceId, aMenuPane);
       
   847         }
       
   848     // Process the menu pane
       
   849     TPhoneCmdParamDynMenu dynMenuPane;
       
   850     dynMenuPane.SetResourceId( aResourceId );
       
   851     dynMenuPane.SetDynMenu( aMenuPane );
       
   852     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuPane, &dynMenuPane );
       
   853     }
   688     }
   854 
   689 
   855 // -----------------------------------------------------------
   690 // -----------------------------------------------------------
   856 // CPhoneStateIncoming::ShowDisconnectingL
   691 // CPhoneStateIncoming::ShowDisconnectingL
   857 // -----------------------------------------------------------
   692 // -----------------------------------------------------------