phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 58 40a3f856b14d
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
    25 #include <aknnotedialog.h> // For CAknNoteDialog::EErrorTone
    25 #include <aknnotedialog.h> // For CAknNoteDialog::EErrorTone
    26 #include <apgcli.h>
    26 #include <apgcli.h>
    27 #include <telephonyvariant.hrh>
    27 #include <telephonyvariant.hrh>
    28 #include <featmgr.h>
    28 #include <featmgr.h>
    29 #include <settingsinternalcrkeys.h>
    29 #include <settingsinternalcrkeys.h>
    30 #include <ScreensaverInternalPSKeys.h>
       
    31 #include <mpeengineinfo.h>
    30 #include <mpeengineinfo.h>
    32 #include <activeidle2domainpskeys.h>
       
    33 #include <mpeclientinformation.h>
    31 #include <mpeclientinformation.h>
    34 #include <bldvariant.hrh>
    32 #include <bldvariant.hrh>
    35 #include <MProEngEngine.h>
       
    36 #include <ProEngFactory.h>
       
    37 
    33 
    38 #include "cphonepubsubproxy.h"
    34 #include "cphonepubsubproxy.h"
    39 #include "cphonecenrepproxy.h"
    35 #include "cphonecenrepproxy.h"
    40 #include "cphonestateidle.h"
    36 #include "cphonestateidle.h"
    41 #include "tphonecmdparaminteger.h"
    37 #include "tphonecmdparaminteger.h"
    42 #include "tphonecmdparamboolean.h"
    38 #include "tphonecmdparamboolean.h"
    43 #include "tphonecmdparamglobalnote.h"
    39 #include "tphonecmdparamglobalnote.h"
       
    40 #include "tphonecmdparamkeycapture.h"
    44 #include "tphonecmdparamstring.h"
    41 #include "tphonecmdparamstring.h"
    45 #include "tphonecmdparamspeeddial.h"
       
    46 #include "tphonecmdparamboolean.h"
    42 #include "tphonecmdparamboolean.h"
    47 #include "mphonestatemachine.h"
    43 #include "mphonestatemachine.h"
    48 #include "phonestatedefinitions.h"
    44 #include "phonestatedefinitions.h"
    49 #include "tphonecmdparamappinfo.h"
    45 #include "tphonecmdparamappinfo.h"
    50 #include "cphonekeys.h"
    46 #include "cphonekeys.h"
    51 
    47 
    52 #include "tphonecmdparamcallstatedata.h"
    48 #include "tphonecmdparamcallstatedata.h"
    53 #include "tphonecmdparamcallheaderdata.h"
       
    54 #include "phoneviewcommanddefinitions.h"
    49 #include "phoneviewcommanddefinitions.h"
    55 #include "phoneui.hrh"
    50 #include "phoneui.hrh"
    56 #include "phonerssbase.h"
    51 #include "phonerssbase.h"
    57 #include "cphonemainresourceresolver.h"
    52 #include "cphonemainresourceresolver.h"
    58 #include "cphonecenrepproxy.h"
    53 #include "cphonecenrepproxy.h"
    59 #include "cphonepubsubproxy.h"
    54 #include "cphonepubsubproxy.h"
    60 #include "phonelogger.h"
    55 #include "phonelogger.h"
    61 #include "phoneui.pan"
    56 #include "phoneui.pan"
    62 #include "phoneconstants.h"
       
    63 #include "mphonecustomization.h"
    57 #include "mphonecustomization.h"
    64 #include <easydialingcommands.hrh>
    58 
    65 #include "mphonesecuritymodeobserver.h"
       
    66 
       
    67 //CONSTANTS
       
    68 const TInt  KMaxParamLength = 1024;
       
    69 
    59 
    70 // ================= MEMBER FUNCTIONS =======================
    60 // ================= MEMBER FUNCTIONS =======================
    71 
    61 
    72 // C++ default constructor can NOT contain any code, that
    62 // C++ default constructor can NOT contain any code, that
    73 // might leave.
    63 // might leave.
    74 //
    64 //
    75 EXPORT_C CPhoneStateIdle::CPhoneStateIdle( 
    65 EXPORT_C CPhoneStateIdle::CPhoneStateIdle( 
    76     MPhoneStateMachine* aStateMachine, 
    66     MPhoneStateMachine* aStateMachine, 
    77     MPhoneViewCommandHandle* aViewCommandHandle,
    67     MPhoneViewCommandHandle* aViewCommandHandle,
    78     MPhoneCustomization* aCustomization ) : 
    68     MPhoneCustomization* aCustomization ) : 
    79     CPhoneState( aStateMachine, aViewCommandHandle, aCustomization ),
    69     CPhoneState( aStateMachine, aViewCommandHandle, aCustomization )
    80     iCallInitialized( EFalse )
       
    81     {
    70     {
    82     }
    71     }
    83 
    72 
    84 // Destructor
    73 // Destructor
    85 EXPORT_C CPhoneStateIdle::~CPhoneStateIdle()
    74 EXPORT_C CPhoneStateIdle::~CPhoneStateIdle()
    92 //
    81 //
    93 EXPORT_C void CPhoneStateIdle::ConstructL()
    82 EXPORT_C void CPhoneStateIdle::ConstructL()
    94     {
    83     {
    95     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::ConstructL() ");
    84     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::ConstructL() ");
    96     CPhoneState::BaseConstructL();
    85     CPhoneState::BaseConstructL();
    97     
       
    98     // Set send key activation on.
       
    99     TPhoneCmdParamBoolean boolean;
       
   100     boolean.SetBoolean( ETrue );
       
   101     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSendKeyDialerActivationFlag, 
       
   102                 &boolean );
       
   103     
       
   104     iViewCommandHandle->ExecuteCommandL( EPhoneViewCreatePhoneBookServices ); 
       
   105 
       
   106     // If Sim is not ok and we are not at foreground, bring ourselves to foreground
       
   107     // so that the security note can be seen.
       
   108     TPhoneCmdParamInteger foregroundAppParam;
       
   109     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetForegroundApplication,
       
   110                                          &foregroundAppParam );
       
   111 
       
   112     if ( !IsSimOk() )
       
   113         {
       
   114         TPhoneCmdParamInteger uidParam;
       
   115         // Bring Phone app in the foreground
       
   116         uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   117         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
       
   118             &uidParam );
       
   119 
       
   120         // Set Phone as the top application
       
   121         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
       
   122             &uidParam );
       
   123         }
       
   124     }
    86     }
   125 
    87 
   126 // -----------------------------------------------------------
    88 // -----------------------------------------------------------
   127 // CPhoneStateIdle::NewL()
    89 // CPhoneStateIdle::NewL()
   128 // -----------------------------------------------------------
    90 // -----------------------------------------------------------
   149 EXPORT_C void CPhoneStateIdle::HandleKeyEventL( 
   111 EXPORT_C void CPhoneStateIdle::HandleKeyEventL( 
   150     const TKeyEvent& aKeyEvent, 
   112     const TKeyEvent& aKeyEvent, 
   151     TEventCode aEventCode )
   113     TEventCode aEventCode )
   152     {
   114     {
   153     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   115     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyEventL( ) ");
   154     
   116     // Security mode check
       
   117     TPhoneCmdParamBoolean isSecurityMode;      
       
   118     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );  
   155     // Number entry is blocked, if active Query
   119     // Number entry is blocked, if active Query
   156     if ( !IsAnyQueryActiveL() )
   120     if ( !IsAnyQueryActiveL() )
   157         {
   121         {
   158         // Handle numeric keys when key events are received in idle state
   122         // Handle numeric keys when key events are received in idle state
   159         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   123         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   160         }
   124         }
   161     else if ( iStateMachine->SecurityMode()->IsSecurityMode()
   125     else if ( isSecurityMode.Boolean() && CPhoneKeys::IsNumericKey( 
   162         && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
   126         aKeyEvent, aEventCode ) )
   163         {
   127         {
   164         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   128         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   165         // Handle numeric keys when key events are received in single state
   129         // Handle numeric keys when key events are received in single state
   166         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   130         HandleNumericKeyEventL( aKeyEvent, aEventCode );  
   167         }
   131         }
   206     TPhoneKeyEventMessages aMessage,
   170     TPhoneKeyEventMessages aMessage,
   207     TKeyCode aCode )
   171     TKeyCode aCode )
   208     {
   172     {
   209     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyMessageL( ) ");
   173     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleKeyMessageL( ) ");
   210 
   174 
   211     if( aMessage == EPhoneKeyLongPress && CheckAppLaunchingL( aCode ) )
       
   212         {
       
   213         return;
       
   214         }
       
   215 
       
   216     switch ( aCode )
   175     switch ( aCode )
   217         {
   176         {
   218         case EKeyEnd:
   177         case EKeyEnd:
   219             // This key even occur only in idle state, behaviour for this should
   178             // This key even occur only in idle state, behaviour for this should
   220             // be same as long end-key press. (Bug in window server)
   179             // be same as long end-key press. (Bug in window server)
   221             HandleEndKeyPressL( EPhoneKeyLongPress );
   180             HandleEndKeyPressL( EPhoneKeyLongPress );
   222             break;
   181             break;
   223             
   182             
   224         // end-key
   183         // end-key
   225         case EKeyNo:
   184         case EKeyNo:
   226             HandleEndKeyPressL( aMessage );
   185             HandleEndKeyPressL( aMessage );            
   227             break;
   186             break;
   228 
   187 
   229         // send-key
   188         // send-key
   230         case EKeyYes:
   189         case EKeyYes:
   231             
   190             
   232             if ( iOnScreenDialer )
   191             if ( iOnScreenDialer )
   233                 {
   192                 {
   234                 if ( IsNumberEntryUsedL() )
   193                 if ( IsNumberEntryUsedL() )
   235                     {
   194                     {
   236                    
   195                     // Security mode check
       
   196                     TPhoneCmdParamBoolean isSecurityMode;      
       
   197                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   198 
   237                     TPhoneCmdParamInteger numberEntryCountParam;
   199                     TPhoneCmdParamInteger numberEntryCountParam;
   238                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   200                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   239                     &numberEntryCountParam );
   201                     &numberEntryCountParam );
   240                     TInt neLength( numberEntryCountParam.Integer() );
   202                     TInt neLength( numberEntryCountParam.Integer() );
   241                     
   203                     
   242                     // Query on top of dialer
   204                     // Query on top of dialer
   243                     if ( IsAnyQueryActiveL() )
   205                     if ( IsAnyQueryActiveL() )
   244                         {
   206                         {
   245                         return;
   207                         return;
   246                         }
   208                         }
   247                     else if ( IsMenuBarVisibleL() )
       
   248                         {
       
   249                         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   250                         return;
       
   251                         }
       
   252                     
   209                     
   253                     else if ( neLength == 0 && !iStateMachine->SecurityMode()->IsSecurityMode() )
   210                     else if ( neLength == 0 && !isSecurityMode.Boolean())
   254                         {
   211                         {
   255                         // start logs
   212                         // start logs
   256                         iViewCommandHandle->HandleCommandL( 
   213                         iViewCommandHandle->HandleCommandL( 
   257                         EPhoneDialerCmdLog );
   214                         EPhoneDialerCmdLog );
   258                         return;
   215                         return;
   260                     HandleSendCommandL();
   217                     HandleSendCommandL();
   261                     }
   218                     }
   262                 // If dialer is not open but phone is in foreground and phone receives
   219                 // If dialer is not open but phone is in foreground and phone receives
   263                 // send-key event we have to check if security mode is true and if it
   220                 // send-key event we have to check if security mode is true and if it
   264                 // is then open emergency dialer.
   221                 // is then open emergency dialer.
   265                 else if ( !IsNumberEntryUsedL() ) 
   222                 else if ( !IsNumberEntryUsedL() )
   266                     {
   223                     {
   267                    if ( iStateMachine->SecurityMode()->IsSecurityMode() )
   224                     // Security mode check
       
   225                     TPhoneCmdParamBoolean isSecurityMode;      
       
   226                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   227 
       
   228                     if ( isSecurityMode.Boolean())
   268                         {
   229                         {
   269                         iViewCommandHandle->HandleCommandL( EPhoneViewOpenNumberEntry );
   230                         // launch dialer.
       
   231                         HandleCommandL(EPhoneNumberAcqSecurityDialer);
   270                         }
   232                         }
   271                     }           
   233                     }           
   272                 }
   234                 }
   273             else // iOnScreenDialer false, non-touch.
   235             else // iOnScreenDialer false, non-touch.
   274                 {
   236                 {
   277             break;
   239             break;
   278             
   240             
   279         case EKeyApplication0:
   241         case EKeyApplication0:
   280             {
   242             {
   281             // If dialer is not open but phone is in foreground and phone receives
   243             // If dialer is not open but phone is in foreground and phone receives
   282             // applicaion-key event we have to open emergency dialer. 
   244             // applicaion-key event we have to open emergency dialer. No need own
   283             // Securitymode check because Applicationkey only open dialer in securitymode.
   245             // securitymode check because Applicationkey only captured in securitymode.
   284             if ( iStateMachine->SecurityMode()->IsSecurityMode() && !IsNumberEntryUsedL() )
   246             if ( !IsNumberEntryUsedL() )
   285                 {
   247                 {
   286                 iViewCommandHandle->HandleCommandL( EPhoneViewOpenNumberEntry );
   248                 HandleCommandL(EPhoneNumberAcqSecurityDialer);
   287                 }           
   249                 }           
   288             }
   250             }
   289             break;
   251             break;
   290             
   252             
   291         // "O" key
       
   292         case KPhoneDtmf0Character:
       
   293             if ( aMessage == EPhoneKeyLongPress && IsSimOk() )
       
   294                 {
       
   295                 LaunchApplicationL();
       
   296                 }
       
   297             break;
       
   298             
       
   299         // number key
       
   300         case KPhoneDtmf1Character:
       
   301         case KPhoneDtmf2Character:
       
   302         case KPhoneDtmf3Character:
       
   303         case KPhoneDtmf4Character:
       
   304         case KPhoneDtmf5Character:
       
   305         case KPhoneDtmf6Character:
       
   306         case KPhoneDtmf7Character:
       
   307         case KPhoneDtmf8Character:
       
   308         case KPhoneDtmf9Character:
       
   309             if ( aMessage == EPhoneKeyLongPress && IsSimOk() )
       
   310                 {
       
   311                 HandleNumberLongKeyPressL();
       
   312                 }
       
   313             break;
       
   314 
       
   315 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   253 #ifdef RD_INTELLIGENT_TEXT_INPUT   
   316         case EKeyEnter:
   254         case EKeyEnter:
   317             if ( IsNumberEntryVisibleL() )
   255             if ( IsNumberEntryVisibleL() )
   318                 {
   256                 {
   319                 if ( IsDialingExtensionInFocusL() )
   257                 HandleCommandL( EPhoneCmdOptions );
   320                     {
       
   321                     HandleCommandL( EEasyDialingEnterKeyAction );
       
   322                     }
       
   323                 else
       
   324                     {
       
   325                     TPhoneCmdParamInteger numberEntryCountParam;
       
   326                     iViewCommandHandle->ExecuteCommandL( 
       
   327                             EPhoneViewGetNumberEntryCount,
       
   328                             &numberEntryCountParam );
       
   329                     
       
   330                     TInt neLength( numberEntryCountParam.Integer() );
       
   331                     if ( neLength > 0 )
       
   332                         {
       
   333                         HandleSendCommandL();
       
   334                         }
       
   335                     }               
       
   336                 }
   258                 }
   337             break;
   259             break;
   338 #endif
   260 #endif
   339             
   261             
   340         default:
   262         default:
   351     TInt aCallId )
   273     TInt aCallId )
   352     {
   274     {
   353     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneEngineMessageL( ) ");
   275     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneEngineMessageL( ) ");
   354     switch ( aMessage )
   276     switch ( aMessage )
   355         {
   277         {
   356         case MEngineMonitor::EPEMessageInitiatedMoCall:
       
   357             SetCallInitialized( ETrue );
       
   358             break;
       
   359                     
       
   360         case MEngineMonitor::EPEMessageIncoming:
   278         case MEngineMonitor::EPEMessageIncoming:
   361             HandleIncomingL( aCallId );
   279             HandleIncomingL( aCallId );
   362             break;
   280             break;
   363             
   281             
   364         case MEngineMonitor::EPEMessageDialing:
   282         case MEngineMonitor::EPEMessageDialing:
   375             if ( !iOnScreenDialer )  
   293             if ( !iOnScreenDialer )  
   376                 {
   294                 {
   377                 if ( IsNumberEntryUsedL() )
   295                 if ( IsNumberEntryUsedL() )
   378                     {
   296                     {
   379                     // Show the number entry if it exists
   297                     // Show the number entry if it exists
   380                     SetNumberEntryVisibilityL(ETrue);
   298                     SetNumberEntryVisibilityL(ETrue);    
   381                     }    
   299                     }    
   382                 else if ( NeedToReturnToForegroundAppL() )
   300                 else if ( NeedToSendToBackgroundL() )
   383                     {
   301                     {
   384                     // Continue displaying current app but set up the 
   302                     // Continue displaying current app but set up the 
   385                     // idle screen in the background
   303                     // idle screen in the background
   386                     SetupIdleScreenInBackgroundL();
   304                     SetupIdleScreenInBackgroundL();
   387                     }
   305                     }
   395             
   313             
   396         case MEngineMonitor::EPEMessageIdle:
   314         case MEngineMonitor::EPEMessageIdle:
   397             HandleIdleL( aCallId );
   315             HandleIdleL( aCallId );
   398             break;
   316             break;
   399             
   317             
   400         case MEngineMonitor::EPEMessageInValidEmergencyNumber:
   318         case MEngineMonitor::EPEMessageInValidEmergencyNumber:                
   401             SendGlobalWarningNoteL( EPhoneEmergencyCallsOnly );
   319             SendGlobalWarningNoteL( EPhoneEmergencyCallsOnly, ETrue );                           
   402             break;
   320             break;
   403             
   321             
   404         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   322         case MEngineMonitor::EPEMessageValidEmergencyNumber:
   405             DialVoiceCallL();
   323             DialVoiceCallL();
   406             break; 
   324             break; 
   407         
   325                         
   408         default:
   326         default:
   409             CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId );
   327             CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId );
   410             break;
   328             break;
   411         }
   329         }
   412     }
   330     }
   420 void CPhoneStateIdle::HandleIncomingL( TInt aCallId )
   338 void CPhoneStateIdle::HandleIncomingL( TInt aCallId )
   421     {
   339     {
   422     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIncomingL( ) ");
   340     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIncomingL( ) ");
   423 
   341 
   424     HandleAudioAvailableOutputChangedL();
   342     HandleAudioAvailableOutputChangedL();
   425     
       
   426     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNaviPaneAudioVolume );
       
   427 
   343 
   428     SetRingingTonePlaybackL( aCallId );
   344     SetRingingTonePlaybackL( aCallId );
   429     
   345 
   430     CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
   431         KPSUidScreenSaver,
       
   432         KScreenSaverAllowScreenSaver,
       
   433         EPhoneScreensaverNotAllowed );
       
   434     
       
   435     IsNumberEntryUsedL() ? 
       
   436         BeginTransEffectLC( ECallUiAppear ) :
       
   437         BeginTransEffectLC( ENumberEntryOpen );
       
   438     BeginUiUpdateLC();
   346     BeginUiUpdateLC();
   439     
   347     
   440     // Hide the number entry if it exists
   348     // Hide the number entry if it exists
   441     if ( IsNumberEntryUsedL() )
   349     if ( IsNumberEntryUsedL() )
   442         {
   350         {
   443         SetNumberEntryVisibilityL(EFalse);    
   351         SetNumberEntryVisibilityL(EFalse);    
   444         }
   352         }
   445      
   353      
   446     // Close fast swap window if it's displayed
   354     // Display incoming call
   447     EikonEnv()->DismissTaskList();
   355     DisplayIncomingCallL( aCallId );
   448 
   356     
   449     // Show incoming call buttons
   357     // Show incoming call buttons
   450     SetTouchPaneButtons( EPhoneIncomingCallButtons );
   358     SetTouchPaneButtons( EPhoneIncomingCallButtons );
   451     SetTouchPaneButtonEnabled( EPhoneCallComingCmdSilent );
   359     
   452     SetTouchPaneButtonEnabled( EPhoneInCallCmdHold );
   360     // Disable HW keys and Call UI if needed
   453     
   361     CheckDisableHWKeysAndCallUIL();
   454     // Display incoming call
   362     
   455     DisplayIncomingCallL( aCallId );
   363     SetBackButtonActive(EFalse);
   456 
   364     
   457     EndUiUpdate();
   365     EndUiUpdate();
   458     EndTransEffect();
       
   459     
   366     
   460     // Go to incoming state
   367     // Go to incoming state
   461     iCbaManager->UpdateIncomingCbaL( aCallId );
   368     iCbaManager->UpdateIncomingCbaL( aCallId );
   462     UpdateSilenceButtonDimming();
   369 
   463     UpdateIncomingContextMenuL( aCallId );
       
   464     //Dim toolbar items
       
   465     SetToolbarDimming( ETrue );
       
   466     //request that dimmed toolbar is visible.
   370     //request that dimmed toolbar is visible.
   467     iViewCommandHandle->HandleCommandL( EPhoneViewShowToolbar );
   371     iViewCommandHandle->HandleCommandL( EPhoneViewShowToolbar );
   468     
   372     iStateMachine->ChangeState( EPhoneStateIncoming );
   469     ChangeTo( EPhoneStateIncoming );
   373          
   470     }
   374     // Reset divert indication
   471 
   375     SetDivertIndication( EFalse );
   472 // -----------------------------------------------------------
   376     }
   473 // CPhoneStateIdle::HandleDialingL
   377 
       
   378 // -----------------------------------------------------------
       
   379 // CPhoneStateIdle::HandleDiallingL
   474 // Default handling for dialling message
   380 // Default handling for dialling message
   475 // (other items were commented in a header).
   381 // (other items were commented in a header).
   476 // -----------------------------------------------------------
   382 // -----------------------------------------------------------
   477 //
   383 //
   478 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   384 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   479     {    
   385     {
   480     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   386     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   481     // Indicate that the Phone needs to be sent to the background if
   387     BeginUiUpdateLC();
   482     // an application other than phone or idle application is in the foreground
   388 
   483     SetNeedToReturnToForegroundAppStatusL( !TopAppIsDisplayedL() );
   389     // Display call setup 
   484    
   390     DisplayCallSetupL( aCallId );  
   485     DisplayCallSetupL( aCallId );
   391     
   486     ChangeTo( EPhoneStateCallSetup );
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------
       
   490 // CPhoneStateIdle::DoStateSpecificCallSetUpDefinitionsL
       
   491 // -----------------------------------------------------------
       
   492 //
       
   493 EXPORT_C void CPhoneStateIdle::DoStateSpecificCallSetUpDefinitionsL()
       
   494     {
       
   495     // Show call setup buttons
   392     // Show call setup buttons
   496     SetTouchPaneButtons( EPhoneCallSetupButtons );
   393     SetTouchPaneButtons( EPhoneCallSetupButtons );          
   497     SetTouchPaneButtonDisabled( EPhoneInCallCmdHold );
   394     
   498 
   395     EndUiUpdate();
   499     SetToolbarDimming( ETrue );
   396     
   500     SetToolbarButtonLoudspeakerEnabled();
   397     // Remove any phone dialogs if they are displayed
   501     SetToolbarButtonHandsetEnabled();
   398     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   502     SetToolbarButtonBTHFEnabled();
   399             
       
   400     // Go to call setup state
       
   401     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
       
   402     
       
   403     iStateMachine->ChangeState( EPhoneStateCallSetup );
   503     }
   404     }
   504 
   405 
   505 // -----------------------------------------------------------
   406 // -----------------------------------------------------------
   506 // CPhoneStateIdle::HandleConnectedL
   407 // CPhoneStateIdle::HandleConnectedL
   507 // Message Handling function for message EPEMessageConnected
   408 // Message Handling function for message EPEMessageConnected
   521         TPhoneCmdParamInteger uidParam;
   422         TPhoneCmdParamInteger uidParam;
   522         uidParam.SetInteger( KUidPhoneApplication.iUid );
   423         uidParam.SetInteger( KUidPhoneApplication.iUid );
   523         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, 
   424         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, 
   524             &uidParam );
   425             &uidParam );
   525         }
   426         }
   526     BeginTransEffectLC( ENumberEntryClose );
       
   527     BeginUiUpdateLC();
   427     BeginUiUpdateLC();
   528     
   428             
   529     // Remove the number entry
   429     // Remove the number entry
   530     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   430     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   531  
   431  
   532     // Display call setup header
   432     // Display call setup header
   533     DisplayCallSetupL( aCallId );
   433     DisplayCallSetupL( aCallId );
   535     // Update single active call
   435     // Update single active call
   536     UpdateSingleActiveCallL( aCallId );
   436     UpdateSingleActiveCallL( aCallId );
   537     
   437     
   538     // Update touch buttons
   438     // Update touch buttons
   539     SetTouchPaneButtons( EPhoneIncallButtons );
   439     SetTouchPaneButtons( EPhoneIncallButtons );
   540     SetToolbarDimming( EFalse );
       
   541     
   440     
   542     EndUiUpdate();
   441     EndUiUpdate();
   543     EndTransEffect();
       
   544   
   442   
   545     // Go to single state
   443     // Go to single state
   546     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   444     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   547     ChangeTo( EPhoneStateSingle );
   445     iStateMachine->ChangeState( EPhoneStateSingle );
   548     }
   446     }
   549 
   447 
   550 // -----------------------------------------------------------
   448 // -----------------------------------------------------------
   551 // CPhoneStateIdle::HandleCommandL
   449 // CPhoneStateIdle::HandleCommandL
   552 // -----------------------------------------------------------
   450 // -----------------------------------------------------------
   558 
   456 
   559     switch( aCommand )
   457     switch( aCommand )
   560         {
   458         {
   561         case EPhoneCmdOptions:
   459         case EPhoneCmdOptions:
   562             {
   460             {
   563             // Open number entry menubar
   461             break;
   564             TInt menuId( GetNumberAcqMenuIdL() );
   462             }
   565             TPhoneCmdParamInteger integerParam;
   463         
   566             integerParam.SetInteger( menuId );
       
   567             iViewCommandHandle->ExecuteCommandL( 
       
   568                 EPhoneViewMenuBarOpen, &integerParam );
       
   569             }
       
   570             break;
       
   571         case EPhoneNumberAcqCmdCall:
   464         case EPhoneNumberAcqCmdCall:
   572             HandleVoiceCallCommandL( EFalse );
   465             HandleVoiceCallCommandL();
   573             break;
   466             break;
   574         case EPhoneNumberAcqCmdSendCommand:
   467         case EPhoneNumberAcqCmdSendCommand:
   575             HandleSendCommandL();
   468             HandleSendCommandL();
   576             break;
   469             break;
   577             
   470             
   578         case EPhoneNumberAcqCmdVideoCall:
   471         case EPhoneNumberAcqCmdVideoCall:
   579             DialVideoCallL();
   472             DialVideoCallL();
   580             break;
   473             break;
   581             
   474             
   582         case EPhoneCmdBack:
   475         case EPhoneCmdBack:
   583             BeginTransEffectLC( ENumberEntryClose );
   476             break;            
   584             HandleBackCommandL();
       
   585             EndTransEffect();
       
   586             break;
       
   587         
       
   588         case EPhoneViewOpenNumberEntry:
       
   589             BeginTransEffectLC( ENumberEntryOpen );
       
   590             commandStatus = CPhoneState::HandleCommandL( aCommand );
       
   591             EndTransEffect();
       
   592             break;
       
   593             
   477             
   594         default:
   478         default:
   595             commandStatus = CPhoneState::HandleCommandL( aCommand );
   479             commandStatus = CPhoneState::HandleCommandL( aCommand );
   596             break;
   480             break;
   597         }
   481         }
       
   482 
   598     return commandStatus;
   483     return commandStatus;
       
   484 
   599     }
   485     }
   600 
   486 
   601 // -----------------------------------------------------------------------------
   487 // -----------------------------------------------------------------------------
   602 // CPhoneStateIdle::ProcessCommandL
   488 // CPhoneStateIdle::ProcessCommandL
   603 // -----------------------------------------------------------------------------
   489 // -----------------------------------------------------------------------------
   608     TBool commandStatus = EFalse;
   494     TBool commandStatus = EFalse;
   609     switch( aCommand )
   495     switch( aCommand )
   610        {
   496        {
   611        case EAknSoftkeyContextOptions:
   497        case EAknSoftkeyContextOptions:
   612            {
   498            {
   613            // Open number entry OK menubar
       
   614            TPhoneCmdParamInteger integerParam;
       
   615            integerParam.SetInteger( 
       
   616                CPhoneMainResourceResolver::Instance()->
       
   617                ResolveResourceID( EPhoneNumberAcqOkMenubar ) );
       
   618            iViewCommandHandle->ExecuteCommandL( 
       
   619                EPhoneViewMenuBarOpen, &integerParam );
       
   620            commandStatus = ETrue;
       
   621            }
   499            }
   622            break;
   500            break;       
       
   501            
   623        default:
   502        default:
   624            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   503            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   625            break;
   504            break;
   626        }
   505        }
   627     return commandStatus;
   506     return commandStatus;
   659         {
   538         {
   660         iCustomization->HandleDialL( aNumber );
   539         iCustomization->HandleDialL( aNumber );
   661         }
   540         }
   662     else
   541     else
   663         {
   542         {
   664         DialVoiceCallL();
   543         DialVoiceCallL();                
   665         }
   544         }
   666     }
       
   667     
       
   668 // -----------------------------------------------------------
       
   669 // CPhoneStateIdle::HandleBackCommandL
       
   670 // -----------------------------------------------------------
       
   671 //
       
   672 void CPhoneStateIdle::HandleBackCommandL()
       
   673     {
       
   674     TBool previousApp(EFalse);
       
   675 
       
   676     // If previous app activation is true then open
       
   677     // previous application.
       
   678     if ( iOnScreenDialer && 
       
   679         IsSimOk() )
       
   680         {
       
   681         TPhoneCmdParamBoolean booleanParam;
       
   682         iViewCommandHandle->ExecuteCommandL( 
       
   683             EPhoneViewGetActivatePreviousApp, &booleanParam );
       
   684         
       
   685 
       
   686         if ( booleanParam.Boolean() )
       
   687             {
       
   688             // Open previous app.
       
   689             iViewCommandHandle->ExecuteCommandL( 
       
   690                 EPhoneViewActivatePreviousApp );
       
   691 
       
   692             // Remove number entry from screen
       
   693             iViewCommandHandle->ExecuteCommandL( 
       
   694                 EPhoneViewRemoveNumberEntry ); 
       
   695 
       
   696             iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW ); 
       
   697             previousApp = ETrue;   
       
   698             }        
       
   699         }
       
   700         
       
   701     if ( !previousApp )
       
   702         {
       
   703         // Remove number entry from screen
       
   704         iViewCommandHandle->ExecuteCommandL( 
       
   705             EPhoneViewRemoveNumberEntry );
       
   706          
       
   707         // Do state-specific operation when number entry is cleared
       
   708         HandleNumberEntryClearedL();
       
   709         }  
       
   710  
       
   711     }
   545     }
   712 
   546 
   713 // -----------------------------------------------------------
   547 // -----------------------------------------------------------
   714 // CPhoneStateIdle::DialVideoCallL
   548 // CPhoneStateIdle::DialVideoCallL
   715 // -----------------------------------------------------------
   549 // -----------------------------------------------------------
   728             SendExitCommandL();
   562             SendExitCommandL();
   729             }
   563             }
   730         else
   564         else
   731 #endif // _DEBUG
   565 #endif // _DEBUG
   732             {
   566             {
   733             if ( IsSpeedDialNumber( (*phoneNumber) ) )
   567             // call the number
   734                 {
   568             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
   735                 // Handle speed dial
   569             DialMultimediaCallL();
   736                 SpeedDialL( (*phoneNumber)[0], EDialMethodMenuSelection );
       
   737                 }
       
   738             else
       
   739                 {
       
   740                 // call the number
       
   741                 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
       
   742                 DialMultimediaCallL();
       
   743                 }
       
   744 
   570 
   745             CleanupStack::PopAndDestroy( phoneNumber );
   571             CleanupStack::PopAndDestroy( phoneNumber );
   746             }
   572             }
   747         }       
   573         }       
   748     }
   574     }
   754 EXPORT_C void CPhoneStateIdle::DisplayIncomingCallL( TInt aCallId )
   580 EXPORT_C void CPhoneStateIdle::DisplayIncomingCallL( TInt aCallId )
   755     {
   581     {
   756     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DisplayIncomingCallL( ) ");
   582     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DisplayIncomingCallL( ) ");
   757     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo() && aCallId >= 0,
   583     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo() && aCallId >= 0,
   758         Panic( EPhoneCtrlInvariant ) );
   584         Panic( EPhoneCtrlInvariant ) );
   759     // Close menu bar, if it is displayed
       
   760     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   761 
   585 
   762     // Remove any phone dialogs if they are displayed
   586     // Remove any phone dialogs if they are displayed
   763     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   587     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   764 
   588 
       
   589     TPhoneCmdParamKeyCapture captureParam;
       
   590     captureParam.SetKeyCode( EKeyNo );
       
   591     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   592     
   765     // Capture keys when there is an incoming call
   593     // Capture keys when there is an incoming call
   766     CaptureKeysDuringCallNotificationL( ETrue );
   594     CaptureKeysDuringCallNotificationL( ETrue );
   767 
   595 
   768     // Indicate that the Foreground application needs to be sent to the foreground 
   596     // Indicate that the Phone needs to be sent to the background if
   769     // after call is ended.
   597     // an application other than the top application is in the foreground
   770     SetNeedToReturnToForegroundAppStatusL( !TopAppIsDisplayedL() );
   598     TPhoneCmdParamBoolean booleanParam;
   771     
   599     booleanParam.SetBoolean( !TopAppIsDisplayedL() );
       
   600     iViewCommandHandle->ExecuteCommandL( 
       
   601         EPhoneViewSetNeedToSendToBackgroundStatus,
       
   602         &booleanParam );
       
   603 
   772     // Bring Phone app in the foreground
   604     // Bring Phone app in the foreground
   773     TPhoneCmdParamInteger uidParam;
   605     TPhoneCmdParamInteger uidParam;
   774     uidParam.SetInteger( KUidPhoneApplication.iUid );
   606     uidParam.SetInteger( KUidPhoneApplication.iUid );
   775     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   607     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   776         &uidParam );
   608         &uidParam );
   789     
   621     
   790     DisplayHeaderForCallComingInL( aCallId, EFalse ); //not waiting
   622     DisplayHeaderForCallComingInL( aCallId, EFalse ); //not waiting
   791     }
   623     }
   792 
   624 
   793 // -----------------------------------------------------------
   625 // -----------------------------------------------------------
       
   626 // CPhoneStateIdle::DisplayCallSetupL
       
   627 // -----------------------------------------------------------
       
   628 //
       
   629 EXPORT_C void CPhoneStateIdle::DisplayCallSetupL( TInt aCallId )
       
   630     {
       
   631     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DisplayCallSetupL( ) ");
       
   632     __ASSERT_DEBUG( aCallId > KErrNotFound, Panic( EPhoneCtrlParameterNotInitialized ) );
       
   633 
       
   634     TPhoneCmdParamKeyCapture captureParam;
       
   635     captureParam.SetKeyCode( EKeyNo );
       
   636     iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   637     
       
   638     // Capture keys when the phone is dialling
       
   639     CaptureKeysDuringCallNotificationL( ETrue );
       
   640 
       
   641     // Indicate that the Phone needs to be sent to the background if
       
   642     // an application other than the top application is in the foreground
       
   643     TPhoneCmdParamBoolean booleanParam;
       
   644     booleanParam.SetBoolean( !TopAppIsDisplayedL() );
       
   645     
       
   646     iViewCommandHandle->ExecuteCommandL( 
       
   647         EPhoneViewSetNeedToSendToBackgroundStatus,
       
   648         &booleanParam );
       
   649     
       
   650     // Bring Phone app in the foreground
       
   651     TPhoneCmdParamInteger uidParam;
       
   652     uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   653     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
       
   654         &uidParam );
       
   655 
       
   656     // Set Phone as the top application
       
   657     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
       
   658         &uidParam ); 
       
   659     
       
   660     // Display call setup header
       
   661     DisplayHeaderForOutgoingCallL( aCallId );
       
   662     }
       
   663 
       
   664 // -----------------------------------------------------------
   794 // CPhoneStateIdle::HandleIdleForegroundEventL
   665 // CPhoneStateIdle::HandleIdleForegroundEventL
   795 // -----------------------------------------------------------
   666 // -----------------------------------------------------------
   796 //
   667 //
   797 EXPORT_C void CPhoneStateIdle::HandleIdleForegroundEventL()
   668 EXPORT_C void CPhoneStateIdle::HandleIdleForegroundEventL()
   798     {
   669     {
   799     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIdleForegroundEventL( ) ");
   670     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIdleForegroundEventL( ) ");
   800     
   671     
   801     if ( IsNumberEntryUsedL() )
   672     if ( IsNumberEntryUsedL() )
   802         {
   673         {        
   803         // If numberentry is used then we need to call EPhoneViewSetDialerControlVisible 
   674         if ( IsNumberEntryVisibleL() )
   804         // to ensure that numberentry/dialler is drawn to UI.
       
   805         TPhoneViewResponseId respond = 
       
   806             iViewCommandHandle->HandleCommandL( EPhoneViewSetDialerControlVisible );
       
   807         
       
   808         if ( respond && IsNumberEntryVisibleL() )
       
   809             {
   675             {
   810             // Set Number Entry CBA
   676             // Set Number Entry CBA
   811             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   677             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
   812             }
   678             }
   813         }
   679         }
   814     else if ( !IsAnyQueryActiveL() )
   680     else if ( !IsAnyQueryActiveL() )
   815         {
   681         {
   816         // Set idle as top application
   682         // Set idle as top application
   817         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   683         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );            
   818         }
   684         }
   819     }
   685     }
   820 
   686 
   821 // -----------------------------------------------------------
   687 // -----------------------------------------------------------
   822 // CPhoneStateIdle::HandlePhoneForegroundEventL
   688 // CPhoneStateIdle::HandlePhoneForegroundEventL
   823 // -----------------------------------------------------------
   689 // -----------------------------------------------------------
   824 
   690 
   825 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   691 EXPORT_C void CPhoneStateIdle::HandlePhoneForegroundEventL()
   826     {
   692     {
   827     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandlePhoneForegroundEventL( ) ");
       
   828     
       
   829     TBool activatePhone = CPhonePubSubProxy::Instance()->Value(
       
   830                     KPSUidAiInformation, KActiveIdleState ) == EPSAiNumberEntry;
       
   831     
       
   832     if ( activatePhone )
       
   833         {
       
   834         // If activatePhone is true then user has pressed some numeric
       
   835         // key and icon must be set to FSW. In this case number entry is not yet open so it
       
   836         // it is not enough to call EPhoneViewUpdateFSW.
       
   837         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdatePhoneIconToFSW );
       
   838         }
       
   839     // If number entry is used update FSW accordingly.
       
   840     else if ( IsNumberEntryUsedL() )
       
   841         {
       
   842         // If numberentry is used then we need to call EPhoneViewSetDialerControlVisible 
       
   843         // to ensure that numberentry/dialler is drawn to UI.
       
   844         TPhoneViewResponseId respond = 
       
   845             iViewCommandHandle->HandleCommandL( EPhoneViewSetDialerControlVisible );
       
   846         
       
   847         if ( respond && IsNumberEntryVisibleL() )
       
   848             {
       
   849             // Set Number Entry CBA
       
   850             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
       
   851             }
       
   852         
       
   853         // If dialer is open add icon to FSW list.
       
   854         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
       
   855         }
       
   856     /*iCallInitialized has to be checked because if it true then phoneapp 
       
   857     is already initializing call bubble and we cant bring idle to screen. */
       
   858     else if ( !IsNumberEntryUsedL() && 
       
   859               !iStateMachine->SecurityMode()->IsSecurityMode() &&
       
   860               !iCallInitialized )
       
   861         {
       
   862         // Bring Idle app to the foreground
       
   863         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
       
   864         }
       
   865     }
   693     }
   866 
   694 
   867 // -----------------------------------------------------------
   695 // -----------------------------------------------------------
   868 // CPhoneStateIdle::HandlePhoneFocusLostEventL
   696 // CPhoneStateIdle::HandlePhoneFocusLostEventL
   869 // -----------------------------------------------------------
   697 // -----------------------------------------------------------
   882 // CPhoneStateIdle::HandleIdleL
   710 // CPhoneStateIdle::HandleIdleL
   883 // -----------------------------------------------------------
   711 // -----------------------------------------------------------
   884 //
   712 //
   885 void CPhoneStateIdle::HandleIdleL( TInt /*aCallId*/ )
   713 void CPhoneStateIdle::HandleIdleL( TInt /*aCallId*/ )
   886     {
   714     {
   887     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleIdleL()" );
   715     __LOGMETHODSTARTEND(EPhoneControl,  
       
   716         "CPhoneStateIdle::HandleIdleL()" );
       
   717         
       
   718     // Remove all call headers
   888     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveAllCallHeaders );
   719     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveAllCallHeaders );
   889     CloseClearNumberEntryAndLoadEffectL( ECallUiDisappear );
   720     
   890     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   721     // Close number entry
   891     // Reset flag.
   722     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );    
   892     SetCallInitialized( EFalse );
   723 
   893     }
   724     // Remove all notes and dialogs
   894  
   725     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );    
   895 // -----------------------------------------------------------
       
   896 // CPhoneStateIdle::SpeedDialL
       
   897 // -----------------------------------------------------------
       
   898 //
       
   899 EXPORT_C void CPhoneStateIdle::SpeedDialL( const TUint& aDigit, 
       
   900         TDialInitiationMethod aDialMethod )
       
   901     {
       
   902     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialL( ) ");
       
   903     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
       
   904     
       
   905     TPhoneCmdParamSpeedDial speedDialParam;
       
   906     HBufC* phoneNumber = NumberForSpeedDialLocationL( aDigit, speedDialParam );
       
   907 
       
   908     // Store serviceId received from vmbx handler
       
   909     iStateMachine->PhoneEngineInfo()->SetServiceIdCommand( speedDialParam.ServiceId() );
       
   910     CleanupStack::PushL( phoneNumber );
       
   911     
       
   912     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
       
   913         {
       
   914         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
       
   915         RemoveNumberEntryAndSetIdleToBackgroundIfNeededL();
       
   916         }
       
   917     else
       
   918         {
       
   919         // User cancelled dialog or didn't give a valid number
       
   920         SpeedDialCanceledL( aDigit );
       
   921         }
       
   922     CleanupStack::PopAndDestroy( phoneNumber );
       
   923     }
       
   924 
       
   925 // -----------------------------------------------------------
       
   926 // CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL
       
   927 // -----------------------------------------------------------
       
   928 //
       
   929 void CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL()
       
   930     {
       
   931     __LOGMETHODSTARTEND(EPhoneControl, 
       
   932     "CPhoneStateIdle::RemoveNumberEntryAndSetIdleToBackgroundIfNeededL( ) ");
       
   933     if ( IsNumberEntryUsedL() )
       
   934         {
       
   935         BeginTransEffectLC( ECallUiAppear );
       
   936         /*NE should be removed because if speeddial dial is interupted during
       
   937         call setup phone should not return to NE/Dialler view.*/
       
   938         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   939         
       
   940         /*It might be possible that some async operation was ongoing and 
       
   941         state has already in that case do not set idle to background.*/
       
   942         if ( iStateMachine->State() == this )
       
   943             {
       
   944             iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
   945             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );
       
   946             }
       
   947         EndTransEffect();
       
   948         }
       
   949     }
       
   950 
       
   951 // -----------------------------------------------------------
       
   952 // CPhoneStateIdle::SpeedDialCanceledL
       
   953 // -----------------------------------------------------------
       
   954 //
       
   955 EXPORT_C void CPhoneStateIdle::SpeedDialCanceledL( const TUint& aDigit )
       
   956 
       
   957     {
       
   958     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SpeedDialCanceledL( ) ");
       
   959     if ( IsNumberEntryUsedL() )
       
   960         {
       
   961         if ( aDigit == KPhoneDtmf1Character || 
       
   962                   ( aDigit == KPhoneDtmf2Character && 
       
   963                     iViewCommandHandle->HandleCommandL( 
       
   964                      EPhoneViewIsStraightCallToVideoMailBox ) == EPhoneViewResponseSuccess ) ) 
       
   965             {
       
   966             // Remove number entry and set idle background on non-touch products
       
   967             if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
   968                 {
       
   969                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   970                 
       
   971                 // Set Idle background, if still idle ( f.e not incoming call arrived )
       
   972                 if ( iStateMachine->State() == this )
       
   973                     {
       
   974                     // idle screen in the background
       
   975                     SetupIdleScreenInBackgroundL();
       
   976                     }
       
   977                 }
       
   978             }
       
   979         }        
       
   980     }
       
   981 
       
   982 // -----------------------------------------------------------
       
   983 // CPhoneStateIdle::HandleNumberLongKeyPressL()
       
   984 // -----------------------------------------------------------
       
   985 //
       
   986 EXPORT_C void CPhoneStateIdle::HandleNumberLongKeyPressL()
       
   987     {
       
   988     __LOGMETHODSTARTEND(EPhoneControl, 
       
   989         "CPhoneStateIdle::HandleNumberLongKeyPressL( ) ");
       
   990     
       
   991     HBufC* phoneNumber = PhoneNumberFromEntryLC();
       
   992     
       
   993     if ( phoneNumber && IsSpeedDialNumber ( *phoneNumber ) )
       
   994         {
       
   995         SpeedDialL( (*phoneNumber)[0], EDialMethodOneKeyDialing );
       
   996         }
       
   997     
       
   998     CleanupStack::PopAndDestroy( phoneNumber );
       
   999     }
       
  1000 
       
  1001 // -----------------------------------------------------------
       
  1002 // CPhoneStateIdle::IsSpeedDialNumber()
       
  1003 // -----------------------------------------------------------
       
  1004 //
       
  1005 EXPORT_C TBool CPhoneStateIdle::IsSpeedDialNumber( 
       
  1006         const TDesC& aNumber ) const
       
  1007     {
       
  1008     return ( aNumber.Length() == KPhoneDtmfSpeedDialPrefixLength 
       
  1009             && aNumber[0] >= KPhoneDtmf1Character 
       
  1010             && aNumber[0] <= KPhoneDtmf9Character );
       
  1011     }
   726     }
  1012 
   727 
  1013 // -----------------------------------------------------------
   728 // -----------------------------------------------------------
  1014 // CPhoneStateIdle::HandleSendCommandL()
   729 // CPhoneStateIdle::HandleSendCommandL()
  1015 // -----------------------------------------------------------
   730 // -----------------------------------------------------------
  1017 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
   732 EXPORT_C void CPhoneStateIdle::HandleSendCommandL()
  1018     {
   733     {
  1019     __LOGMETHODSTARTEND(
   734     __LOGMETHODSTARTEND(
  1020         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
   735         EPhoneControl, "CPhoneStateIdle::HandleSendCommandL()" );
  1021     
   736     
  1022     HandleVoiceCallCommandL( ETrue );
   737     HandleVoiceCallCommandL();
  1023     }
       
  1024 
       
  1025 // -----------------------------------------------------------
       
  1026 // CPhoneStateIdle::LaunchApplicationL()
       
  1027 // -----------------------------------------------------------
       
  1028 //
       
  1029 void CPhoneStateIdle::LaunchApplicationL()
       
  1030     {
       
  1031     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::LaunchApplicationL( ) ");
       
  1032     // Check if only one number exists in the number
       
  1033     // entry
       
  1034     TPhoneCmdParamInteger numberEntryCountParam;
       
  1035     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
       
  1036         &numberEntryCountParam );
       
  1037 
       
  1038     if ( numberEntryCountParam.Integer() == 1 )
       
  1039         {
       
  1040         // Remove the number entry window
       
  1041         iViewCommandHandle->ExecuteCommandL( EPhoneViewClearNumberEntryContent );
       
  1042         
       
  1043         iStateMachine->SendPhoneEngineMessage( 
       
  1044                 MPEPhoneModel::EPEMessageEndDTMF );
       
  1045 
       
  1046         // Launch application.
       
  1047         iViewCommandHandle->ExecuteCommandL(
       
  1048             EPhoneViewLaunchApplication );
       
  1049 
       
  1050         }
       
  1051     }
   738     }
  1052 
   739 
  1053 // -----------------------------------------------------------
   740 // -----------------------------------------------------------
  1054 // CPhoneStateIdle:SendExitCommandL
   741 // CPhoneStateIdle:SendExitCommandL
  1055 // -----------------------------------------------------------
   742 // -----------------------------------------------------------
  1056 //
   743 //
  1057 void CPhoneStateIdle::SendExitCommandL()
   744 void CPhoneStateIdle::SendExitCommandL()
  1058     {
   745     {
  1059     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SendExitCommand( ) ");
   746     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::SendExitCommand( ) ");
  1060     // Remove number entry from screen 
   747     // Remove number entry from screen
  1061     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry ); 
   748     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1062 
   749 
  1063     // Simulate exit command 
   750     // Simulate exit command
  1064     RWsSession& wsSession = EikonEnv()->WsSession(); 
   751     CEikonEnv& eikEnv = *CEikonEnv::Static();
  1065     TKeyEvent keyEvent; 
   752     CCoeEnv& coeEnv = eikEnv;
  1066     keyEvent.iCode = EEikCmdExit; 
   753     RWsSession& wsSession=coeEnv.WsSession();
  1067     keyEvent.iScanCode = EEikCmdExit; 
   754     TKeyEvent keyEvent;
  1068     keyEvent.iModifiers = 0; 
   755     keyEvent.iCode = EEikCmdExit;
  1069     keyEvent.iRepeats = 0; 
   756     keyEvent.iScanCode = EEikCmdExit;
  1070     wsSession.SimulateKeyEvent( keyEvent ); 
   757     keyEvent.iModifiers = 0;
  1071     wsSession.Flush(); 
   758     keyEvent.iRepeats = 0;
       
   759     wsSession.SimulateKeyEvent( keyEvent );
       
   760     wsSession.Flush();  
       
   761 
       
   762     iViewCommandHandle->ExecuteCommandL( EPhoneAppShutDown );
  1072     }
   763     }
  1073 
   764 
  1074 // -----------------------------------------------------------
   765 // -----------------------------------------------------------
  1075 // CPhoneStateIdle::HandleEndKeyPressL
   766 // CPhoneStateIdle::HandleEndKeyPressL
  1076 // -----------------------------------------------------------
   767 // -----------------------------------------------------------
  1086     
   777     
  1087     if ( !IsAutoLockOn() && !IsKeyLockOn() && !startup.Exists() )
   778     if ( !IsAutoLockOn() && !IsKeyLockOn() && !startup.Exists() )
  1088         {
   779         {
  1089         //Cancels e.g. USB notifier and Audio notifier.
   780         //Cancels e.g. USB notifier and Audio notifier.
  1090         iViewCommandHandle->ExecuteCommandL( EPhoneViewCancelAllNotications );
   781         iViewCommandHandle->ExecuteCommandL( EPhoneViewCancelAllNotications );
  1091         iViewCommandHandle->ExecuteCommandL( EPhoneViewExitApplications );
       
  1092         // If KFeatureIdFfSimlessOfflineSupport is undef and security note is shown then do not
   782         // If KFeatureIdFfSimlessOfflineSupport is undef and security note is shown then do not
  1093         // remove security note from screen.
   783         // remove security note from screen.
  1094         if ( !( IsSimStateNotPresentWithSecurityModeEnabled() && 
   784         if ( !( IsSimStateNotPresentWithSecurityModeEnabled() && 
  1095                 !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
   785                 !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
  1096             {
   786             {
  1105                 iStateMachine->SendPhoneEngineMessage(
   795                 iStateMachine->SendPhoneEngineMessage(
  1106                         MPEPhoneModel::EPEMessageTerminateAllConnections );   
   796                         MPEPhoneModel::EPEMessageTerminateAllConnections );   
  1107 
   797 
  1108                 if ( IsNumberEntryUsedL() )
   798                 if ( IsNumberEntryUsedL() )
  1109                     {
   799                     {
  1110                     CloseClearNumberEntryAndLoadEffectL( ENumberEntryClose );
   800                     // Remove number entry from screen
       
   801                     iViewCommandHandle->ExecuteCommandL( 
       
   802                         EPhoneViewRemoveNumberEntry );
       
   803                     // Do state-specific operation when number entry is cleared
       
   804                     HandleNumberEntryClearedL();
       
   805                     
  1111                     // If long end key event occures then all calls are terminated and
   806                     // If long end key event occures then all calls are terminated and
  1112                     // dialer is closed, therefore tel.icon must be removed from FSW.
   807                     // dialer is closed, therefore tel.icon must be removed from FSW.
  1113                     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
   808                     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
  1114                     }
   809                     }
  1115                 if ( !TopAppIsDisplayedL() )
   810                 if ( !TopAppIsDisplayedL() )
  1118                     DisplayIdleScreenL();
   813                     DisplayIdleScreenL();
  1119                     }
   814                     }
  1120                 }
   815                 }
  1121             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
   816             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
  1122                 {
   817                 {
  1123                 CloseClearNumberEntryAndLoadEffectL( ENumberEntryClose );
   818                 // Remove number entry from screen
       
   819                 iViewCommandHandle->ExecuteCommandL( 
       
   820                     EPhoneViewRemoveNumberEntry );
       
   821                 // Do state-specific operation when number entry is cleared
       
   822                 HandleNumberEntryClearedL();
  1124                 }
   823                 }
  1125             else if ( !TopAppIsDisplayedL() )
   824             else if ( !TopAppIsDisplayedL() )
  1126                 {
   825                 {
  1127                 // Phone might not be the topmost app since it has
   826                 // Phone might not be the topmost app since it has
  1128                 // some dialog/query open therefore we need to remove dialog/phone.
   827                 // some dialog/query open therefore we need to check this
  1129                 if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
   828                 // and remove dialog/phone.
       
   829                 if ( IsAnyQueryActiveL()  )
  1130                     {
   830                     {
  1131                     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   831                     if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
  1132                     }
   832                         {
  1133                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   833                         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
       
   834                         }
       
   835                     
       
   836                     // Remove number entry from screen
       
   837                     iViewCommandHandle->ExecuteCommandL( 
       
   838                         EPhoneViewRemoveNumberEntry );
       
   839                     } 
       
   840                 // Bring Idle app to the foreground
  1134                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
   841                 iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1135                 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
       
  1136                 }
   842                 }
  1137             }
   843             }
  1138         else if ( IsNumberEntryUsedL() )
   844         else if ( IsNumberEntryUsedL() )
  1139             {
   845             {
  1140             // Remove number entry from screen
   846             // Remove number entry from screen
  1150 // ---------------------------------------------------------
   856 // ---------------------------------------------------------
  1151 //
   857 //
  1152 EXPORT_C void CPhoneStateIdle::OnlyHashInNumberEntryL()
   858 EXPORT_C void CPhoneStateIdle::OnlyHashInNumberEntryL()
  1153     {
   859     {
  1154     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::OnlyHashInNumberEntryL( ) ");
   860     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::OnlyHashInNumberEntryL( ) ");
  1155     if ( CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported( 
   861     
  1156         KTelephonyLVFlagMannerMode ) )
       
  1157         {
       
  1158         ChangeMannerModeL();
       
  1159         }
       
  1160     else
       
  1161         {
       
  1162         StartAlsLineChangeTimerL();
       
  1163         }
       
  1164     // Check if any application launch functionality
       
  1165     // is configured for pressing hash for a long time
       
  1166     // the return value of CheckAppLaunchingL ignored.
       
  1167     CheckAppLaunchingL( TKeyCode( KPhoneDtmfHashCharacter ) );
       
  1168     }
   862     }
  1169 
   863 
  1170 // ---------------------------------------------------------
   864 // ---------------------------------------------------------
  1171 // CPhoneStateIdle::ChangeMannerModeL
   865 // CPhoneStateIdle::ChangeMannerModeL
  1172 // ---------------------------------------------------------
   866 // ---------------------------------------------------------
  1173 //
   867 //
  1174 void CPhoneStateIdle::ChangeMannerModeL()
   868 void CPhoneStateIdle::ChangeMannerModeL()
  1175     {
   869     {
  1176     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");
   870     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");         
  1177 
       
  1178     // Get the profile information
       
  1179     MProEngEngine* profileEngine = ProEngFactory::NewEngineLC();
       
  1180     const TInt profileId =
       
  1181             profileEngine->ActiveProfileId();
       
  1182     
       
  1183     TInt newProfile;
       
  1184     
       
  1185     if ( profileId == EProfileSilentId )
       
  1186         {
       
  1187         newProfile = EProfileGeneralId;
       
  1188         }
       
  1189     else
       
  1190         {
       
  1191         newProfile = EProfileSilentId;    
       
  1192         }
       
  1193     
       
  1194     profileEngine->SetActiveProfileL( newProfile );
       
  1195     
       
  1196     CleanupStack::Pop(); // profileEngine 
       
  1197     profileEngine->Release();
       
  1198     
       
  1199     // Stop playing DTMF tone
       
  1200     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF ); 
       
  1201     
       
  1202     if ( !iOnScreenDialer )
       
  1203         {
       
  1204         // Remove the number entry
       
  1205         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );        
       
  1206         }
       
  1207     else
       
  1208         {
       
  1209         NumberEntryClearL();
       
  1210         }
       
  1211     
       
  1212     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
  1213  
       
  1214      // Bring Idle app to the top app
       
  1215     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );            
       
  1216     }
   871     }
  1217 
   872 
  1218 // -----------------------------------------------------------
   873 // -----------------------------------------------------------
  1219 // CPhoneStateIdle::DialMultimediaCallL
   874 // CPhoneStateIdle::DialMultimediaCallL
  1220 // -----------------------------------------------------------
   875 // -----------------------------------------------------------
  1240 // -----------------------------------------------------------
   895 // -----------------------------------------------------------
  1241 //
   896 //
  1242 EXPORT_C void CPhoneStateIdle::DialVoiceCallL()
   897 EXPORT_C void CPhoneStateIdle::DialVoiceCallL()
  1243     {
   898     {
  1244     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DialVoiceCallL() ");
   899     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::DialVoiceCallL() ");
  1245     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   900     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
       
   901         Panic( EPhoneCtrlInvariant ) );
       
   902         
       
   903     // Disable global notes
       
   904     TPhoneCmdParamBoolean globalNotifierParam;
       
   905     globalNotifierParam.SetBoolean( ETrue );
       
   906     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
   907         &globalNotifierParam );
       
   908     
  1246     CPhoneState::DialVoiceCallL();
   909     CPhoneState::DialVoiceCallL();
       
   910  
  1247     }
   911     }
  1248 
   912 
  1249 // -----------------------------------------------------------------------------
   913 // -----------------------------------------------------------------------------
  1250 // CPhoneStateIdle::RestoreOngoing
   914 // CPhoneStateIdle::RestoreOngoing
  1251 // -----------------------------------------------------------------------------
   915 // -----------------------------------------------------------------------------
  1259                     restoreValue );
   923                     restoreValue );
  1260         
   924         
  1261     return ( restoreValue & ( conn::EBURRestoreFull | conn::EBURRestorePartial ));
   925     return ( restoreValue & ( conn::EBURRestoreFull | conn::EBURRestorePartial ));
  1262     }
   926     }
  1263 
   927 
  1264 // -----------------------------------------------------------------------------
       
  1265 // CPhoneStateIdle::CheckAppLaunchingL
       
  1266 // -----------------------------------------------------------------------------
       
  1267 //
       
  1268 TBool CPhoneStateIdle::CheckAppLaunchingL( const TKeyCode aCode )
       
  1269     {
       
  1270     TBool valuesFetched( EFalse );
       
  1271     
       
  1272     if( !IsSimOk() )
       
  1273         {
       
  1274         return valuesFetched;
       
  1275         }
       
  1276     
       
  1277     TPhoneCmdParamAppInfo appInfo;
       
  1278     HBufC8* appParam = HBufC8::NewL( KMaxParamLength );
       
  1279     CleanupStack::PushL( appParam );
       
  1280 
       
  1281     TBool isValidAppLaunchingKeyEvent = ETrue;
       
  1282     
       
  1283     // By-pass checking of number entry length in case of #-character.
       
  1284     // #-character is handled differently from other keys, and number 
       
  1285     // entry length has been checked earlier. Checking number entry length
       
  1286     // for #-character is difficult here, because we cannot know if FEP
       
  1287     // has removed the long-# from number entry or not.
       
  1288     if ( TKeyCode( KPhoneDtmfHashCharacter ) != aCode )
       
  1289         {
       
  1290         TPhoneCmdParamInteger numberEntryCount;
       
  1291         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
       
  1292             &numberEntryCount );
       
  1293     
       
  1294         isValidAppLaunchingKeyEvent = ( numberEntryCount.Integer() == 1 );
       
  1295         }
       
  1296     
       
  1297     if ( isValidAppLaunchingKeyEvent )
       
  1298         {
       
  1299         TRAPD( err, 
       
  1300             CPhoneCenRepProxy::Instance()->FetchValuesFromCenRepL( 
       
  1301             appInfo, aCode, appParam, valuesFetched ) );
       
  1302         
       
  1303         if ( KErrNone == err && valuesFetched )
       
  1304             {
       
  1305             // Remove the number entry window
       
  1306             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  1307 
       
  1308             // Stop playing DTMF tone
       
  1309             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
       
  1310 
       
  1311             TPhoneCommandParam* phoneCommandParam = 
       
  1312                 static_cast<TPhoneCommandParam*>( &appInfo );
       
  1313             iViewCommandHandle->ExecuteCommandL( 
       
  1314                         EPhoneViewActivateAppViewConventional,
       
  1315                         phoneCommandParam ); 
       
  1316             
       
  1317             // Continue displaying current app but set up the 
       
  1318             // idle screen in the background
       
  1319             SetupIdleScreenInBackgroundL();
       
  1320             }
       
  1321         }
       
  1322     CleanupStack::PopAndDestroy( appParam );
       
  1323     return valuesFetched;
       
  1324     }
       
  1325 
       
  1326 // -----------------------------------------------------------
       
  1327 // CPhoneStateIdle::NumberForSpeedDialLocationL
       
  1328 // -----------------------------------------------------------
       
  1329 // 
       
  1330 HBufC* CPhoneStateIdle::NumberForSpeedDialLocationL( 
       
  1331         const TUint& aDigit,
       
  1332         TPhoneCmdParamSpeedDial& aSpeedDialParam ) const
       
  1333     {
       
  1334     // Set the speed dial location from the digit in buffer. Character
       
  1335     // '1' means location 1, and so on.
       
  1336     const TInt location = aDigit - KPhoneDtmf1Character + 1;
       
  1337     aSpeedDialParam.SetLocation( location );
       
  1338     
       
  1339     // Get the number and type from the speed dial location.
       
  1340     HBufC* phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
  1341     
       
  1342     TPtr ptr( phoneNumber->Des() );
       
  1343     aSpeedDialParam.SetPhoneNumber( &ptr );
       
  1344     iViewCommandHandle->HandleCommandL( 
       
  1345         EPhoneViewGetNumberFromSpeedDialLocation, &aSpeedDialParam );
       
  1346 
       
  1347     CleanupStack::Pop( phoneNumber );
       
  1348     return phoneNumber;
       
  1349     }
       
  1350 
       
  1351 // -----------------------------------------------------------
   928 // -----------------------------------------------------------
  1352 // CPhoneStateIdle::HandleVoiceCallCommandL()
   929 // CPhoneStateIdle::HandleVoiceCallCommandL()
  1353 // -----------------------------------------------------------
   930 // -----------------------------------------------------------
  1354 //
   931 //
  1355 void CPhoneStateIdle::HandleVoiceCallCommandL( TBool aSendKey )
   932 void CPhoneStateIdle::HandleVoiceCallCommandL()
  1356     {
   933     {
  1357     __LOGMETHODSTARTEND(
   934     __LOGMETHODSTARTEND(
  1358         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
   935         EPhoneControl, "CPhoneStateIdle::HandleVoiceCallCommandL()" );
  1359     
   936     
  1360     if ( IsNumberEntryUsedL() )
   937     if ( IsNumberEntryUsedL() )
  1378             SendExitCommandL();
   955             SendExitCommandL();
  1379             }
   956             }
  1380         else
   957         else
  1381 #endif // _DEBUG
   958 #endif // _DEBUG
  1382             {
   959             {
  1383             if ( IsDialingExtensionInFocusL() )
   960             // call the number
  1384                 {
   961             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1385                 CPhoneState::HandleCommandL( EEasyDialingVoiceCall );
   962             DialVoiceCallL();
  1386                 }
       
  1387             
       
  1388             else if ( IsSpeedDialNumber( *phoneNumber ) )
       
  1389                 {
       
  1390                 // Handle speed dial
       
  1391                 SpeedDialL( (*phoneNumber)[0], aSendKey ? EDialMethodSendCommand : EDialMethodMenuSelection );
       
  1392                 }
       
  1393             else
       
  1394                 {
       
  1395                 // call the number
       
  1396                 iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
       
  1397                 DialVoiceCallL();
       
  1398                 }
       
  1399             
       
  1400             CleanupStack::PopAndDestroy( phoneNumber );
   963             CleanupStack::PopAndDestroy( phoneNumber );
  1401             }
   964             }
  1402         }    
   965         }    
  1403     }
   966     }
  1404 
   967 
  1405 // -----------------------------------------------------------
       
  1406 // CPhoneStateIdle::GetNumberAcqMenuIdL()
       
  1407 // -----------------------------------------------------------
       
  1408 //
       
  1409 TInt CPhoneStateIdle::GetNumberAcqMenuIdL()
       
  1410     {
       
  1411     TInt menuId = CPhoneMainResourceResolver::Instance()->
       
  1412             ResolveResourceID( EPhoneNumberAcqMenubar );
       
  1413     
       
  1414     // Use easy dialing menu id, if easydialing is in focus.
       
  1415     // Otherwise use number acquisition menu id.
       
  1416     if ( IsDialingExtensionInFocusL() )
       
  1417         {
       
  1418         // Fetch easydialing menu id, check its validity and assign to menuId
       
  1419         TPhoneCmdParamInteger integerParam;  
       
  1420         iViewCommandHandle->ExecuteCommandL(
       
  1421                 EPhoneViewGetEasyDialingMenuId, &integerParam );
       
  1422         if ( integerParam.Integer() ) 
       
  1423             {
       
  1424             menuId = integerParam.Integer();
       
  1425             }
       
  1426         }
       
  1427     return menuId;
       
  1428     }
       
  1429 	
       
  1430 // -----------------------------------------------------------
       
  1431 // CPhoneStateIdle::HandleErrorL
       
  1432 // -----------------------------------------------------------
       
  1433 //
       
  1434 EXPORT_C void CPhoneStateIdle::HandleErrorL( const TPEErrorInfo& aErrorInfo )
       
  1435     {
       
  1436     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneStateIdle::HandleErrorL() ");
       
  1437     if( KErrNotFound < aErrorInfo.iCallId )
       
  1438         {
       
  1439         SetCallInitialized( EFalse );
       
  1440         }
       
  1441     CPhoneState::HandleErrorL( aErrorInfo );
       
  1442     }
       
  1443 
       
  1444 // -----------------------------------------------------------
       
  1445 // CPhoneStateIdle::ChangeTo
       
  1446 // -----------------------------------------------------------
       
  1447 //
       
  1448 void CPhoneStateIdle::ChangeTo( TInt aState )
       
  1449     {
       
  1450     __PHONELOG1( EBasic, EPhoneControl, 
       
  1451            "PhoneUIControl: CPhoneStateIdle::ChangeTo - aState =%d ",
       
  1452            aState );
       
  1453     SetCallInitialized( EFalse );
       
  1454     iStateMachine->ChangeState( aState );
       
  1455     }
       
  1456 
       
  1457 // -----------------------------------------------------------
       
  1458 // CPhoneStateIdle::SetBubbleInitialized
       
  1459 // -----------------------------------------------------------
       
  1460 //
       
  1461 void CPhoneStateIdle::SetCallInitialized( TBool aValue )
       
  1462     {
       
  1463     __PHONELOG1( EBasic, EPhoneControl, 
       
  1464             "PhoneUIControl: CPhoneStateIdle::SetCallInitialized - iCallInitialized =%d ",
       
  1465             aValue );
       
  1466     iCallInitialized = aValue;
       
  1467     }
       
  1468 
       
  1469 // -----------------------------------------------------------
       
  1470 // CPhoneStateIdle::IsBubbleInitialized
       
  1471 // -----------------------------------------------------------
       
  1472 //
       
  1473 TBool CPhoneStateIdle::IsCallInitialized()
       
  1474     {
       
  1475     __PHONELOG1( EBasic, EPhoneControl, 
       
  1476             "PhoneUIControl: CPhoneStateIdle::IsCallInitialized - iCallInitialized =%d ",
       
  1477             iCallInitialized );
       
  1478     return iCallInitialized;
       
  1479     }
       
  1480 
       
  1481 // End of File
   968 // End of File