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