phoneapp/phoneuistates/src/cphonesingleandcallsetupandwaiting.cpp
changeset 37 ba76fc04e6c2
child 45 6b911d05207e
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation of CPhoneSingleAndCallSetupAndWaiting class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <eikmenub.h> 
       
    21 #include <eikenv.h>
       
    22 #include <StringLoader.h>
       
    23 #include <pevirtualengine.h>
       
    24 #include <cpephonemodelif.h>
       
    25 #include "cphonesingleandcallsetupandwaiting.h"
       
    26 #include "mphonestatemachine.h"
       
    27 #include "phoneviewcommanddefinitions.h"
       
    28 #include "phoneui.hrh"
       
    29 #include "cphonemainresourceresolver.h"
       
    30 #include "phonerssbase.h"
       
    31 #include "cphonestateincall.h"
       
    32 #include "tphonecmdparaminteger.h"
       
    33 #include "tphonecmdparamboolean.h"
       
    34 #include "tphonecmdparamstring.h"
       
    35 #include "tphonecmdparamcallheaderdata.h"
       
    36 #include "tphonecmdparamglobalnote.h"
       
    37 #include "tphonecmdparamcallstatedata.h"
       
    38 #include "phonestatedefinitionsgsm.h"
       
    39 #include "phonelogger.h"
       
    40 
       
    41 enum TTerminatedCall
       
    42 {
       
    43     ENull = 0,
       
    44     EHold,
       
    45     ERinging,
       
    46     EAlerting    
       
    47 };
       
    48 
       
    49 // ================= MEMBER FUNCTIONS =======================
       
    50 
       
    51 // C++ default constructor can NOT contain any code, that
       
    52 // might leave.
       
    53 //
       
    54 CPhoneSingleAndCallSetupAndWaiting::CPhoneSingleAndCallSetupAndWaiting( 
       
    55     MPhoneStateMachine* aStateMachine, 
       
    56     MPhoneViewCommandHandle* aViewCommandHandle,
       
    57     MPhoneCustomization* aPhoneCustomization ) : 
       
    58     CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization )
       
    59     {
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------
       
    63 // CPhoneSingleAndCallSetupAndWaiting::~CPhoneSingleAndCallSetupAndWaiting()
       
    64 // Destructor
       
    65 // (other items were commented in a header).
       
    66 // -----------------------------------------------------------
       
    67 //
       
    68 CPhoneSingleAndCallSetupAndWaiting::~CPhoneSingleAndCallSetupAndWaiting()
       
    69     {
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------
       
    73 // CPhoneSingleAndCallSetupAndWaiting::ConstructL()
       
    74 // Constructor
       
    75 // (other items were commented in a header).
       
    76 // -----------------------------------------------------------
       
    77 //
       
    78 void CPhoneSingleAndCallSetupAndWaiting::ConstructL()
       
    79     {
       
    80     CPhoneGsmInCall::ConstructL();
       
    81 
       
    82     TPhoneCmdParamCallStateData callStateData;
       
    83     callStateData.SetCallState( EPEStateRinging );
       
    84     iViewCommandHandle->HandleCommandL(
       
    85         EPhoneViewGetCallIdByState, &callStateData );
       
    86     iWaitingCallId = callStateData.CallId();
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------
       
    90 // CPhoneSingleAndCallSetupAndWaiting::NewL()
       
    91 // Constructor
       
    92 // (other items were commented in a header).
       
    93 // -----------------------------------------------------------
       
    94 //
       
    95 CPhoneSingleAndCallSetupAndWaiting* CPhoneSingleAndCallSetupAndWaiting::NewL( 
       
    96     MPhoneStateMachine* aStateMachine, 
       
    97     MPhoneViewCommandHandle* aViewCommandHandle,
       
    98     MPhoneCustomization* aPhoneCustomization )
       
    99     {
       
   100     CPhoneSingleAndCallSetupAndWaiting* self = new( ELeave ) CPhoneSingleAndCallSetupAndWaiting( 
       
   101         aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
   102     
       
   103     CleanupStack::PushL( self );
       
   104     self->ConstructL();
       
   105     CleanupStack::Pop( self );
       
   106     
       
   107     return self;
       
   108     }
       
   109 
       
   110 // --------------------------------------------------------------
       
   111 // CPhoneSingleAndCallSetupAndWaiting::HandleKeyMessageL
       
   112 // --------------------------------------------------------------
       
   113 //
       
   114 void CPhoneSingleAndCallSetupAndWaiting::HandleKeyMessageL( 
       
   115     TPhoneKeyEventMessages aMessage,
       
   116     TKeyCode aCode )
       
   117     {
       
   118     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleKeyMessageL() ");
       
   119     switch ( aCode )
       
   120         {
       
   121         // send-key
       
   122         case EKeyYes:
       
   123             if( IsNumberEntryVisibleL() )
       
   124                 {
       
   125                 CPhoneState::CallFromNumberEntryL();                            
       
   126                 }
       
   127             else
       
   128                 {
       
   129                 // Number entry is behind waiting call bubble
       
   130                 // We can't answer to waiting call in this state
       
   131                 // so display Not allowed -note.                        
       
   132                 CPhoneState::SendGlobalErrorNoteL( 
       
   133                     EPhoneNoteTextNotAllowed );
       
   134                 }
       
   135             break;
       
   136             
       
   137         // end-key
       
   138         case EKeyNo:
       
   139             if ( aMessage == EPhoneKeyLongPress )
       
   140                 {
       
   141                 // Close all connections
       
   142                 iStateMachine->SendPhoneEngineMessage(
       
   143                     MPEPhoneModel::EPEMessageTerminateAllConnections );
       
   144                  
       
   145                 if ( IsNumberEntryContentStored() )
       
   146                     {
       
   147                     ClearNumberEntryContentCache();
       
   148                     }
       
   149                 
       
   150                 if ( CPhoneState::IsNumberEntryUsedL() )
       
   151                     {
       
   152                     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   153                         {
       
   154                         CloseDTMFEditorL();
       
   155                         } 
       
   156                     else
       
   157                         {
       
   158                         // Remove number entry from screen
       
   159                         iViewCommandHandle->ExecuteCommandL( 
       
   160                             EPhoneViewRemoveNumberEntry );
       
   161                         // Do state-specific operation when number entry is cleared
       
   162                         HandleNumberEntryClearedL();
       
   163                         }
       
   164                     }
       
   165                 if ( !TopAppIsDisplayedL() )
       
   166                     {
       
   167                     // Bring app to foreground
       
   168                     TPhoneCmdParamInteger uidParam;
       
   169                     uidParam.SetInteger( KUidPhoneApplication.iUid );
       
   170                     iViewCommandHandle->ExecuteCommandL(
       
   171                         EPhoneViewBringAppToForeground, &uidParam );
       
   172                     }
       
   173                 }
       
   174             else
       
   175                 {
       
   176                 // handle end key
       
   177                 DisconnectOutgoingCallL();              
       
   178                 }
       
   179             break;
       
   180             
       
   181         default:
       
   182             // do base operation
       
   183             CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
       
   184             break;
       
   185         }
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------
       
   189 // CPhoneSingleAndCallSetupAndWaiting::HandlePhoneEngineMessageL
       
   190 // -----------------------------------------------------------
       
   191 //
       
   192 void CPhoneSingleAndCallSetupAndWaiting::HandlePhoneEngineMessageL( 
       
   193     const TInt aMessage, 
       
   194     TInt aCallId )
       
   195     {
       
   196     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandlePhoneEngineMessageL() ");
       
   197     switch ( aMessage )
       
   198         {
       
   199         case MEngineMonitor::EPEMessageConnecting:
       
   200             iAlerting = ETrue;
       
   201             HandleConnectingL( aCallId );
       
   202             break;
       
   203         
       
   204         case MEngineMonitor::EPEMessageConnected:
       
   205             HandleConnectedL( aCallId );
       
   206             break;
       
   207         
       
   208         case MEngineMonitor::EPEMessageIdle:
       
   209             HandleIdleL( aCallId );
       
   210             break;
       
   211                     
       
   212         case MEngineMonitor::EPEMessageRemoteBusy:
       
   213             // If call setup failed then stop capturing keys.
       
   214             // Flow through to default branch.
       
   215             CaptureKeysDuringCallNotificationL( EFalse );     
       
   216         default:
       
   217             CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
       
   218             break;
       
   219         }
       
   220     }
       
   221 
       
   222 
       
   223 // -----------------------------------------------------------
       
   224 // CPhoneSingleAndCallSetupAndWaiting:HandleCommandL
       
   225 // -----------------------------------------------------------
       
   226 //
       
   227 TBool CPhoneSingleAndCallSetupAndWaiting::HandleCommandL( TInt aCommand )
       
   228     {
       
   229     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleCommandL() ");
       
   230     TBool commandStatus = ETrue;
       
   231 
       
   232     switch( aCommand )
       
   233         {               
       
   234         // 'End active call' from menu
       
   235         case EPhoneInCallCmdEndThisActiveCall:
       
   236             DisconnectOutgoingCallL();
       
   237             break;
       
   238         
       
   239         // 'End all calls' from menu
       
   240         case EPhoneInCallCmdEndAllCalls:
       
   241             iStateMachine->SendPhoneEngineMessage(
       
   242                 MPEPhoneModel::EPEMessageReleaseAll );
       
   243             break;
       
   244             
       
   245         case EPhoneDtmfDialerCancel:
       
   246             {
       
   247             CloseDTMFEditorL();
       
   248             }
       
   249             break;    
       
   250             
       
   251         default:
       
   252             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
       
   253             break;
       
   254         }
       
   255 
       
   256     return commandStatus;
       
   257     }
       
   258 
       
   259 // -----------------------------------------------------------
       
   260 // CPhoneSingleAndCallSetupAndWaiting::OpenMenuBarL
       
   261 // -----------------------------------------------------------
       
   262 //
       
   263 void CPhoneSingleAndCallSetupAndWaiting::OpenMenuBarL()
       
   264     {
       
   265     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::OpenMenuBarL() ");
       
   266     TInt resourceId;
       
   267 
       
   268     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   269         {
       
   270         resourceId = EPhoneDtmfDialerMenubar;
       
   271         }
       
   272     else if ( IsNumberEntryVisibleL() )
       
   273         {
       
   274         resourceId = EPhoneAlertingHeldAndWaitingCallMenuBarWithNumberEntry;
       
   275         }
       
   276     else
       
   277         {
       
   278         resourceId = EPhoneAlertingHeldAndWaitingCallMenuBar;
       
   279         }
       
   280 
       
   281     TPhoneCmdParamInteger integerParam;
       
   282     integerParam.SetInteger( 
       
   283         CPhoneMainResourceResolver::Instance()->
       
   284         ResolveResourceID( resourceId ) );
       
   285     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, 
       
   286         &integerParam );
       
   287     }
       
   288 
       
   289 // -----------------------------------------------------------
       
   290 // CPhoneSingleAndCallSetupAndWaiting:HandleIdleL
       
   291 // -----------------------------------------------------------
       
   292 //
       
   293 void CPhoneSingleAndCallSetupAndWaiting::HandleIdleL( TInt aCallId )
       
   294     {
       
   295     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleIdleL() ");
       
   296     // Fetch call ids for hold, ringing and alerting bubbles
       
   297     TInt holdCallId;
       
   298     TInt ringingCallId;
       
   299     TInt alertingCallId;
       
   300     TPhoneViewResponseId heldResponse;
       
   301     TPhoneViewResponseId ringingResponse;
       
   302     TPhoneViewResponseId alertingResponse;
       
   303     TPhoneCmdParamCallStateData callStateData;
       
   304     
       
   305     // Remove call 
       
   306     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   307     
       
   308     callStateData.SetCallState( EPEStateHeld );
       
   309     heldResponse = iViewCommandHandle->HandleCommandL(
       
   310         EPhoneViewGetCallIdByState, &callStateData );
       
   311     holdCallId = callStateData.CallId();
       
   312     
       
   313     callStateData.SetCallState( EPEStateRinging );
       
   314     ringingResponse = iViewCommandHandle->HandleCommandL(
       
   315         EPhoneViewGetCallIdByState, &callStateData );
       
   316     ringingCallId = callStateData.CallId();
       
   317                 
       
   318     callStateData.SetCallState( EPEStateConnecting );
       
   319     alertingResponse = iViewCommandHandle->HandleCommandL(
       
   320         EPhoneViewGetCallIdByState, &callStateData );
       
   321     alertingCallId = callStateData.CallId();
       
   322     
       
   323     if( heldResponse != EPhoneViewResponseSuccess ||
       
   324         ringingResponse != EPhoneViewResponseSuccess ||
       
   325         alertingResponse != EPhoneViewResponseSuccess )
       
   326         {
       
   327         // Some or all call id fetches were unsuccesfull.
       
   328         // Terminate all connections and return to idle state.
       
   329         
       
   330         // TBD: Kill all bubbles here
       
   331 
       
   332         iStateMachine->SendPhoneEngineMessage(
       
   333             MPEPhoneModel::EPEMessageTerminateAllConnections );
       
   334             
       
   335         CPhoneGsmInCall::HandleIdleL( aCallId );            
       
   336         return;
       
   337         }
       
   338 
       
   339     // Find out which call was terminated
       
   340     TTerminatedCall terminatedCall = ENull;
       
   341     if( holdCallId < 0 )
       
   342         {
       
   343         terminatedCall = EHold;            
       
   344         }
       
   345     else if( ringingCallId < 0 )
       
   346         {
       
   347         terminatedCall = ERinging;            
       
   348         }
       
   349     else if( alertingCallId < 0 )
       
   350         {
       
   351         terminatedCall = EAlerting;            
       
   352         }
       
   353     
       
   354     switch( terminatedCall )
       
   355         {
       
   356         case EHold:
       
   357             // Idle message came for hold call
       
   358             StateChangeToCallSetupAndWaitingL( aCallId );            
       
   359             break;
       
   360             
       
   361         case ERinging:
       
   362             // Idle message came for ringing call
       
   363             StateChangeToSingleAndAlertingL( aCallId );                    
       
   364             break;        
       
   365             
       
   366         case EAlerting:
       
   367             // Idle message came for alerting call
       
   368             StateChangeToSingleAndWaitingL( aCallId );            
       
   369             break;
       
   370             
       
   371         default:
       
   372             break;
       
   373         }
       
   374 
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------
       
   378 // CPhoneSingleAndCallSetupAndWaiting:HandleConnectingL
       
   379 // -----------------------------------------------------------
       
   380 //
       
   381 void CPhoneSingleAndCallSetupAndWaiting::HandleConnectingL( TInt aCallId )
       
   382     {
       
   383     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleConnectingL() ");
       
   384     
       
   385     // Remove the number entry if it isn't DTMF dialer
       
   386     if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
       
   387         {
       
   388         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   389         }
       
   390     
       
   391     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote );
       
   392     
       
   393     // Re-enable global notes
       
   394     TPhoneCmdParamBoolean globalNotifierParam;
       
   395     globalNotifierParam.SetBoolean( EFalse );
       
   396     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
   397         &globalNotifierParam );
       
   398 
       
   399     BeginUiUpdateLC();
       
   400 
       
   401     // Update bubble content
       
   402     UpdateRemoteInfoDataL( aCallId );
       
   403     
       
   404     // Update bubble type
       
   405     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   406     callHeaderParam.SetCallState( EPEStateConnecting );
       
   407     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   408         &callHeaderParam );
       
   409         
       
   410     EndUiUpdate();                
       
   411 
       
   412     // Set call waiting cba
       
   413     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
       
   414     
       
   415     // Stop key Capture when the phone is connecting
       
   416     CaptureKeysDuringCallNotificationL( EFalse );           
       
   417     }
       
   418 
       
   419 // -----------------------------------------------------------
       
   420 // CPhoneSingleAndCallSetupAndWaiting::HandleConnectedL
       
   421 // -----------------------------------------------------------
       
   422 //
       
   423 void CPhoneSingleAndCallSetupAndWaiting::HandleConnectedL( TInt aCallId )
       
   424     {
       
   425     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   426         "CPhoneSingleAndCallSetupAndWaiting::HandleConnectedL()");
       
   427     // Keep Phone in the foreground
       
   428     TPhoneCmdParamBoolean booleanParam;
       
   429     booleanParam.SetBoolean( EFalse );
       
   430     iViewCommandHandle->ExecuteCommandL( 
       
   431         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
       
   432     
       
   433     // Close menu bar, if it is displayed
       
   434     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   435 
       
   436     // Show bubble
       
   437     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   438     callHeaderParam.SetCallState( EPEStateConnected );
       
   439     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   440         &callHeaderParam );
       
   441     
       
   442     // Capturing keys and number entry must be removed because some
       
   443     // networks jump over connecting state directly to connected state.
       
   444     CaptureKeysDuringCallNotificationL( EFalse );
       
   445     
       
   446     // Remove the number entry if it isn't DTMF dialer
       
   447     if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
       
   448         {
       
   449         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   450         }
       
   451     
       
   452     HandleColpNoteL( aCallId );
       
   453 
       
   454     if ( aCallId != iWaitingCallId )
       
   455         {
       
   456         // Alerting call is connected
       
   457         StateChangeToTwoSinglesAndWaitingL( aCallId );
       
   458         }
       
   459     else   
       
   460         {
       
   461         // Waiting call is connected while alerting call is disconnecting
       
   462         // (manual control sequence '1' + Send). 
       
   463         StateChangeToTwoSinglesL( aCallId );                      
       
   464         }
       
   465     }
       
   466     
       
   467 // -----------------------------------------------------------
       
   468 // CPhoneSingleAndCallSetupAndWaiting:StateChangeToCallSetupAndWaitingL
       
   469 // -----------------------------------------------------------
       
   470 //
       
   471 void CPhoneSingleAndCallSetupAndWaiting::StateChangeToCallSetupAndWaitingL( TInt aCallId )
       
   472     {
       
   473     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::StateChangeToCallSetupAndWaitingL() ");
       
   474     // Remove call 
       
   475     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   476         
       
   477     // Close menu bar, if it is displayed
       
   478     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   479     
       
   480     // Reset Hold flag to view
       
   481     TPhoneCmdParamBoolean holdFlag;
       
   482     holdFlag.SetBoolean( EFalse );
       
   483     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );       
       
   484 
       
   485     BeginUiUpdateLC();
       
   486     
       
   487     SetTouchPaneButtons( EPhoneCallSetupButtons );
       
   488     SetToolbarDimming( ETrue );
       
   489     SetToolbarButtonLoudspeakerEnabled();
       
   490     
       
   491     EndUiUpdate();
       
   492     
       
   493     // Go to Call Setup And Waiting state
       
   494     // No need to update cbas
       
   495     iStateMachine->ChangeState( EPhoneStateCallSetupAndWaiting );
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------
       
   499 // CPhoneSingleAndCallSetupAndWaiting:StateChangeToSingleAndWaitingL
       
   500 // -----------------------------------------------------------
       
   501 //
       
   502 void CPhoneSingleAndCallSetupAndWaiting::StateChangeToSingleAndWaitingL( TInt aCallId )
       
   503     {
       
   504     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::StateChangeToSingleAndWaitingL() ");
       
   505     // Remove call 
       
   506     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   507     
       
   508     CheckIfRestoreNEContentAfterDtmfDialer();
       
   509       
       
   510     if ( CPhoneState::IsNumberEntryUsedL() )
       
   511         {
       
   512         // Show number entry
       
   513         TPhoneCmdParamBoolean booleanParam;
       
   514         booleanParam.SetBoolean( ETrue );
       
   515         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam );
       
   516         }
       
   517 
       
   518     // Close menu bar, if it is displayed
       
   519     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   520     
       
   521         // Set Hold flag to view
       
   522     TPhoneCmdParamBoolean holdFlag;
       
   523     holdFlag.SetBoolean( ETrue );
       
   524     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
       
   525 
       
   526     BeginUiUpdateLC();
       
   527     
       
   528     SetTouchPaneButtons( EPhoneWaitingCallButtons );
       
   529     
       
   530     EndUiUpdate();
       
   531     // Go to Single And Waiting state  
       
   532     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );  
       
   533     iStateMachine->ChangeState( EPhoneStateWaitingInSingle );        
       
   534     }
       
   535 
       
   536 // -----------------------------------------------------------
       
   537 // CPhoneSingleAndCallSetupAndWaiting:StateChangeToSingleAndAlertingL
       
   538 // -----------------------------------------------------------
       
   539 //
       
   540 void CPhoneSingleAndCallSetupAndWaiting::StateChangeToSingleAndAlertingL( TInt aCallId )
       
   541     {
       
   542     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::StateChangeToSingleAndAlertingL() ");
       
   543     // Remove call 
       
   544     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   545 
       
   546     // Close menu bar, if it is displayed
       
   547     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   548 
       
   549     // Remove the number entry if it isn't DTMF dialer
       
   550     if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
       
   551         {
       
   552         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   553         }
       
   554     
       
   555     // Set Hold flag to view EFalse that dtmf menu item not delete
       
   556     TPhoneCmdParamBoolean holdFlag;
       
   557     holdFlag.SetBoolean( EFalse );
       
   558     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
       
   559 
       
   560     BeginUiUpdateLC();
       
   561     
       
   562     SetTouchPaneButtons( EPhoneCallSetupButtons );
       
   563     
       
   564     EndUiUpdate();
       
   565     // Go to Single And Alerting state
       
   566     UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   567     iStateMachine->ChangeState( EPhoneStateAlertingInSingle );        
       
   568     }
       
   569 
       
   570 // -----------------------------------------------------------
       
   571 // CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesL
       
   572 // -----------------------------------------------------------
       
   573 //
       
   574 void CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesL( TInt /*aCallId*/ )
       
   575     {
       
   576     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   577         "CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesL()");
       
   578 
       
   579     BeginUiUpdateLC();
       
   580     
       
   581     SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer );
       
   582     SetTouchPaneButtons( EPhoneTwoSinglesButtons );
       
   583     
       
   584     EndUiUpdate();
       
   585 
       
   586     // Go to two singles state 
       
   587     UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA );
       
   588     iStateMachine->ChangeState( EPhoneStateTwoSingles );                     
       
   589     }
       
   590 
       
   591 // -----------------------------------------------------------
       
   592 // CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesAndWaitingL
       
   593 // -----------------------------------------------------------
       
   594 //
       
   595 void CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesAndWaitingL( TInt /*aCallId*/ )
       
   596     {
       
   597     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   598         "CPhoneSingleAndCallSetupAndWaiting::StateChangeToTwoSinglesAndWaitingL()");
       
   599 
       
   600     BeginUiUpdateLC();
       
   601     
       
   602     SetTouchPaneButtons( EPhoneWaitingCallButtons );
       
   603     SetTouchPaneButtonDisabled( EPhoneCallComingCmdAnswer );
       
   604     
       
   605     EndUiUpdate();
       
   606 
       
   607     // Go to two singles state and waiting
       
   608     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
       
   609     iStateMachine->ChangeState( EPhoneStateTwoSinglesAndWaiting );
       
   610     }
       
   611 
       
   612 // -----------------------------------------------------------
       
   613 // CPhoneSingleAndCallSetupAndWaiting::UpdateInCallCbaL
       
   614 // -----------------------------------------------------------
       
   615 //
       
   616 void CPhoneSingleAndCallSetupAndWaiting::UpdateInCallCbaL()
       
   617     {
       
   618     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   619         "CPhoneSingleAndCallSetupAndWaiting::UpdateInCallCbaL() ");
       
   620     
       
   621     if ( iAlerting )
       
   622         {
       
   623         UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
       
   624         }
       
   625     else
       
   626         {
       
   627         UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
       
   628         }
       
   629     }
       
   630     
       
   631                 
       
   632 
       
   633 // End of File