phoneapp/phoneuicontrol/src/cphonestateidle.cpp
changeset 77 2be0b271d017
parent 72 c76a0b1755b9
child 76 cfea66083b62
equal deleted inserted replaced
72:c76a0b1755b9 77:2be0b271d017
   137     if ( IsSimOk() && !IsSimStateNotPresentWithSecurityModeEnabled() )
   137     if ( IsSimOk() && !IsSimStateNotPresentWithSecurityModeEnabled() )
   138         {
   138         {
   139         //  if still idle ( f.e not incoming call arrived when rfs )
   139         //  if still idle ( f.e not incoming call arrived when rfs )
   140         if ( iStateMachine->State() == this )
   140         if ( iStateMachine->State() == this )
   141             {
   141             {
   142             DisplayIdleScreenL();
   142             RemoveDialogsAndSendPhoneToBackgroundL();
   143             }
   143             }
   144         }
   144         }
   145    else
   145    else
   146         {
   146         {
   147         StartShowSecurityNoteL(); 
   147         StartShowSecurityNoteL(); 
   169         case EKeyNo:
   169         case EKeyNo:
   170             HandleEndKeyPressL( aMessage );
   170             HandleEndKeyPressL( aMessage );
   171             break;
   171             break;
   172         // send-key
   172         // send-key
   173         case EKeyYes:
   173         case EKeyYes:
   174             if ( IsNumberEntryUsedL() )
   174             if ( iNumberEntryManager->IsNumberEntryUsedL() )
   175                 {
   175                 {
   176                 TPhoneCmdParamBoolean isSecurityMode;
   176                 TPhoneCmdParamBoolean isSecurityMode;
   177                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   177                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   178                 
   178                 
   179                 TPhoneCmdParamInteger numberEntryCountParam;
   179                 TPhoneCmdParamInteger numberEntryCountParam;
   180                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   180                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   181                 &numberEntryCountParam );
   181                 &numberEntryCountParam );
   182                 
   182                 
   183                 TInt neLength( numberEntryCountParam.Integer() );
   183                 TInt neLength( numberEntryCountParam.Integer() );
   184                 if ( IsAnyQueryActiveL() )
   184                 if ( neLength == 0 && !isSecurityMode.Boolean())
   185                     {
       
   186                     return;
       
   187                     }
       
   188                 else if ( neLength == 0 && !isSecurityMode.Boolean())
       
   189                     {
   185                     {
   190                     // start logs
   186                     // start logs
   191                     iViewCommandHandle->HandleCommandL( 
   187                     iViewCommandHandle->HandleCommandL( 
   192                     EPhoneDialerCmdLog );
   188                     EPhoneDialerCmdLog );
   193                     return;
   189                     return;
   195                 HandleSendCommandL();
   191                 HandleSendCommandL();
   196                 }
   192                 }
   197             // If dialer is not open but phone is in foreground and phone receives
   193             // If dialer is not open but phone is in foreground and phone receives
   198             // send-key event we have to check if security mode is true and if it
   194             // send-key event we have to check if security mode is true and if it
   199             // is then open emergency dialer.
   195             // is then open emergency dialer.
   200             else if ( !IsNumberEntryUsedL() )
   196             else
   201                 {
   197                 {
   202                 TPhoneCmdParamBoolean isSecurityMode;
   198                 TPhoneCmdParamBoolean isSecurityMode;
   203                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   199                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   204                 if ( isSecurityMode.Boolean())
   200                 if ( isSecurityMode.Boolean())
   205                     {
   201                     {
   212         case EKeyApplication0:
   208         case EKeyApplication0:
   213             {
   209             {
   214             // If dialer is not open but phone is in foreground and phone receives
   210             // If dialer is not open but phone is in foreground and phone receives
   215             // applicaion-key event we have to open emergency dialer. No need own
   211             // applicaion-key event we have to open emergency dialer. No need own
   216             // securitymode check because Applicationkey only captured in securitymode.
   212             // securitymode check because Applicationkey only captured in securitymode.
   217             if ( !IsNumberEntryUsedL() )
   213             if ( !iNumberEntryManager->IsNumberEntryUsedL() )
   218                 {
   214                 {
   219                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   215                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   220                 }
   216                 }
   221             }
   217             }
   222             break;
   218             break;
   223 #ifdef RD_INTELLIGENT_TEXT_INPUT
   219 #ifdef RD_INTELLIGENT_TEXT_INPUT
   224         case EKeyEnter:
   220         case EKeyEnter:
   225             if ( IsNumberEntryVisibleL() )
   221             if ( iNumberEntryManager->IsNumberEntryVisibleL() )
   226                 {
   222                 {
   227                 HandleCommandL( EPhoneCmdOptions );
   223                 HandleCommandL( EPhoneCmdOptions );
   228                 }
   224                 }
   229             break;
   225             break;
   230 #endif
   226 #endif
   257             break;
   253             break;
   258             
   254             
   259         case MEngineMonitor::EPEMessageIssuedUSSDRequest:
   255         case MEngineMonitor::EPEMessageIssuedUSSDRequest:
   260             // Note that after the sending of SS 
   256             // Note that after the sending of SS 
   261             // strings the view stays in Dialer.
   257             // strings the view stays in Dialer.
   262             if ( IsNumberEntryUsedL() )
   258             if ( !iNumberEntryManager->SetVisibilityIfNumberEntryUsedL( ETrue ) )
   263                 {
   259                 {
   264                 // Show the number entry if it exists
   260                 RemoveDialogsAndSendPhoneToBackgroundL();
   265                 SetNumberEntryVisibilityL(ETrue);    
       
   266                 }    
       
   267             else if ( NeedToSendToBackgroundL() )
       
   268                 {
       
   269                 // Continue displaying current app but set up the 
       
   270                 // idle screen in the background
       
   271                 SetupIdleScreenInBackgroundL();
       
   272                 }
       
   273             else
       
   274                 {
       
   275                  // Display idle screen
       
   276                 DisplayIdleScreenL();
       
   277                 }
   261                 }
   278             break;
   262             break;
   279             
   263             
   280         case MEngineMonitor::EPEMessageIdle:
   264         case MEngineMonitor::EPEMessageIdle:
   281             HandleIdleL( aCallId );
   265             HandleIdleL( aCallId );
   304 void CPhoneStateIdle::HandleIncomingL( TInt aCallId )
   288 void CPhoneStateIdle::HandleIncomingL( TInt aCallId )
   305     {
   289     {
   306     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIncomingL( ) ");
   290     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIncomingL( ) ");
   307     HandleAudioAvailableOutputChangedL();
   291     HandleAudioAvailableOutputChangedL();
   308     SetRingingTonePlaybackL( aCallId );
   292     SetRingingTonePlaybackL( aCallId );
       
   293     
   309     BeginUiUpdateLC();
   294     BeginUiUpdateLC();
   310     
   295     iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(EFalse);
   311     if ( IsNumberEntryUsedL() )
       
   312         {
       
   313         SetNumberEntryVisibilityL(EFalse);
       
   314         }
       
   315      
       
   316     DisplayIncomingCallL( aCallId );
   296     DisplayIncomingCallL( aCallId );
   317     SetTouchPaneButtons( EPhoneIncomingCallButtons );
       
   318     CheckDisableHWKeysAndCallUIL();
       
   319     SetBackButtonActive(EFalse);
   297     SetBackButtonActive(EFalse);
       
   298     UpdateUiCommands();
   320     EndUiUpdate();
   299     EndUiUpdate();
   321     
   300     
   322     iCbaManager->UpdateIncomingCbaL( aCallId );
   301     ChangeTo( EPhoneStateIncoming );
   323     iViewCommandHandle->HandleCommandL( EPhoneViewShowToolbar );
   302     }
   324     iStateMachine->ChangeState( EPhoneStateIncoming );
   303 
   325     SetDivertIndication( EFalse );
   304 // -----------------------------------------------------------
   326     }
   305 // CPhoneStateIdle::HandleDialingL
   327 
       
   328 // -----------------------------------------------------------
       
   329 // CPhoneStateIdle::HandleDiallingL
       
   330 // Default handling for dialling message
   306 // Default handling for dialling message
   331 // (other items were commented in a header).
   307 // (other items were commented in a header).
   332 // -----------------------------------------------------------
   308 // -----------------------------------------------------------
   333 //
   309 //
   334 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   310 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   335     {
   311     {
   336     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   312     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");   
   337     BeginUiUpdateLC();
   313     TPhoneCmdParamKeyCapture captureParam;
   338     DisplayCallSetupL( aCallId );
   314     captureParam.SetKeyCode( EKeyNo );
   339     SetTouchPaneButtons( EPhoneCallSetupButtons );
   315     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
   340     EndUiUpdate();
   316     DisplayCallHeaderL( aCallId, ESetNEVisibilityFalse );
   341     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   317     SetToolbarButtonLoudspeakerEnabled();
   342     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   318     ChangeTo( EPhoneStateCallSetup );
   343     iStateMachine->ChangeState( EPhoneStateCallSetup );
       
   344     }
   319     }
   345 
   320 
   346 // -----------------------------------------------------------
   321 // -----------------------------------------------------------
   347 // CPhoneStateIdle::HandleConnectedL
   322 // CPhoneStateIdle::HandleConnectedL
   348 // Message Handling function for message EPEMessageConnected
   323 // Message Handling function for message EPEMessageConnected
   354 // -----------------------------------------------------------
   329 // -----------------------------------------------------------
   355 //
   330 //
   356 void CPhoneStateIdle::HandleConnectedL( TInt aCallId )
   331 void CPhoneStateIdle::HandleConnectedL( TInt aCallId )
   357     {
   332     {
   358     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleConnectedL( ) ");
   333     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleConnectedL( ) ");
   359     // Keep Phone app in the foreground if it is external
       
   360     if ( !TopAppIsDisplayedL() )
       
   361         {
       
   362         TPhoneCmdParamInteger uidParam;
       
   363         uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   364         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, 
       
   365             &uidParam );
       
   366         }
       
   367     BeginUiUpdateLC();
   334     BeginUiUpdateLC();
   368     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   335     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   369     DisplayCallSetupL( aCallId );
   336     DisplayCallHeaderL( aCallId, ESetNEVisibilityFalse );
   370     UpdateSingleActiveCallL( aCallId );
   337     UpdateSingleActiveCallL( aCallId );
   371     SetTouchPaneButtons( EPhoneIncallButtons );
   338     UpdateUiCommands();
   372     EndUiUpdate();
   339     EndUiUpdate();
   373     
   340     ChangeTo( EPhoneStateSingle );
   374     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   375     iStateMachine->ChangeState( EPhoneStateSingle );
       
   376     }
   341     }
   377 
   342 
   378 // -----------------------------------------------------------
   343 // -----------------------------------------------------------
   379 // CPhoneStateIdle::HandleCommandL
   344 // CPhoneStateIdle::HandleCommandL
   380 // -----------------------------------------------------------
   345 // -----------------------------------------------------------
   470 // -----------------------------------------------------------
   435 // -----------------------------------------------------------
   471 //
   436 //
   472 void CPhoneStateIdle::DialVideoCallL()
   437 void CPhoneStateIdle::DialVideoCallL()
   473     {
   438     {
   474     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DialVideoCallL( ) ");
   439     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DialVideoCallL( ) ");
   475     if ( IsNumberEntryUsedL() )
   440     if ( iNumberEntryManager->IsNumberEntryUsedL() )
   476         {
   441         {
   477         // get the number entry contents
   442         // get the number entry contents
   478         HBufC* phoneNumber = PhoneNumberFromEntryLC();
   443         HBufC* phoneNumber = iNumberEntryManager->PhoneNumberFromEntryLC();
   479 #ifdef _DEBUG
   444 #ifdef _DEBUG
   480         if ( (*phoneNumber).Compare( KExit ) == 0 )
   445         if ( (*phoneNumber).Compare( KExit ) == 0 )
   481             {
   446             {
   482             CleanupStack::PopAndDestroy( phoneNumber );
   447             CleanupStack::PopAndDestroy( phoneNumber );
   483             SendExitCommandL();
   448             SendExitCommandL();
   505     
   470     
   506     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   471     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   507     TPhoneCmdParamKeyCapture captureParam;
   472     TPhoneCmdParamKeyCapture captureParam;
   508     captureParam.SetKeyCode( EKeyNo );
   473     captureParam.SetKeyCode( EKeyNo );
   509     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
   474     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
   510 
   475     
   511     // Indicate that the Phone needs to be sent to the background if
   476     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringPhoneAppToForeground );
   512     // an application other than the top application is in the foreground
   477     
   513     TPhoneCmdParamBoolean booleanParam;
       
   514     booleanParam.SetBoolean( !TopAppIsDisplayedL() );
       
   515     iViewCommandHandle->ExecuteCommandL( 
       
   516         EPhoneViewSetNeedToSendToBackgroundStatus,
       
   517         &booleanParam );
       
   518 
       
   519     TPhoneCmdParamInteger uidParam;
       
   520     uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   521     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
       
   522         &uidParam );
       
   523     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
       
   524         &uidParam );
       
   525         
       
   526     // Disable global notes when there is an incoming call
   478     // Disable global notes when there is an incoming call
   527     TPhoneCmdParamBoolean globalNotifierParam;
   479     TPhoneCmdParamBoolean globalNotifierParam;
   528     globalNotifierParam.SetBoolean( ETrue );
   480     globalNotifierParam.SetBoolean( ETrue );
   529     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   481     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   530         &globalNotifierParam );
   482         &globalNotifierParam );
   531     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   483     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   532         &globalNotifierParam );
   484         &globalNotifierParam );
   533     DisplayHeaderForCallComingInL( aCallId, EFalse ); //not waiting
   485     iViewCommandHandle->ExecuteCommandL(EPhoneViewCreateCallHeader, aCallId);
   534     }
       
   535 
       
   536 // -----------------------------------------------------------
       
   537 // CPhoneStateIdle::DisplayCallSetupL
       
   538 // -----------------------------------------------------------
       
   539 //
       
   540 EXPORT_C void CPhoneStateIdle::DisplayCallSetupL( TInt aCallId )
       
   541     {
       
   542     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DisplayCallSetupL( ) ");
       
   543     __ASSERT_DEBUG( aCallId > KErrNotFound, Panic( EPhoneCtrlParameterNotInitialized ) );
       
   544 
       
   545     TPhoneCmdParamKeyCapture captureParam;
       
   546     captureParam.SetKeyCode( EKeyNo );
       
   547     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   548 
       
   549     // Indicate that the Phone needs to be sent to the background if
       
   550     // an application other than the top application is in the foreground
       
   551     TPhoneCmdParamBoolean booleanParam;
       
   552     booleanParam.SetBoolean( !TopAppIsDisplayedL() );
       
   553     iViewCommandHandle->ExecuteCommandL( 
       
   554         EPhoneViewSetNeedToSendToBackgroundStatus,
       
   555         &booleanParam );
       
   556     
       
   557     // Bring Phone app in the foreground
       
   558     TPhoneCmdParamInteger uidParam;
       
   559     uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   560     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
       
   561         &uidParam );
       
   562     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
       
   563         &uidParam ); 
       
   564     
       
   565     DisplayHeaderForOutgoingCallL( aCallId );
       
   566     }
   486     }
   567 
   487 
   568 // -----------------------------------------------------------
   488 // -----------------------------------------------------------
   569 // CPhoneStateIdle::HandleIdleForegroundEventL
   489 // CPhoneStateIdle::HandleIdleForegroundEventL
   570 // -----------------------------------------------------------
   490 // -----------------------------------------------------------
   571 //
   491 //
   572 EXPORT_C void CPhoneStateIdle::HandleIdleForegroundEventL()
   492 EXPORT_C void CPhoneStateIdle::HandleIdleForegroundEventL()
   573     {
   493     {
   574     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIdleForegroundEventL( ) ");
   494     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIdleForegroundEventL( ) ");
   575     if ( IsNumberEntryUsedL() )
   495     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   576         {
       
   577         if ( IsNumberEntryVisibleL() )
       
   578             {
       
   579             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
       
   580             }
       
   581         }
       
   582     else if ( !IsAnyQueryActiveL() )
       
   583         {
       
   584         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
       
   585         }
       
   586     }
   496     }
   587 
   497 
   588 // -----------------------------------------------------------
   498 // -----------------------------------------------------------
   589 // CPhoneStateIdle::HandlePhoneForegroundEventL
   499 // CPhoneStateIdle::HandlePhoneForegroundEventL
   590 // -----------------------------------------------------------
   500 // -----------------------------------------------------------
   598 // -----------------------------------------------------------
   508 // -----------------------------------------------------------
   599 //
   509 //
   600 EXPORT_C void CPhoneStateIdle::HandlePhoneFocusLostEventL()
   510 EXPORT_C void CPhoneStateIdle::HandlePhoneFocusLostEventL()
   601     {
   511     {
   602     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneFocusLostEventL( ) ");
   512     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneFocusLostEventL( ) ");
   603     if ( !IsNumberEntryUsedL() )
   513     if ( !iNumberEntryManager->IsNumberEntryUsedL() )
   604          {
   514          {
   605          // If dialer is open add icon to FSW list.
   515          // If dialer is open add icon to FSW list.
   606          iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   516          iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   607          }
   517          }
   608     }
   518     }
   635 // -----------------------------------------------------------
   545 // -----------------------------------------------------------
   636 //
   546 //
   637 void CPhoneStateIdle::SendExitCommandL()
   547 void CPhoneStateIdle::SendExitCommandL()
   638     {
   548     {
   639     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SendExitCommand( ) ");
   549     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SendExitCommand( ) ");
   640     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   550     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry ); 
   641 
   551     // Simulate exit command 
   642     // Simulate exit command
   552     RWsSession& wsSession = EikonEnv()->WsSession(); 
   643     CEikonEnv& eikEnv = *CEikonEnv::Static();
   553     TKeyEvent keyEvent; 
   644     CCoeEnv& coeEnv = eikEnv;
   554     keyEvent.iCode = EEikCmdExit; 
   645     RWsSession& wsSession=coeEnv.WsSession();
   555     keyEvent.iScanCode = EEikCmdExit; 
   646     TKeyEvent keyEvent;
   556     keyEvent.iModifiers = 0; 
   647     keyEvent.iCode = EEikCmdExit;
   557     keyEvent.iRepeats = 0; 
   648     keyEvent.iScanCode = EEikCmdExit;
   558     wsSession.SimulateKeyEvent( keyEvent ); 
   649     keyEvent.iModifiers = 0;
   559     wsSession.Flush(); 
   650     keyEvent.iRepeats = 0;
       
   651     wsSession.SimulateKeyEvent( keyEvent );
       
   652     wsSession.Flush();  
       
   653 
   560 
   654     iViewCommandHandle->ExecuteCommandL( EPhoneAppShutDown );
   561     iViewCommandHandle->ExecuteCommandL( EPhoneAppShutDown );
   655     }
   562     }
   656 
   563 
   657 // -----------------------------------------------------------
   564 // -----------------------------------------------------------
   663     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::HandleEndKeyPressL( ) ");
   570     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::HandleEndKeyPressL( ) ");
   664     // End key not handled also in phone startup when pressed during country/time/date query
   571     // End key not handled also in phone startup when pressed during country/time/date query
   665     RWsSession sess = CCoeEnv::Static()->WsSession();
   572     RWsSession sess = CCoeEnv::Static()->WsSession();
   666     TApaTaskList appList( sess );
   573     TApaTaskList appList( sess );
   667     TApaTask startup = appList.FindApp( KUidStartupApplication );
   574     TApaTask startup = appList.FindApp( KUidStartupApplication );
   668     if ( !IsAutoLockOn() && !IsKeyLockOn() && !startup.Exists() )
   575     if ( !IsAutoLockOn() && !startup.Exists() )
   669         {
   576         {
   670         //Cancels e.g. USB notifier and Audio notifier.
   577         //Cancels e.g. USB notifier and Audio notifier.
   671         iViewCommandHandle->ExecuteCommandL( EPhoneViewCancelAllNotications );
   578         iViewCommandHandle->ExecuteCommandL( EPhoneViewCancelAllNotications );
   672         // If KFeatureIdFfSimlessOfflineSupport is undef and security note is shown then do not
   579         // If KFeatureIdFfSimlessOfflineSupport is undef and security note is shown then do not
   673         // remove security note from screen.
   580         // remove security note from screen.
   681             {
   588             {
   682             if ( aMessage == EPhoneKeyLongPress )
   589             if ( aMessage == EPhoneKeyLongPress )
   683                 {
   590                 {
   684                 iStateMachine->SendPhoneEngineMessage(
   591                 iStateMachine->SendPhoneEngineMessage(
   685                         MPEPhoneModel::EPEMessageTerminateAllConnections );
   592                         MPEPhoneModel::EPEMessageTerminateAllConnections );
   686                 if ( IsNumberEntryUsedL() )
   593                 if ( iNumberEntryManager->IsNumberEntryUsedL() )
   687                     {
   594                     {
   688                     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   595                     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   689                     // Do state-specific operation when number entry is cleared
   596                     // Do state-specific operation when number entry is cleared
   690                     HandleNumberEntryClearedL();
   597                     HandleNumberEntryClearedL();
   691                     // If long end key event occures then all calls are terminated and
   598                     // If long end key event occures then all calls are terminated and
   692                     // dialer is closed, therefore tel.icon must be removed from FSW.
   599                     // dialer is closed, therefore tel.icon must be removed from FSW.
   693                     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   600                     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   694                     }
   601                     }
   695                 if ( !TopAppIsDisplayedL() )
       
   696                     {
       
   697                     DisplayIdleScreenL();
       
   698                     }
       
   699                 }
   602                 }
   700             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
   603             else if ( iNumberEntryManager->IsNumberEntryUsedL() )
   701                 {
   604                 {
   702                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   605                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   703                 // Do state-specific operation when number entry is cleared
   606                 // Do state-specific operation when number entry is cleared
   704                 HandleNumberEntryClearedL();
   607                 HandleNumberEntryClearedL();
   705                 }
   608                 }
   706             else if ( !TopAppIsDisplayedL() )
   609             }
   707                 {
   610         else if ( iNumberEntryManager->IsNumberEntryUsedL() )
   708                 // Phone might not be the topmost app since it has
       
   709                 // some dialog/query open therefore we need to check this
       
   710                 // and remove dialog/phone.
       
   711                 if ( IsAnyQueryActiveL()  )
       
   712                     {
       
   713                     if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
       
   714                         {
       
   715                         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
       
   716                         }
       
   717                     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   718                     }
       
   719                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
       
   720                 }
       
   721             }
       
   722         else if ( IsNumberEntryUsedL() )
       
   723             {
   611             {
   724             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   612             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   725             StartShowSecurityNoteL();
   613             StartShowSecurityNoteL();
   726             }
   614             }
   727         }
   615         }
   779 //
   667 //
   780 void CPhoneStateIdle::HandleVoiceCallCommandL()
   668 void CPhoneStateIdle::HandleVoiceCallCommandL()
   781     {
   669     {
   782     __LOGMETHODSTARTEND(
   670     __LOGMETHODSTARTEND(
   783         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
   671         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
   784     if ( IsNumberEntryUsedL() )
   672     if ( iNumberEntryManager->IsNumberEntryUsedL() )
   785         {
   673         {
   786         HBufC* phoneNumber = PhoneNumberFromEntryLC();
   674         HBufC* phoneNumber = iNumberEntryManager->PhoneNumberFromEntryLC();
   787         if ( !IsSimOk() )
   675         if ( !IsSimOk() )
   788             {
   676             {
   789             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber ) ;
   677             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber ) ;
   790             iStateMachine->SendPhoneEngineMessage( 
   678             iStateMachine->SendPhoneEngineMessage( 
   791             MPEPhoneModel::EPEMessageCheckEmergencyNumber );
   679             MPEPhoneModel::EPEMessageCheckEmergencyNumber );
   807             CleanupStack::PopAndDestroy( phoneNumber );
   695             CleanupStack::PopAndDestroy( phoneNumber );
   808             }
   696             }
   809         }    
   697         }    
   810     }
   698     }
   811 
   699 
       
   700 // -----------------------------------------------------------
       
   701 // CPhoneStateIdle::ChangeTo
       
   702 // -----------------------------------------------------------
       
   703 //
       
   704 void CPhoneStateIdle::ChangeTo( TInt aState )
       
   705     {
       
   706     __PHONELOG1( EBasic, EPhoneControl, 
       
   707            "PhoneUIControl: CPhoneStateIdle::ChangeTo - aState =%d ",
       
   708            aState );
       
   709     iStateMachine->ChangeState( aState );
       
   710     }
       
   711 
   812 // End of File
   712 // End of File