phoneapp/phoneuicontrol/src/cphonestatecallsetup.cpp
changeset 0 5f000ab63145
child 14 24062c24fe38
child 21 92ab7f8d0eab
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     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 CPhoneStateCallSetup class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <featmgr.h>
       
    21 #include <StringLoader.h> 
       
    22 #include <ScreensaverInternalPSKeys.h>
       
    23 #include <AknUtils.h>
       
    24 #include <mpeengineinfo.h>
       
    25 #include <mpeclientinformation.h>
       
    26 
       
    27 #include "cphonepubsubproxy.h"
       
    28 #include "cphonestatecallsetup.h"
       
    29 #include "cphonestateincall.h"
       
    30 #include "mphonestatemachine.h"
       
    31 #include "tphonecmdparamboolean.h"
       
    32 #include "tphonecmdparaminteger.h"
       
    33 #include "tphonecmdparamcallstatedata.h"
       
    34 #include "tphonecmdparamcallheaderdata.h"
       
    35 #include "tphonecmdparamglobalnote.h"
       
    36 #include "tphonecmdparamstring.h"
       
    37 #include "tphonecmdparamkeyevent.h"
       
    38 #include "tphonecmdparamnote.h"
       
    39 #include "tphonecmdparamquery.h"
       
    40 #include "phonestatedefinitions.h"
       
    41 #include "phoneui.hrh"
       
    42 #include "phonerssbase.h"
       
    43 #include "cphonemainresourceresolver.h"
       
    44 #include "phonelogger.h"
       
    45 #include "phoneui.pan"
       
    46 #include "cphonedtmfwaitchartimer.h"
       
    47 #include "tphonecmdparamaudiooutput.h"
       
    48 #include "cphonekeys.h"
       
    49 
       
    50 // ================= MEMBER FUNCTIONS =======================
       
    51 
       
    52 // C++ default constructor can NOT contain any code, that
       
    53 // might leave.
       
    54 //
       
    55 EXPORT_C CPhoneStateCallSetup::CPhoneStateCallSetup( 
       
    56     MPhoneStateMachine* aStateMachine, 
       
    57     MPhoneViewCommandHandle* aViewCommandHandle,
       
    58     MPhoneCustomization* aCustomization ) : 
       
    59     CPhoneState( aStateMachine, aViewCommandHandle, aCustomization )
       
    60     {
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------
       
    64 // CPhoneStateCallSetup::~CPhoneStateCallSetup()
       
    65 // Destructor
       
    66 // (other items were commented in a header).
       
    67 // -----------------------------------------------------------
       
    68 //
       
    69 EXPORT_C CPhoneStateCallSetup::~CPhoneStateCallSetup()
       
    70     {
       
    71     delete iDtmfWaitCharTimer;    
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------
       
    75 // CPhoneStateCallSetup::ConstructL()
       
    76 // Constructor
       
    77 // (other items were commented in a header).
       
    78 // -----------------------------------------------------------
       
    79 //
       
    80 EXPORT_C void CPhoneStateCallSetup::ConstructL()
       
    81     {
       
    82     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
       
    83         Panic( EPhoneCtrlInvariant ) );
       
    84     
       
    85     CPhoneState::BaseConstructL();
       
    86     
       
    87     // Enable the volume display
       
    88     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNaviPaneAudioVolume );   
       
    89     HandleAudioOutputChangedL();
       
    90      
       
    91     CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
    92                     KPSUidScreenSaver,
       
    93                     KScreenSaverAllowScreenSaver,
       
    94                     EPhoneScreensaverNotAllowed );
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------
       
    98 // CPhoneStateCallSetup::NewL()
       
    99 // Constructor
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------
       
   102 //
       
   103 CPhoneStateCallSetup* CPhoneStateCallSetup::NewL( 
       
   104     MPhoneStateMachine* aStateMachine, 
       
   105     MPhoneViewCommandHandle* aViewCommandHandle,
       
   106     MPhoneCustomization* aPhoneCustomization )
       
   107     {
       
   108     CPhoneStateCallSetup* self = new (ELeave) CPhoneStateCallSetup( 
       
   109         aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
   110     
       
   111     CleanupStack::PushL( self );
       
   112     self->ConstructL();
       
   113     CleanupStack::Pop( self );
       
   114     
       
   115     return self;
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------
       
   119 // CPhoneStateCallSetup::HandleCommandL()
       
   120 // -----------------------------------------------------------
       
   121 //
       
   122 EXPORT_C TBool CPhoneStateCallSetup::HandleCommandL( TInt aCommand )
       
   123     {
       
   124     __LOGMETHODSTARTEND( EPhoneControl,  
       
   125         "CPhoneStateCallSetup::HandleCommandL()" );
       
   126     TBool commandStatus = ETrue;
       
   127     
       
   128     switch( aCommand )
       
   129         {
       
   130         case EPhoneNumberAcqCmdAddToContacts:
       
   131             {
       
   132             // If call setup is ongoing then add to contacts query should
       
   133             // not be opened -> do nothing here.
       
   134             }
       
   135             break;
       
   136          
       
   137         // DTMF entry - Ok          
       
   138         case EPhoneCmdDtmfOk:
       
   139             SendDtmfL();
       
   140             break;
       
   141          
       
   142         // DTMF sending - Cancel
       
   143         case EPhoneInCallCmdCancelSendingDtmfString:
       
   144             // Stop the asynchronous sending operation the 
       
   145             // PhoneEngine may be performing.
       
   146             iStateMachine->SendPhoneEngineMessage( 
       
   147             MPEPhoneModel::EPEMessageStopDTMFSending );
       
   148             // Remove DTMF sending from screen
       
   149             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
       
   150             break; 
       
   151         
       
   152         // DTMF wait - Ok
       
   153         case EPhoneInCallCmdContinueSendingDtmfString:
       
   154             // Continue sending the DTMF string
       
   155             if( !iDtmfWaitCharTimer )
       
   156                 {
       
   157                 iDtmfWaitCharTimer = CPhoneDtmfWaitCharTimer::NewL( 
       
   158                     iStateMachine );                    
       
   159                 }
       
   160             iDtmfWaitCharTimer->ButtonPressedL();
       
   161             break;
       
   162                 
       
   163         case EPhoneDialerCmdHelpDtmf:
       
   164             {
       
   165             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   166                 {                
       
   167                 TPtrC contextName( KDATA_DIALER_HLP_SEND_DTMF );
       
   168                 iViewCommandHandle->ExecuteCommandL( 
       
   169                     EPhoneViewLaunchHelpApplication,
       
   170                     0,
       
   171                     contextName );
       
   172                 }
       
   173             }
       
   174             break;
       
   175         
       
   176         case EPhoneCmdOptions:
       
   177             OpenMenuBarL();
       
   178             break;
       
   179         
       
   180         case EPhoneInCallCmdDtmfManualQuery:
       
   181              if ( iOnScreenDialer )
       
   182                  {
       
   183                  ShowDtmfDialerL();
       
   184                  }
       
   185               break;    
       
   186             
       
   187         case EPhoneDtmfDialerExit:      // fall through
       
   188         case EPhoneDtmfDialerCancel:
       
   189             CloseDTMFEditorL();
       
   190             break;
       
   191                                    
       
   192         default:
       
   193             commandStatus = CPhoneState::HandleCommandL( aCommand );
       
   194             break;
       
   195         }
       
   196 
       
   197     return commandStatus;
       
   198     }
       
   199 
       
   200 // -----------------------------------------------------------
       
   201 // CPhoneStateCallSetup::OpenMenuBarL   
       
   202 // -----------------------------------------------------------
       
   203 //
       
   204 EXPORT_C void CPhoneStateCallSetup::OpenMenuBarL()
       
   205     {
       
   206     __LOGMETHODSTARTEND(EPhoneControl,  
       
   207         "CPhoneStateCallSetup::OpenMenuBarL()" );
       
   208 
       
   209     if ( iOnScreenDialer )
       
   210         {
       
   211         if ( IsDTMFEditorVisibleL() && IsNumberEntryVisibleL() )
       
   212             {
       
   213             TInt resourceId = EPhoneDtmfDialerMenubar;
       
   214             
       
   215             TPhoneCmdParamInteger integerParam;
       
   216             integerParam.SetInteger( 
       
   217                 CPhoneMainResourceResolver::Instance()->
       
   218                 ResolveResourceID( resourceId ) );
       
   219             iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, 
       
   220                 &integerParam );
       
   221             }
       
   222         }
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------
       
   226 // CPhoneStateCallSetup::HandleNumberEntryClearedL()
       
   227 // -----------------------------------------------------------
       
   228 //
       
   229 EXPORT_C void CPhoneStateCallSetup::HandleNumberEntryClearedL()
       
   230     {
       
   231     __LOGMETHODSTARTEND(EPhoneControl,  
       
   232         "CPhoneStateCallSetup::HandleNumberEntryClearedL()" );
       
   233          
       
   234     // Update call setup CBA when number entry is cleared
       
   235     UpdateInCallCbaL();
       
   236     }
       
   237 
       
   238 // -----------------------------------------------------------
       
   239 // CPhoneStateCallSetup::HandleCreateNumberEntryL
       
   240 // -----------------------------------------------------------
       
   241 //
       
   242 EXPORT_C void CPhoneStateCallSetup::HandleCreateNumberEntryL( 
       
   243         const TKeyEvent& /*aKeyEvent*/,
       
   244         TEventCode /*aEventCode*/)
       
   245     {
       
   246     __LOGMETHODSTARTEND(EPhoneControl,  
       
   247         "CPhoneStateCallSetup::HandleCreateNumberEntryL()" );
       
   248     
       
   249     }
       
   250 
       
   251 
       
   252 // -----------------------------------------------------------
       
   253 // CPhoneStateCallSetup::UpdateInCallCbaL
       
   254 // -----------------------------------------------------------
       
   255 //
       
   256 EXPORT_C void CPhoneStateCallSetup::UpdateInCallCbaL()
       
   257     {
       
   258     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::UpdateInCallCbaL() ");
       
   259     UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------
       
   263 // CPhoneStateCallSetup::UpdateCbaL
       
   264 // -----------------------------------------------------------
       
   265 //
       
   266 EXPORT_C void CPhoneStateCallSetup::UpdateCbaL( TInt aResource )
       
   267     {
       
   268     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::UpdateCbaL() ");
       
   269     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   270         {
       
   271         iCbaManager->SetCbaL( EPhoneDtmfDialerCBA );        
       
   272         }
       
   273     else
       
   274         {
       
   275         iCbaManager->UpdateCbaL( aResource );   
       
   276         }
       
   277     }
       
   278 
       
   279 // -----------------------------------------------------------
       
   280 // CPhoneStateCallSetup::HandleKeyEventL
       
   281 // -----------------------------------------------------------
       
   282 //
       
   283 EXPORT_C void CPhoneStateCallSetup::HandleKeyEventL( 
       
   284     const TKeyEvent& aKeyEvent, 
       
   285     TEventCode aEventCode )
       
   286     {
       
   287     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleKeyEventL( ) ");
       
   288    
       
   289     if ( iOnScreenDialer && IsNumberEntryVisibleL() )
       
   290         {
       
   291         HandleNumericKeyEventL( aKeyEvent, aEventCode );
       
   292         }
       
   293     else
       
   294         {
       
   295         // Send the key events to the phone engine
       
   296         switch( aEventCode )
       
   297             {
       
   298             case EEventKey:
       
   299                 {
       
   300                 PlayKeySpecificDTMF( aKeyEvent.iCode );
       
   301                     
       
   302                 if ( aKeyEvent.iScanCode == EStdKeyUpArrow && 
       
   303                         !OnlySideVolumeKeySupported() )
       
   304                     {
       
   305                     // Increace audio volume
       
   306                     CPhoneState::IncreaseAudioVolumeL();            
       
   307                     }
       
   308                 else if ( aKeyEvent.iScanCode == EStdKeyDownArrow && 
       
   309                         !OnlySideVolumeKeySupported() )
       
   310                     {
       
   311                     // Decreace audio volume
       
   312                     CPhoneState::DecreaseAudioVolumeL();     
       
   313                     }
       
   314                 }
       
   315                 break;
       
   316                 
       
   317             case EEventKeyUp:
       
   318                 // Send a key up event for the last key code sent to
       
   319                 // the phone engine
       
   320                 iStateMachine->SendPhoneEngineMessage( 
       
   321                     MPEPhoneModel::EPEMessageEndDTMF );
       
   322                 break;
       
   323                 
       
   324             default:
       
   325                 break;
       
   326             }
       
   327         }
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------
       
   331 // CPhoneStateCallSetup::PlayKeySpecificDTMF
       
   332 // -----------------------------------------------------------
       
   333 //
       
   334 void CPhoneStateCallSetup::PlayKeySpecificDTMF( const TUint aCode )
       
   335     {
       
   336     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::PlayKeySpecificDTMF( ) ");
       
   337     TBuf<1> buffer; // one character
       
   338     buffer.Append( aCode );
       
   339     __PHONELOG1( EBasic, EPhoneControl, "HandleKeyEventL(%S)", &buffer );
       
   340     // Convert key code to western.
       
   341     AknTextUtils::ConvertDigitsTo( buffer, EDigitTypeWestern );
       
   342     __PHONELOG1( EBasic, EPhoneControl, "ConvertDigitsTo(%S)", &buffer );
       
   343     TLex code( buffer ); 
       
   344     // Send the key press to the phone engine, if applicable
       
   345     iStateMachine->PhoneEngineInfo()->SetKeyCode( code.Peek() );
       
   346     iStateMachine->SendPhoneEngineMessage( 
       
   347         MPEPhoneModel::EPEMessagePlayDTMF );
       
   348     }
       
   349 
       
   350 // -----------------------------------------------------------
       
   351 // CPhoneStateCallSetup::HandleKeyMessageL
       
   352 // -----------------------------------------------------------
       
   353 //
       
   354 EXPORT_C void CPhoneStateCallSetup::HandleKeyMessageL( 
       
   355     TPhoneKeyEventMessages aMessage,
       
   356     TKeyCode aCode )
       
   357     {
       
   358     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleKeyMessageL()");
       
   359     switch ( aCode )
       
   360         {
       
   361         // end-key
       
   362         case EKeyNo:
       
   363             if ( aMessage == EPhoneKeyLongPress )
       
   364                 {
       
   365                 // Close all connections
       
   366                 iStateMachine->SendPhoneEngineMessage(
       
   367                     MPEPhoneModel::EPEMessageTerminateAllConnections );
       
   368                 
       
   369                 // Remove number entry if long press
       
   370                 if ( IsNumberEntryUsedL() )
       
   371                     {
       
   372                     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   373                         {
       
   374                         CloseDTMFEditorL();
       
   375                         } 
       
   376                     else
       
   377                         {
       
   378                         iViewCommandHandle->ExecuteCommandL( 
       
   379                             EPhoneViewRemoveNumberEntry );
       
   380                         }
       
   381                     }
       
   382                 }
       
   383             else
       
   384                 {                
       
   385                 // handle end key
       
   386                 CPhoneState::DisconnectCallL();             
       
   387                 }
       
   388             break;
       
   389         
       
   390         // Voice key
       
   391         case EKeyDevice6:
       
   392             if ( aMessage == EPhoneKeyShortPress )
       
   393                 {
       
   394                 // Toggle the handsfree mode
       
   395                 const TBool handsfreeMode = 
       
   396                     iStateMachine->PhoneEngineInfo()->AudioOutput() ==
       
   397                         EPELoudspeaker;
       
   398                 CPhoneState::SetHandsfreeModeL( !handsfreeMode );
       
   399                 }
       
   400             else // aMessage == EPhoneKeyLongPress
       
   401                 {
       
   402                 // Display call in progress information note
       
   403                 CPhoneState::SendGlobalInfoNoteL( EPhoneCallInProgress );
       
   404                 }
       
   405             break;
       
   406 
       
   407         default:
       
   408             break;
       
   409         }
       
   410     }
       
   411 
       
   412 // -----------------------------------------------------------
       
   413 // CPhoneStateCallSetup::HandlePhoneEngineMessageL
       
   414 // -----------------------------------------------------------
       
   415 //
       
   416 EXPORT_C void CPhoneStateCallSetup::HandlePhoneEngineMessageL( 
       
   417     const TInt aMessage, 
       
   418     TInt aCallId )
       
   419     {
       
   420     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandlePhoneEngineMessageL()");
       
   421 
       
   422     switch ( aMessage )
       
   423         {
       
   424         case MEngineMonitor::EPEMessageConnected:
       
   425             HandleConnectedL( aCallId );
       
   426             break;
       
   427 
       
   428         case MEngineMonitor::EPEMessageRemoteTerminated:
       
   429             if ( IsVideoCall( aCallId ) )
       
   430                 {
       
   431                 HandleRemoteTerminatedL( aCallId );
       
   432                 }
       
   433             break;
       
   434 
       
   435         case MEngineMonitor::EPEMessageIdle:
       
   436             HandleIdleL( aCallId );
       
   437             break;
       
   438 
       
   439         case MEngineMonitor::EPEMessageAudioOutputChanged:
       
   440             HandleAudioOutputChangedL();
       
   441             break;
       
   442             
       
   443         case MEngineMonitor::EPEMessageSendingDTMF:   // fall through
       
   444         case MEngineMonitor::EPEMessageContinuingDTMFSending:
       
   445             HandleSendingDTMFL();
       
   446             break;
       
   447          
       
   448         case MEngineMonitor::EPEMessageStoppedDTMF:
       
   449             HandleStoppedDTMFL();
       
   450             break;
       
   451 
       
   452         case MEngineMonitor::EPEMessageSentDTMF:    // fall through
       
   453         case MEngineMonitor::EPEMessageDTMFSendingAborted:
       
   454             CancelDTMFSendingL();
       
   455             break;
       
   456             
       
   457          default:
       
   458             CPhoneState::HandlePhoneEngineMessageL( aMessage, aCallId );
       
   459             break;
       
   460         }
       
   461     }
       
   462 
       
   463 // -----------------------------------------------------------
       
   464 // CPhoneStateCallSetup::HandleSendingDTMFL
       
   465 // -----------------------------------------------------------
       
   466 //
       
   467 void CPhoneStateCallSetup::HandleSendingDTMFL()
       
   468     {
       
   469     __LOGMETHODSTARTEND(EPhoneControl,  
       
   470         "CPhoneStateCallSetup::HandleSendingDTMFL()" );
       
   471     TPhoneCmdParamNote noteParam;
       
   472     noteParam.SetType( EPhoneNoteDtmfSending );
       
   473     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
       
   474         ResolveResourceID( EPhoneSendingDtmfWaitNote ) );
       
   475 
       
   476     // Show the "Sending..." Wait Note, and pre-populate it 
       
   477     // with the PhoneEngine's current DTMF String.
       
   478     // Set the text for the wait-note.
       
   479     TPEDtmfString dtmfString = iStateMachine->PhoneEngineInfo()->DtmfString();
       
   480     HBufC* noteText = StringLoader::LoadLC( 
       
   481         CPhoneMainResourceResolver::Instance()->
       
   482             ResolveResourceID( EPhoneSendingDtmfWaitNoteText ), 
       
   483         dtmfString );
       
   484     noteParam.SetText( *noteText );
       
   485 
       
   486     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
       
   487 
       
   488     CleanupStack::PopAndDestroy( noteText );
       
   489     }
       
   490 
       
   491 // -----------------------------------------------------------
       
   492 // CPhoneStateCallSetup::HandleStoppedDTMFL
       
   493 // -----------------------------------------------------------
       
   494 //
       
   495 void CPhoneStateCallSetup::HandleStoppedDTMFL()
       
   496     {
       
   497     __LOGMETHODSTARTEND(EPhoneControl,  
       
   498         "CPhoneStateCallSetup::HandleStoppedDTMFL()" );
       
   499     // Remove the Sending... note
       
   500     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
       
   501 
       
   502     // Fetch the remaining (unparsed) portion of the DTMF String 
       
   503     // from PhoneEngine
       
   504     TPEDtmfString dtmfString = iStateMachine->PhoneEngineInfo()->DtmfString();
       
   505 
       
   506     if ( dtmfString.Length() )
       
   507         {
       
   508         // Show the DTMF Wait Character confirmation query
       
   509         TPhoneCmdParamQuery queryParam;
       
   510         queryParam.SetQueryType( EPhoneQueryDialog );
       
   511         queryParam.SetQueryResourceId( 
       
   512             CPhoneMainResourceResolver::Instance()->ResolveResourceID( 
       
   513                 EPhoneDtmfWaitCharacterConfirmationQuery ) );
       
   514 
       
   515         // Append the PhoneEngine's current DTMF String to the query's prompt
       
   516         HBufC* queryPrompt = StringLoader::LoadLC( 
       
   517             CPhoneMainResourceResolver::Instance()->ResolveResourceID( 
       
   518                 EPhoneDtmfWaitCharacterConfirmationQueryText ), 
       
   519             dtmfString );
       
   520         queryParam.SetQueryPrompt( *queryPrompt );
       
   521 
       
   522         iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, 
       
   523             &queryParam );
       
   524 
       
   525         CleanupStack::PopAndDestroy( queryPrompt );
       
   526         }
       
   527     else
       
   528         {
       
   529         // Stop the asynchronous sending operation the 
       
   530         // PhoneEngine may be performing.
       
   531         iStateMachine->SendPhoneEngineMessage( 
       
   532             MPEPhoneModel::EPEMessageStopDTMFSending );
       
   533 
       
   534         // Prompt for more characters by showing DTMF query with empty string
       
   535         HBufC* emptyString = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
   536         TPtr ptr( emptyString->Des() );
       
   537 
       
   538         CPhoneState::ShowTextQueryL( 
       
   539             CPhoneMainResourceResolver::Instance()->
       
   540                 ResolveResourceID( EPhoneDtmfNumberQuery ),
       
   541             CPhoneMainResourceResolver::Instance()->
       
   542                 ResolveResourceID( EPhoneSendDtmfEmptyEditBoxCBA ),
       
   543             CPhoneMainResourceResolver::Instance()->
       
   544                 ResolveResourceID( EPhoneSendDtmfNormalEditBoxCBA ),
       
   545             &ptr );
       
   546 
       
   547         CleanupStack::PopAndDestroy( emptyString );
       
   548         }
       
   549     }
       
   550 
       
   551 // -----------------------------------------------------------
       
   552 // CPhoneStateCallSetup::CancelDTMFSendingL
       
   553 // -----------------------------------------------------------
       
   554 //
       
   555 void CPhoneStateCallSetup::CancelDTMFSendingL()
       
   556     {
       
   557     __LOGMETHODSTARTEND(EPhoneControl,  
       
   558         "CPhoneStateCallSetup::CancelDTMFSendingL()" );
       
   559     // Remove the Sending... note
       
   560     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveDtmfNote );
       
   561     }
       
   562 
       
   563 // -----------------------------------------------------------
       
   564 // CPhoneStateCallSetup::HandleConnectedL
       
   565 // -----------------------------------------------------------
       
   566 //
       
   567 void CPhoneStateCallSetup::HandleConnectedL( TInt aCallId )
       
   568     {
       
   569     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleConnectedL()");
       
   570     // Keep Phone in the foreground
       
   571     TPhoneCmdParamBoolean booleanParam;
       
   572     booleanParam.SetBoolean( EFalse );
       
   573     iViewCommandHandle->ExecuteCommandL( 
       
   574         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
       
   575         
       
   576     // Close menu bar, if it is displayed
       
   577     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   578     
       
   579     BeginUiUpdateLC();
       
   580         
       
   581     // Remove the number entry if it isn't DTMF dialer
       
   582     if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
       
   583         {
       
   584         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   585         }
       
   586     
       
   587     // Update the single call
       
   588     CPhoneState::UpdateSingleActiveCallL( aCallId );
       
   589         
       
   590     // Complete sat request
       
   591     if ( iStateMachine->PhoneEngineInfo()->CallOrigin( aCallId ) == EPECallOriginSAT )
       
   592         {
       
   593         CompleteSatRequestL( aCallId );
       
   594         }
       
   595         
       
   596     // Update touch buttons
       
   597     SetTouchPaneButtons( EPhoneIncallButtons );        
       
   598 
       
   599     SetToolbarDimming( EFalse );
       
   600 
       
   601     EndUiUpdate();
       
   602     
       
   603     // Go to single state
       
   604     UpdateCbaL( EPhoneCallHandlingInCallCBA );    
       
   605 
       
   606     iStateMachine->ChangeState( EPhoneStateSingle );
       
   607     }
       
   608 
       
   609 // -----------------------------------------------------------
       
   610 // CPhoneStateCallSetup::HandleIdleL
       
   611 // -----------------------------------------------------------
       
   612 //
       
   613 void CPhoneStateCallSetup::HandleIdleL( TInt aCallId )
       
   614     {
       
   615     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleIdleL()");
       
   616     
       
   617     BeginTransEffectLC ( ENumberEntryOpen );
       
   618     BeginUiUpdateLC ();
       
   619     
       
   620     // Disable the volume display
       
   621     iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
       
   622 
       
   623     // Remove call 
       
   624     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   625     SetDefaultFlagsL();
       
   626        
       
   627     CheckIfRestoreNEContentAfterDtmfDialer();
       
   628       
       
   629     if ( IsNumberEntryUsedL() )
       
   630         {
       
   631         // Show the number entry if it exists
       
   632         SetNumberEntryVisibilityL(ETrue);    
       
   633         }    
       
   634     else if ( NeedToSendToBackgroundL() )
       
   635         {
       
   636         __PHONELOG( EBasic,EPhoneControl,"CPhoneStateCallSetup::elseif1");
       
   637         // Continue displaying current app but set up the 
       
   638         // idle screen in the background
       
   639         SetupIdleScreenInBackgroundL();
       
   640         }
       
   641     else
       
   642         {
       
   643         __PHONELOG( EBasic,EPhoneControl,"CPhoneStateCallSetup::elseif2");
       
   644          // Display idle screen
       
   645         DisplayIdleScreenL();
       
   646         }
       
   647         
       
   648     EndUiUpdate();
       
   649     EndTransEffect(); 
       
   650     // Go to idle state
       
   651     // No need update cba
       
   652     iStateMachine->ChangeState( EPhoneStateIdle );
       
   653     }
       
   654 
       
   655 // -----------------------------------------------------------------------------
       
   656 // CPhoneStateCallSetup::HandleRemoteTerminatedL
       
   657 // -----------------------------------------------------------------------------
       
   658 //
       
   659 void CPhoneStateCallSetup::HandleRemoteTerminatedL( TInt aCallId )
       
   660     {
       
   661     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleRemoteTerminatedL( ) ");
       
   662 
       
   663     // Remove call header
       
   664     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   665     
       
   666     TPhoneCmdParamBoolean globalNotifierParam;
       
   667     globalNotifierParam.SetBoolean( EFalse );
       
   668     iViewCommandHandle->ExecuteCommandL( 
       
   669         EPhoneViewSetGlobalNotifiersDisabled, &globalNotifierParam );
       
   670 
       
   671     // Video call not possible note is shown by 
       
   672     // CPhoneErrorMessagesHandler::ShowErrorSpecificNoteL method,
       
   673     // if error ECCPErrorCCResourceNotAvailable occured.
       
   674     }    
       
   675     
       
   676 // -----------------------------------------------------------------------------
       
   677 // CPhoneStateCallSetup::HandleAudioOutputChangedL
       
   678 // -----------------------------------------------------------------------------
       
   679 //    
       
   680 void CPhoneStateCallSetup::HandleAudioOutputChangedL()
       
   681     {
       
   682     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleAudioOutputChangedL( ) ");
       
   683    
       
   684     // Update the call setup CBA
       
   685     UpdateInCallCbaL();
       
   686     
       
   687     CPhoneState::HandleAudioOutputChangedL();
       
   688     }
       
   689  
       
   690 // -----------------------------------------------------------
       
   691 // CPhoneStateCallSetup::SendDtmfL
       
   692 // -----------------------------------------------------------
       
   693 //
       
   694 void CPhoneStateCallSetup::SendDtmfL()
       
   695     {
       
   696     __LOGMETHODSTARTEND(EPhoneControl,  
       
   697         "CPhoneStateCallSetup::SendDtmfL()" );
       
   698     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
       
   699         Panic( EPhoneCtrlInvariant ) );    
       
   700 
       
   701     // First get the DTMF sequence from dialog
       
   702     TPhoneCmdParamString dtmfSequence;
       
   703     HBufC *content = HBufC::NewLC( KPEDtmfMaxLength );
       
   704     TPtr ptr( content->Des() );
       
   705     dtmfSequence.SetString( &ptr );
       
   706     
       
   707     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   708         {
       
   709         iViewCommandHandle->ExecuteCommand(
       
   710             EPhoneViewGetNumberFromEntry,
       
   711             &dtmfSequence );  
       
   712                     
       
   713         CloseDTMFEditorL();
       
   714         }
       
   715     else
       
   716         {
       
   717         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetTextQueryContent,
       
   718                                              &dtmfSequence );
       
   719         }        
       
   720 
       
   721     // Send the DTMF
       
   722     if ( ptr.Length() )
       
   723         {
       
   724         iStateMachine->PhoneEngineInfo()->SetDtmfStringCommand( ptr );
       
   725         iStateMachine->SendPhoneEngineMessage(
       
   726             MPEPhoneModel::EPEMessageSendDTMF );    
       
   727         }
       
   728     
       
   729     CleanupStack::PopAndDestroy( content );
       
   730     }
       
   731 
       
   732 // End of File