phoneapp/phoneuicontrol/src/cphonestate.cpp
changeset 65 2a5d4ab426d3
parent 53 22cc52eade9b
child 74 d1c62c765e48
equal deleted inserted replaced
60:1eef62f5c541 65:2a5d4ab426d3
    86 #include "cphonepubsubproxy.h"
    86 #include "cphonepubsubproxy.h"
    87 #include "phoneviewcommanddefinitions.h"
    87 #include "phoneviewcommanddefinitions.h"
    88 #include "phonelogger.h"
    88 #include "phonelogger.h"
    89 #include "phonestatedefinitions.h"
    89 #include "phonestatedefinitions.h"
    90 #include "cphonetimer.h"
    90 #include "cphonetimer.h"
    91 #include "cphonereconnectquery.h"
       
    92 #include "mphoneerrormessageshandler.h"
    91 #include "mphoneerrormessageshandler.h"
    93 #include "cphoneclearblacklist.h"
    92 #include "cphoneclearblacklist.h"
    94 #include "mphonecustomization.h"
    93 #include "mphonecustomization.h"
    95 #include "cphonemainerrormessageshandler.h"
    94 #include "cphonemainerrormessageshandler.h"
    96 #include "cphoneaccessorybthandler.h"
    95 #include "cphoneaccessorybthandler.h"
   120     // Need to get current SimState for inherited classis
   119     // Need to get current SimState for inherited classis
   121     iPreviousSimState = SimState();
   120     iPreviousSimState = SimState();
   122     __ASSERT_ALWAYS(
   121     __ASSERT_ALWAYS(
   123         aStateMachine && aViewCommandHandle,
   122         aStateMachine && aViewCommandHandle,
   124         Panic( EPhoneCtrlParameterNotInitialized ) );
   123         Panic( EPhoneCtrlParameterNotInitialized ) );
   125     if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
       
   126         {
       
   127         iOnScreenDialer = ETrue;
       
   128         }
       
   129     }
   124     }
   130 
   125 
   131 EXPORT_C void CPhoneState::BaseConstructL()
   126 EXPORT_C void CPhoneState::BaseConstructL()
   132     {
   127     {
   133     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::BaseConstructL() ");
   128     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::BaseConstructL() ");
   140         }
   135         }
   141     }
   136     }
   142 
   137 
   143 EXPORT_C CPhoneState::~CPhoneState()
   138 EXPORT_C CPhoneState::~CPhoneState()
   144     {
   139     {
   145     if( iAlsLineChangeKeyPressTimer )
       
   146         {
       
   147         if( iAlsLineChangeKeyPressTimer->IsActive() )
       
   148             {
       
   149             iAlsLineChangeKeyPressTimer->CancelTimer();
       
   150             }
       
   151         delete iAlsLineChangeKeyPressTimer;
       
   152         }
       
   153     delete iNumberEntryManager;
   140     delete iNumberEntryManager;
   154     delete iCallHeaderManager;
   141     delete iCallHeaderManager;
   155     delete iCbaManager;
   142     delete iCbaManager;
   156     }
   143     }
   157 
   144 
   158 // <-------------------------- PHONE ENGINE EVENTS --------------------------->
   145 // <-------------------------- PHONE ENGINE EVENTS --------------------------->
   159 
       
   160 // -----------------------------------------------------------
   146 // -----------------------------------------------------------
   161 // CPhoneState::HandlePhoneEngineMessageL
   147 // CPhoneState::HandlePhoneEngineMessageL
   162 // Default handling for Phone Engine messages
   148 // Default handling for Phone Engine messages
   163 // (other items were commented in a header).
   149 // (other items were commented in a header).
   164 // -----------------------------------------------------------
   150 // -----------------------------------------------------------
   166 EXPORT_C void CPhoneState::HandlePhoneEngineMessageL(
   152 EXPORT_C void CPhoneState::HandlePhoneEngineMessageL(
   167     const TInt aMessage,
   153     const TInt aMessage,
   168     TInt aCallId )
   154     TInt aCallId )
   169     {
   155     {
   170     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneEngineMessageL() ");
   156     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneEngineMessageL() ");
   171 
       
   172     CPhoneAccessoryBTHandler* accessoryBtHandler;
   157     CPhoneAccessoryBTHandler* accessoryBtHandler;
   173 
       
   174     switch ( aMessage )
   158     switch ( aMessage )
   175         {
   159         {
   176         case MEngineMonitor::EPEMessageNetworkRegistrationStatusChange:
   160         case MEngineMonitor::EPEMessageNetworkRegistrationStatusChange:
   177             {
   161             {
   178             __PHONELOG1( EBasic, EPhoneControl,
   162             __PHONELOG1( EBasic, EPhoneControl,
   209         case MEngineMonitor::EPEMessageRemoteBusy:
   193         case MEngineMonitor::EPEMessageRemoteBusy:
   210             HandleRemoteBusyL( aCallId );
   194             HandleRemoteBusyL( aCallId );
   211             break;
   195             break;
   212 
   196 
   213         case MEngineMonitor::EPEMessageCallWaiting:
   197         case MEngineMonitor::EPEMessageCallWaiting:
   214             // No need to send waiting notification for user.
       
   215             //SendGlobalInfoNoteL( EPhoneWaitingText, ETrue );
       
   216             break;
       
   217 
       
   218         case MEngineMonitor::EPEMessageProfileChanged:
   198         case MEngineMonitor::EPEMessageProfileChanged:
   219             {
       
   220             }
       
   221             break;
   199             break;
   222 
   200 
   223         case MEngineMonitor::EPEMessageRemoteTerminated:
   201         case MEngineMonitor::EPEMessageRemoteTerminated:
   224             /* Flow through */
   202             /* Flow through */
   225         case MEngineMonitor::EPEMessageDisconnecting:
   203         case MEngineMonitor::EPEMessageDisconnecting:
   238            HandleInitiatedEmergencyWhileActiveVideoL();
   216            HandleInitiatedEmergencyWhileActiveVideoL();
   239            break;
   217            break;
   240 
   218 
   241        case MEngineMonitor::EPEMessageCallSecureStatusChanged:
   219        case MEngineMonitor::EPEMessageCallSecureStatusChanged:
   242            HandleCallSecureStatusChangeL( aCallId );
   220            HandleCallSecureStatusChangeL( aCallId );
   243 
       
   244            if ( iCustomization )
   221            if ( iCustomization )
   245                {
   222                {
   246                iCustomization->HandlePhoneEngineMessageL( aMessage,
   223                iCustomization->HandlePhoneEngineMessageL( aMessage,
   247                    aCallId );
   224                    aCallId );
   248                }
   225                }
   249            break;
   226            break;
   250 
   227 
   251         case MEngineMonitor::EPEMessageIssuingUSSDRequest:
   228         case MEngineMonitor::EPEMessageIssuingUSSDRequest:
   252             {
   229             {
   253              // Enable global notes
       
   254             TPhoneCmdParamBoolean globalNotifierParam;
   230             TPhoneCmdParamBoolean globalNotifierParam;
   255             globalNotifierParam.SetBoolean( EFalse );
   231             globalNotifierParam.SetBoolean( EFalse );
   256             iViewCommandHandle->ExecuteCommandL(
   232             iViewCommandHandle->ExecuteCommandL(
   257                 EPhoneViewSetGlobalNotifiersDisabled,
   233                 EPhoneViewSetGlobalNotifiersDisabled,
   258                 &globalNotifierParam );
   234                 &globalNotifierParam );
   259 
   235             NumberEntryClearL();
   260             if ( !IsOnScreenDialerSupported() && IsNumberEntryUsedL() )
       
   261                 {
       
   262                 // Remove number entry from screen
       
   263                 iViewCommandHandle->ExecuteCommandL(
       
   264                     EPhoneViewRemoveNumberEntry );
       
   265                 }
       
   266             else if ( IsOnScreenDialerSupported() )
       
   267                 {
       
   268                 NumberEntryClearL();
       
   269                 }
       
   270             }
   236             }
   271             break;
   237             break;
   272 
   238 
   273         case MEngineMonitor::EPEMessageIssuedUSSDRequest:
   239         case MEngineMonitor::EPEMessageIssuedUSSDRequest:
   274             // Go to current state implementation
   240             // Go to current state implementation
   275             iCbaManager->UpdateInCallCbaL();
   241             iCbaManager->UpdateInCallCbaL();
   276             break;
   242             break;
   277 
   243 
   278         // *#9990#
   244         // *#9990#
   279         case MEngineMonitor::EPEMessageShowBTLoopback:
   245         case MEngineMonitor::EPEMessageShowBTLoopback:
   280             // Stop playing DTMF tone
       
   281             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   246             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   282             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   247             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   283                 iViewCommandHandle, iStateMachine, this );
   248                 iViewCommandHandle, iStateMachine, this );
   284             accessoryBtHandler->ShowBTLoopbackL();
   249             accessoryBtHandler->ShowBTLoopbackL();
   285             CleanupStack::PopAndDestroy( accessoryBtHandler );
   250             CleanupStack::PopAndDestroy( accessoryBtHandler );
   286             break;
   251             break;
   287 
   252 
   288         // *#2820#
   253         // *#2820#
   289         case MEngineMonitor::EPEMessageShowBTDeviceAddress:
   254         case MEngineMonitor::EPEMessageShowBTDeviceAddress:
   290             // Stop playing DTMF tone
       
   291             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   255             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   292             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   256             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   293                 iViewCommandHandle, iStateMachine, this );
   257                 iViewCommandHandle, iStateMachine, this );
   294             accessoryBtHandler->ShowBTAddressL();
   258             accessoryBtHandler->ShowBTAddressL();
   295             CleanupStack::PopAndDestroy( accessoryBtHandler );
   259             CleanupStack::PopAndDestroy( accessoryBtHandler );
   296             break;
   260             break;
   297 
   261 
   298         // *#7370#
   262         // *#7370#
   299         case MEngineMonitor::EPEMessageActivateRfsDeep:
   263         case MEngineMonitor::EPEMessageActivateRfsDeep:
   300             // Stop playing DTMF tone
       
   301             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   264             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   302             // Launch RFS
       
   303             iViewCommandHandle->ExecuteCommandL( EPhoneViewLaunchRfsDeep );
   265             iViewCommandHandle->ExecuteCommandL( EPhoneViewLaunchRfsDeep );
   304             if ( !IsOnScreenDialerSupported() )
       
   305                 {
       
   306                 // Do state-specific operation when number entry is cleared
       
   307                 HandleNumberEntryClearedL();
       
   308                 }
       
   309             break;
   266             break;
   310 
   267 
   311         // *#7780#
   268         // *#7780#
   312         case MEngineMonitor::EPEMessageActivateRfsNormal:
   269         case MEngineMonitor::EPEMessageActivateRfsNormal:
   313             // Stop playing DTMF tone
       
   314             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   270             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   315             // Launch RFS
       
   316             iViewCommandHandle->ExecuteCommandL( EPhoneViewLaunchRfsNormal );
   271             iViewCommandHandle->ExecuteCommandL( EPhoneViewLaunchRfsNormal );
   317             if ( !IsOnScreenDialerSupported() )
   272             break;
   318                 {
   273             
   319                 // Do state-specific operation when number entry is cleared
       
   320                 HandleNumberEntryClearedL();
       
   321                 }
       
   322             break;
       
   323         // *#62209526#
   274         // *#62209526#
   324         case MEngineMonitor::EPEMessageShowWlanMacAddress:
   275         case MEngineMonitor::EPEMessageShowWlanMacAddress:
   325             // Stop playing DTMF tone
       
   326             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   276             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   327             ShowWlanMacAddressL();
   277             ShowWlanMacAddressL();
   328             break;
   278             break;
   329 
   279 
   330         case MEngineMonitor::EPEMessageThumbnailLoadingCompleted:
   280         case MEngineMonitor::EPEMessageThumbnailLoadingCompleted:
   331             // Update call buble
       
   332             UpdateRemoteInfoDataL( aCallId );
   281             UpdateRemoteInfoDataL( aCallId );
   333             break;
   282             break;
   334 
   283 
   335         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   284         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   336             UpdateRemoteInfoDataL ( aCallId );
   285             UpdateRemoteInfoDataL ( aCallId );
   344         case MEngineMonitor::EPEMessageShowIncCallGroupIndex:
   293         case MEngineMonitor::EPEMessageShowIncCallGroupIndex:
   345             HandleCugInUseNoteL();
   294             HandleCugInUseNoteL();
   346             break;
   295             break;
   347 
   296 
   348         default:
   297         default:
   349 
       
   350             TBool handled( EFalse );
   298             TBool handled( EFalse );
   351 
       
   352             if ( iCustomization )
   299             if ( iCustomization )
   353                 {
   300                 {
   354                 handled = iCustomization->HandlePhoneEngineMessageL(
   301                 handled = iCustomization->HandlePhoneEngineMessageL(
   355                                 aMessage, aCallId );
   302                                 aMessage, aCallId );
   356                 }
   303                 }
   357 
       
   358             if ( EFalse == handled )
   304             if ( EFalse == handled )
   359                 {
   305                 {
   360                 MPhoneMediatorMessage* mediatorMessage = CPhoneMediatorFactory::Instance()->MediatorMessage( aMessage, aCallId );
   306                 MPhoneMediatorMessage* mediatorMessage = CPhoneMediatorFactory::Instance()->MediatorMessage( aMessage, aCallId );
   361                 if( mediatorMessage )
   307                 if( mediatorMessage )
   362                     {
   308                     {
   379 EXPORT_C void CPhoneState::HandleAudioMuteChangedL()
   325 EXPORT_C void CPhoneState::HandleAudioMuteChangedL()
   380     {
   326     {
   381     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioMuteChangedL() ");
   327     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioMuteChangedL() ");
   382     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   328     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   383         Panic( EPhoneCtrlInvariant ) );
   329         Panic( EPhoneCtrlInvariant ) );
   384 
       
   385     TPhoneCmdParamBoolean booleanParam;
   330     TPhoneCmdParamBoolean booleanParam;
   386     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
   331     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
   387     booleanParam.SetBoolean( audioMute );
   332     booleanParam.SetBoolean( audioMute );
   388     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
   333     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
   389         &booleanParam );
   334         &booleanParam );
   390     
       
   391     SetTouchPaneButtons(0);
   335     SetTouchPaneButtons(0);
   392     }
   336     }
   393 
   337 
   394 // -----------------------------------------------------------
   338 // -----------------------------------------------------------
   395 // CPhoneState::HandleAudioOutputChangedL
   339 // CPhoneState::HandleAudioOutputChangedL
   398 // -----------------------------------------------------------
   342 // -----------------------------------------------------------
   399 //
   343 //
   400 EXPORT_C void CPhoneState::HandleAudioOutputChangedL()
   344 EXPORT_C void CPhoneState::HandleAudioOutputChangedL()
   401     {
   345     {
   402     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioOutputChangedL() ");
   346     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioOutputChangedL() ");
   403     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   347     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   404         Panic( EPhoneCtrlInvariant ) );
       
   405 
       
   406     TPhoneCmdParamAudioOutput outputParam;
   348     TPhoneCmdParamAudioOutput outputParam;
   407 
       
   408     // Output
       
   409     const TPEAudioOutput audioOutput =
   349     const TPEAudioOutput audioOutput =
   410         iStateMachine->PhoneEngineInfo()->AudioOutput();
   350         iStateMachine->PhoneEngineInfo()->AudioOutput();
   411     outputParam.SetAudioOutput( audioOutput );
   351     outputParam.SetAudioOutput( audioOutput );
   412 
   352 
   413     // view update
       
   414     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
   353     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
   415         &outputParam );
   354         &outputParam );
   416 
   355 
   417     // Previous Output
   356     // Previous Output
   418     TPEPhoneAudioRouteParameters RouteParameters = iStateMachine->
   357     TPEPhoneAudioRouteParameters RouteParameters = iStateMachine->
   419         PhoneEngineInfo()->RouteParameters();
   358         PhoneEngineInfo()->RouteParameters();
   420     const TPEAudioOutput previousOutput =
   359     const TPEAudioOutput previousOutput =
   421         RouteParameters.iPreviousOutput;
   360         RouteParameters.iPreviousOutput;
   422 
   361 
   423     // BT availability
       
   424     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
   362     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
   425             EPEBTAudioAccessory );
   363             EPEBTAudioAccessory );
   426 
       
   427     // Show note or BT disconnect handler
   364     // Show note or BT disconnect handler
   428     if ( audioOutput != EPENotActive &&
   365     if ( audioOutput != EPENotActive &&
   429          previousOutput == EPEBTAudioAccessory &&
   366          previousOutput == EPEBTAudioAccessory &&
   430          !btAvailable )
   367          !btAvailable )
   431         {
   368         {
   461 void CPhoneState::HandleSimStateChangedL()
   398 void CPhoneState::HandleSimStateChangedL()
   462     {
   399     {
   463     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleSimStateChangedL()" );
   400     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleSimStateChangedL()" );
   464     CPhoneMainResourceResolver& resolver = *CPhoneMainResourceResolver::Instance();
   401     CPhoneMainResourceResolver& resolver = *CPhoneMainResourceResolver::Instance();
   465     TPESimState simState = SimState();
   402     TPESimState simState = SimState();
   466 
       
   467     __PHONELOG2( EBasic, EPhoneControl, "SIM state was changed from %d to %d", iPreviousSimState, simState );
   403     __PHONELOG2( EBasic, EPhoneControl, "SIM state was changed from %d to %d", iPreviousSimState, simState );
   468 
       
   469     switch ( simState )
   404     switch ( simState )
   470         {
   405         {
   471         case EPESimUsable: // Falls through.
   406         case EPESimUsable: // Falls through.
   472         case EPESimReadable: // Falls through.
   407         case EPESimReadable: // Falls through.
   473         case EPESimNotReady:
   408         case EPESimNotReady:
   476                 {
   411                 {
   477                 __PHONELOG( EBasic, EPhoneControl, "SIM card was inserted, rebooting the phone" );
   412                 __PHONELOG( EBasic, EPhoneControl, "SIM card was inserted, rebooting the phone" );
   478                 RStarterSession starterSession;
   413                 RStarterSession starterSession;
   479                 User::LeaveIfError( starterSession.Connect() );
   414                 User::LeaveIfError( starterSession.Connect() );
   480                 CleanupClosePushL( starterSession );
   415                 CleanupClosePushL( starterSession );
   481 
   416                 
   482                 HBufC* queryText = StringLoader::LoadLC( resolver.ResolveResourceID( EPhoneRebootRequired ) );
   417                 HBufC* queryText = StringLoader::LoadLC( resolver.ResolveResourceID( EPhoneRebootRequired ) );
   483 
       
   484                 TPhoneCmdParamQuery queryParams;
   418                 TPhoneCmdParamQuery queryParams;
   485                 queryParams.SetCommandParamId( TPhoneCommandParam::EPhoneParamRebootQuery );
   419                 queryParams.SetCommandParamId( TPhoneCommandParam::EPhoneParamRebootQuery );
   486                 queryParams.SetQueryPrompt( *queryText );
   420                 queryParams.SetQueryPrompt( *queryText );
   487                 queryParams.SetDefaultCba( R_AVKON_SOFTKEYS_OK_EMPTY );
   421                 queryParams.SetDefaultCba( R_AVKON_SOFTKEYS_OK_EMPTY );
   488                 iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParams );
   422                 iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParams );
   489 
       
   490                 starterSession.Reset( RStarterSession::ESIMStatusChangeReset );
   423                 starterSession.Reset( RStarterSession::ESIMStatusChangeReset );
   491                 CleanupStack::PopAndDestroy( 2, &starterSession ); // queryText
   424                 CleanupStack::PopAndDestroy( 2, &starterSession ); // queryText
   492                 }
   425                 }
   493             break;
   426             break;
   494             }
   427             }
   497             if ( iPreviousSimState == EPESimUsable ||
   430             if ( iPreviousSimState == EPESimUsable ||
   498                  iPreviousSimState == EPESimReadable ||
   431                  iPreviousSimState == EPESimReadable ||
   499                  iPreviousSimState == EPESimNotReady )
   432                  iPreviousSimState == EPESimNotReady )
   500                 {
   433                 {
   501                 __PHONELOG( EBasic, EPhoneControl, "SIM card was removed" );
   434                 __PHONELOG( EBasic, EPhoneControl, "SIM card was removed" );
   502 
       
   503                 TPhoneCmdParamGlobalNote globalNoteParam;
   435                 TPhoneCmdParamGlobalNote globalNoteParam;
   504                 globalNoteParam.SetType( EPhoneMessageBoxInformation );
   436                 globalNoteParam.SetType( EPhoneMessageBoxInformation );
   505 
       
   506                 globalNoteParam.SetTextResourceId(
   437                 globalNoteParam.SetTextResourceId(
   507                     CPhoneMainResourceResolver::Instance()->
   438                     CPhoneMainResourceResolver::Instance()->
   508                     ResolveResourceID( EPhoneSimRemoved ) );
   439                     ResolveResourceID( EPhoneSimRemoved ) );
   509 
       
   510                 iViewCommandHandle->ExecuteCommandL(
   440                 iViewCommandHandle->ExecuteCommandL(
   511                     EPhoneViewShowGlobalNote, &globalNoteParam );
   441                     EPhoneViewShowGlobalNote, &globalNoteParam );
   512 
       
   513                 }
   442                 }
   514             // Show security note, if SIM not present and KFeatureIdFfSimlessOfflineSupport is disabled.
   443             // Show security note, if SIM not present and KFeatureIdFfSimlessOfflineSupport is disabled.
   515             else if ( !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) &&
   444             else if ( !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) &&
   516                     ( iPreviousSimState != EPESimNotSupported ) )
   445                     ( iPreviousSimState != EPESimNotSupported ) )
   517                 {
   446                 {
   520             break;
   449             break;
   521             }
   450             }
   522         default:
   451         default:
   523             break;
   452             break;
   524         }
   453         }
   525 
       
   526     iPreviousSimState = simState;
   454     iPreviousSimState = simState;
   527     }
   455     }
   528 
   456 
   529 // -----------------------------------------------------------------------------
   457 // -----------------------------------------------------------------------------
   530 // CPhoneState::IsValidAlphaNumericKey
   458 // CPhoneState::IsValidAlphaNumericKey
   534 //
   462 //
   535 TBool CPhoneState::IsValidAlphaNumericKey( const TKeyEvent& aKeyEvent,
   463 TBool CPhoneState::IsValidAlphaNumericKey( const TKeyEvent& aKeyEvent,
   536         TEventCode aEventCode )
   464         TEventCode aEventCode )
   537     {
   465     {
   538     TBool ret(EFalse);
   466     TBool ret(EFalse);
   539 
       
   540     const TBool numericKeyEntered( CPhoneKeys::IsNumericKey(
   467     const TBool numericKeyEntered( CPhoneKeys::IsNumericKey(
   541           aKeyEvent, aEventCode ) );
   468           aKeyEvent, aEventCode ) );
   542 
       
   543     // a numeric key (1,2,3,4,6,7,8,9,0,+,*,p,w )
   469     // a numeric key (1,2,3,4,6,7,8,9,0,+,*,p,w )
   544     // or
   470     // or
   545     // a letter from fullscreen qwerty, miniqwerty or handwriting
   471     // a letter from fullscreen qwerty, miniqwerty or handwriting
   546     // when voip is enabled
   472     // when voip is enabled
   547     if ( numericKeyEntered
   473     if ( numericKeyEntered
   548         || IsAlphanumericSupportedAndCharInput( aKeyEvent ) )
   474         || IsAlphanumericSupportedAndCharInput( aKeyEvent ) )
   549         {
   475         {
   550         ret= ETrue;
   476         ret= ETrue;
   551         }
   477         }
   552 
       
   553     return ret;
   478     return ret;
   554     }
   479     }
   555 
   480 
   556 // -----------------------------------------------------------------------------
       
   557 // CPhoneState::CustomizeCBAForPhoneNumber
       
   558 //
       
   559 // -----------------------------------------------------------------------------
       
   560 //
       
   561 void CPhoneState::CustomizeCbaForPhoneNumberL()
       
   562     {
       
   563     if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) &&
       
   564          iCustomization &&
       
   565          iCustomization->AllowAlphaNumericMode() )
       
   566         {
       
   567         // Get the number entry contents
       
   568         HBufC* phoneNumber = PhoneNumberFromEntryLC();
       
   569 
       
   570         TPhoneCmdParamInteger integerParam;
       
   571 
       
   572         //only charaters from set { 0, .., 9, *, #, +, p, w, P, W } used
       
   573         if ( CPhoneKeys::Validate( phoneNumber->Des()) )
       
   574             {
       
   575             integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
       
   576                                     ResolveResourceID( EPhoneNumberAcqCBA ) );
       
   577             }
       
   578         //other characters
       
   579         else
       
   580             {
       
   581             integerParam.SetInteger( iCustomization->CustomizeSoftKeys() );
       
   582             }
       
   583 
       
   584         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateCba, &integerParam );
       
   585         CleanupStack::PopAndDestroy( phoneNumber );
       
   586         }
       
   587 
       
   588     }
       
   589 
       
   590 // -----------------------------------------------------------------------------
       
   591 // CPhoneState::IsTouchDTmfDialerOn
       
   592 // -----------------------------------------------------------------------------
       
   593 //
       
   594 TBool CPhoneState::IsTouchDTmfDialerOn() const
       
   595     {
       
   596     TBool status( EFalse );
       
   597     return status;
       
   598     }
       
   599 // -----------------------------------------------------------------------------
   481 // -----------------------------------------------------------------------------
   600 // CPhoneState::SendDtmfKeyEventL
   482 // CPhoneState::SendDtmfKeyEventL
   601 // send dtmf event when,
   483 // send dtmf event when,
   602 // -touch dtmf dialer is NOT visible
   484 // -touch dtmf dialer is NOT visible
   603 // -query is not active
   485 // -query is not active
   605 // -----------------------------------------------------------------------------
   487 // -----------------------------------------------------------------------------
   606 //
   488 //
   607 void CPhoneState::SendDtmfKeyEventL( const TKeyEvent& aKeyEvent,
   489 void CPhoneState::SendDtmfKeyEventL( const TKeyEvent& aKeyEvent,
   608                TEventCode aEventCode  )
   490                TEventCode aEventCode  )
   609     {
   491     {
   610 
   492     if ( !IsAnyQueryActiveL() )
   611     if ( !IsTouchDTmfDialerOn()
       
   612         && !IsAnyQueryActiveL() )
       
   613         {
   493         {
   614         // Send the key event to the phone engine.
   494         // Send the key event to the phone engine.
   615         SendKeyEventL( aKeyEvent, aEventCode );
   495         SendKeyEventL( aKeyEvent, aEventCode );
   616         }
   496         }
   617     }
       
   618 
       
   619 // -----------------------------------------------------------------------------
       
   620 // CPhoneState::IsKeyEventFurtherProcessed
       
   621 // -----------------------------------------------------------------------------
       
   622 //
       
   623 TBool CPhoneState::IsKeyEventFurtherProcessedL( const TKeyEvent& /*aKeyEvent*/ ) const
       
   624     {
       
   625     return ETrue;
       
   626     }
   497     }
   627 
   498 
   628 // -----------------------------------------------------------
   499 // -----------------------------------------------------------
   629 // CPhoneState::HandleErrorL
   500 // CPhoneState::HandleErrorL
   630 // Default handling for HandleError message
   501 // Default handling for HandleError message
   632 // -----------------------------------------------------------
   503 // -----------------------------------------------------------
   633 //
   504 //
   634 EXPORT_C void CPhoneState::HandleErrorL( const TPEErrorInfo& aErrorInfo )
   505 EXPORT_C void CPhoneState::HandleErrorL( const TPEErrorInfo& aErrorInfo )
   635     {
   506     {
   636     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleErrorL()");
   507     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleErrorL()");
   637 
       
   638     __PHONELOG1( EBasic, EPhoneControl,
   508     __PHONELOG1( EBasic, EPhoneControl,
   639             "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iErrorCode =%d ",
   509             "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iErrorCode =%d ",
   640             aErrorInfo.iErrorCode );
   510             aErrorInfo.iErrorCode );
   641 
       
   642     __PHONELOG1( EBasic, EPhoneControl,
   511     __PHONELOG1( EBasic, EPhoneControl,
   643         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   512         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   644         aErrorInfo.iCallId );
   513         aErrorInfo.iCallId );
   645 
       
   646 
       
   647     // Do the common error handling (display proper notes etc)
   514     // Do the common error handling (display proper notes etc)
   648     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
   515     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
   649 
       
   650     switch( aErrorInfo.iErrorCode )
   516     switch( aErrorInfo.iErrorCode )
   651         {
   517         {
   652         case ECCPErrorCCUserAlertingNoAnswer:
       
   653         case ECCPErrorCCResourceNotAvailable:
       
   654             {
       
   655             if( aErrorInfo.iCallId > KErrNotFound )
       
   656                 {
       
   657                 if ( iStateMachine->PhoneEngineInfo()->CallDirection(
       
   658                         aErrorInfo.iCallId ) != RMobileCall::EMobileTerminated )
       
   659                     {
       
   660                     if( IsVideoCall( aErrorInfo.iCallId ) )
       
   661                         {
       
   662                         // Active MO video call lost 3G network.
       
   663                         __PHONELOG1( EBasic, EPhoneControl,
       
   664                         "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 1, callid%d ",
       
   665                         aErrorInfo.iCallId );
       
   666                         CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
       
   667                         }
       
   668                     else
       
   669                         {
       
   670                          __PHONELOG1( EBasic, EPhoneControl,
       
   671                             "PhoneUIControl: CPhoneState::HandleErrorL - No video call =%d ",
       
   672                             aErrorInfo.iCallId );
       
   673                         }
       
   674                     }
       
   675                 }
       
   676             }
       
   677             break;
       
   678 
       
   679             case ECCPErrorCCServiceNotAvailable:
       
   680                 {
       
   681                 if( IsVideoCall( aErrorInfo.iCallId ) )
       
   682                     {
       
   683                     CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( EFalse );
       
   684                     }
       
   685                 }
       
   686                 break;
       
   687 
       
   688             case ECCPErrorBadRequest:
       
   689                 {
       
   690                 TPECallType callType =
       
   691                     iStateMachine->PhoneEngineInfo()->CallTypeCommand();
       
   692 
       
   693                 if( callType == EPECallTypeVideo )
       
   694                     {
       
   695                         // Dialling MO video call cannot reach 3G network.
       
   696                         __PHONELOG1( EBasic, EPhoneControl,
       
   697                             "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 2, callid%d ",
       
   698                             aErrorInfo.iCallId );
       
   699                         CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
       
   700                     }
       
   701                 }
       
   702                 break;
       
   703 
       
   704         case ECCPErrorVideoCallNotSupportedByNetwork:
       
   705         case ECCPErrorVideoCallSetupFailed:
       
   706         case ECCPErrorNotReached:
       
   707            // If call id found and seems to be Video Call
       
   708             if ( IsVideoCall( aErrorInfo.iCallId ) )
       
   709                 {
       
   710                 // Get active call count
       
   711                 TPhoneCmdParamInteger activeCallCount;
       
   712                 iViewCommandHandle->ExecuteCommandL(
       
   713                     EPhoneViewGetCountOfActiveCalls, &activeCallCount );
       
   714 
       
   715                 if ( activeCallCount.Integer() == 0
       
   716                      || iStateMachine->PhoneEngineInfo()->CallDirection(
       
   717                         aErrorInfo.iCallId ) != RMobileCall::EMobileTerminated )
       
   718                     {
       
   719                     // Dialling MO video call attempted in 2G network or
       
   720                     // dialing MO video to unvalid number
       
   721                     // Reconnect query include video label if errorcode is unvalid number.
       
   722                     __PHONELOG1( EBasic, EPhoneControl,
       
   723                     "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 3, callid%d ",
       
   724                     aErrorInfo.iCallId );
       
   725                     CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL(
       
   726                               ECCPErrorNotReached == aErrorInfo.iErrorCode );
       
   727                     }
       
   728                 }
       
   729             break;
       
   730 
   518 
   731         case ECCPErrorNoService:
   519         case ECCPErrorNoService:
   732             // No network -> hide volume popup
   520             // No network -> hide volume popup
   733             iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
   521             iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
   734             break;
   522             break;
   735 
   523 
   736         case ECCPErrorSatControl:
   524         case ECCPErrorSatControl:
   737             {
   525             NumberEntryClearL();
   738             // check, that there really was a call established before completing SAT request
       
   739             if( aErrorInfo.iCallId != KPECallIdNotUsed )
       
   740                 {
       
   741                 }
       
   742 
       
   743             // remove number entry
       
   744             if ( !IsOnScreenDialerSupported() && IsNumberEntryUsedL() )
       
   745                 {
       
   746                 iViewCommandHandle->ExecuteCommandL(
       
   747                     EPhoneViewRemoveNumberEntry );
       
   748                 }
       
   749             else if ( IsOnScreenDialerSupported() )
       
   750                 {
       
   751                 NumberEntryClearL();
       
   752                 }
       
   753             }
       
   754             break;
   526             break;
   755 
   527 
   756         default:
   528         default:
   757             break;
   529             break;
   758         }
   530         }
   759 
       
   760     // clear call blacklist if call failure occurs
   531     // clear call blacklist if call failure occurs
   761     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   532     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   762     }
   533     }
   763 
   534 
   764 // -----------------------------------------------------------
   535 // -----------------------------------------------------------
   767 // (other items were commented in a header).
   538 // (other items were commented in a header).
   768 // -----------------------------------------------------------
   539 // -----------------------------------------------------------
   769 void CPhoneState::HandleChangedCallDurationL( TInt aCallId )
   540 void CPhoneState::HandleChangedCallDurationL( TInt aCallId )
   770     {
   541     {
   771      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleChangedCallDurationL() ");
   542      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleChangedCallDurationL() ");
   772     
       
   773     TInt ret = KErrNone;
   543     TInt ret = KErrNone;
   774     TInt isDisplayOn;
   544     TInt isDisplayOn;
   775     
       
   776     ret = HAL::Get( HALData::EDisplayState, isDisplayOn );
   545     ret = HAL::Get( HALData::EDisplayState, isDisplayOn );
   777     
       
   778     // Update only if the display is on or if HAL::Get returns an error, 
   546     // Update only if the display is on or if HAL::Get returns an error, 
   779     // in which case display value cannot be trusted.
   547     // in which case display value cannot be trusted.
   780     if ( ret || isDisplayOn )
   548     if ( ret || isDisplayOn )
   781         {
   549         {
   782         // Get the call duration
   550         // Get the call duration
   783         TTimeIntervalSeconds seconds =
   551         TTimeIntervalSeconds seconds =
   784             iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
   552             iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
   785 
       
   786         TPhoneCmdParamInteger time;
   553         TPhoneCmdParamInteger time;
   787         time.SetInteger(seconds.Int());
   554         time.SetInteger(seconds.Int());
   788         iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
   555         iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
   789         }
   556         }
   790     }	
   557     }	
   794 // -----------------------------------------------------------------------------
   561 // -----------------------------------------------------------------------------
   795 //
   562 //
   796 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
   563 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
   797     {
   564     {
   798     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
   565     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
   799 
       
   800     TPEErrorInfo info;
   566     TPEErrorInfo info;
   801     info.iCallId = aCallId;
   567     info.iCallId = aCallId;
   802     info.iErrorCode = ECCPErrorBusy;
   568     info.iErrorCode = ECCPErrorBusy;
   803     info.iErrorType = EPECcp;
   569     info.iErrorType = EPECcp;
   804     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( info );
   570     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( info );
   805     
       
   806     const TPECallType callType =
       
   807         iStateMachine->PhoneEngineInfo()->CallTypeCommand();
       
   808 
       
   809     if( callType == EPECallTypeVideo )
       
   810         {
       
   811          // Launch reconnect query including video call menu item
       
   812          __PHONELOG1( EBasic, EPhoneControl,
       
   813             "PhoneUIControl: CPhoneState::HandleRemoteBusyL - ShowReconnectQueryL vid 5, callid%d ",
       
   814                 aCallId );
       
   815         CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
       
   816         }
       
   817     }
   571     }
   818 
   572 
   819 // -----------------------------------------------------------
   573 // -----------------------------------------------------------
   820 // CPhoneState::HandleDisconnectingL
   574 // CPhoneState::HandleDisconnectingL
   821 // -----------------------------------------------------------
   575 // -----------------------------------------------------------
   822 //
   576 //
   823 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   577 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   824     {
   578     {
   825     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   579     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   826 
       
   827     TPhoneCmdParamCallHeaderData callHeaderParam;
   580     TPhoneCmdParamCallHeaderData callHeaderParam;
   828     callHeaderParam.SetCallState( EPEStateDisconnecting );
   581     callHeaderParam.SetCallState( EPEStateDisconnecting );
   829 
       
   830     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   582     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   831     LoadResource( labelText, EPhoneInCallDisconnected );
   583     LoadResource( labelText, EPhoneInCallDisconnected );
   832 
       
   833     callHeaderParam.SetLabelText( labelText );
   584     callHeaderParam.SetLabelText( labelText );
   834 
   585 
   835     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   586     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   836 
   587     iViewCommandHandle->ExecuteCommandL( 
   837     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   588             EPhoneViewUpdateBubble, 
   838         &callHeaderParam );    
   589             aCallId,
       
   590             &callHeaderParam );
   839 
   591 
   840     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   592     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   841     }
   593     }
   842 
   594 
   843 // -----------------------------------------------------------
   595 // -----------------------------------------------------------
   850     return iViewCommandHandle->HandleCommandL(
   602     return iViewCommandHandle->HandleCommandL(
   851         EPhoneIsCustomizedDialerVisible ) == EPhoneViewResponseSuccess;
   603         EPhoneIsCustomizedDialerVisible ) == EPhoneViewResponseSuccess;
   852     }
   604     }
   853 
   605 
   854 // <------------------------------- KEY EVENTS ------------------------------->
   606 // <------------------------------- KEY EVENTS ------------------------------->
   855 
       
   856 // -----------------------------------------------------------
   607 // -----------------------------------------------------------
   857 // CPhoneState::HandleKeyMessageL( aMessage, aKeyCode )
   608 // CPhoneState::HandleKeyMessageL( aMessage, aKeyCode )
   858 // -----------------------------------------------------------
   609 // -----------------------------------------------------------
   859 //
   610 //
   860 EXPORT_C void CPhoneState::HandleKeyMessageL(
   611 EXPORT_C void CPhoneState::HandleKeyMessageL(
   871 EXPORT_C void CPhoneState::HandleKeyEventL(
   622 EXPORT_C void CPhoneState::HandleKeyEventL(
   872     const TKeyEvent& aKeyEvent,
   623     const TKeyEvent& aKeyEvent,
   873     TEventCode aEventCode )
   624     TEventCode aEventCode )
   874     {
   625     {
   875     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleKeyEventL( ) ");
   626     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleKeyEventL( ) ");
   876     if ( ( IsNumberEntryVisibleL() ) || OnlySideVolumeKeySupported() )
   627     if ( aKeyEvent.iScanCode == EStdKeyUpArrow &&
   877         {
   628          aEventCode == EEventKey )
   878         // Handle numeric keys when key events are received in single state
       
   879         HandleNumericKeyEventL( aKeyEvent, aEventCode );
       
   880         }
       
   881     else if ( aKeyEvent.iScanCode == EStdKeyUpArrow &&
       
   882               aEventCode == EEventKey )
       
   883         {
   629         {
   884         // Increace audio volume
   630         // Increace audio volume
   885         IncreaseAudioVolumeL();
   631         IncreaseAudioVolumeL();
   886         }
   632         }
   887     else if ( aKeyEvent.iScanCode == EStdKeyDownArrow &&
   633     else if ( aKeyEvent.iScanCode == EStdKeyDownArrow &&
   888             aEventCode == EEventKey )
   634             aEventCode == EEventKey )
   889         {
   635         {
   890         // Decreace audio volume
   636         // Decreace audio volume
   891         DecreaseAudioVolumeL();
   637         DecreaseAudioVolumeL();
   892         }
       
   893     else
       
   894         {
       
   895         // Handle numeric keys when key events are received in single state
       
   896         HandleNumericKeyEventL( aKeyEvent, aEventCode );
       
   897         }
   638         }
   898     }
   639     }
   899 
   640 
   900 // -----------------------------------------------------------
   641 // -----------------------------------------------------------
   901 // CPhoneState::OnlySideVolumeKeySupported
   642 // CPhoneState::OnlySideVolumeKeySupported
   905     {
   646     {
   906     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::OnlySideVolumeKeySupported( ) ");
   647     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::OnlySideVolumeKeySupported( ) ");
   907     TBool onlySideVolumeKeySupported(EFalse);
   648     TBool onlySideVolumeKeySupported(EFalse);
   908     if ( !CPhoneCenRepProxy::Instance()->
   649     if ( !CPhoneCenRepProxy::Instance()->
   909             IsTelephonyFeatureSupported( KTelephonyLVFlagScrollVolumeKeys ) &&
   650             IsTelephonyFeatureSupported( KTelephonyLVFlagScrollVolumeKeys ) &&
   910          FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) )
   651             FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) )
   911         {
   652         {
   912         onlySideVolumeKeySupported = ETrue;
   653         onlySideVolumeKeySupported = ETrue;
   913         }
   654         }
   914     __PHONELOG1( EBasic, EPhoneControl,
   655     __PHONELOG1( EBasic, EPhoneControl,
   915             "OnlySideVolumeKeySupported: %d",
   656             "OnlySideVolumeKeySupported: %d",
   916             onlySideVolumeKeySupported );
   657             onlySideVolumeKeySupported );
   917     return onlySideVolumeKeySupported;
   658     return onlySideVolumeKeySupported;
   918     }
   659     }
   919 
   660 
   920 // -----------------------------------------------------------
       
   921 // CPhoneState::HandleKeyPressDurationL( aScanCode, aKeyPressDuration )
       
   922 // -----------------------------------------------------------
       
   923 //
       
   924 EXPORT_C void CPhoneState::HandleKeyPressDurationL(
       
   925     TKeyCode aCode,
       
   926     TTimeIntervalMicroSeconds /*aKeyPressDuration*/ )
       
   927     {
       
   928     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleKeyPressDurationL( ) ");
       
   929 
       
   930     if( aCode == KPhoneDtmfHashCharacter )
       
   931         {
       
   932         if( iAlsLineChangeKeyPressTimer )
       
   933             {
       
   934             if( iAlsLineChangeKeyPressTimer->IsActive() )
       
   935                 {
       
   936                 iAlsLineChangeKeyPressTimer->Cancel();
       
   937                 }
       
   938             }
       
   939         }
       
   940     }
       
   941 
       
   942 // -----------------------------------------------------------
       
   943 // CPhoneState::HandleNumericKeyEventL
       
   944 // -----------------------------------------------------------
       
   945 //
       
   946 EXPORT_C void CPhoneState::HandleNumericKeyEventL(
       
   947     const TKeyEvent& /*aKeyEvent*/,
       
   948     TEventCode /*aEventCode*/ )
       
   949     {
       
   950     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleNumericKeyEventL( ) ");
       
   951 
       
   952     }
       
   953 
       
   954 // -----------------------------------------------------------------------------
   661 // -----------------------------------------------------------------------------
   955 // CPhoneState::IsAnyQueryActiveL
   662 // CPhoneState::IsAnyQueryActiveL
   956 // -----------------------------------------------------------------------------
   663 // -----------------------------------------------------------------------------
   957 //
   664 //
   958 EXPORT_C TBool CPhoneState::IsAnyQueryActiveL()
   665 EXPORT_C TBool CPhoneState::IsAnyQueryActiveL()
   959     {
   666     {
   960     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsAnyQueryActiveL( ) ");
   667     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsAnyQueryActiveL( ) ");
   961     TBool isActive( EFalse );
   668     TBool isActive( EFalse );
   962 
       
   963     // If IsNoteDismissableL returns true then shown note is dismissable by key event
   669     // If IsNoteDismissableL returns true then shown note is dismissable by key event
   964     // and then there is no actual query and IsAnyQueryActiveL returns false.
   670     // and then there is no actual query and IsAnyQueryActiveL returns false.
   965     if ( !IsNoteDismissableL() )
   671     if ( !IsNoteDismissableL() )
   966         {
   672         {
   967         // Check is query displayed
   673         // Check is query displayed
  1019     TEventCode aEventCode )
   725     TEventCode aEventCode )
  1020     {
   726     {
  1021     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendKeyEventL( ) ");
   727     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendKeyEventL( ) ");
  1022     switch( aEventCode )
   728     switch( aEventCode )
  1023         {
   729         {
  1024         // EEventKey
       
  1025         case EEventKey:
   730         case EEventKey:
  1026             // Send the key press to the phone engine, if applicable
   731             // Send the key press to the phone engine, if applicable
  1027             SendKeyPressL( aKeyEvent, aEventCode );
   732             SendKeyPressL( aKeyEvent, aEventCode );
  1028             break;
   733             break;
  1029 
   734 
  1030         // EEventKeyUp
       
  1031         case EEventKeyUp:
   735         case EEventKeyUp:
  1032             // Send a key up event for the last key code sent to
   736             // Send a key up event for the last key code sent to
  1033             // the phone engine
   737             // the phone engine
  1034             iStateMachine->SendPhoneEngineMessage(
   738             iStateMachine->SendPhoneEngineMessage(
  1035                 MPEPhoneModel::EPEMessageEndDTMF );
   739                 MPEPhoneModel::EPEMessageEndDTMF );
  1053         CPhoneKeys::IsDtmfTone( aKeyEvent, aEventCode );
   757         CPhoneKeys::IsDtmfTone( aKeyEvent, aEventCode );
  1054 
   758 
  1055     if ( dtmfToneKeyEntered ||
   759     if ( dtmfToneKeyEntered ||
  1056         aKeyEvent.iCode == EKeyBackspace )
   760         aKeyEvent.iCode == EKeyBackspace )
  1057         {
   761         {
  1058         // Get the number entry contents, if it exists
   762         // Get the number entry contents and store, if it exists
  1059         if ( IsNumberEntryUsedL() )
   763         if ( IsNumberEntryUsedL() )
  1060             {
   764             {
  1061             HBufC* phoneNumber = PhoneNumberFromEntryLC();
   765             HBufC* phoneNumber = PhoneNumberFromEntryLC();
  1062             // Save the phone number
       
  1063             __PHONELOG1( EBasic, EPhoneControl, "SetPhoneNumber: %S ", phoneNumber );
   766             __PHONELOG1( EBasic, EPhoneControl, "SetPhoneNumber: %S ", phoneNumber );
  1064             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
   767             iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1065 
   768 
  1066             // Convert key code to western.
   769             // Convert key code to western.
  1067             TBuf<1> buffer; // one character
   770             TBuf<1> buffer; // one character
  1071                 &buffer );
   774                 &buffer );
  1072             AknTextUtils::ConvertDigitsTo( buffer, EDigitTypeWestern );
   775             AknTextUtils::ConvertDigitsTo( buffer, EDigitTypeWestern );
  1073             __PHONELOG1( EBasic, EPhoneControl,
   776             __PHONELOG1( EBasic, EPhoneControl,
  1074                 "CPhoneState::SendKeyPressL(%S)",
   777                 "CPhoneState::SendKeyPressL(%S)",
  1075                 &buffer );
   778                 &buffer );
       
   779 
       
   780             // Save the key code
  1076             TLex code( buffer );
   781             TLex code( buffer );
  1077 
       
  1078             // Save the key code
       
  1079             iStateMachine->PhoneEngineInfo()->SetKeyCode( code.Peek() );
   782             iStateMachine->PhoneEngineInfo()->SetKeyCode( code.Peek() );
  1080 
   783 
  1081             // Plays a DTMF tone if active call
   784             // Plays a DTMF tone if active call
  1082             iStateMachine->SendPhoneEngineMessage(
   785             iStateMachine->SendPhoneEngineMessage(
  1083                 MPEPhoneModel::EPEMessagePlayDTMF );
   786                 MPEPhoneModel::EPEMessagePlayDTMF );
  1084             // remove the phone number from the cleanup stack
       
  1085             CleanupStack::PopAndDestroy( phoneNumber );
   787             CleanupStack::PopAndDestroy( phoneNumber );
  1086             }
   788             }
  1087         }
   789         }
  1088     }
   790     }
  1089 
   791 
  1090 // <------------------------------ SYSTEM EVENTS ----------------------------->
   792 // <------------------------------ SYSTEM EVENTS ----------------------------->
  1091 
       
  1092 
       
  1093 // -----------------------------------------------------------
   793 // -----------------------------------------------------------
  1094 // CPhoneState::HandleSystemEventL
   794 // CPhoneState::HandleSystemEventL
  1095 // -----------------------------------------------------------
   795 // -----------------------------------------------------------
  1096 //
   796 //
  1097 EXPORT_C void CPhoneState::HandleSystemEventL( const TWsEvent& /*aEvent*/ )
   797 EXPORT_C void CPhoneState::HandleSystemEventL( const TWsEvent& /*aEvent*/ )
  1128 //
   828 //
  1129 EXPORT_C void CPhoneState::HandlePhoneFocusLostEventL()
   829 EXPORT_C void CPhoneState::HandlePhoneFocusLostEventL()
  1130     {
   830     {
  1131     // Notify that this method is called always when Idle is brought to foreground
   831     // Notify that this method is called always when Idle is brought to foreground
  1132     // See implementation in CPhoneAppUI::HandleWsEventL
   832     // See implementation in CPhoneAppUI::HandleWsEventL
  1133 
       
  1134     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneFocusLostEventL( ) ");
   833     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePhoneFocusLostEventL( ) ");
  1135     }
   834     }
  1136 // ---------------------------------------------------------
   835 // ---------------------------------------------------------
  1137 // CPhoneState::HandleIdleForegroundEventL
   836 // CPhoneState::HandleIdleForegroundEventL
  1138 // ---------------------------------------------------------
   837 // ---------------------------------------------------------
  1139 //
   838 //
  1140 EXPORT_C void CPhoneState::HandleIdleForegroundEventL()
   839 EXPORT_C void CPhoneState::HandleIdleForegroundEventL()
  1141     {
   840     {
  1142     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleIdleForegroundEventL( ) ");
   841     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleIdleForegroundEventL( ) ");
  1143     // Empty implementation
   842     // Empty implementation
  1144     }
       
  1145 
       
  1146 // -----------------------------------------------------------
       
  1147 // CPhoneState::HandleEnvironmentChangeL
       
  1148 // -----------------------------------------------------------
       
  1149 //
       
  1150 EXPORT_C void CPhoneState::HandleEnvironmentChangeL( const TInt aChanges )
       
  1151     {
       
  1152     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleEnvironmentChangeL( ) ");
       
  1153     __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::HandleEnvironmentChangeL - Changes:  %d ", aChanges );
       
  1154     // Update the profile display if required
       
  1155     if ( aChanges &
       
  1156         ( EChangesLocale | EChangesMidnightCrossover | EChangesSystemTime ) )
       
  1157         {
       
  1158         UpdateProfileDisplayL();
       
  1159         }
       
  1160     }
   843     }
  1161 
   844 
  1162 // -----------------------------------------------------------
   845 // -----------------------------------------------------------
  1163 // CPhoneState::HandlePhoneStartupL
   846 // CPhoneState::HandlePhoneStartupL
  1164 // -----------------------------------------------------------
   847 // -----------------------------------------------------------
  1176 EXPORT_C void CPhoneState::HandlePropertyChangedL(
   859 EXPORT_C void CPhoneState::HandlePropertyChangedL(
  1177     const TUid& aCategory,
   860     const TUid& aCategory,
  1178     const TUint aKey,
   861     const TUint aKey,
  1179     const TInt aValue )
   862     const TInt aValue )
  1180     {
   863     {
  1181 
       
  1182     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePropertyChangedL( ) ");
   864     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandlePropertyChangedL( ) ");
  1183 
       
  1184     __PHONELOG1( EBasic, EPhoneControl,
   865     __PHONELOG1( EBasic, EPhoneControl,
  1185             "CPhoneState::HandlePropertyChangedL - aCategory= %d", aCategory  );
   866             "CPhoneState::HandlePropertyChangedL - aCategory= %d", aCategory  );
  1186     __PHONELOG1( EBasic, EPhoneControl,
   867     __PHONELOG1( EBasic, EPhoneControl,
  1187             "CPhoneState::HandlePropertyChangedL - aKey= %d", aKey  );
   868             "CPhoneState::HandlePropertyChangedL - aKey= %d", aKey  );
  1188     __PHONELOG1( EBasic, EPhoneControl,
   869     __PHONELOG1( EBasic, EPhoneControl,
  1189             "CPhoneState::HandlePropertyChangedL - aValue= %d", aValue  );
   870             "CPhoneState::HandlePropertyChangedL - aValue= %d", aValue  );
  1190     if ( aCategory == KPSUidTelInformation
   871     if ( aCategory == KPSUidTelInformation && SimState() == EPESimUsable )
  1191               && SimState() == EPESimUsable )
   872         {
  1192         {
       
  1193         // Telephony display event
       
  1194         if ( aKey == KTelDisplayInfo )
   873         if ( aKey == KTelDisplayInfo )
  1195             {
   874             {
  1196             __PHONELOG( EBasic, EPhoneControl, "CPhoneState::HandlePropertyChangedL - telephony display info received" );
   875             __PHONELOG( EBasic, EPhoneControl, 
  1197             // Update the operator and profile display
   876                     "CPhoneState::HandlePropertyChangedL - telephony display info received" );
  1198             UpdateProfileDisplayL();
       
  1199             }
   877             }
  1200         }
   878         }
  1201     else if ( aCategory == KPSUidStartup && aKey == KStartupSimSecurityStatus )
   879     else if ( aCategory == KPSUidStartup && aKey == KStartupSimSecurityStatus )
  1202         {
   880         {
  1203         // Show security note, SIM is not valid.
   881         // Show security note, SIM is not valid.
  1246         EPhoneViewGetTopApplicationIsDisplayedStatus ) ==
   924         EPhoneViewGetTopApplicationIsDisplayedStatus ) ==
  1247         EPhoneViewResponseSuccess;
   925         EPhoneViewResponseSuccess;
  1248     }
   926     }
  1249 
   927 
  1250 // <---------------------------- MENU AND CBA EVENTS ------------------------->
   928 // <---------------------------- MENU AND CBA EVENTS ------------------------->
  1251 
       
  1252 EXPORT_C TBool CPhoneState::HandleCommandL( TInt aCommand )
   929 EXPORT_C TBool CPhoneState::HandleCommandL( TInt aCommand )
  1253     {
   930     {
  1254     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCommandL( ) ");
   931     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCommandL( ) ");
  1255     TBool commandStatus = ETrue;
   932     TBool commandStatus = ETrue;
  1256     switch( aCommand )
   933     switch( aCommand )
  1257         {
   934         {
  1258         case EPhoneEmergencyCmdExit:
   935         case EPhoneEmergencyCmdExit:
  1259             {
       
  1260             }
       
  1261             // this should be bypasses?
       
  1262         case EPhoneDialerCallHandling:
   936         case EPhoneDialerCallHandling:
  1263         case EPhoneCmdBack:
   937         case EPhoneCmdBack:
  1264             // Remove number entry from screen
       
  1265             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   938             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1266             // Do state-specific behaviour if number entry is cleared
   939             // Do state-specific behaviour if number entry is cleared
  1267             HandleNumberEntryClearedL();
   940             HandleNumberEntryClearedL();
  1268             break;
   941             break;
  1269 
   942 
  1270         case EPhoneDialerCmdTouchInput:
   943         case EPhoneDialerCmdTouchInput:
  1271             break;
       
  1272 
       
  1273         case EPhoneNumberAcqCmdSendMessage:
   944         case EPhoneNumberAcqCmdSendMessage:
  1274             break;
       
  1275 
       
  1276         case EPhoneNumberAcqCmdSave:
   945         case EPhoneNumberAcqCmdSave:
  1277             break;
       
  1278 
       
  1279         case EPhoneNumberAcqCmdAddToName:
   946         case EPhoneNumberAcqCmdAddToName:
  1280             break;
   947             break;
  1281 
   948 
  1282         case EPhoneNumberAcqCmdAddToContacts:
   949         case EPhoneNumberAcqCmdAddToContacts:
  1283             {
   950             {
  1284             if ( IsOnScreenDialerSupported() )
   951             TPhoneCmdParamQuery queryDialogParam;
  1285                 {
   952                 queryDialogParam.SetQueryType( EPhoneContactsListQuery );
  1286                 TPhoneCmdParamQuery queryDialogParam;
   953                 queryDialogParam.SetQueryResourceId(
  1287                     queryDialogParam.SetQueryType( EPhoneContactsListQuery );
   954                 CPhoneMainResourceResolver::Instance()->
  1288                     queryDialogParam.SetQueryResourceId(
   955                 ResolveResourceID( EPhoneAddtoContactsListQuery ) );
  1289                     CPhoneMainResourceResolver::Instance()->
   956             iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery,
  1290                     ResolveResourceID( EPhoneAddtoContactsListQuery )  );
   957                 &queryDialogParam );
  1291 
       
  1292                  // Display dialog
       
  1293                 iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery,
       
  1294                     &queryDialogParam );
       
  1295                 }
       
  1296             }
   958             }
  1297             break;
   959             break;
  1298 
   960 
  1299         case EPhoneCmdWaitNoteOk:
   961         case EPhoneCmdWaitNoteOk:
  1300             // Remove number entry from screen
       
  1301             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   962             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
  1302             if ( !IsOnScreenDialerSupported() )
       
  1303                 {
       
  1304                 HandleNumberEntryClearedL();
       
  1305                 }
       
  1306             break;
   963             break;
  1307 
   964 
  1308         case EPhoneInCallCmdEndThisOutgoingCall:
   965         case EPhoneInCallCmdEndThisOutgoingCall:
  1309             DisconnectCallL();
   966             DisconnectCallL();
  1310             break;
   967             break;
  1315                 ChangeAlsLineL();
   972                 ChangeAlsLineL();
  1316                 }
   973                 }
  1317             else
   974             else
  1318                 {
   975                 {
  1319                 SendGlobalErrorNoteL( EPhoneLineBlockingNote );
   976                 SendGlobalErrorNoteL( EPhoneLineBlockingNote );
  1320                 HandleNumberEntryClearedL(); // Set back CBAs
       
  1321                 }
       
  1322             break;
       
  1323 
       
  1324         case EPhoneCmdNoAlsLineChange:
       
  1325             if ( !IsOnScreenDialerSupported() )
       
  1326                 {
       
  1327                 HandleNumberEntryClearedL();
   977                 HandleNumberEntryClearedL();
  1328                 }
   978                 }
  1329             break;
   979             break;
  1330 
   980 
  1331         case EPhoneCmdYesBtDisconnectQuery:
   981         case EPhoneCmdYesBtDisconnectQuery:
  1345         case EPhoneInCallCmdBtHandsfree:
   995         case EPhoneInCallCmdBtHandsfree:
  1346             CPhoneState::SetBTHandsfreeModeL(
   996             CPhoneState::SetBTHandsfreeModeL(
  1347                  aCommand == EPhoneInCallCmdBtHandsfree );
   997                  aCommand == EPhoneInCallCmdBtHandsfree );
  1348             break;
   998             break;
  1349 
   999 
       
  1000         case EPhoneCmdNoAlsLineChange:
  1350         case EPhoneInCallCmdActivatEPhonebook:
  1001         case EPhoneInCallCmdActivatEPhonebook:
  1351             {
       
  1352             }
       
  1353             break;
       
  1354 
       
  1355         case EPhoneNumberAcqSecurityDialer:
  1002         case EPhoneNumberAcqSecurityDialer:
  1356             {
       
  1357 
       
  1358             }
       
  1359             break;
       
  1360 
       
  1361         case EPhoneDialerCmdContacts:
  1003         case EPhoneDialerCmdContacts:
  1362             {
       
  1363             }
       
  1364             break;
       
  1365 
       
  1366         case EPhoneNumberAcqCmdToggleNeAlphaMode:
  1004         case EPhoneNumberAcqCmdToggleNeAlphaMode:
  1367         case EPhoneNumberAcqCmdToggleNeNumericMode:
  1005         case EPhoneNumberAcqCmdToggleNeNumericMode:
  1368             {
       
  1369 
       
  1370             }
       
  1371             break;
  1006             break;
  1372 
  1007 
  1373         case EPhoneCmdYesVideoFailedNoMemorySwitchToVoice:
  1008         case EPhoneCmdYesVideoFailedNoMemorySwitchToVoice:
  1374             DialVoiceCallL();
  1009             DialVoiceCallL();
  1375             break;
  1010             break;
  1376 
  1011 
  1377         case EPhoneCmdNoVideoFailedNoMemorySwitchToVoice:
  1012         case EPhoneCmdNoVideoFailedNoMemorySwitchToVoice:
  1378             if ( IsNumberEntryUsedL() )
  1013             if ( IsNumberEntryUsedL() )
  1379                 {
  1014                 {
  1380                 // Show the number entry if it exists
       
  1381                 SetNumberEntryVisibilityL(ETrue);
  1015                 SetNumberEntryVisibilityL(ETrue);
  1382                 }
  1016                 }
  1383             else if ( NeedToSendToBackgroundL() )
  1017             else if ( NeedToSendToBackgroundL() )
  1384                 {
  1018                 {
  1385                 // Continue displaying current app but set up the
  1019                 // Continue displaying current app but set up the
  1386                 // idle screen in the background
  1020                 // idle screen in the background
  1387                 SetupIdleScreenInBackgroundL();
  1021                 SetupIdleScreenInBackgroundL();
  1388                 }
  1022                 }
  1389             else
  1023             else
  1390                 {
  1024                 {
  1391                  // Display idle screen
       
  1392                 DisplayIdleScreenL();
  1025                 DisplayIdleScreenL();
  1393                 }
  1026                 }
  1394             break;
  1027             break;
  1395 
  1028 
  1396         case EPhoneInCallCmdSetVolumeLevel:
  1029         case EPhoneInCallCmdSetVolumeLevel:
  1405             ShowVideoCallOutOfMemoryNoteL();
  1038             ShowVideoCallOutOfMemoryNoteL();
  1406             DisconnectCallL();
  1039             DisconnectCallL();
  1407             break;
  1040             break;
  1408             
  1041             
  1409         case EPhoneCallComingCmdSoftReject:
  1042         case EPhoneCallComingCmdSoftReject:
  1410             // Open Soft reject message editor
       
  1411             OpenSoftRejectMessageEditorL();
  1043             OpenSoftRejectMessageEditorL();
  1412             break;
  1044             break;
  1413             
  1045             
  1414         case EPhoneInCallCmdContacts:
  1046         case EPhoneInCallCmdContacts:
  1415             iViewCommandHandle->ExecuteCommand( EPhoneViewOpenContacts );
  1047             iViewCommandHandle->ExecuteCommand( EPhoneViewOpenContacts );
  1416             break;
  1048             break;
  1417             
  1049             
  1418         default:
  1050         default:
  1419 
  1051             {
  1420             /*if ( IsOnScreenDialerSupported() )
  1052             commandStatus = EFalse;
  1421                 {
  1053             }
  1422                 // Offer command to view.
  1054             break;
  1423                 TPhoneViewResponseId resId =
  1055         }
  1424                             iViewCommandHandle->HandleCommandL( aCommand );
  1056     
  1425 
       
  1426                 if( resId == EPhoneViewResponseFailed )
       
  1427                     {
       
  1428                     commandStatus = EFalse;
       
  1429                     }
       
  1430                 }
       
  1431             else*/
       
  1432 
       
  1433                 {
       
  1434                 commandStatus = EFalse;
       
  1435                 }
       
  1436             break;
       
  1437         }
       
  1438 
       
  1439     if( !commandStatus && iCustomization )
  1057     if( !commandStatus && iCustomization )
  1440         {
  1058         {
  1441         commandStatus = iCustomization->HandleCommandL( aCommand );
  1059         commandStatus = iCustomization->HandleCommandL( aCommand );
  1442         }
  1060         }
  1443 
       
  1444     return commandStatus;
  1061     return commandStatus;
  1445     }
  1062     }
  1446 
  1063 
  1447 // -----------------------------------------------------------------------------
  1064 // -----------------------------------------------------------------------------
  1448 // CPhoneState::ProcessCommandL
  1065 // CPhoneState::ProcessCommandL
  1464 EXPORT_C TBool CPhoneState::HandleRemConCommandL(
  1081 EXPORT_C TBool CPhoneState::HandleRemConCommandL(
  1465     TRemConCoreApiOperationId aOperationId,
  1082     TRemConCoreApiOperationId aOperationId,
  1466     TRemConCoreApiButtonAction /*aButtonAct*/ )
  1083     TRemConCoreApiButtonAction /*aButtonAct*/ )
  1467     {
  1084     {
  1468     TBool handled = EFalse;
  1085     TBool handled = EFalse;
  1469 
       
  1470     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::MrccatoCommand() ");
  1086     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::MrccatoCommand() ");
  1471     switch ( aOperationId )
  1087     switch ( aOperationId )
  1472         {
  1088         {
  1473         case ERemConCoreApiVolumeUp:
  1089         case ERemConCoreApiVolumeUp:
  1474             __PHONELOG( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand ERemConCoreApiVolumeUp" );
  1090             __PHONELOG( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand ERemConCoreApiVolumeUp" );
  1496          default:
  1112          default:
  1497              __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand MrccatoCmd.Other(%d)", aOperationId );
  1113              __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand MrccatoCmd.Other(%d)", aOperationId );
  1498             // Other commands ignored.
  1114             // Other commands ignored.
  1499             break;
  1115             break;
  1500         }
  1116         }
  1501 
       
  1502     return handled;
  1117     return handled;
  1503     }
  1118     }
  1504 
  1119 
  1505 // -----------------------------------------------------------
  1120 // -----------------------------------------------------------
  1506 // CPhoneState::DecreaseAudioVolume()
  1121 // CPhoneState::DecreaseAudioVolume()
  1507 // -----------------------------------------------------------
  1122 // -----------------------------------------------------------
  1508 //
  1123 //
  1509 EXPORT_C void CPhoneState::DecreaseAudioVolumeL()
  1124 EXPORT_C void CPhoneState::DecreaseAudioVolumeL()
  1510     {
  1125     {
  1511     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DecreaceAudioVolumeL( ) ");
  1126     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DecreaceAudioVolumeL( ) ");
  1512     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1127     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1513         Panic( EPhoneCtrlInvariant ) );
       
  1514 
       
  1515     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1128     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1516      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
  1129     __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
  1517     if( output == EPETTY )
  1130     if( output == EPETTY )
  1518         {
  1131         {
  1519         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1132         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1520         }
  1133         }
  1521     else
  1134     else
  1531 // -----------------------------------------------------------
  1144 // -----------------------------------------------------------
  1532 //
  1145 //
  1533 EXPORT_C void CPhoneState::IncreaseAudioVolumeL()
  1146 EXPORT_C void CPhoneState::IncreaseAudioVolumeL()
  1534     {
  1147     {
  1535      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IncreaceAudioVolumeL( ) ");
  1148      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IncreaceAudioVolumeL( ) ");
  1536     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1149     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1537         Panic( EPhoneCtrlInvariant ) );
       
  1538 
       
  1539     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1150     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1540      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
  1151      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
  1541     if( output == EPETTY )
  1152     if( output == EPETTY )
  1542         {
  1153         {
  1543         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1154         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1556 //
  1167 //
  1557 void CPhoneState::ChangeAudioVolumeL( TInt aLevel, TBool aUpdateControl )
  1168 void CPhoneState::ChangeAudioVolumeL( TInt aLevel, TBool aUpdateControl )
  1558     {
  1169     {
  1559      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ChangeAudioVolumeL( ) ");
  1170      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ChangeAudioVolumeL( ) ");
  1560      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::ChangeAudioVolumeL - set volume =%d", aLevel );
  1171      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::ChangeAudioVolumeL - set volume =%d", aLevel );
  1561 
       
  1562     TInt valueToControl = aLevel;
  1172     TInt valueToControl = aLevel;
  1563 
       
  1564     // sets value between 1 -10
  1173     // sets value between 1 -10
  1565     if ( aLevel>=KPhoneVolumeMinValue && aLevel<=KPhoneVolumeMaxValue )
  1174     if ( aLevel>=KPhoneVolumeMinValue && aLevel<=KPhoneVolumeMaxValue )
  1566         {
  1175         {
  1567         iStateMachine->PhoneEngineInfo()->SetAudioVolumeCommand( aLevel );
  1176         iStateMachine->PhoneEngineInfo()->SetAudioVolumeCommand( aLevel );
  1568         // Syncronizes audio volume level between engine and ui
  1177         // Syncronizes audio volume level between engine and ui
  1569         // causes EPEMessageAudioVolumeChanged message to phoneUI
  1178         // causes EPEMessageAudioVolumeChanged message to phoneUI
  1570         iStateMachine->SendPhoneEngineMessage(
  1179         iStateMachine->SendPhoneEngineMessage(
  1571             MPEPhoneModel::EPEMessageSetAudioVolume );
  1180             MPEPhoneModel::EPEMessageSetAudioVolume );
  1572         }
  1181         }
  1573         
  1182         
  1574     if ( aUpdateControl )        
  1183     if ( aUpdateControl )
  1575         {
  1184         {
  1576         // Update the volume display.
  1185         // Update the volume display.
  1577         // Upper max (11) and under min (-1)
  1186         // Upper max (11) and under min (-1)
  1578         // values are also updated to volume popup.
  1187         // values are also updated to volume popup.
  1579         TPhoneCmdParamInteger volumeParam;
  1188         TPhoneCmdParamInteger volumeParam;
  1583             &volumeParam );
  1192             &volumeParam );
  1584         }
  1193         }
  1585     }
  1194     }
  1586 
  1195 
  1587 // <-------------------------- COMMON STATE FUNCTIONS ------------------------>
  1196 // <-------------------------- COMMON STATE FUNCTIONS ------------------------>
  1588 
       
  1589 // -----------------------------------------------------------
  1197 // -----------------------------------------------------------
  1590 // CPhoneState::DialMultimediaCallL
  1198 // CPhoneState::DialMultimediaCallL
  1591 // -----------------------------------------------------------
  1199 // -----------------------------------------------------------
  1592 //
  1200 //
  1593 EXPORT_C void CPhoneState::DialMultimediaCallL()
  1201 EXPORT_C void CPhoneState::DialMultimediaCallL()
  1604 // -----------------------------------------------------------
  1212 // -----------------------------------------------------------
  1605 //
  1213 //
  1606 EXPORT_C void CPhoneState::DialVoiceCallL()
  1214 EXPORT_C void CPhoneState::DialVoiceCallL()
  1607     {
  1215     {
  1608     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DialVoiceCallL() ");
  1216     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DialVoiceCallL() ");
  1609     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1217     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1610         Panic( EPhoneCtrlInvariant ) );
       
  1611 
       
  1612     // Disable global notes
       
  1613     TPhoneCmdParamBoolean globalNotifierParam;
  1218     TPhoneCmdParamBoolean globalNotifierParam;
  1614     globalNotifierParam.SetBoolean( ETrue );
  1219     globalNotifierParam.SetBoolean( ETrue );
  1615     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1220     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1616             &globalNotifierParam );
  1221             &globalNotifierParam );
  1617    iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
  1222    iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
  1626     {
  1231     {
  1627     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisconnectCallL( ) ");
  1232     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisconnectCallL( ) ");
  1628     TPhoneCmdParamInteger callIdParam;
  1233     TPhoneCmdParamInteger callIdParam;
  1629     iViewCommandHandle->ExecuteCommandL( 
  1234     iViewCommandHandle->ExecuteCommandL( 
  1630             EPhoneViewGetExpandedBubbleCallId, &callIdParam );
  1235             EPhoneViewGetExpandedBubbleCallId, &callIdParam );
  1631 
       
  1632     TBool ret = EFalse;
  1236     TBool ret = EFalse;
  1633     if( callIdParam.Integer() > KErrNotFound )
  1237     if( callIdParam.Integer() > KErrNotFound )
  1634         {
  1238         {
  1635         // Release the call
       
  1636         iStateMachine->SetCallId( callIdParam.Integer() );
  1239         iStateMachine->SetCallId( callIdParam.Integer() );
  1637 
       
  1638         if( IsVideoCall( callIdParam.Integer() ) )
  1240         if( IsVideoCall( callIdParam.Integer() ) )
  1639             {
  1241             {
  1640             // Video call can be released only after we get response to VT Shutdown Command
  1242             // Video call can be released only after we get response to VT Shutdown Command
  1641             CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
  1243             CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
  1642                                                                                  KCatPhoneToVideotelCommands,
  1244                     KMediatorVideoTelephonyDomain,
  1643                                                                                  EVtCmdReleaseDataport,
  1245                              KCatPhoneToVideotelCommands,
  1644                                                                        TVersion( KPhoneToVideotelCmdVersionMajor,
  1246                              EVtCmdReleaseDataport,
  1645                                                                                  KPhoneToVideotelCmdVersionMinor,
  1247                    TVersion( KPhoneToVideotelCmdVersionMajor,
  1646                                                                                  KPhoneToVideotelCmdVersionBuild ),
  1248                              KPhoneToVideotelCmdVersionMinor,
  1647                                                                        KNullDesC8,
  1249                              KPhoneToVideotelCmdVersionBuild ),
  1648                                                                        CPhoneReleaseCommand::NewL( *iStateMachine ) );
  1250                    KNullDesC8,
       
  1251                    CPhoneReleaseCommand::NewL( *iStateMachine ) );
  1649             }
  1252             }
  1650         else
  1253         else
  1651             {
  1254             {
  1652             // Release the call
       
  1653             iStateMachine->SendPhoneEngineMessage(
  1255             iStateMachine->SendPhoneEngineMessage(
  1654                 MPEPhoneModel::EPEMessageRelease );
  1256                 MPEPhoneModel::EPEMessageRelease );
  1655             }
  1257             }
  1656         ret = ETrue;
  1258         ret = ETrue;
  1657         }
  1259         }
  1658     else
  1260     else
  1659         {
  1261         {
  1660         __PHONELOG( EOnlyFatal, EPhoneControl,
  1262         __PHONELOG( EOnlyFatal, EPhoneControl,
  1661             "CPhoneState::DisconnectCallL has negative call id!" );
  1263             "CPhoneState::DisconnectCallL has negative call id!" );
  1662         }
  1264         }
  1663 
       
  1664     return ret;
  1265     return ret;
  1665     }
  1266     }
  1666 
  1267 
  1667 // -----------------------------------------------------------
  1268 // -----------------------------------------------------------
  1668 // CPhoneState::DisplayIdleScreenL
  1269 // CPhoneState::DisplayIdleScreenL
  1670 //
  1271 //
  1671 EXPORT_C void CPhoneState::DisplayIdleScreenL()
  1272 EXPORT_C void CPhoneState::DisplayIdleScreenL()
  1672     {
  1273     {
  1673     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisplayIdleScreenL( ) ");
  1274     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisplayIdleScreenL( ) ");
  1674 
  1275 
  1675     // Don't remove reconnect query if it's shown
  1276      iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  1676     if( !CPhoneReconnectQuery::InstanceL()->IsDisplayingQuery() )
       
  1677         {
       
  1678         // Remove dialogs if necessary
       
  1679         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
       
  1680         }
       
  1681 
  1277 
  1682     // Set Empty CBA
  1278     // Set Empty CBA
  1683     iCbaManager->SetCbaL( EPhoneEmptyCBA );
  1279     iCbaManager->SetCbaL( EPhoneEmptyCBA );
  1684     // Bring Idle app to the foreground
  1280     // Bring Idle app to the foreground
  1685     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1281     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringIdleToForeground );
  1690 // -----------------------------------------------------------
  1286 // -----------------------------------------------------------
  1691 //
  1287 //
  1692 EXPORT_C void CPhoneState::SetupIdleScreenInBackgroundL()
  1288 EXPORT_C void CPhoneState::SetupIdleScreenInBackgroundL()
  1693     {
  1289     {
  1694     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetupIdleScreenInBackgroundL( ) ");
  1290     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetupIdleScreenInBackgroundL( ) ");
  1695     // Don't remove reconnect query if it's shown
  1291     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  1696     if( !CPhoneReconnectQuery::InstanceL()->IsDisplayingQuery() )
       
  1697         {
       
  1698         // Remove dialogs if necessary
       
  1699         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
       
  1700         }
       
  1701     // Return phone to the background
       
  1702     iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
  1292     iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
  1703 
       
  1704     // Set Idle app as the top app
       
  1705     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );
  1293     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetIdleTopApplication );
  1706 
       
  1707     // Set Empty CBA
       
  1708     iCbaManager->SetCbaL( EPhoneEmptyCBA );
  1294     iCbaManager->SetCbaL( EPhoneEmptyCBA );
  1709     }
  1295     }
  1710 
  1296 
  1711 // ---------------------------------------------------------
  1297 // ---------------------------------------------------------
  1712 // CPhoneState::CallFromNumberEntryL
  1298 // CPhoneState::CallFromNumberEntryL
  1713 // ---------------------------------------------------------
  1299 // ---------------------------------------------------------
  1714 //
  1300 //
  1715 EXPORT_C void CPhoneState::CallFromNumberEntryL()
  1301 EXPORT_C void CPhoneState::CallFromNumberEntryL()
  1716     {
  1302     {
  1717     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CallFromNumberEntryL( ) ");
  1303     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CallFromNumberEntryL( ) ");
  1718     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1304     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1719         Panic( EPhoneCtrlInvariant ) );
  1305     if ( IsCustomizedDialerVisibleL() )
  1720 
  1306         {
  1721     if ( IsOnScreenDialerSupported() )
  1307         return;
  1722         {
  1308         }
  1723         if ( IsCustomizedDialerVisibleL() )
  1309     else if( IsNumberEntryUsedL() )
       
  1310         {
       
  1311         // IS query on top of dialer
       
  1312         if ( IsAnyQueryActiveL() )
  1724             {
  1313             {
  1725             return;
  1314             return;
  1726             }
  1315             }
  1727 
  1316         // Open recent calls list when the number entry is empty
  1728         else if( IsNumberEntryUsedL() )
  1317         TPhoneCmdParamInteger numberEntryCountParam;
  1729             {
  1318         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1730             // Query on top of dialer
  1319         &numberEntryCountParam );
  1731             if ( IsAnyQueryActiveL() )
  1320         TInt neLength( numberEntryCountParam.Integer() );
  1732                 {
  1321         TBool startLogs = neLength == 0 ? ETrue : EFalse;
  1733                 return;
  1322 
  1734                 }
  1323         if ( startLogs )
  1735             // Open recent calls list when the number entry is empty
  1324             {
  1736             TPhoneCmdParamInteger numberEntryCountParam;
  1325             iViewCommandHandle->HandleCommandL(
  1737             iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
  1326             EPhoneDialerCmdLog );
  1738             &numberEntryCountParam );
  1327             return;
  1739             TInt neLength( numberEntryCountParam.Integer() );
  1328             }
  1740             TBool startLogs = neLength == 0 ? ETrue : EFalse;
  1329         }
  1741 
  1330 
  1742             if ( startLogs )
       
  1743                 {
       
  1744                 iViewCommandHandle->HandleCommandL(
       
  1745                 EPhoneDialerCmdLog );
       
  1746                 return;
       
  1747                 }
       
  1748             }
       
  1749         }
       
  1750 
       
  1751     // Get the number entry contents
       
  1752     HBufC* phoneNumber = PhoneNumberFromEntryLC();
  1331     HBufC* phoneNumber = PhoneNumberFromEntryLC();
  1753 
       
  1754     // Call the number
       
  1755     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1332     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( *phoneNumber );
  1756 
       
  1757     if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
  1333     if ( phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
  1758         {
  1334         {
  1759         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1335         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  1760 
       
  1761         HandleNumberEntryClearedL();
  1336         HandleNumberEntryClearedL();
  1762         }
  1337         }
  1763 
       
  1764     CleanupStack::PopAndDestroy( phoneNumber );
  1338     CleanupStack::PopAndDestroy( phoneNumber );
  1765 
  1339 
  1766     if ( !iCustomization ||
  1340     if ( !iCustomization ||
  1767          !iCustomization->HandleCallFromNumberEntryL() )
  1341          !iCustomization->HandleCallFromNumberEntryL() )
  1768         {
  1342         {
  1814 // -----------------------------------------------------------
  1388 // -----------------------------------------------------------
  1815 //
  1389 //
  1816 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
  1390 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
  1817     {
  1391     {
  1818     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateSingleActiveCallL( ) ");
  1392     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateSingleActiveCallL( ) ");
  1819 
       
  1820     // Stop capturing keys
       
  1821     CaptureKeysDuringCallNotificationL( EFalse );
       
  1822 
       
  1823     BeginUiUpdateLC();
  1393     BeginUiUpdateLC();
  1824 
       
  1825     // Update call state
       
  1826     TPhoneCmdParamCallHeaderData callHeaderParam;
  1394     TPhoneCmdParamCallHeaderData callHeaderParam;
  1827     callHeaderParam.SetCallState( EPEStateConnected );
  1395     callHeaderParam.SetCallState( EPEStateConnected );
  1828     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
  1396     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
  1829         &callHeaderParam );
  1397         &callHeaderParam );
  1830 
  1398     
  1831     // Update remote info data
       
  1832     UpdateRemoteInfoDataL( aCallId );
  1399     UpdateRemoteInfoDataL( aCallId );
  1833 
  1400 
  1834     // Create call duration label if enabled
  1401     // Create call duration label if enabled
  1835     // This key will be moved to some other area, but since key
  1402     // This key will be moved to some other area, but since key
  1836     // is supported we can still use it.
  1403     // is supported we can still use it.
  1840 
  1407 
  1841     if ( callDuration )
  1408     if ( callDuration )
  1842         {
  1409         {
  1843         HandleChangedCallDurationL( aCallId );
  1410         HandleChangedCallDurationL( aCallId );
  1844         }
  1411         }
  1845 
       
  1846     EndUiUpdate();
  1412     EndUiUpdate();
  1847 
  1413 
  1848      // Go to current state implementation
       
  1849     iCbaManager->UpdateInCallCbaL();
  1414     iCbaManager->UpdateInCallCbaL();
  1850 
       
  1851     // Go to background if necessary
       
  1852     if ( NeedToSendToBackgroundL() ||  IsAutoLockOn() )
       
  1853         {
       
  1854         }
       
  1855     // If there is no need to send back ground and number entry is used then
  1415     // If there is no need to send back ground and number entry is used then
  1856     // we must show number entry.
  1416     // we must show number entry.
  1857     else if ( !NeedToSendToBackgroundL() && IsNumberEntryUsedL() )
  1417     if ( !NeedToSendToBackgroundL() && IsNumberEntryUsedL() && !IsAutoLockOn() )
  1858         {
  1418         {
  1859         SetNumberEntryVisibilityL(ETrue);
  1419         SetNumberEntryVisibilityL(ETrue);
  1860         }
  1420         }
  1861     }
       
  1862 
       
  1863 // -----------------------------------------------------------
       
  1864 // CPhoneState::CaptureKeysDuringCallNotificationL
       
  1865 // -----------------------------------------------------------
       
  1866 //
       
  1867 EXPORT_C void CPhoneState::CaptureKeysDuringCallNotificationL(
       
  1868     TBool /*aCaptured*/ )
       
  1869     {
       
  1870     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CaptureKeysDuringCallNotificationL( ) ");
       
  1871     // Determine which view command to execute based on the capture status
       
  1872     /*const TInt viewCommandId = aCaptured ?
       
  1873         EPhoneViewStartCapturingKey :
       
  1874         EPhoneViewStopCapturingKey;
       
  1875 
       
  1876     // Capture the App key
       
  1877     TPhoneCmdParamKeyCapture appKeyCaptureParam;
       
  1878     appKeyCaptureParam.SetKey( EStdKeyApplication0 );
       
  1879     appKeyCaptureParam.SetKeyCode( EKeyApplication0 );
       
  1880     appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
  1881     iViewCommandHandle->ExecuteCommandL( viewCommandId, &appKeyCaptureParam );
       
  1882 
       
  1883     // Capture the Camera key, if it exists
       
  1884     if ( FeatureManager::FeatureSupported( KFeatureIdCamera ) )
       
  1885         {
       
  1886         TPhoneCmdParamKeyCapture cameraKeyCaptureParam;
       
  1887         cameraKeyCaptureParam.SetKey( EStdKeyDevice7 );
       
  1888         cameraKeyCaptureParam.SetKeyCode( EKeyDevice7 );
       
  1889         cameraKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
  1890         iViewCommandHandle->ExecuteCommandL( viewCommandId,
       
  1891             &cameraKeyCaptureParam );
       
  1892         }*/
       
  1893     }
  1421     }
  1894 
  1422 
  1895 // -----------------------------------------------------------
  1423 // -----------------------------------------------------------
  1896 // CPhoneState::IsWaitingCallL
  1424 // CPhoneState::IsWaitingCallL
  1897 // -----------------------------------------------------------
  1425 // -----------------------------------------------------------
  1918 //
  1446 //
  1919 EXPORT_C void CPhoneState::UpdateRemoteInfoDataL( TInt aCallId )
  1447 EXPORT_C void CPhoneState::UpdateRemoteInfoDataL( TInt aCallId )
  1920     {
  1448     {
  1921     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::UpdateRemoteInfoDataL() ");
  1449     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::UpdateRemoteInfoDataL() ");
  1922     TPhoneCmdParamCallHeaderData callHeaderParam = UpdateCallHeaderInfoL( aCallId );
  1450     TPhoneCmdParamCallHeaderData callHeaderParam = UpdateCallHeaderInfoL( aCallId );
  1923 
       
  1924     if( iCustomization )
  1451     if( iCustomization )
  1925         {
  1452         {
  1926         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
  1453         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
  1927 
       
  1928         // to check if we have VoIP call in question and fix
  1454         // to check if we have VoIP call in question and fix
  1929         // parameters if needed
  1455         // parameters if needed
  1930         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
  1456         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
  1931             inCallNumberText );
  1457             inCallNumberText );
  1932         }
  1458         }
  1933 
       
  1934 
       
  1935     // Update the remote info data in the call header
  1459     // Update the remote info data in the call header
  1936     iViewCommandHandle->ExecuteCommandL(
  1460     iViewCommandHandle->ExecuteCommandL(
  1937         EPhoneViewUpdateCallHeaderRemoteInfoData,
  1461         EPhoneViewUpdateCallHeaderRemoteInfoData,
  1938         aCallId,
  1462         aCallId,
  1939         &callHeaderParam );
  1463         &callHeaderParam );
  1967 // -----------------------------------------------------------
  1491 // -----------------------------------------------------------
  1968 //
  1492 //
  1969 void CPhoneState::UpdateCbaSwivelStateChangedL()
  1493 void CPhoneState::UpdateCbaSwivelStateChangedL()
  1970     {
  1494     {
  1971     __LOGMETHODSTARTEND(EPhoneControl,"CPhoneState::UpdateCbaSwivelStateChangedL()" );
  1495     __LOGMETHODSTARTEND(EPhoneControl,"CPhoneState::UpdateCbaSwivelStateChangedL()" );
  1972 
       
  1973     TPhoneCmdParamCallStateData callStateData;
  1496     TPhoneCmdParamCallStateData callStateData;
  1974     callStateData.SetCallState( EPEStateRinging );
  1497     callStateData.SetCallState( EPEStateRinging );
  1975     iViewCommandHandle->HandleCommandL(
  1498     iViewCommandHandle->HandleCommandL(
  1976         EPhoneViewGetCallIdByState, &callStateData );
  1499         EPhoneViewGetCallIdByState, &callStateData );
  1977     TInt incomingCall = callStateData.CallId();
  1500     TInt incomingCall = callStateData.CallId();
  2030     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1553     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2031     TPhoneCmdParamNote noteParam;
  1554     TPhoneCmdParamNote noteParam;
  2032     noteParam.SetType( EPhoneNotePermanent );
  1555     noteParam.SetType( EPhoneNotePermanent );
  2033     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  1556     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2034         ResolveResourceID( aResourceId ) );
  1557         ResolveResourceID( aResourceId ) );
  2035 
       
  2036     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  1558     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  2037     }
  1559     }
  2038 
  1560 
  2039 // -----------------------------------------------------------
  1561 // -----------------------------------------------------------
  2040 // CPhoneState::ShowQueryL
  1562 // CPhoneState::ShowQueryL
  2046     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1568     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2047     TPhoneCmdParamQuery queryParam;
  1569     TPhoneCmdParamQuery queryParam;
  2048     queryParam.SetQueryType( EPhoneQueryDialog );
  1570     queryParam.SetQueryType( EPhoneQueryDialog );
  2049     queryParam.SetQueryResourceId( CPhoneMainResourceResolver::Instance()->
  1571     queryParam.SetQueryResourceId( CPhoneMainResourceResolver::Instance()->
  2050         ResolveResourceID( aResourceId ) );
  1572         ResolveResourceID( aResourceId ) );
  2051 
       
  2052     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParam );
  1573     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParam );
  2053     }
  1574     }
  2054 
  1575 
  2055 // -----------------------------------------------------------
  1576 // -----------------------------------------------------------
  2056 // CPhoneState::ShowTextQueryL
  1577 // CPhoneState::ShowTextQueryL
  2073     queryDialogParam.SetQueryResourceId( aDialogResourceId );
  1594     queryDialogParam.SetQueryResourceId( aDialogResourceId );
  2074     queryDialogParam.SetDefaultCba( aDefaultCbaResourceId );
  1595     queryDialogParam.SetDefaultCba( aDefaultCbaResourceId );
  2075     queryDialogParam.SetContentCba( aContentCbaResourceId );
  1596     queryDialogParam.SetContentCba( aContentCbaResourceId );
  2076     queryDialogParam.SetDataText( aDataText );
  1597     queryDialogParam.SetDataText( aDataText );
  2077     queryDialogParam.SetSendKeyEnabled( aSendKeyEnabled );
  1598     queryDialogParam.SetSendKeyEnabled( aSendKeyEnabled );
  2078 
       
  2079     // Display dialog
       
  2080     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery,
  1599     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery,
  2081         &queryDialogParam );
  1600         &queryDialogParam );
  2082     }
  1601     }
  2083 
  1602 
  2084 // -----------------------------------------------------------
  1603 // -----------------------------------------------------------
  2142     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  1661     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  2143     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1662     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2144     if ( CPhonePubSubProxy::Instance()->Value(
  1663     if ( CPhonePubSubProxy::Instance()->Value(
  2145             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  1664             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2146         {
  1665         {
  2147         // Re-enable global notes
       
  2148         TPhoneCmdParamBoolean globalNotifierParam;
  1666         TPhoneCmdParamBoolean globalNotifierParam;
  2149         globalNotifierParam.SetBoolean( EFalse );
  1667         globalNotifierParam.SetBoolean( EFalse );
  2150         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1668         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2151             &globalNotifierParam );
  1669             &globalNotifierParam );
  2152 
  1670 
  2155             EPhoneNotificationDialog : EPhoneMessageBoxInformation;
  1673             EPhoneNotificationDialog : EPhoneMessageBoxInformation;
  2156         globalNoteParam.SetType( type );
  1674         globalNoteParam.SetType( type );
  2157         globalNoteParam.SetTextResourceId(
  1675         globalNoteParam.SetTextResourceId(
  2158             CPhoneMainResourceResolver::Instance()->
  1676             CPhoneMainResourceResolver::Instance()->
  2159             ResolveResourceID( aResourceId ) );
  1677             ResolveResourceID( aResourceId ) );
  2160 
       
  2161         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  1678         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2162         
  1679         
  2163         iViewCommandHandle->ExecuteCommandL(
  1680         iViewCommandHandle->ExecuteCommandL(
  2164             EPhoneViewShowGlobalNote, &globalNoteParam );
  1681             EPhoneViewShowGlobalNote, &globalNoteParam );
  2165         }
  1682         }
  2176     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1693     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2177     if ( CPhonePubSubProxy::Instance()->Value(
  1694     if ( CPhonePubSubProxy::Instance()->Value(
  2178             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 ||
  1695             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 ||
  2179             SimState() == EPESimReadable )
  1696             SimState() == EPESimReadable )
  2180         {
  1697         {
  2181         // Re-enable global notes
       
  2182         TPhoneCmdParamBoolean globalNotifierParam;
  1698         TPhoneCmdParamBoolean globalNotifierParam;
  2183         globalNotifierParam.SetBoolean( EFalse );
  1699         globalNotifierParam.SetBoolean( EFalse );
  2184         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1700         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2185             &globalNotifierParam );
  1701             &globalNotifierParam );
  2186 
  1702 
  2189                     EPhoneNotificationDialog : EPhoneMessageBoxWarning;
  1705                     EPhoneNotificationDialog : EPhoneMessageBoxWarning;
  2190         globalNoteParam.SetType( type );
  1706         globalNoteParam.SetType( type );
  2191         globalNoteParam.SetTextResourceId(
  1707         globalNoteParam.SetTextResourceId(
  2192             CPhoneMainResourceResolver::Instance()->
  1708             CPhoneMainResourceResolver::Instance()->
  2193             ResolveResourceID( aResourceId ) );
  1709             ResolveResourceID( aResourceId ) );
  2194   
       
  2195         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  1710         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2196         
  1711         
  2197         iViewCommandHandle->ExecuteCommandL(
  1712         iViewCommandHandle->ExecuteCommandL(
  2198             EPhoneViewShowGlobalNote, &globalNoteParam );
  1713             EPhoneViewShowGlobalNote, &globalNoteParam );
  2199         }
  1714         }
  2209     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  1724     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  2210     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1725     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2211     if ( CPhonePubSubProxy::Instance()->Value(
  1726     if ( CPhonePubSubProxy::Instance()->Value(
  2212             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  1727             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2213         {
  1728         {
  2214         // Re-enable global notes
       
  2215         TPhoneCmdParamBoolean globalNotifierParam;
  1729         TPhoneCmdParamBoolean globalNotifierParam;
  2216         globalNotifierParam.SetBoolean( EFalse );
  1730         globalNotifierParam.SetBoolean( EFalse );
  2217         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1731         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2218             &globalNotifierParam );
  1732             &globalNotifierParam );
  2219 
  1733 
  2263         }
  1777         }
  2264     CleanupStack::PopAndDestroy( bt );
  1778     CleanupStack::PopAndDestroy( bt );
  2265     }
  1779     }
  2266 
  1780 
  2267 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  1781 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  2268 
       
  2269 // -----------------------------------------------------------
       
  2270 // CPhoneState::UpdateProfileDisplayL
       
  2271 // -----------------------------------------------------------
       
  2272 //
       
  2273 void CPhoneState::UpdateProfileDisplayL()
       
  2274     {
       
  2275     }
       
  2276 
       
  2277 
       
  2278 // -----------------------------------------------------------
  1782 // -----------------------------------------------------------
  2279 // CPhoneState::HandleInitiatedEmergencyCallL
  1783 // CPhoneState::HandleInitiatedEmergencyCallL
  2280 // Default handling for EPEMessageInitiatedEmergencyCallL message
  1784 // Default handling for EPEMessageInitiatedEmergencyCallL message
  2281 // (other items were commented in a header).
  1785 // (other items were commented in a header).
  2282 // -----------------------------------------------------------
  1786 // -----------------------------------------------------------
  2283 //
  1787 //
  2284 void CPhoneState::HandleInitiatedEmergencyCallL( TInt /*aCallId*/ )
  1788 void CPhoneState::HandleInitiatedEmergencyCallL( TInt /*aCallId*/ )
  2285     {
  1789     {
  2286     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyCallL( ) ");
  1790     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyCallL( ) ");
  2287 
       
  2288     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  1791     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
  2289 
       
  2290     // Stop tone playing, if necessary
       
  2291     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
  1792     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
  2292 
  1793 
  2293     // Reset Hold flag to view
  1794     // Reset Hold flag to view
  2294     TPhoneCmdParamBoolean holdFlag;
  1795     TPhoneCmdParamBoolean holdFlag;
  2295     holdFlag.SetBoolean( EFalse );
  1796     holdFlag.SetBoolean( EFalse );
  2296     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  1797     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  2297 
  1798     
  2298     // Go to emergency call state
       
  2299     // No need update cba
       
  2300     iStateMachine->ChangeState( EPhoneStateEmergency );
  1799     iStateMachine->ChangeState( EPhoneStateEmergency );
  2301     }
  1800     }
  2302 
  1801 
  2303 // -----------------------------------------------------------
  1802 // -----------------------------------------------------------
  2304 // CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL
  1803 // CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL
  2305 // -----------------------------------------------------------
  1804 // -----------------------------------------------------------
  2306 //
  1805 //
  2307 void CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL()
  1806 void CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL()
  2308     {
  1807     {
  2309     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL( ) ");
  1808     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL( ) ");
  2310 
  1809     // We have existing video call so need to release dataport before continuings
  2311     // We have existing video call so need to release dataport before continuing
       
  2312     // emergency call. Otherwise we will face problems with dataport use later.
  1810     // emergency call. Otherwise we will face problems with dataport use later.
  2313     CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
  1811     CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
  2314                                                                      KCatPhoneToVideotelCommands,
  1812             KMediatorVideoTelephonyDomain,
  2315                                                                      EVtCmdReleaseDataport,
  1813             KCatPhoneToVideotelCommands,
  2316                                                                TVersion( KPhoneToVideotelCmdVersionMajor,
  1814             EVtCmdReleaseDataport,
  2317                                                                          KPhoneToVideotelCmdVersionMinor,
  1815             TVersion( KPhoneToVideotelCmdVersionMajor,
  2318                                                                          KPhoneToVideotelCmdVersionBuild ),
  1816                     KPhoneToVideotelCmdVersionMinor,
  2319                                                                KNullDesC8,
  1817                     KPhoneToVideotelCmdVersionBuild ),
  2320                                                                CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  1818             KNullDesC8,
       
  1819             CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  2321     }
  1820     }
  2322 
  1821 
  2323 // -----------------------------------------------------------
  1822 // -----------------------------------------------------------
  2324 // CPhoneState::HandleCallSecureStatusChangeL
  1823 // CPhoneState::HandleCallSecureStatusChangeL
  2325 // -----------------------------------------------------------
  1824 // -----------------------------------------------------------
  2326 //
  1825 //
  2327 void CPhoneState::HandleCallSecureStatusChangeL( TInt aCallId )
  1826 void CPhoneState::HandleCallSecureStatusChangeL( TInt aCallId )
  2328     {
  1827     {
  2329     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCallSecureStatusChangeL( ) ");
  1828     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCallSecureStatusChangeL( ) ");
  2330 
       
  2331     TBool ciphering( ETrue );
  1829     TBool ciphering( ETrue );
  2332     TBool secureSpecified( ETrue );
  1830     TBool secureSpecified( ETrue );
  2333 
       
  2334     if ( aCallId > KErrNotFound )
  1831     if ( aCallId > KErrNotFound )
  2335         {
  1832         {
  2336         ciphering = iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId );
  1833         ciphering = iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId );
  2337         secureSpecified = iStateMachine->PhoneEngineInfo()->SecureSpecified();
  1834         secureSpecified = iStateMachine->PhoneEngineInfo()->SecureSpecified();
  2338         }
  1835         }
  2339 
       
  2340     TPhoneCmdParamCallHeaderData callHeaderParam;
  1836     TPhoneCmdParamCallHeaderData callHeaderParam;
  2341 
       
  2342     callHeaderParam.SetCiphering( ciphering );
  1837     callHeaderParam.SetCiphering( ciphering );
  2343     callHeaderParam.SetCipheringIndicatorAllowed( secureSpecified );
  1838     callHeaderParam.SetCipheringIndicatorAllowed( secureSpecified );
  2344 
       
  2345     iViewCommandHandle->ExecuteCommandL(
  1839     iViewCommandHandle->ExecuteCommandL(
  2346         EPhoneViewCipheringInfoChange,
  1840         EPhoneViewCipheringInfoChange,
  2347         aCallId,
  1841         aCallId,
  2348         &callHeaderParam );
  1842         &callHeaderParam );
  2349     }
  1843     }
  2368 // ---------------------------------------------------------
  1862 // ---------------------------------------------------------
  2369 //
  1863 //
  2370 void CPhoneState::ChangeAlsLineL()
  1864 void CPhoneState::ChangeAlsLineL()
  2371     {
  1865     {
  2372     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ChangeAlsLineL( ) ");
  1866     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ChangeAlsLineL( ) ");
  2373 
       
  2374     if ( !IsOnScreenDialerSupported() )
       
  2375         {
       
  2376         // Do state-specific operation when number entry is cleared
       
  2377         HandleNumberEntryClearedL();
       
  2378         }
       
  2379 
       
  2380     CCCECallParameters::TCCELineType currentLine;
  1867     CCCECallParameters::TCCELineType currentLine;
  2381     TSSSettingsAlsValue newLine( ESSSettingsAlsPrimary );
  1868     TSSSettingsAlsValue newLine( ESSSettingsAlsPrimary );
  2382 
       
  2383     currentLine = iStateMachine->PhoneEngineInfo()->ALSLine();
  1869     currentLine = iStateMachine->PhoneEngineInfo()->ALSLine();
  2384 
       
  2385     if ( currentLine == CCCECallParameters::ECCELineTypePrimary )
  1870     if ( currentLine == CCCECallParameters::ECCELineTypePrimary )
  2386         {
  1871         {
  2387         newLine = ESSSettingsAlsAlternate;
  1872         newLine = ESSSettingsAlsAlternate;
  2388         }
  1873         }
  2389     else if ( currentLine == CCCECallParameters::ECCELineTypeAux )
  1874     else if ( currentLine == CCCECallParameters::ECCELineTypeAux )
  2409 // ---------------------------------------------------------
  1894 // ---------------------------------------------------------
  2410 //
  1895 //
  2411 TInt CPhoneState::GetActiveCallIdL()
  1896 TInt CPhoneState::GetActiveCallIdL()
  2412     {
  1897     {
  2413     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::GetActiveCallId()( ) ");
  1898     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::GetActiveCallId()( ) ");
  2414 
       
  2415     // Fetch active call's id from view
  1899     // Fetch active call's id from view
  2416     TPhoneViewResponseId response;
  1900     TPhoneViewResponseId response;
  2417     TPhoneCmdParamCallStateData callStateData;
  1901     TPhoneCmdParamCallStateData callStateData;
  2418     callStateData.SetCallState( EPEStateConnected );
  1902     callStateData.SetCallState( EPEStateConnected );
  2419     response = iViewCommandHandle->HandleCommandL(
  1903     response = iViewCommandHandle->HandleCommandL(
  2425         // check for held call
  1909         // check for held call
  2426         callStateData.SetCallState( EPEStateHeld );
  1910         callStateData.SetCallState( EPEStateHeld );
  2427         response = iViewCommandHandle->HandleCommandL(
  1911         response = iViewCommandHandle->HandleCommandL(
  2428             EPhoneViewGetCallIdByState, &callStateData );
  1912             EPhoneViewGetCallIdByState, &callStateData );
  2429         }
  1913         }
  2430 
       
  2431     return callStateData.CallId();
  1914     return callStateData.CallId();
  2432     }
  1915     }
  2433 
  1916 
  2434 // ---------------------------------------------------------
  1917 // ---------------------------------------------------------
  2435 // CPhoneState::SimState()
  1918 // CPhoneState::SimState()
  2436 // ---------------------------------------------------------
  1919 // ---------------------------------------------------------
  2437 //
  1920 //
  2438 EXPORT_C TPESimState CPhoneState::SimState() const
  1921 EXPORT_C TPESimState CPhoneState::SimState() const
  2439     {
  1922     {
  2440 
       
  2441     /*
  1923     /*
  2442     SIM states:
  1924     SIM states:
  2443 
       
  2444     EPESimStatusUninitialized = KPEStartupEnumerationFirstValue =100,
  1925     EPESimStatusUninitialized = KPEStartupEnumerationFirstValue =100,
  2445     EPESimUsable,       // The Sim card is fully usable.
  1926     EPESimUsable,       // The Sim card is fully usable.
  2446     EPESimReadable,     // The SIM card is not fully usable, but the emergency number can be read.
  1927     EPESimReadable,     // The SIM card is not fully usable, but the emergency number can be read.
  2447     EPESimNotReady,     // The Sim card is present but not ready or usable.
  1928     EPESimNotReady,     // The Sim card is present but not ready or usable.
  2448     EPESimNotPresent,   // The Sim card is not present.
  1929     EPESimNotPresent,   // The Sim card is not present.
  2450     */
  1931     */
  2451     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SimState()");
  1932     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SimState()");
  2452     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  1933     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  2453         Panic( EPhoneCtrlInvariant ) );
  1934         Panic( EPhoneCtrlInvariant ) );
  2454     TPESimState simState = iStateMachine->PhoneEngineInfo()->SimState();
  1935     TPESimState simState = iStateMachine->PhoneEngineInfo()->SimState();
  2455 
       
  2456     __PHONELOG1( EBasic, EPhoneControl,
  1936     __PHONELOG1( EBasic, EPhoneControl,
  2457             "CPhoneState::SimState - value= %d", simState );
  1937             "CPhoneState::SimState - value= %d", simState );
  2458     return simState;
  1938     return simState;
  2459     }
  1939     }
  2460 
  1940 
  2462 // CPhoneState::IsSimOk()
  1942 // CPhoneState::IsSimOk()
  2463 // ---------------------------------------------------------
  1943 // ---------------------------------------------------------
  2464 //
  1944 //
  2465 EXPORT_C TBool CPhoneState::IsSimOk()
  1945 EXPORT_C TBool CPhoneState::IsSimOk()
  2466     {
  1946     {
  2467 
       
  2468     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsSimOk()");
  1947     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsSimOk()");
  2469     // Phone is interested on Sim state and sim security statuses
  1948     // Phone is interested on Sim state and sim security statuses
  2470     // Check first Sim state status:
  1949     // Check first Sim state status:
  2471     TBool retVal( ETrue );
  1950     TBool retVal( ETrue );
  2472     switch ( SimState() )
  1951     switch ( SimState() )
  2512 // -----------------------------------------------------------
  1991 // -----------------------------------------------------------
  2513 //
  1992 //
  2514 EXPORT_C TBool CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled()
  1993 EXPORT_C TBool CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled()
  2515     {
  1994     {
  2516     TPhoneCmdParamBoolean isSecurityMode;
  1995     TPhoneCmdParamBoolean isSecurityMode;
       
  1996     TBool retValue(EFalse);
  2517     TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ) );
  1997     TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode ) );
  2518     if ( SimState() == EPESimNotPresent && isSecurityMode.Boolean() )
  1998     if ( SimState() == EPESimNotPresent && isSecurityMode.Boolean() )
  2519         {
  1999         {
  2520         return ETrue;
  2000         retValue = ETrue;
  2521         }
  2001         }
  2522     else
  2002     return retValue;
  2523         {
       
  2524         return EFalse;
       
  2525         }
       
  2526     }
  2003     }
  2527 
  2004 
  2528 // ---------------------------------------------------------
  2005 // ---------------------------------------------------------
  2529 // CPhoneState::SetDivertIndication
  2006 // CPhoneState::SetDivertIndication
  2530 // ---------------------------------------------------------
  2007 // ---------------------------------------------------------
  2531 //
  2008 //
  2532 EXPORT_C void CPhoneState::SetDivertIndication( const TBool aDivertIndication )
  2009 EXPORT_C void CPhoneState::SetDivertIndication( const TBool aDivertIndication )
  2533     {
  2010     {
  2534     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetDivertIndication()");
  2011     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetDivertIndication()");
  2535     TRAP_IGNORE( CallheaderManagerL()->SetDivertIndication( aDivertIndication ) );
  2012     TRAP_IGNORE( CallheaderManagerL()->SetDivertIndication( aDivertIndication ) );
  2536     }
       
  2537 
       
  2538 // ---------------------------------------------------------
       
  2539 // CPhoneState::StartAlsLineChangeTimerL
       
  2540 // ---------------------------------------------------------
       
  2541 //
       
  2542 EXPORT_C void CPhoneState::StartAlsLineChangeTimerL()
       
  2543     {
       
  2544     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::StartAlsLineChangeTimerL()");
       
  2545     TBool alsLineAvailable = iStateMachine->PhoneEngineInfo()->ALSLineSupport();
       
  2546 
       
  2547     if( alsLineAvailable )
       
  2548         {
       
  2549         if( !iAlsLineChangeKeyPressTimer )
       
  2550             {
       
  2551             iAlsLineChangeKeyPressTimer = CPhoneTimer::NewL();
       
  2552             }
       
  2553 
       
  2554         iAlsLineChangeKeyPressTimer->After( KAlsLineChangeTimerValue,
       
  2555             TCallBack( AlsLineChangeTimerCallbackL, this ) );
       
  2556         }
       
  2557     else
       
  2558         {
       
  2559          // Don't bother launching the timer. ALS not supported.
       
  2560         __PHONELOG( EBasic, EPhoneControl,
       
  2561             "CPhoneState::StartAlsLineChangeTimerL - ALS not supported " );
       
  2562         }
       
  2563     }
  2013     }
  2564 
  2014 
  2565 // -----------------------------------------------------------------------------
  2015 // -----------------------------------------------------------------------------
  2566 // CPhoneState::StartShowSecurityNoteL
  2016 // CPhoneState::StartShowSecurityNoteL
  2567 // -----------------------------------------------------------------------------
  2017 // -----------------------------------------------------------------------------
  2568 //
  2018 //
  2569 EXPORT_C void CPhoneState::StartShowSecurityNoteL()
  2019 EXPORT_C void CPhoneState::StartShowSecurityNoteL()
  2570     {
  2020     {
  2571     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::StartShowSecurityNoteL ");
  2021     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::StartShowSecurityNoteL ");
  2572 
       
  2573     // Set security mode on.
       
  2574     TPhoneCmdParamBoolean securityMode;
  2022     TPhoneCmdParamBoolean securityMode;
  2575     securityMode.SetBoolean( ETrue );
  2023     securityMode.SetBoolean( ETrue );
  2576     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
  2024     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
  2577 
       
  2578     // Remove number entry from screen
       
  2579     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
  2025     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  2026     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
  2580     
  2027     
  2581     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
  2582 
       
  2583     TPhoneCmdParamInteger uidParam;
  2028     TPhoneCmdParamInteger uidParam;
  2584     // Bring Phone app in the foreground
       
  2585     uidParam.SetInteger( KUidPhoneApplication.iUid );
  2029     uidParam.SetInteger( KUidPhoneApplication.iUid );
  2586     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
  2030     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
  2587         &uidParam );
  2031         &uidParam );
  2588 
       
  2589     // Set Phone as the top application
       
  2590     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
  2032     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
  2591         &uidParam );
  2033         &uidParam );
  2592 
  2034 
  2593     TInt resourceId ( KErrNone );
  2035     TInt resourceId ( KErrNone );
  2594 
       
  2595     if ( SimSecurityStatus() == ESimRejected )
  2036     if ( SimSecurityStatus() == ESimRejected )
  2596         {
  2037         {
  2597         resourceId = CPhoneMainResourceResolver::Instance()->
  2038         resourceId = CPhoneMainResourceResolver::Instance()->
  2598             ResolveResourceID( EPhoneSimRejected );
  2039             ResolveResourceID( EPhoneSimRejected );
  2599         }
  2040         }
  2611 
  2052 
  2612     if ( resourceId != KErrNone )
  2053     if ( resourceId != KErrNone )
  2613         {
  2054         {
  2614         // Add it to the resource string
  2055         // Add it to the resource string
  2615         HBufC* buf = StringLoader::LoadLC( resourceId );
  2056         HBufC* buf = StringLoader::LoadLC( resourceId );
  2616 
       
  2617         TPhoneCmdParamNote noteParam;
  2057         TPhoneCmdParamNote noteParam;
  2618 
       
  2619         noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2058         noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2620            ResolveResourceID( EPhoneSecurityInformationNote ) );
  2059            ResolveResourceID( EPhoneSecurityInformationNote ) );
  2621 
       
  2622         noteParam.SetText( *buf );
  2060         noteParam.SetText( *buf );
  2623         noteParam.SetTone( CAknNoteDialog::EConfirmationTone );
  2061         noteParam.SetTone( CAknNoteDialog::EConfirmationTone );
  2624         noteParam.SetType( EPhoneNoteSecurity );
  2062         noteParam.SetType( EPhoneNoteSecurity );
  2625         // Display note
  2063         // Display note
  2626         iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  2064         iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  2627 
       
  2628         CleanupStack::PopAndDestroy( buf );
  2065         CleanupStack::PopAndDestroy( buf );
  2629            
       
  2630            
       
  2631         // Capture the App key
  2066         // Capture the App key
  2632         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2067         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2633         appKeyCaptureParam.SetKey( EStdKeyApplication0 );
  2068         appKeyCaptureParam.SetKey( EStdKeyApplication0 );
  2634         appKeyCaptureParam.SetKeyCode( EKeyApplication0 );
  2069         appKeyCaptureParam.SetKeyCode( EKeyApplication0 );
  2635         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  2070         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  2637                EPhoneViewStartCapturingKey, &appKeyCaptureParam );
  2072                EPhoneViewStartCapturingKey, &appKeyCaptureParam );
  2638         }
  2073         }
  2639     }
  2074     }
  2640 
  2075 
  2641 // ---------------------------------------------------------
  2076 // ---------------------------------------------------------
  2642 // CPhoneState::AlsLineChangeTimerCallbackL
       
  2643 // ---------------------------------------------------------
       
  2644 //
       
  2645 TInt CPhoneState::AlsLineChangeTimerCallbackL( TAny* aAny )
       
  2646     {
       
  2647     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::AlsLineChangeTimerCallbackL()");
       
  2648 
       
  2649     // Send a key up event for stopping keypad tone
       
  2650     reinterpret_cast<CPhoneState*>( aAny )->
       
  2651         iStateMachine->SendPhoneEngineMessage(
       
  2652         MPEPhoneModel::EPEMessageEndDTMF );
       
  2653 
       
  2654     if ( !( reinterpret_cast<CPhoneState*>( aAny )->
       
  2655             IsOnScreenDialerSupported() ) )
       
  2656         {
       
  2657         // If dialer is undefined remove the number entry.
       
  2658         reinterpret_cast<CPhoneState*>( aAny )->
       
  2659             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  2660         }
       
  2661     else
       
  2662         {
       
  2663         // If on screen dialer is in use just clear entry
       
  2664         // do not remove dialer.
       
  2665         reinterpret_cast<CPhoneState*>( aAny )->
       
  2666             NumberEntryClearL();
       
  2667         }
       
  2668 
       
  2669     // Show the als line changing confirmation query
       
  2670     reinterpret_cast<CPhoneState*>( aAny )->
       
  2671         ShowQueryL( EPhoneAlsLineChangeConfirmationQuery );
       
  2672 
       
  2673     return KErrNone;
       
  2674     }
       
  2675 
       
  2676 // ---------------------------------------------------------
       
  2677 // CPhoneState::ShowWlanMacAddressL
  2077 // CPhoneState::ShowWlanMacAddressL
  2678 // ---------------------------------------------------------
  2078 // ---------------------------------------------------------
  2679 //
  2079 //
  2680 void CPhoneState::ShowWlanMacAddressL()
  2080 void CPhoneState::ShowWlanMacAddressL()
  2681     {
  2081     {
  2682     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::ShowWlanMacAddressL()");
  2082     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::ShowWlanMacAddressL()");
  2683     if ( IsOnScreenDialerSupported() )
  2083     NumberEntryClearL();
  2684         {
       
  2685         NumberEntryClearL();
       
  2686         }
       
  2687     else
       
  2688         {
       
  2689         // Remove number entry from screen
       
  2690         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  2691         }
       
  2692 
       
  2693     // Fetch WLAN MAC address
  2084     // Fetch WLAN MAC address
  2694     TBuf8<KPhoneWlanMacAddressLength> address;
  2085     TBuf8<KPhoneWlanMacAddressLength> address;
  2695     RProperty::Get(
  2086     RProperty::Get(
  2696         KPSUidWlan,
  2087         KPSUidWlan,
  2697         KPSWlanMacAddress,
  2088         KPSWlanMacAddress,
  2698         address );
  2089         address );
  2699 
       
  2700     // Format fetched address
  2090     // Format fetched address
  2701     TBuf<KPhoneWlanMacAddressLength> wlanMACAddress;
  2091     TBuf<KPhoneWlanMacAddressLength> wlanMACAddress;
  2702     for ( TInt i( 0 ); i < address.Length(); i++ )
  2092     for ( TInt i( 0 ); i < address.Length(); i++ )
  2703         {
  2093         {
  2704         // Set separator
  2094         // Set separator
  2714 
  2104 
  2715     // Now we need the localised text
  2105     // Now we need the localised text
  2716     HBufC* wlanMacAddress = StringLoader::LoadLC(
  2106     HBufC* wlanMacAddress = StringLoader::LoadLC(
  2717         CPhoneMainResourceResolver::Instance()->
  2107         CPhoneMainResourceResolver::Instance()->
  2718         ResolveResourceID( EPhoneWlanMacAddress ), wlanMACAddress );
  2108         ResolveResourceID( EPhoneWlanMacAddress ), wlanMACAddress );
  2719 
       
  2720     TPhoneCmdParamNote noteParam;
  2109     TPhoneCmdParamNote noteParam;
  2721     noteParam.SetType( EPhoneNoteCustom );
  2110     noteParam.SetType( EPhoneNoteCustom );
  2722     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2111     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2723         ResolveResourceID( EPhoneInformationWaitNote ) );
  2112         ResolveResourceID( EPhoneInformationWaitNote ) );
  2724     noteParam.SetText( *wlanMacAddress );
  2113     noteParam.SetText( *wlanMacAddress );
  2725     noteParam.SetTone( CAknNoteDialog::EConfirmationTone );
  2114     noteParam.SetTone( CAknNoteDialog::EConfirmationTone );
  2726 
       
  2727     // Display note
       
  2728     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  2115     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
  2729 
       
  2730     CleanupStack::PopAndDestroy( wlanMacAddress );
  2116     CleanupStack::PopAndDestroy( wlanMacAddress );
  2731     }
  2117     }
  2732 
  2118 
  2733 // -----------------------------------------------------------
  2119 // -----------------------------------------------------------
  2734 // CPhoneState::HandleAudioAvailableOutputChangedL
  2120 // CPhoneState::HandleAudioAvailableOutputChangedL
  2737 // -----------------------------------------------------------
  2123 // -----------------------------------------------------------
  2738 //
  2124 //
  2739 void CPhoneState::HandleAudioAvailableOutputChangedL()
  2125 void CPhoneState::HandleAudioAvailableOutputChangedL()
  2740     {
  2126     {
  2741     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioAvailableOutputChangedL() ");
  2127     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioAvailableOutputChangedL() ");
  2742     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
  2128     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  2743         Panic( EPhoneCtrlInvariant ) );
       
  2744 
       
  2745     TPhoneCmdParamAudioAvailability outputParam;
  2129     TPhoneCmdParamAudioAvailability outputParam;
  2746 
       
  2747     // Output
  2130     // Output
  2748     const TPEAudioOutput audioOutput =
  2131     const TPEAudioOutput audioOutput =
  2749         iStateMachine->PhoneEngineInfo()->AudioOutput();
  2132         iStateMachine->PhoneEngineInfo()->AudioOutput();
  2750 
       
  2751     // BT availability
  2133     // BT availability
  2752     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2134     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2753             EPEBTAudioAccessory );
  2135             EPEBTAudioAccessory );
  2754     outputParam.SetBTAccAvailable( btAvailable );
  2136     outputParam.SetBTAccAvailable( btAvailable );
  2755 
       
  2756     // Wired availability
  2137     // Wired availability
  2757     TBool wiredAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2138     TBool wiredAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2758             EPEWiredAudioAccessory );
  2139             EPEWiredAudioAccessory );
  2759     outputParam.SetWiredAccAvailable( wiredAvailable );
  2140     outputParam.SetWiredAccAvailable( wiredAvailable );
  2760 
       
  2761     // BTA disconnect handler check
  2141     // BTA disconnect handler check
  2762     if( btAvailable )
  2142     if( btAvailable )
  2763         {
  2143         {
  2764         CPhoneBtaaDisconnectHandler::InstanceL()->Cancel();
  2144         CPhoneBtaaDisconnectHandler::InstanceL()->Cancel();
  2765         }
  2145         }
  2766 
  2146     iViewCommandHandle->ExecuteCommandL( 
  2767     // view update
  2147             EPhoneViewActivateAudioAvailabilityUIChanges,
  2768     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioAvailabilityUIChanges,
  2148             &outputParam );
  2769         &outputParam );
       
  2770     }
  2149     }
  2771 
  2150 
  2772 
  2151 
  2773 // ---------------------------------------------------------
  2152 // ---------------------------------------------------------
  2774 // CPhoneState::IsAlsLineChangePossible
  2153 // CPhoneState::IsAlsLineChangePossible
  2775 // ---------------------------------------------------------
  2154 // ---------------------------------------------------------
  2776 //
  2155 //
  2777 TBool CPhoneState::IsAlsLineChangePossible()
  2156 TBool CPhoneState::IsAlsLineChangePossible()
  2778     {
  2157     {
  2779     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsAlsLineChangePossible( ) ");
  2158     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsAlsLineChangePossible( ) ");
  2780 
       
  2781     TBool isAlsLineChangePossible( ETrue );
  2159     TBool isAlsLineChangePossible( ETrue );
  2782     TSSSettingsAlsBlockingValue AlsBlockingValue( ESSSettingsAlsBlockingNotSupported );
  2160     TSSSettingsAlsBlockingValue AlsBlockingValue( ESSSettingsAlsBlockingNotSupported );
  2783     TInt value( 0 );
  2161     TInt value( 0 );
  2784 
       
  2785     RSSSettings ssSettings;
  2162     RSSSettings ssSettings;
  2786     TInt retValue = ssSettings.Open();
  2163     TInt retValue = ssSettings.Open();
  2787 
       
  2788     if ( retValue == KErrNone )
  2164     if ( retValue == KErrNone )
  2789         {
  2165         {
  2790         ssSettings.Get( ESSSettingsAlsBlocking, value );
  2166         ssSettings.Get( ESSSettingsAlsBlocking, value );
  2791         ssSettings.Close();
  2167         ssSettings.Close();
  2792 
       
  2793         AlsBlockingValue = static_cast< TSSSettingsAlsBlockingValue > ( value );
  2168         AlsBlockingValue = static_cast< TSSSettingsAlsBlockingValue > ( value );
  2794 
       
  2795         if( AlsBlockingValue == ESSSettingsAlsAlternate )
  2169         if( AlsBlockingValue == ESSSettingsAlsAlternate )
  2796             {
  2170             {
  2797             isAlsLineChangePossible = EFalse;
  2171             isAlsLineChangePossible = EFalse;
  2798             }
  2172             }
  2799         }
  2173         }
  2800 
       
  2801     return isAlsLineChangePossible;
  2174     return isAlsLineChangePossible;
  2802     }
  2175     }
  2803 
  2176 
  2804 // ---------------------------------------------------------
  2177 // ---------------------------------------------------------
  2805 // CPhoneState::ShowNumberBusyNoteL
  2178 // CPhoneState::ShowNumberBusyNoteL
  2806 // ---------------------------------------------------------
  2179 // ---------------------------------------------------------
  2807 //
  2180 //
  2808 EXPORT_C void CPhoneState::ShowNumberBusyNoteL()
  2181 EXPORT_C void CPhoneState::ShowNumberBusyNoteL()
  2809     {
  2182     {
  2810     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNumberBusyNoteL( ) ");
  2183     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNumberBusyNoteL( ) ");
  2811     // Re-enable global notes
       
  2812     TPhoneCmdParamBoolean globalNotifierParam;
  2184     TPhoneCmdParamBoolean globalNotifierParam;
  2813     globalNotifierParam.SetBoolean( EFalse );
  2185     globalNotifierParam.SetBoolean( EFalse );
  2814     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2186     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2815         &globalNotifierParam );
  2187         &globalNotifierParam );
  2816 
  2188 
  2817     TInt resource( EPhoneNumberBusy );
  2189     TInt resource( EPhoneNumberBusy );
  2818 
       
  2819     if( iCustomization )
  2190     if( iCustomization )
  2820         {
  2191         {
  2821         // Get customized text resource for busy note
  2192         // Get customized text resource for busy note
  2822         resource = iCustomization->CustomizeBusyNoteText();
  2193         resource = iCustomization->CustomizeBusyNoteText();
  2823         }
  2194         }
  2838 // CPhoneState::IsAutoLockOn
  2209 // CPhoneState::IsAutoLockOn
  2839 // ---------------------------------------------------------
  2210 // ---------------------------------------------------------
  2840 //
  2211 //
  2841 EXPORT_C TBool CPhoneState::IsAutoLockOn() const
  2212 EXPORT_C TBool CPhoneState::IsAutoLockOn() const
  2842     {
  2213     {
  2843     // Check if phone is locked
       
  2844     const TBool phoneIsLocked =
  2214     const TBool phoneIsLocked =
  2845                 CPhonePubSubProxy::Instance()->Value(
  2215                 CPhonePubSubProxy::Instance()->Value(
  2846                 KPSUidCoreApplicationUIs,
  2216                 KPSUidCoreApplicationUIs,
  2847                 KCoreAppUIsAutolockStatus ) > EAutolockOff;
  2217                 KCoreAppUIsAutolockStatus ) > EAutolockOff;
  2848 
       
  2849     __PHONELOG1( EBasic,
  2218     __PHONELOG1( EBasic,
  2850             EPhoneControl,
  2219             EPhoneControl,
  2851             "CPhoneState::IsAutoLockOn() Status: %d",
  2220             "CPhoneState::IsAutoLockOn() Status: %d",
  2852             phoneIsLocked );
  2221             phoneIsLocked );
  2853     
       
  2854     return phoneIsLocked;
  2222     return phoneIsLocked;
  2855     }
  2223     }
  2856 
  2224 
  2857 // ---------------------------------------------------------
  2225 // ---------------------------------------------------------
  2858 // CPhoneState::IsKeyLockOn
  2226 // CPhoneState::IsKeyLockOn
  2861 EXPORT_C TBool CPhoneState::IsKeyLockOn() const
  2229 EXPORT_C TBool CPhoneState::IsKeyLockOn() const
  2862     {
  2230     {
  2863     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsKeyLockOn( ) ");
  2231     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IsKeyLockOn( ) ");
  2864     TPhoneCmdParamBoolean keyLockStatus;
  2232     TPhoneCmdParamBoolean keyLockStatus;
  2865     keyLockStatus.SetBoolean( EFalse );
  2233     keyLockStatus.SetBoolean( EFalse );
  2866 
       
  2867     iViewCommandHandle->ExecuteCommand(
  2234     iViewCommandHandle->ExecuteCommand(
  2868             EPhoneViewGetKeyLockStatus,
  2235             EPhoneViewGetKeyLockStatus,
  2869             &keyLockStatus );
  2236             &keyLockStatus );
  2870 
       
  2871     __PHONELOG1( EBasic,
  2237     __PHONELOG1( EBasic,
  2872             EPhoneControl,
  2238             EPhoneControl,
  2873             "CPhoneState::IsKeyLockOn() Lock Status: %d",
  2239             "CPhoneState::IsKeyLockOn() Lock Status: %d",
  2874             keyLockStatus.Boolean() );
  2240             keyLockStatus.Boolean() );
  2875     return keyLockStatus.Boolean();
  2241     return keyLockStatus.Boolean();
  2891 // CPhoneState::SetTouchPaneButtons
  2257 // CPhoneState::SetTouchPaneButtons
  2892 // ---------------------------------------------------------
  2258 // ---------------------------------------------------------
  2893 //
  2259 //
  2894 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt /*aResourceId*/ )
  2260 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt /*aResourceId*/ )
  2895     {
  2261     {
  2896     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  2262     TPhoneCmdParamBoolean muteParam;
  2897         {
  2263     muteParam.SetBoolean( iStateMachine->PhoneEngineInfo()->AudioMute() );
  2898         TPhoneCmdParamBoolean muteParam;
  2264     iViewCommandHandle->ExecuteCommand(EPhoneViewSetMuteFlag,&muteParam);
  2899         muteParam.SetBoolean( iStateMachine->PhoneEngineInfo()->AudioMute() );
  2265     
  2900         iViewCommandHandle->ExecuteCommand(EPhoneViewSetMuteFlag,&muteParam);
  2266     const TPEAudioOutput audioOutput =
  2901         
  2267         iStateMachine->PhoneEngineInfo()->AudioOutput();
  2902         const TPEAudioOutput audioOutput =
  2268 
  2903             iStateMachine->PhoneEngineInfo()->AudioOutput();
  2269     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2904 
  2270         EPEBTAudioAccessory );
  2905         TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
  2271     
  2906             EPEBTAudioAccessory );
  2272     TPhoneCmdParamBoolean btParam;
  2907         
  2273     btParam.SetBoolean( audioOutput == EPEBTAudioAccessory );        
  2908         TPhoneCmdParamBoolean btParam;
  2274     iViewCommandHandle->ExecuteCommand(EPhoneViewSetBlueToothFlag,&btParam);
  2909         btParam.SetBoolean( audioOutput == EPEBTAudioAccessory );        
  2275 
  2910         iViewCommandHandle->ExecuteCommand(EPhoneViewSetBlueToothFlag,&btParam);
  2276     TPhoneCmdParamBoolean btAvailableParam;
  2911 
  2277     btAvailableParam.SetBoolean( btAvailable );        
  2912         TPhoneCmdParamBoolean btAvailableParam;
  2278     iViewCommandHandle->ExecuteCommand(
  2913         btAvailableParam.SetBoolean( btAvailable );        
  2279             EPhoneViewSetBluetoothAvailableFlag,&btAvailableParam);
  2914         iViewCommandHandle->ExecuteCommand(
  2280            
  2915                 EPhoneViewSetBluetoothAvailableFlag,&btAvailableParam);
  2281     TBool emergency( EPEStateIdle != 
  2916                
  2282         iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) );
  2917         TBool emergency( EPEStateIdle != 
  2283     TPhoneCmdParamBoolean booleanParam;
  2918             iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) );
  2284     booleanParam.SetBoolean( emergency );
  2919         TPhoneCmdParamBoolean booleanParam;
  2285 
  2920         booleanParam.SetBoolean( emergency );
  2286     TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2921 
  2287                  EPhoneViewSetTouchPaneButtons,
  2922         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2288                  &booleanParam ) );
  2923                      EPhoneViewSetTouchPaneButtons,
       
  2924                      &booleanParam ) );
       
  2925         }
       
  2926     }
  2289     }
  2927 
  2290 
  2928 // ---------------------------------------------------------
  2291 // ---------------------------------------------------------
  2929 // CPhoneState::DeleteTouchPaneButtons
  2292 // CPhoneState::DeleteTouchPaneButtons
  2930 // ---------------------------------------------------------
  2293 // ---------------------------------------------------------
  2931 //
  2294 //
  2932 EXPORT_C void CPhoneState::DeleteTouchPaneButtons()
  2295 EXPORT_C void CPhoneState::DeleteTouchPaneButtons()
  2933     {
  2296     {
  2934     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  2297     TPhoneCmdParamBoolean boolParam;
  2935         {
  2298     TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2936         TPhoneCmdParamBoolean boolParam;
  2299                     EPhoneViewSetTouchPaneButtons,
  2937         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  2300                     &boolParam ) );
  2938                         EPhoneViewSetTouchPaneButtons,
       
  2939                         &boolParam ) );
       
  2940         }
       
  2941     }
       
  2942 
       
  2943 // ---------------------------------------------------------
       
  2944 // CPhoneState::HandleLongHashL
       
  2945 // ---------------------------------------------------------
       
  2946 //
       
  2947 EXPORT_C void CPhoneState::HandleLongHashL()
       
  2948     {
       
  2949     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::HandleLongHashL() ");
       
  2950 
       
  2951     }
  2301     }
  2952 
  2302 
  2953 // -----------------------------------------------------------
  2303 // -----------------------------------------------------------
  2954 // CPhoneState::BeginUiUpdateLC
  2304 // CPhoneState::BeginUiUpdateLC
  2955 // -----------------------------------------------------------
  2305 // -----------------------------------------------------------
  2956 //
  2306 //
  2957 EXPORT_C void CPhoneState::BeginUiUpdateLC()
  2307 EXPORT_C void CPhoneState::BeginUiUpdateLC()
  2958     {
  2308     {
  2959 
       
  2960     iViewCommandHandle->ExecuteCommand( EPhoneViewBeginUpdate );
  2309     iViewCommandHandle->ExecuteCommand( EPhoneViewBeginUpdate );
  2961 
       
  2962     TCleanupItem operation( UiUpdateCleanup, this );
  2310     TCleanupItem operation( UiUpdateCleanup, this );
  2963     CleanupStack::PushL( operation );
  2311     CleanupStack::PushL( operation );
  2964     }
  2312     }
  2965 
  2313 
  2966 // -----------------------------------------------------------
  2314 // -----------------------------------------------------------
  2984     TInt callSummaryActivated = 0;
  2332     TInt callSummaryActivated = 0;
  2985     const TInt err = CPhoneCenRepProxy::Instance()->GetInt(
  2333     const TInt err = CPhoneCenRepProxy::Instance()->GetInt(
  2986         KCRUidCommonTelephonySettings,
  2334         KCRUidCommonTelephonySettings,
  2987         KSettingsSummaryAfterCall,
  2335         KSettingsSummaryAfterCall,
  2988         callSummaryActivated );
  2336         callSummaryActivated );
  2989 
       
  2990     if ( err == KErrNone && callSummaryActivated )
  2337     if ( err == KErrNone && callSummaryActivated )
  2991         {
  2338         {
  2992           show = ETrue;
  2339           show = ETrue;
  2993         }
  2340         }
  2994 
       
  2995     return show;
  2341     return show;
  2996     }
  2342     }
  2997 
  2343 
  2998 // -----------------------------------------------------------------------------
  2344 // -----------------------------------------------------------------------------
  2999 // CPhoneState::HandleDtmfKeyTone
  2345 // CPhoneState::HandleDtmfKeyTone
  3000 // Called from KeyEventForwarder
  2346 // Called from KeyEventForwarder
  3001 // Allow only special characters to pass from
  2347 // Allow only special characters to pass from
  3002 // keyEventForwarder to phoneEngine
  2348 // keyEventForwarder to phoneEngine
  3003 // -----------------------------------------------------------------------------
  2349 // -----------------------------------------------------------------------------
  3004 //
  2350 //
  3005 
       
  3006 EXPORT_C void CPhoneState::HandleDtmfKeyToneL( const TKeyEvent& aKeyEvent,
  2351 EXPORT_C void CPhoneState::HandleDtmfKeyToneL( const TKeyEvent& aKeyEvent,
  3007                 TEventCode aEventCode )
  2352                 TEventCode aEventCode )
  3008     {
  2353     {
  3009     SendDtmfKeyEventL( aKeyEvent, aEventCode );
  2354     SendDtmfKeyEventL( aKeyEvent, aEventCode );
  3010     }
  2355     }
  3025 //
  2370 //
  3026 EXPORT_C void CPhoneState::SetDefaultFlagsL()
  2371 EXPORT_C void CPhoneState::SetDefaultFlagsL()
  3027     {
  2372     {
  3028     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetDefaultFlagsL()");
  2373     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetDefaultFlagsL()");
  3029     iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
  2374     iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
       
  2375     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
  3030 
  2376 
  3031     // Reset Hold flag to view
  2377     // Reset Hold flag to view
  3032     TPhoneCmdParamBoolean holdFlag;
  2378     TPhoneCmdParamBoolean holdFlag;
  3033     holdFlag.SetBoolean( EFalse );
  2379     holdFlag.SetBoolean( EFalse );
  3034     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  2380     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
  3035 
  2381     
  3036     // Update FSW
       
  3037     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateFSW );
       
  3038 
       
  3039     // Re-enable global notes
       
  3040     TPhoneCmdParamBoolean globalNotifierParam;
  2382     TPhoneCmdParamBoolean globalNotifierParam;
  3041     globalNotifierParam.SetBoolean( EFalse );
  2383     globalNotifierParam.SetBoolean( EFalse );
  3042     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2384     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  3043         &globalNotifierParam );
  2385         &globalNotifierParam );
  3044     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
  2386     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
  3045         &globalNotifierParam );
  2387         &globalNotifierParam );
  3046 
  2388     
  3047     // uncapture App and Camera keys if not security mode
       
  3048     TPhoneCmdParamBoolean isSecurityMode;
       
  3049     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
  3050     if ( !isSecurityMode.Boolean() )
       
  3051         {
       
  3052         CaptureKeysDuringCallNotificationL( EFalse );
       
  3053         }
       
  3054 
       
  3055     // Restore keylock if phone has been locked before call.
  2389     // Restore keylock if phone has been locked before call.
  3056     if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
  2390     if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
  3057         {
  2391         {
  3058         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
  2392         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
  3059         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
  2393         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
  3065 // -----------------------------------------------------------
  2399 // -----------------------------------------------------------
  3066 //
  2400 //
  3067 TInt CPhoneState::GetVolumeLevel()
  2401 TInt CPhoneState::GetVolumeLevel()
  3068     {
  2402     {
  3069     TPhoneCmdParamInteger integerParam;
  2403     TPhoneCmdParamInteger integerParam;
  3070 
       
  3071     iViewCommandHandle->ExecuteCommand( EPhoneViewGetAudioVolumeLevel,
  2404     iViewCommandHandle->ExecuteCommand( EPhoneViewGetAudioVolumeLevel,
  3072                                         &integerParam );
  2405                                         &integerParam );
  3073     return integerParam.Integer();
  2406     return integerParam.Integer();
  3074     }
  2407     }
  3075 
  2408 
  3079 //
  2412 //
  3080 void CPhoneState::ShowVideoCallOutOfMemoryNoteL()
  2413 void CPhoneState::ShowVideoCallOutOfMemoryNoteL()
  3081     {
  2414     {
  3082     __LOGMETHODSTARTEND(EPhoneControl,
  2415     __LOGMETHODSTARTEND(EPhoneControl,
  3083         "CPhoneState::ShowVideoCallOutOfMemoryNoteL()" );
  2416         "CPhoneState::ShowVideoCallOutOfMemoryNoteL()" );
  3084 
       
  3085     // Re-enable global notes
       
  3086     TPhoneCmdParamBoolean globalNotifierParam;
  2417     TPhoneCmdParamBoolean globalNotifierParam;
  3087     globalNotifierParam.SetBoolean( EFalse );
  2418     globalNotifierParam.SetBoolean( EFalse );
  3088     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  2419     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  3089         &globalNotifierParam );
  2420         &globalNotifierParam );
  3090 
  2421     
  3091     // Bring Phone app in the foreground
       
  3092     TPhoneCmdParamInteger uidParam;
  2422     TPhoneCmdParamInteger uidParam;
  3093     uidParam.SetInteger( KUidPhoneApplication.iUid );
  2423     uidParam.SetInteger( KUidPhoneApplication.iUid );
  3094     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
  2424     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
  3095         &uidParam );
  2425         &uidParam );
  3096 
       
  3097     // Set Phone as the top application
       
  3098     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
  2426     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
  3099         &uidParam );
  2427         &uidParam );
  3100 
  2428 
  3101     // Display error note
  2429     // Display error note
  3102     SExtendedError ext;
  2430     SExtendedError ext;
  3113 //
  2441 //
  3114 TInt CPhoneState::SimSecurityStatus() const
  2442 TInt CPhoneState::SimSecurityStatus() const
  3115     {
  2443     {
  3116     /*
  2444     /*
  3117     Sim security statuses:
  2445     Sim security statuses:
  3118 
       
  3119     ESimSecurityStatusUninitialized = KStartupEnumerationFirstValue,
  2446     ESimSecurityStatusUninitialized = KStartupEnumerationFirstValue,
  3120     ESimRejected,   // The PUK code has been entered incorrectly, so the card is rejected.
  2447     ESimRejected,   // The PUK code has been entered incorrectly, so the card is rejected.
  3121     ESimUnaccepted  // The SIM lock is on, so the card is unaccepted.
  2448     ESimUnaccepted  // The SIM lock is on, so the card is unaccepted.
  3122     */
  2449     */
  3123     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SimSecurityStatus()" );
  2450     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SimSecurityStatus()" );
  3130 // -----------------------------------------------------------------------------
  2457 // -----------------------------------------------------------------------------
  3131 //
  2458 //
  3132 EXPORT_C void CPhoneState::CallWaitingNoteL( TInt aCallId )
  2459 EXPORT_C void CPhoneState::CallWaitingNoteL( TInt aCallId )
  3133     {
  2460     {
  3134     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CallWaitingNoteL()" );
  2461     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CallWaitingNoteL()" );
  3135 
       
  3136     TBuf< KPhoneContactNameMaxLength > callText( KNullDesC );
  2462     TBuf< KPhoneContactNameMaxLength > callText( KNullDesC );
  3137 
       
  3138     // Set CLI text for the call header
  2463     // Set CLI text for the call header
  3139     const TBool contactInfoAvailable =
  2464     const TBool contactInfoAvailable =
  3140         iStateMachine->PhoneEngineInfo()->RemoteName( aCallId ).Length() ||
  2465         iStateMachine->PhoneEngineInfo()->RemoteName( aCallId ).Length() ||
  3141         iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length();
  2466         iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length();
  3142 
  2467 
  3143     __PHONELOG1( EBasic, EPhoneControl,
  2468     __PHONELOG1( EBasic, EPhoneControl,
  3144         "CPhoneState::CallWaitingNoteL - contactInfoAvailable(%d)", contactInfoAvailable );
  2469         "CPhoneState::CallWaitingNoteL - contactInfoAvailable(%d)", contactInfoAvailable );
  3145 
       
  3146     __PHONELOG1( EBasic, EPhoneControl,
  2470     __PHONELOG1( EBasic, EPhoneControl,
  3147         "CPhoneState::CallWaitingNoteL - remote name(%S)",
  2471         "CPhoneState::CallWaitingNoteL - remote name(%S)",
  3148         &iStateMachine->PhoneEngineInfo()->RemoteName( aCallId ) );
  2472         &iStateMachine->PhoneEngineInfo()->RemoteName( aCallId ) );
  3149 
       
  3150     __PHONELOG1( EBasic, EPhoneControl,
  2473     __PHONELOG1( EBasic, EPhoneControl,
  3151         "CPhoneState::CallWaitingNoteL - company name(%S)",
  2474         "CPhoneState::CallWaitingNoteL - company name(%S)",
  3152         &iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId ) );
  2475         &iStateMachine->PhoneEngineInfo()->RemoteCompanyName( aCallId ) );
  3153 
  2476     
  3154     if ( contactInfoAvailable )
  2477     if ( contactInfoAvailable )
  3155         {
  2478         {
  3156         // Set Call Text flag to waiting note
  2479         // Set Call Text flag to waiting note
  3157         callText = iStateMachine->PhoneEngineInfo()->RemoteName( aCallId );
  2480         callText = iStateMachine->PhoneEngineInfo()->RemoteName( aCallId );
  3158 
  2481 
  3163             }
  2486             }
  3164 
  2487 
  3165         TPhoneCmdParamGlobalNote globalNoteParam;
  2488         TPhoneCmdParamGlobalNote globalNoteParam;
  3166         globalNoteParam.SetText( callText );
  2489         globalNoteParam.SetText( callText );
  3167         globalNoteParam.SetType( EPhoneNotificationDialog );
  2490         globalNoteParam.SetType( EPhoneNotificationDialog );
  3168 
       
  3169         globalNoteParam.SetTextResourceId(
  2491         globalNoteParam.SetTextResourceId(
  3170             CPhoneMainResourceResolver::Instance()->
  2492             CPhoneMainResourceResolver::Instance()->
  3171             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  2493             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  3172         globalNoteParam.SetNotificationDialog( ETrue );
  2494         globalNoteParam.SetNotificationDialog( ETrue );
  3173         
       
  3174         iViewCommandHandle->ExecuteCommandL(
  2495         iViewCommandHandle->ExecuteCommandL(
  3175                 EPhoneViewShowGlobalNote, &globalNoteParam );
  2496                 EPhoneViewShowGlobalNote, &globalNoteParam );
  3176         }
  2497         }
  3177     else
  2498     else
  3178         {
  2499         {
  3184 // CPhoneState::SetRingingTonePlaybackL()
  2505 // CPhoneState::SetRingingTonePlaybackL()
  3185 // ----------------------------------------------------------------------------
  2506 // ----------------------------------------------------------------------------
  3186 //
  2507 //
  3187 EXPORT_C void CPhoneState::SetRingingTonePlaybackL( TInt aCallId )
  2508 EXPORT_C void CPhoneState::SetRingingTonePlaybackL( TInt aCallId )
  3188     {
  2509     {
  3189     __LOGMETHODSTARTEND(EPhoneControl,
  2510     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetRingingTonePlaybackL()" );
  3190         "CPhoneState::SetRingingTonePlaybackL()" );
       
  3191 
       
  3192     TPhoneCmdParamRingTone ringToneParam;
  2511     TPhoneCmdParamRingTone ringToneParam;
  3193     ringToneParam.SetVolume(
  2512     ringToneParam.SetVolume(
  3194         iStateMachine->PhoneEngineInfo()->RingingVolume() );
  2513         iStateMachine->PhoneEngineInfo()->RingingVolume() );
  3195 
  2514 
  3196     TArray< TContactItemId > alertGroups =
  2515     TArray< TContactItemId > alertGroups =
  3197         iStateMachine->PhoneEngineInfo()->AlertForGroup();
  2516         iStateMachine->PhoneEngineInfo()->AlertForGroup();
  3198 
  2517     
  3199     TInt alertGroupCount = alertGroups.Count();
  2518     TInt alertGroupCount = alertGroups.Count();
  3200     TInt contactGroupCount =
  2519     TInt contactGroupCount =
  3201         iStateMachine->PhoneEngineInfo()->ContactGroups( aCallId ).Count();
  2520         iStateMachine->PhoneEngineInfo()->ContactGroups( aCallId ).Count();
  3202     TBool alertingGroupFound( EFalse );
  2521     TBool alertingGroupFound( EFalse );
  3203 
  2522 
  3269         }
  2588         }
  3270 
  2589 
  3271     if ( iStateMachine->PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
  2590     if ( iStateMachine->PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
  3272         {
  2591         {
  3273         ringToneParam.SetCallerTextStatus( ETrue );
  2592         ringToneParam.SetCallerTextStatus( ETrue );
  3274         }
  2593         }    
  3275 
       
  3276     // Play the ring tone
       
  3277     iViewCommandHandle->ExecuteCommandL( EPhoneViewPlayRingTone, &ringToneParam );
  2594     iViewCommandHandle->ExecuteCommandL( EPhoneViewPlayRingTone, &ringToneParam );
  3278     }
  2595     }
  3279 
  2596 
  3280 // -----------------------------------------------------------
  2597 // -----------------------------------------------------------
  3281 // CPhoneState::HandleCugNoteL
  2598 // CPhoneState::HandleCugNoteL
  3282 // -----------------------------------------------------------
  2599 // -----------------------------------------------------------
  3283 //
  2600 //
  3284 void CPhoneState::HandleCugInUseNoteL()
  2601 void CPhoneState::HandleCugInUseNoteL()
  3285     {
  2602     {
  3286     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCugInUseNoteL() ");
  2603     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleCugInUseNoteL() ");
  3287 
       
  3288     TInt cugIndex( 0 );
  2604     TInt cugIndex( 0 );
  3289 
       
  3290     RSSSettings ssSettings;
  2605     RSSSettings ssSettings;
  3291     TInt retValue = ssSettings.Open();
  2606     TInt retValue = ssSettings.Open();
  3292 
       
  3293     if ( retValue == KErrNone )
  2607     if ( retValue == KErrNone )
  3294         {
  2608         {
  3295         ssSettings.Get( ESSSettingsCug, cugIndex  );
  2609         ssSettings.Get( ESSSettingsCug, cugIndex  );
  3296         }
  2610         }
  3297     ssSettings.Close();
  2611     ssSettings.Close();
  3298 
       
  3299     if ( cugIndex )
  2612     if ( cugIndex )
  3300         {
  2613         {
  3301         // Add it to the resource string
  2614         // Add it to the resource string
  3302         HBufC* buf = StringLoader::LoadLC(
  2615         HBufC* buf = StringLoader::LoadLC(
  3303             CPhoneMainResourceResolver::Instance()->
  2616             CPhoneMainResourceResolver::Instance()->
  3304             ResolveResourceID(
  2617             ResolveResourceID(
  3305             EPhoneInfoCugInUse ), cugIndex );
  2618             EPhoneInfoCugInUse ), cugIndex );
  3306 
       
  3307         TPhoneCmdParamGlobalNote globalNoteParam;
  2619         TPhoneCmdParamGlobalNote globalNoteParam;
  3308         globalNoteParam.SetText( *buf );
  2620         globalNoteParam.SetText( *buf );
  3309         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  2621         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  3310    
       
  3311         iViewCommandHandle->ExecuteCommandL(
  2622         iViewCommandHandle->ExecuteCommandL(
  3312                 EPhoneViewShowGlobalNote, &globalNoteParam );
  2623                 EPhoneViewShowGlobalNote, &globalNoteParam );
  3313 
       
  3314         CleanupStack::PopAndDestroy( buf );
  2624         CleanupStack::PopAndDestroy( buf );
  3315         }
  2625         }
  3316     }
  2626     }
  3317 
  2627 
  3318 // -----------------------------------------------------------
  2628 // -----------------------------------------------------------
  3328                 *iViewCommandHandle,
  2638                 *iViewCommandHandle,
  3329                 *iStateMachine,
  2639                 *iStateMachine,
  3330                 iCustomization );
  2640                 iCustomization );
  3331         }
  2641         }
  3332     return iCallHeaderManager;
  2642     return iCallHeaderManager;
  3333     }
       
  3334 
       
  3335 // -----------------------------------------------------------
       
  3336 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
       
  3337 // -----------------------------------------------------------
       
  3338 //
       
  3339 EXPORT_C void CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer()
       
  3340     {
       
  3341 
       
  3342     }
       
  3343 
       
  3344 // -----------------------------------------------------------
       
  3345 // CPhoneState::IsOnScreenDialerSupported
       
  3346 // -----------------------------------------------------------
       
  3347 //
       
  3348 EXPORT_C TBool CPhoneState::IsOnScreenDialerSupported() const
       
  3349     {
       
  3350     return iOnScreenDialer;
       
  3351     }
  2643     }
  3352 
  2644 
  3353 // ---------------------------------------------------------------------------
  2645 // ---------------------------------------------------------------------------
  3354 // CPhoneState::LoadResource
  2646 // CPhoneState::LoadResource
  3355 // ---------------------------------------------------------------------------
  2647 // ---------------------------------------------------------------------------
  3495     TBool alphaNumericSupport(EFalse);
  2787     TBool alphaNumericSupport(EFalse);
  3496     TRAP_IGNORE( alphaNumericSupport = NumberEntryManagerL()->IsAlphanumericSupportedAndCharInput( aKeyEvent ) );
  2788     TRAP_IGNORE( alphaNumericSupport = NumberEntryManagerL()->IsAlphanumericSupportedAndCharInput( aKeyEvent ) );
  3497     return alphaNumericSupport;
  2789     return alphaNumericSupport;
  3498     }
  2790     }
  3499 
  2791 
  3500 // ---------------------------------------------------------
       
  3501 // CPhoneState::OnlyHashInNumberEntryL
       
  3502 // ---------------------------------------------------------
       
  3503 //
       
  3504 EXPORT_C void CPhoneState::OnlyHashInNumberEntryL()
       
  3505     {
       
  3506     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::OnlyHashInNumberEntryL( ) ");
       
  3507     // 0.8 seconds has passed, start ALS line change timer
       
  3508     StartAlsLineChangeTimerL();
       
  3509     }
       
  3510 
       
  3511 // -----------------------------------------------------------
  2792 // -----------------------------------------------------------
  3512 // CPhoneState::NumberEntryClearL
  2793 // CPhoneState::NumberEntryClearL
  3513 // -----------------------------------------------------------
  2794 // -----------------------------------------------------------
  3514 //
  2795 //
  3515 void CPhoneState::NumberEntryClearL()
  2796 void CPhoneState::NumberEntryClearL()
  3536     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableHWKeysL( ) ");
  2817     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableHWKeysL( ) ");
  3537 
  2818 
  3538     if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
  2819     if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
  3539         {
  2820         {
  3540         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableHWKeysL HW Keys Disabled " );
  2821         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableHWKeysL HW Keys Disabled " );
  3541 
       
  3542         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyNo );
  2822         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyNo );
  3543         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyYes );
  2823         iStateMachine->PhoneStorage()->AppendBlockedKeysListL( EStdKeyYes );
  3544         }
  2824         }
  3545     }
  2825     }
  3546 
  2826 
  3549 // -----------------------------------------------------------
  2829 // -----------------------------------------------------------
  3550 //
  2830 //
  3551 EXPORT_C void CPhoneState::DisableCallUIL()
  2831 EXPORT_C void CPhoneState::DisableCallUIL()
  3552     {
  2832     {
  3553     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableCallUIL( ) ");
  2833     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisableCallUIL( ) ");
  3554 
       
  3555     // Set Call UI state to storage
  2834     // Set Call UI state to storage
  3556     if( !iStateMachine->PhoneStorage()->IsScreenLocked() )
  2835     if( !iStateMachine->PhoneStorage()->IsScreenLocked() )
  3557         {
  2836         {
  3558         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableCallUIL CallUI Disabled " );
  2837         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::DisableCallUIL CallUI Disabled " );
  3559 
       
  3560         // Show keys locked note
  2838         // Show keys locked note
  3561         TPhoneCmdParamNote noteParam;
  2839         TPhoneCmdParamNote noteParam;
  3562         noteParam.SetType( EPhoneNoteUIDisabled );
  2840         noteParam.SetType( EPhoneNoteUIDisabled );
  3563         noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  2841         noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
  3564             ResolveResourceID( EPhoneInformationNote ) );
  2842             ResolveResourceID( EPhoneInformationNote ) );
  3575         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2853         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  3576         appKeyCaptureParam.SetKey( EStdKeyDevice7 );
  2854         appKeyCaptureParam.SetKey( EStdKeyDevice7 );
  3577         appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
  2855         appKeyCaptureParam.SetKeyCode( EKeyDeviceF );
  3578         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  2856         appKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  3579         iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, &appKeyCaptureParam );
  2857         iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, &appKeyCaptureParam );
  3580         
       
  3581         // Set Call UI state to storage
  2858         // Set Call UI state to storage
  3582         iStateMachine->PhoneStorage()->SetScreenLocked( ETrue );
  2859         iStateMachine->PhoneStorage()->SetScreenLocked( ETrue );
  3583         }
  2860         }
  3584     }
  2861     }
  3585 
  2862 
  3588 // -----------------------------------------------------------
  2865 // -----------------------------------------------------------
  3589 //
  2866 //
  3590 EXPORT_C void CPhoneState::EnableCallUIL()
  2867 EXPORT_C void CPhoneState::EnableCallUIL()
  3591     {
  2868     {
  3592     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::EnableCallUIL( ) ");
  2869     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::EnableCallUIL( ) ");
  3593 
       
  3594     if( iStateMachine->PhoneStorage()->IsScreenLocked() )
  2870     if( iStateMachine->PhoneStorage()->IsScreenLocked() )
  3595         {
  2871         {
  3596         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::EnableCallUIL CallUI Enabled " );
  2872         __PHONELOG( EBasic, EPhoneControl, " CPhoneState::EnableCallUIL CallUI Enabled " );
  3597 
       
  3598         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
  2873         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
  3599         iViewCommandHandle->ExecuteCommandL( EPhoneViewDisableKeyLockWithoutNote );
  2874         iViewCommandHandle->ExecuteCommandL( EPhoneViewDisableKeyLockWithoutNote );
  3600 
  2875 
  3601         // Stop capturing the key guard key
  2876         // Stop capturing the key guard key
  3602         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2877         TPhoneCmdParamKeyCapture appKeyCaptureParam;
  3614 // -----------------------------------------------------------
  2889 // -----------------------------------------------------------
  3615 //
  2890 //
  3616 EXPORT_C void CPhoneState::CheckDisableHWKeysAndCallUIL()
  2891 EXPORT_C void CPhoneState::CheckDisableHWKeysAndCallUIL()
  3617     {
  2892     {
  3618     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::CheckDisableHWKeysAndCallUIL( ) ");
  2893     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneState::CheckDisableHWKeysAndCallUIL( ) ");
  3619 
       
  3620     if( IsKeyLockOn() || IsAutoLockOn() )
  2894     if( IsKeyLockOn() || IsAutoLockOn() )
  3621         {
  2895         {
  3622         // Disable HW keys if needed
  2896         // Disable HW keys if needed
  3623         if( CPhoneCenRepProxy::Instance()->
  2897         if( CPhoneCenRepProxy::Instance()->
  3624                 IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  2898                 IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  3648     if( CPhoneCenRepProxy::Instance()->
  2922     if( CPhoneCenRepProxy::Instance()->
  3649             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  2923             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  3650         {
  2924         {
  3651         if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
  2925         if( iStateMachine->PhoneStorage()->IsBlockedKeysListEmpty() )
  3652             {
  2926             {
  3653             // Disable HW Keys if needed
       
  3654             DisableHWKeysL();
  2927             DisableHWKeysL();
  3655             }
  2928             }
  3656         else
  2929         else
  3657             {
  2930             {
  3658             // Reset blocked keys list
       
  3659             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  2931             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  3660             }
  2932             }
  3661         }
  2933         }
  3662     
  2934     
  3663     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
  2935     if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) 
  3664             && !CPhoneCenRepProxy::Instance()->
  2936             && !CPhoneCenRepProxy::Instance()->
  3665             IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
  2937             IsTelephonyFeatureSupported( KTelephonyLVFlagAllowUnlockOnIncoming ) )
  3666         {
  2938         {
  3667         if( iStateMachine->PhoneStorage()->IsScreenLocked() )
  2939         if( iStateMachine->PhoneStorage()->IsScreenLocked() )
  3668             {
  2940             {
  3669             // Enable Call
       
  3670             EnableCallUIL();
  2941             EnableCallUIL();
  3671             }
  2942             }
  3672         else
  2943         else
  3673             {
  2944             {
  3674             // Set keylock enabled
       
  3675             iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote );
  2945             iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLockWithoutNote );
  3676             // Disable Call
       
  3677             DisableCallUIL();
  2946             DisableCallUIL();
  3678             }
  2947             }
  3679         }
  2948         }
  3680         
  2949     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
  3681         // Stop ringingtone
       
  3682         iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
       
  3683     }
  2950     }
  3684 
  2951 
  3685 // -----------------------------------------------------------
  2952 // -----------------------------------------------------------
  3686 // CPhoneState::RetainPreviousKeylockStateL
  2953 // CPhoneState::RetainPreviousKeylockStateL
  3687 // -----------------------------------------------------------
  2954 // -----------------------------------------------------------
  3709         && CPhoneCenRepProxy::Instance()->
  2976         && CPhoneCenRepProxy::Instance()->
  3710             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  2977             IsTelephonyFeatureSupported( KTelephonyLVFlagDisableCallControlHardKeysWhileLocked ) )
  3711         {
  2978         {
  3712         if( !aKeylockEnabled )
  2979         if( !aKeylockEnabled )
  3713             {
  2980             {
  3714             // Keylock disabled
       
  3715             // Reset blocked keys list
  2981             // Reset blocked keys list
  3716             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  2982             iStateMachine->PhoneStorage()->ResetBlockedKeysList();
  3717             }
  2983             }
  3718         }
  2984         }
  3719     }
  2985     }
  3722 // CPhoneState::SetToolbarButtonLoudspeakerEnabled
  2988 // CPhoneState::SetToolbarButtonLoudspeakerEnabled
  3723 // ---------------------------------------------------------
  2989 // ---------------------------------------------------------
  3724 //
  2990 //
  3725 EXPORT_C void CPhoneState::SetToolbarButtonLoudspeakerEnabled()
  2991 EXPORT_C void CPhoneState::SetToolbarButtonLoudspeakerEnabled()
  3726     {
  2992     {
  3727     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  2993     TPhoneCmdParamInteger integerParam;
  3728         {
  2994     integerParam.SetInteger( EPhoneInCallCmdActivateIhf );
  3729         TPhoneCmdParamInteger integerParam;
  2995     TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  3730         integerParam.SetInteger( EPhoneInCallCmdActivateIhf );
  2996         EPhoneViewEnableToolbarButton, &integerParam ));
  3731         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
       
  3732             EPhoneViewEnableToolbarButton, &integerParam ));
       
  3733         }
       
  3734     }
  2997     }
  3735 
  2998 
  3736 // ---------------------------------------------------------
  2999 // ---------------------------------------------------------
  3737 // CPhoneState::SetBackButtonActive
  3000 // CPhoneState::SetBackButtonActive
  3738 // ---------------------------------------------------------
  3001 // ---------------------------------------------------------
  3739 //
  3002 //
  3740 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  3003 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  3741     {
  3004     {
  3742     if(IsAutoLockOn() && aActive) {
  3005     if( IsAutoLockOn() && aActive ) 
       
  3006         {
  3743         // keep back button dimmed device lock case
  3007         // keep back button dimmed device lock case
  3744         return;
  3008         return;
  3745     }
  3009         }
  3746     
  3010     TPhoneCmdParamBoolean booleanParam;
  3747     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  3011     booleanParam.SetBoolean( aActive );
  3748         {
  3012     iViewCommandHandle->ExecuteCommand(
  3749         TPhoneCmdParamBoolean booleanParam;
  3013         EPhoneViewBackButtonActive, &booleanParam );
  3750         booleanParam.SetBoolean( aActive );
       
  3751         iViewCommandHandle->ExecuteCommand(
       
  3752             EPhoneViewBackButtonActive, &booleanParam );
       
  3753         }
       
  3754     }
  3014     }
  3755 
  3015 
  3756 // -----------------------------------------------------------
  3016 // -----------------------------------------------------------
  3757 // CPhoneState::OpenSoftRejectMessageEditorL
  3017 // CPhoneState::OpenSoftRejectMessageEditorL
  3758 // -----------------------------------------------------------
  3018 // -----------------------------------------------------------
  3759 //
  3019 //
  3760 EXPORT_C void CPhoneState::OpenSoftRejectMessageEditorL()
  3020 EXPORT_C void CPhoneState::OpenSoftRejectMessageEditorL()
  3761     {
  3021     {
  3762     __LOGMETHODSTARTEND(EPhoneControl,
  3022     __LOGMETHODSTARTEND(EPhoneControl,
  3763         "CPhoneState::OpenSoftRejectMessageEditorL ()" );
  3023         "CPhoneState::OpenSoftRejectMessageEditorL ()" );
  3764 
  3024     iCbaManager->SetSoftRejectStatus( EFalse );
  3765     // Fetch incoming call's id from view
       
  3766     TPhoneCmdParamCallStateData callStateData;
  3025     TPhoneCmdParamCallStateData callStateData;
  3767     callStateData.SetCallState( EPEStateRinging );
  3026     callStateData.SetCallState( EPEStateRinging );
  3768     iViewCommandHandle->HandleCommandL(
  3027     iViewCommandHandle->HandleCommandL(
  3769         EPhoneViewGetCallIdByState, &callStateData );
  3028         EPhoneViewGetCallIdByState, &callStateData );
  3770 
  3029 
  3771     TInt ringingCallId( KErrNotFound );
  3030     TInt ringingCallId( KErrNotFound );
  3772     // Do nothing if negative incoming call id
  3031     // Do nothing if negative incoming call id
  3773     if( callStateData.CallId() > KErrNotFound  )
  3032     if( callStateData.CallId() > KErrNotFound  )
  3774         {
  3033         {
  3775         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
  3034         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
  3776         
       
  3777         ringingCallId = callStateData.CallId();
  3035         ringingCallId = callStateData.CallId();
  3778         }
  3036         }
  3779     
       
  3780     
  3037     
  3781     TPhoneCmdParamSfiData sfiDataParam;
  3038     TPhoneCmdParamSfiData sfiDataParam;
  3782 
       
  3783     if (KErrNotFound != ringingCallId) 
  3039     if (KErrNotFound != ringingCallId) 
  3784         {
  3040         {
  3785         if ( iStateMachine->PhoneEngineInfo()->RemoteName( ringingCallId ).Length() )
  3041         if ( iStateMachine->PhoneEngineInfo()->
       
  3042                 RemoteName( ringingCallId ).Length() )
  3786             {
  3043             {
  3787             // store both the name and the number
  3044             // store both the name and the number
  3788             sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
  3045             sfiDataParam.SetNumber( 
  3789             sfiDataParam.SetName( iStateMachine->PhoneEngineInfo()->RemoteName( ringingCallId ) );
  3046                     iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
       
  3047             sfiDataParam.SetName( 
       
  3048                     iStateMachine->PhoneEngineInfo()->RemoteName( ringingCallId ) );
  3790             }
  3049             }
  3791         else
  3050         else
  3792             {
  3051             {
  3793             // store the number
  3052             // store the number
  3794             sfiDataParam.SetNumber( iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
  3053             sfiDataParam.SetNumber( 
  3795             }
  3054                     iStateMachine->PhoneEngineInfo()->RemotePhoneNumber( ringingCallId ) );
  3796         }
  3055             }
  3797 
  3056         }
       
  3057 
       
  3058     TPhoneCmdParamInteger activeCallCount;
  3798     iViewCommandHandle->ExecuteCommandL(
  3059     iViewCommandHandle->ExecuteCommandL(
  3799         EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
  3060         EPhoneViewGetCountOfActiveCalls, &activeCallCount );
       
  3061 
       
  3062     switch( activeCallCount.Integer() )
       
  3063         {
       
  3064         case EOneActiveCall:
       
  3065             iCbaManager->UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
       
  3066             break;
       
  3067         default:
       
  3068             iCbaManager->UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
       
  3069             break;
       
  3070         }
       
  3071     iViewCommandHandle->ExecuteCommandL( 
       
  3072             EPhoneViewOpenSoftRejectEditor, &sfiDataParam );
  3800     }
  3073     }
  3801 
  3074 
  3802 //  End of File
  3075 //  End of File
  3803 
  3076