phoneapp/phoneuicontrol/src/cphonestateincoming.cpp
changeset 65 2a5d4ab426d3
parent 50 377c906a8701
child 74 d1c62c765e48
equal deleted inserted replaced
60:1eef62f5c541 65:2a5d4ab426d3
    91     // Fetch incoming call's id from view
    91     // Fetch incoming call's id from view
    92     TPhoneCmdParamCallStateData callStateData;
    92     TPhoneCmdParamCallStateData callStateData;
    93     callStateData.SetCallState( EPEStateRinging );
    93     callStateData.SetCallState( EPEStateRinging );
    94     iViewCommandHandle->HandleCommandL(
    94     iViewCommandHandle->HandleCommandL(
    95         EPhoneViewGetCallIdByState, &callStateData );
    95         EPhoneViewGetCallIdByState, &callStateData );
    96 
       
    97     // Do nothing if negative incoming call id
       
    98     if( callStateData.CallId() > KErrNotFound  )
    96     if( callStateData.CallId() > KErrNotFound  )
    99         {
    97         {
   100         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
    98         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   101         
       
   102         iRingingCallId = callStateData.CallId();
    99         iRingingCallId = callStateData.CallId();
   103         }
   100         }
   104     else
   101     else
   105         {
   102         {
   106         __PHONELOG( EOnlyFatal, EPhoneControl,
   103         __PHONELOG( EOnlyFatal, EPhoneControl,
   137     const TKeyEvent& aKeyEvent,
   134     const TKeyEvent& aKeyEvent,
   138     TEventCode aEventCode )
   135     TEventCode aEventCode )
   139     {
   136     {
   140     __LOGMETHODSTARTEND(EPhoneControl,
   137     __LOGMETHODSTARTEND(EPhoneControl,
   141         "CPhoneStateIncoming::HandleKeyEventL ()" );
   138         "CPhoneStateIncoming::HandleKeyEventL ()" );
   142     // Handle numeric keys when key events are received in incoming state
       
   143     CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
   139     CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
   144     }
   140     }
   145 
   141 
   146 // -----------------------------------------------------------
   142 // -----------------------------------------------------------
   147 // CPhoneStateIncoming::HandleNumberEntryClearedL()
   143 // CPhoneStateIncoming::HandleNumberEntryClearedL()
   149 //
   145 //
   150 EXPORT_C void CPhoneStateIncoming::HandleNumberEntryClearedL()
   146 EXPORT_C void CPhoneStateIncoming::HandleNumberEntryClearedL()
   151     {
   147     {
   152     __LOGMETHODSTARTEND(EPhoneControl,
   148     __LOGMETHODSTARTEND(EPhoneControl,
   153         "CPhoneStateIncoming::HandleNumberEntryClearedL ()" );
   149         "CPhoneStateIncoming::HandleNumberEntryClearedL ()" );
   154     // Set incoming call CBA when number entry is cleared
       
   155     iCbaManager->UpdateIncomingCbaL( iRingingCallId );
   150     iCbaManager->UpdateIncomingCbaL( iRingingCallId );
   156     }
   151     }
   157 
   152 
   158 // -----------------------------------------------------------
   153 // -----------------------------------------------------------
   159 // CPhoneStateIncoming::HandleKeyMessageL
   154 // CPhoneStateIncoming::HandleKeyMessageL
   165     {
   160     {
   166     __LOGMETHODSTARTEND( EPhoneControl,
   161     __LOGMETHODSTARTEND( EPhoneControl,
   167         "CPhoneStateIncoming::HandleKeyMessageL ()" );
   162         "CPhoneStateIncoming::HandleKeyMessageL ()" );
   168     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   163     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   169         Panic( EPhoneCtrlInvariant ) );
   164         Panic( EPhoneCtrlInvariant ) );
   170 
       
   171     switch ( aCode )
   165     switch ( aCode )
   172         {
   166         {
   173         // end-key
   167         case EKeyNo: // end-key
   174         case EKeyNo:
       
   175             {
   168             {
   176             // handle long press
       
   177             if ( aMessage == EPhoneKeyLongPress )
   169             if ( aMessage == EPhoneKeyLongPress )
   178                 {
   170                 {
   179                 // Close all connections
       
   180                 iStateMachine->SendPhoneEngineMessage(
   171                 iStateMachine->SendPhoneEngineMessage(
   181                     MPEPhoneModel::EPEMessageTerminateAllConnections );
   172                     MPEPhoneModel::EPEMessageTerminateAllConnections );
   182                 iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   173                 iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   183 
       
   184                 if ( CPhoneState::IsNumberEntryUsedL() )
   174                 if ( CPhoneState::IsNumberEntryUsedL() )
   185                     {
   175                     {
   186                     // Remove number entry from screen
       
   187                     iViewCommandHandle->ExecuteCommandL(
   176                     iViewCommandHandle->ExecuteCommandL(
   188                         EPhoneViewRemoveNumberEntry );
   177                         EPhoneViewRemoveNumberEntry );
   189                     // Do state-specific operation when number entry is cleared
   178                     // Do state-specific operation when number entry is cleared
   190                     HandleNumberEntryClearedL();
   179                     HandleNumberEntryClearedL();
   191                     }
   180                     }
   192                 }
   181                 }
   193             else
   182             else
   194                 {
   183                 {
   195                 // handle end key
   184                 // handle short end key
   196                 DisconnectWaitingCallL();
   185                 DisconnectWaitingCallL();
   197                 }
   186                 }
   198             }
   187             }
   199             break;
   188             break;
   200 
   189             
   201         // send-key
   190         case EKeyYes: // send-key
   202         case EKeyYes:
       
   203             if( CPhoneState::IsNumberEntryVisibleL() )
   191             if( CPhoneState::IsNumberEntryVisibleL() )
   204                 {
   192                 {
   205                 HandleSendL();
   193                 HandleSendL();
   206                 }
   194                 }
   207             else
   195             else
   208                 {
   196                 {
   209                 // Answer the call
       
   210                 AnswerCallL();
   197                 AnswerCallL();
   211                 }
   198                 }
   212             break;
   199             break;
   213 
   200 
   214         // OK key
   201         case EKeyDevice3: // OK key
   215         case EKeyDevice3:
       
   216             if ( aMessage == EPhoneKeyLongPress )
   202             if ( aMessage == EPhoneKeyLongPress )
   217                 {
   203                 {
   218                 // Answer the call if long press of selection key
       
   219                 AnswerCallL();
   204                 AnswerCallL();
   220                 }
   205                 }
   221             break;
   206             break;
   222 
   207 
   223         case EKeyDeviceF:
   208         case EKeyDeviceF:
   224                 {
   209             __PHONELOG( EBasic, EPhoneUIStates,
   225                 __PHONELOG( EBasic, EPhoneUIStates,
   210                 "CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL-deviceF" );
   226                     "CPhoneConferenceAndSingleAndWaiting::HandleKeyMessageL-deviceF" );
   211             HandleHoldSwitchL();
   227                 HandleHoldSwitchL();
       
   228                 }
       
   229             break;
   212             break;
   230             
   213             
   231         default:
   214         default:
   232             break;
   215             break;
   233         }
   216         }
   237 // CPhoneStateIncoming::HandleSendL
   220 // CPhoneStateIncoming::HandleSendL
   238 // -----------------------------------------------------------
   221 // -----------------------------------------------------------
   239 //
   222 //
   240 void CPhoneStateIncoming::HandleSendL()
   223 void CPhoneStateIncoming::HandleSendL()
   241     {
   224     {
   242     // Get the number entry contents
       
   243     HBufC* phoneNumber = PhoneNumberFromEntryLC();
   225     HBufC* phoneNumber = PhoneNumberFromEntryLC();
   244     TPtr ptr( phoneNumber->Des() );
   226     TPtr ptr( phoneNumber->Des() );
   245 
   227 
   246     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr );
   228     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr );
   247     iStateMachine->SendPhoneEngineMessage(
   229     iStateMachine->SendPhoneEngineMessage(
   261         }
   243         }
   262     CleanupStack::PopAndDestroy( phoneNumber );
   244     CleanupStack::PopAndDestroy( phoneNumber );
   263     }
   245     }
   264 
   246 
   265 // -----------------------------------------------------------
   247 // -----------------------------------------------------------
   266 // CPhoneStateIncoming::HandleKeyPressDurationL
       
   267 // -----------------------------------------------------------
       
   268 //
       
   269 EXPORT_C void CPhoneStateIncoming::HandleKeyPressDurationL(
       
   270     TKeyCode /*aCode*/,
       
   271     TTimeIntervalMicroSeconds /*aKeyPressDuration*/ )
       
   272     {
       
   273     __LOGMETHODSTARTEND(EPhoneControl,
       
   274         "CPhoneStateIncoming::HandleKeyPressDurationL ()" );
       
   275  
       
   276     }
       
   277 
       
   278 // -----------------------------------------------------------
       
   279 // CPhoneStateIncoming::HandlePhoneEngineMessageL
   248 // CPhoneStateIncoming::HandlePhoneEngineMessageL
   280 // -----------------------------------------------------------
   249 // -----------------------------------------------------------
   281 //
   250 //
   282 EXPORT_C void CPhoneStateIncoming::HandlePhoneEngineMessageL(
   251 EXPORT_C void CPhoneStateIncoming::HandlePhoneEngineMessageL(
   283     const TInt aMessage,
   252     const TInt aMessage,
   294         case MEngineMonitor::EPEMessageConnected:
   263         case MEngineMonitor::EPEMessageConnected:
   295             HandleConnectedL( aCallId );
   264             HandleConnectedL( aCallId );
   296             break;
   265             break;
   297 
   266 
   298         case MEngineMonitor::EPEMessageInValidEmergencyNumber:
   267         case MEngineMonitor::EPEMessageInValidEmergencyNumber:
   299             // Answer the call
       
   300             AnswerCallL();
   268             AnswerCallL();
   301             break;
   269             break;
   302 
   270 
   303         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   271         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   304             DialVoiceCallL();
   272             DialVoiceCallL();
   320                 MPEPhoneModel::EPEMessageStopTonePlay );
   288                 MPEPhoneModel::EPEMessageStopTonePlay );
   321             break;
   289             break;
   322          
   290          
   323         case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged:
   291         case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged:
   324             HandleAudioAvailableOutputChangedL();
   292             HandleAudioAvailableOutputChangedL();
   325             // Need to avoid CBA update
   293             // Do not update CBA's.
   326             break;
   294             break;
   327         
   295         
   328         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   296         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   329             // Update remote info data
       
   330             UpdateRemoteInfoDataAndLabelL( aCallId, UpdateCallHeaderInfoL( aCallId ) );
   297             UpdateRemoteInfoDataAndLabelL( aCallId, UpdateCallHeaderInfoL( aCallId ) );
   331             break;
   298             break;
   332             
   299             
   333         default:
   300         default:
   334             CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId );
   301             CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId );
   344         TInt aCallId, 
   311         TInt aCallId, 
   345         TPhoneCmdParamCallHeaderData aCallHeaderParam )
   312         TPhoneCmdParamCallHeaderData aCallHeaderParam )
   346     {
   313     {
   347     __LOGMETHODSTARTEND(EPhoneControl,
   314     __LOGMETHODSTARTEND(EPhoneControl,
   348             "CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL ()" );
   315             "CPhoneStateIncoming::UpdateRemoteInfoDataAndLabelL ()" );
   349     // Update the remote info data in the call header
       
   350     iViewCommandHandle->ExecuteCommandL( 
   316     iViewCommandHandle->ExecuteCommandL( 
   351         EPhoneViewUpdateCallHeaderRemoteInfoDataAndLabel, 
   317         EPhoneViewUpdateCallHeaderRemoteInfoDataAndLabel, 
   352         aCallId,
   318         aCallId,
   353         &aCallHeaderParam );
   319         &aCallHeaderParam );
   354     }
   320     }
   359 //
   325 //
   360 void CPhoneStateIncoming::HandleConnectedL( TInt aCallId )
   326 void CPhoneStateIncoming::HandleConnectedL( TInt aCallId )
   361     {
   327     {
   362     __LOGMETHODSTARTEND(EPhoneControl,
   328     __LOGMETHODSTARTEND(EPhoneControl,
   363         "CPhoneStateIncoming::HandleConnectedL ()" );
   329         "CPhoneStateIncoming::HandleConnectedL ()" );
   364 
       
   365     // Re-enable global notes
       
   366     TPhoneCmdParamBoolean globalNotifierParam;
   330     TPhoneCmdParamBoolean globalNotifierParam;
   367     globalNotifierParam.SetBoolean( EFalse );
   331     globalNotifierParam.SetBoolean( EFalse );
   368     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   332     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   369         &globalNotifierParam );
   333         &globalNotifierParam );
   370     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   334     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   371         &globalNotifierParam );
   335         &globalNotifierParam );
   372     // Stop tone playing, if necessary
   336     
   373     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   337     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   374     
   338     
       
   339     // For keeping video call on top!
   375     if( IsVideoCall( aCallId ) && !IsAutoLockOn() )
   340     if( IsVideoCall( aCallId ) && !IsAutoLockOn() )
   376         {
   341         {
   377         // For keeping video call on top
       
   378         TPhoneCmdParamBoolean booleanParam;
   342         TPhoneCmdParamBoolean booleanParam;
   379         booleanParam.SetBoolean( EFalse );
   343         booleanParam.SetBoolean( EFalse );
   380         iViewCommandHandle->ExecuteCommandL(
   344         iViewCommandHandle->ExecuteCommandL(
   381             EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   345             EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   382         }
   346         }
   384     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   348     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   385          && iStateMachine->PhoneStorage()->IsScreenLocked() )
   349          && iStateMachine->PhoneStorage()->IsScreenLocked() )
   386         {
   350         {
   387         EnableCallUIL();
   351         EnableCallUIL();
   388         }
   352         }
   389     
       
   390     // Reset blocked keys list
       
   391     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   353     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   392 
       
   393     BeginUiUpdateLC();
   354     BeginUiUpdateLC();
   394     
       
   395     // Update single call
       
   396     UpdateSingleActiveCallL( aCallId );
   355     UpdateSingleActiveCallL( aCallId );
   397 
   356 
   398     SetTouchPaneButtons( EPhoneIncallButtons );
   357     SetTouchPaneButtons( EPhoneIncallButtons );
   399     SetBackButtonActive(ETrue);
   358     SetBackButtonActive(ETrue);
   400             
       
   401     EndUiUpdate();
   359     EndUiUpdate();
   402 
   360 
   403     // Go to single state
       
   404     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   361     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   405 
       
   406     iStateMachine->ChangeState( EPhoneStateSingle );
   362     iStateMachine->ChangeState( EPhoneStateSingle );
   407     }
   363     }
   408 
   364 
   409 // -----------------------------------------------------------
   365 // -----------------------------------------------------------
   410 // CPhoneStateIncoming::HandleAudioPlayStoppedL
   366 // CPhoneStateIncoming::HandleAudioPlayStoppedL
   412 //
   368 //
   413 EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL()
   369 EXPORT_C void CPhoneStateIncoming::HandleAudioPlayStoppedL()
   414     {
   370     {
   415     __LOGMETHODSTARTEND(EPhoneControl,
   371     __LOGMETHODSTARTEND(EPhoneControl,
   416         "CPhoneStateIncoming::HandleAudioPlayStoppedL ()" );
   372         "CPhoneStateIncoming::HandleAudioPlayStoppedL ()" );
   417     // Set the ringtone silenced status
       
   418     iCbaManager->SetRingtoneSilencedStatus( ETrue );
   373     iCbaManager->SetRingtoneSilencedStatus( ETrue );
   419     TInt resourceId = EPhoneCallHandlingIncomingRejectCBA;
   374     TInt resourceId = iCbaManager->SoftRejectStatus() ? 
       
   375                             EPhoneCallHandlingIncomingSoftRejectCBA:
       
   376                             EPhoneCallHandlingIncomingRejectCBA;
   420     iCbaManager->SetCbaL( resourceId );
   377     iCbaManager->SetCbaL( resourceId );
   421     }
   378     }
   422 
   379 
   423 // -----------------------------------------------------------
   380 // -----------------------------------------------------------
   424 // CPhoneStateIncoming::HandleIdleL
   381 // CPhoneStateIncoming::HandleIdleL
   427 void CPhoneStateIncoming::HandleIdleL( TInt aCallId )
   384 void CPhoneStateIncoming::HandleIdleL( TInt aCallId )
   428     {
   385     {
   429     __LOGMETHODSTARTEND(EPhoneControl,
   386     __LOGMETHODSTARTEND(EPhoneControl,
   430         "CPhoneStateIncoming::HandleIdleL ()" );
   387         "CPhoneStateIncoming::HandleIdleL ()" );
   431     BeginUiUpdateLC();
   388     BeginUiUpdateLC();
   432 
       
   433     // Enable call UI
       
   434     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   389     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
   435         && iStateMachine->PhoneStorage()->IsScreenLocked() )
   390         && iStateMachine->PhoneStorage()->IsScreenLocked() )
   436         {
   391         {
   437         EnableCallUIL();
   392         EnableCallUIL();
   438         }
   393         }
   439 
       
   440     // Reset blocked keys list
       
   441     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   394     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   442     
   395     
   443     // Remove call
       
   444     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   396     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   445     // Stop tone playing, if necessary
       
   446     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   397     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   447     
   398     
   448     TPhoneCmdParamBoolean globalNotifierParam;
   399     TPhoneCmdParamBoolean globalNotifierParam;
   449     globalNotifierParam.SetBoolean( EFalse );
   400     globalNotifierParam.SetBoolean( EFalse );
   450     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   401     iViewCommandHandle->ExecuteCommandL( 
   451         &globalNotifierParam );
   402             EPhoneViewSetEikonNotifiersDisabled,
   452     
   403             &globalNotifierParam );
   453     SetDefaultFlagsL();
   404     SetDefaultFlagsL();
   454     
   405     
   455      if ( IsNumberEntryUsedL() )
   406      if ( IsNumberEntryUsedL() )
   456         {
   407         {
   457         if ( NeedToSendToBackgroundL() )
   408         if ( NeedToSendToBackgroundL() )
   458             {
   409             {
   459             // Return phone to the background if send to background is needed.
       
   460             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   410             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   461 
       
   462             // Set Number Entry CBA
       
   463             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   411             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   464             }
   412             }
   465         else
   413         else
   466             {
   414             {
   467             // Show the number entry if it exists.
       
   468             SetNumberEntryVisibilityL(ETrue);
   415             SetNumberEntryVisibilityL(ETrue);
   469             }
   416             }
   470         }
   417         }
   471     else if ( NeedToSendToBackgroundL() )
   418     else if ( NeedToSendToBackgroundL() )
   472         {
   419         {
   473         // Continue displaying current app but set up the
   420         // Continue displaying current app but set up the
   474         // idle screen in the background
   421         // idle screen in the background.
   475         SetupIdleScreenInBackgroundL();
   422         SetupIdleScreenInBackgroundL();
   476         }
   423         }
   477     else
   424     else
   478         {
   425         {
   479         // Display idle screen
       
   480         DisplayIdleScreenL();
   426         DisplayIdleScreenL();
   481         }
   427         }
   482  
   428  
   483     DeleteTouchPaneButtons();
   429     DeleteTouchPaneButtons();
   484     SetBackButtonActive(ETrue);
   430     SetBackButtonActive(ETrue);
   485     
   431     
   486     EndUiUpdate();
   432     EndUiUpdate();
   487     // Go to idle state   
       
   488     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   433     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   489     iStateMachine->ChangeState( EPhoneStateIdle );
   434     iStateMachine->ChangeState( EPhoneStateIdle );
   490     }
   435     }
   491 
   436 
   492 // -----------------------------------------------------------
   437 // -----------------------------------------------------------
   496 EXPORT_C TBool CPhoneStateIncoming::HandleCommandL( TInt aCommand )
   441 EXPORT_C TBool CPhoneStateIncoming::HandleCommandL( TInt aCommand )
   497     {
   442     {
   498     __LOGMETHODSTARTEND(EPhoneControl,
   443     __LOGMETHODSTARTEND(EPhoneControl,
   499         "CPhoneStateIncoming::HandleCommandL ()" );
   444         "CPhoneStateIncoming::HandleCommandL ()" );
   500     TBool commandStatus = ETrue;
   445     TBool commandStatus = ETrue;
   501 
       
   502     switch( aCommand )
   446     switch( aCommand )
   503         {
   447         {
   504         case EPhoneCmdOptions:
   448         case EPhoneCmdOptions:
   505             // Stop tone playing, if necessary.
   449             // Stop tone playing, if necessary.
   506             // And stop vibrating, if it is active.
   450             // And stop vibrating, if it is active.
   531             iStateMachine->SendPhoneEngineMessage(
   475             iStateMachine->SendPhoneEngineMessage(
   532                 MPEPhoneModel::EPEMessageStopTonePlay );
   476                 MPEPhoneModel::EPEMessageStopTonePlay );
   533             break;
   477             break;
   534 
   478 
   535         case EPhoneCallComingCmdSoftReject:
   479         case EPhoneCallComingCmdSoftReject:
   536             // Open Soft reject message editor
       
   537             OpenSoftRejectMessageL();
   480             OpenSoftRejectMessageL();
   538             break;
   481             break;
   539 
   482 
   540         case EPhoneNumberAcqCmdSendCommand:
   483         case EPhoneNumberAcqCmdSendCommand:
   541             HandleSendL();
   484             HandleSendL();
   543 
   486 
   544         default:
   487         default:
   545             commandStatus = CPhoneState::HandleCommandL( aCommand );
   488             commandStatus = CPhoneState::HandleCommandL( aCommand );
   546             break;
   489             break;
   547         }
   490         }
   548 
       
   549     return commandStatus;
   491     return commandStatus;
   550     }
   492     }
   551 
   493 
   552 // -----------------------------------------------------------
   494 // -----------------------------------------------------------
   553 // CPhoneStateIncoming::AnswerCallL
   495 // CPhoneStateIncoming::AnswerCallL
   555 //
   497 //
   556 void CPhoneStateIncoming::AnswerCallL()
   498 void CPhoneStateIncoming::AnswerCallL()
   557     {
   499     {
   558     __LOGMETHODSTARTEND(EPhoneControl,
   500     __LOGMETHODSTARTEND(EPhoneControl,
   559         "CPhoneStateIncoming::AnswerCallL ()" );
   501         "CPhoneStateIncoming::AnswerCallL ()" );
   560     // Mute the ring tone
       
   561     iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingToneOnAnswer );
   502     iViewCommandHandle->ExecuteCommandL( EPhoneViewMuteRingToneOnAnswer );
   562     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   503     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   563     // Answer the call
   504     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageAnswer );
   564     iStateMachine->SendPhoneEngineMessage(
       
   565         MPEPhoneModel::EPEMessageAnswer );
       
   566     }
   505     }
   567 
   506 
   568 // -----------------------------------------------------------
   507 // -----------------------------------------------------------
   569 // CPhoneStateIncoming::DisconnectWaitingCallL
   508 // CPhoneStateIncoming::DisconnectWaitingCallL
   570 // -----------------------------------------------------------
   509 // -----------------------------------------------------------
   571 //
   510 //
   572 void CPhoneStateIncoming::DisconnectWaitingCallL()
   511 void CPhoneStateIncoming::DisconnectWaitingCallL()
   573     {
   512     {
   574     __LOGMETHODSTARTEND(EPhoneControl,
   513     __LOGMETHODSTARTEND(EPhoneControl,
   575         "CPhoneStateIncoming::DisconnectWaitingCallL ()" );
   514         "CPhoneStateIncoming::DisconnectWaitingCallL ()" );
   576 
       
   577     // Stop tone playing, if necessary
       
   578     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   515     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   579     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   516     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   580 
   517 
   581     // The ringing call might have changed
   518     // The ringing call might have changed
   582     TPhoneCmdParamCallStateData callStateData;
   519     TPhoneCmdParamCallStateData callStateData;
   591     
   528     
   592     iStateMachine->SetCallId( iRingingCallId );
   529     iStateMachine->SetCallId( iRingingCallId );
   593 
   530 
   594     if( IsVideoCall( iRingingCallId ) )
   531     if( IsVideoCall( iRingingCallId ) )
   595         {
   532         {
   596         // Video call can be released only after we get response to VT Shutdown Command
   533         // Video call can be released only after we get response 
   597         CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
   534         // to VT Shutdown Command.
   598                                                                              KCatPhoneToVideotelCommands, 
   535         CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
   599                                                                              EVtCmdReleaseDataport,
   536                 KMediatorVideoTelephonyDomain,
   600                                                                    TVersion( KPhoneToVideotelCmdVersionMajor,
   537                          KCatPhoneToVideotelCommands, 
   601                                                                              KPhoneToVideotelCmdVersionMinor, 
   538                          EVtCmdReleaseDataport,
   602                                                                              KPhoneToVideotelCmdVersionBuild ),
   539                TVersion( KPhoneToVideotelCmdVersionMajor,
   603                                                                    KNullDesC8,
   540                          KPhoneToVideotelCmdVersionMinor, 
   604                                                                    CPhoneReleaseCommand::NewL( *iStateMachine ) );
   541                          KPhoneToVideotelCmdVersionBuild ),
       
   542                KNullDesC8,
       
   543                CPhoneReleaseCommand::NewL( *iStateMachine ) );
   605         }
   544         }
   606     else
   545     else
   607         {
   546         {
   608         // Release the call
   547         iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageRelease );
   609         iStateMachine->SendPhoneEngineMessage(
   548         }
   610                 MPEPhoneModel::EPEMessageRelease );
       
   611         }
       
   612     
       
   613     ShowDisconnectingL( iRingingCallId );
   549     ShowDisconnectingL( iRingingCallId );
   614     }
   550     }
   615 
   551 
   616 // -----------------------------------------------------------
   552 // -----------------------------------------------------------
   617 // CPhoneStateIncoming::OpenSoftRejectMessageEditorL
   553 // CPhoneStateIncoming::OpenSoftRejectMessageEditorL
   619 //
   555 //
   620 void CPhoneStateIncoming::OpenSoftRejectMessageL()
   556 void CPhoneStateIncoming::OpenSoftRejectMessageL()
   621     {
   557     {
   622     __LOGMETHODSTARTEND(EPhoneControl,
   558     __LOGMETHODSTARTEND(EPhoneControl,
   623         "CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" );
   559         "CPhoneStateIncoming::OpenSoftRejectMessageEditorL ()" );
   624     
       
   625     // Silence the vibrating
       
   626     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   560     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   627     iStateMachine->SendPhoneEngineMessage(
   561     iStateMachine->SendPhoneEngineMessage(
   628         MPEPhoneModel::EPEMessageStopTonePlay );
   562         MPEPhoneModel::EPEMessageStopTonePlay );
       
   563     
       
   564     iCbaManager->SetSoftRejectStatus( EFalse );
   629     
   565     
   630     // Re-enable global notes. Otherwise message editor is not opened.
   566     // Re-enable global notes. Otherwise message editor is not opened.
   631     TPhoneCmdParamBoolean globalNotifierParam;
   567     TPhoneCmdParamBoolean globalNotifierParam;
   632     globalNotifierParam.SetBoolean( EFalse );
   568     globalNotifierParam.SetBoolean( EFalse );
   633     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   569     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   634         &globalNotifierParam );
   570         &globalNotifierParam );
   635 
   571 
   636     // Change the CBA to Options..Reject
   572     iCbaManager->SetCbaL( EPhoneCallHandlingIncomingSoftRejectCBA );
   637     iCbaManager->SetCbaL( EPhoneCallHandlingIncomingRejectCBA );
       
   638 
   573 
   639     TPhoneCmdParamSfiData sfiDataParam;
   574     TPhoneCmdParamSfiData sfiDataParam;
   640 
       
   641     if ( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ).Length() )
   575     if ( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ).Length() )
   642         {
   576         {
   643         // store both the name and the number
   577         // store both the name and the number
   644         sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) );
   578         sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) );
   645         sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ) );
   579         sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( iRingingCallId ) );
   647     else
   581     else
   648         {
   582         {
   649         // store the number
   583         // store the number
   650         sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) );
   584         sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( iRingingCallId ) );
   651         }
   585         }
   652 
   586     iViewCommandHandle->ExecuteCommandL( EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
   653     iViewCommandHandle->ExecuteCommandL(
       
   654         EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
       
   655     }
   587     }
   656 
   588 
   657 
   589 
   658 // -----------------------------------------------------------
   590 // -----------------------------------------------------------
   659 // CPhoneStateIncoming::GetNumberEntryVisibleMenuBar
   591 // CPhoneStateIncoming::GetNumberEntryVisibleMenuBar
   660 // -----------------------------------------------------------
   592 // -----------------------------------------------------------
   661 //
   593 //
   662 TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar()
   594 TInt CPhoneStateIncoming::GetNumberEntryVisibleMenuBar()
   663     {
   595     {
   664     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
   596     TInt resource(EPhoneIncomingCallMenubarWithNumberEntry);
   665         {
   597     if( IsVideoCall ( iRingingCallId ) )
   666         return EPhoneIncomingVideoCallMenubarWithNumberEntry;
   598         {
   667         }
   599         resource = EPhoneIncomingVideoCallMenubarWithNumberEntry;
   668     else
   600         }
   669         {
   601     return resource;
   670         return EPhoneIncomingCallMenubarWithNumberEntry;
       
   671         }
       
   672     }
   602     }
   673 
   603 
   674 // -----------------------------------------------------------
   604 // -----------------------------------------------------------
   675 // CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar
   605 // CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar
   676 // -----------------------------------------------------------
   606 // -----------------------------------------------------------
   677 //
   607 //
   678 TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar()
   608 TInt CPhoneStateIncoming::GetNumberEntryNotVisibleMenuBar()
   679     {
   609     {
   680     if( CPhoneState::IsVideoCall ( iRingingCallId ) )
   610     TInt resource(EPhoneIncomingCallMenubar);
   681         {
   611     if( IsVideoCall ( iRingingCallId ) )
   682         return EPhoneIncomingVideoCallMenubar;
   612         {
   683         }
   613         resource =  EPhoneIncomingVideoCallMenubar;
   684     else
   614         }
   685         {
   615     return resource;
   686         return EPhoneIncomingCallMenubar;
       
   687         }
       
   688     }
   616     }
   689 
   617 
   690 // -----------------------------------------------------------
   618 // -----------------------------------------------------------
   691 // CPhoneStateIncoming::ShowDisconnectingL
   619 // CPhoneStateIncoming::ShowDisconnectingL
   692 // -----------------------------------------------------------
   620 // -----------------------------------------------------------
   694 void CPhoneStateIncoming::ShowDisconnectingL( TInt aCallId )
   622 void CPhoneStateIncoming::ShowDisconnectingL( TInt aCallId )
   695     {
   623     {
   696     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::ShowDisconnectingL( ) ");
   624     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIncoming::ShowDisconnectingL( ) ");
   697     TPhoneCmdParamCallHeaderData callHeaderParam;
   625     TPhoneCmdParamCallHeaderData callHeaderParam;
   698     callHeaderParam.SetCallState( EPEStateDisconnecting );
   626     callHeaderParam.SetCallState( EPEStateDisconnecting );
   699 
       
   700     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   627     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   701     TInt callLabelId = CPhoneMainResourceResolver::Instance()->
   628     TInt callLabelId = CPhoneMainResourceResolver::Instance()->
   702         ResolveResourceID( EPhoneInCallDisconnected );
   629         ResolveResourceID( EPhoneInCallDisconnected );
   703 
       
   704     StringLoader::Load( labelText, callLabelId, CCoeEnv::Static() );
   630     StringLoader::Load( labelText, callLabelId, CCoeEnv::Static() );
   705     callHeaderParam.SetLabelText( labelText );
   631     callHeaderParam.SetLabelText( labelText );
   706 
   632 
   707     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   633     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   708         &callHeaderParam );
   634         &callHeaderParam );
   719         && CPhoneCenRepProxy::Instance()->
   645         && CPhoneCenRepProxy::Instance()->
   720             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
   646             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
   721         {
   647         {
   722         if( aKeylockEnabled )
   648         if( aKeylockEnabled )
   723             {
   649             {
   724             // Keylock enabled
       
   725             if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
   650             if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
   726                 {
   651                 {
   727                 // Disable HW Keys if needed
       
   728                 DisableHWKeysL();
   652                 DisableHWKeysL();
   729                 }
   653                 }
   730             }
   654             }
   731         else
   655         else
   732             {
   656             {
   733             // Keylock disabled
       
   734             // Reset blocked keys list
   657             // Reset blocked keys list
   735             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   658             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   736             }
   659             }
   737         }
   660         }
   738     }
   661     }