phoneapp/phoneuistates/src/cphoneconferenceandsingle.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 CPhoneConferenceAndSingle class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <StringLoader.h>
       
    21 #include <cpephonemodelif.h>
       
    22 #include <mpeengineinfo.h>
       
    23 #include <featmgr.h>
       
    24 #include "cphoneconferenceandsingle.h"
       
    25 #include "mphonestatemachine.h"
       
    26 #include "phoneviewcommanddefinitions.h"
       
    27 #include "tphonecmdparamcallheaderdata.h"
       
    28 #include "tphonecmdparamstring.h"
       
    29 #include "phonestatedefinitionsgsm.h"
       
    30 #include "phonelogger.h"
       
    31 #include "tphonecmdparamboolean.h"
       
    32 #include "tphonecmdparaminteger.h"
       
    33 #include "tphonecmdparamcallstatedata.h"
       
    34 #include "cphonemainresourceresolver.h"
       
    35 #include "phonerssbase.h"
       
    36 #include "tphonecmdparamglobalnote.h"
       
    37 #include "phoneui.hrh"
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 //
       
    44 CPhoneConferenceAndSingle::CPhoneConferenceAndSingle( 
       
    45     MPhoneStateMachine* aStateMachine, 
       
    46     MPhoneViewCommandHandle* aViewCommandHandle,
       
    47     MPhoneCustomization* aPhoneCustomization ) : 
       
    48     CPhoneConference( aStateMachine, aViewCommandHandle, aPhoneCustomization )
       
    49     {
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------
       
    53 // CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
       
    54 // Destructor
       
    55 // (other items were commented in a header).
       
    56 // -----------------------------------------------------------
       
    57 //
       
    58 CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
       
    59     {
       
    60     // Reset flag 
       
    61     if ( iViewCommandHandle )
       
    62         {
       
    63         TPhoneCmdParamBoolean dtmfSendFlag;
       
    64         dtmfSendFlag.SetBoolean( EFalse );
       
    65         iViewCommandHandle->ExecuteCommand( EPhoneViewSetDtmfOptionsFlag, 
       
    66             &dtmfSendFlag );
       
    67         }
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------
       
    71 // CPhoneConferenceAndSingle::ConstructL()
       
    72 // Constructor
       
    73 // (other items were commented in a header).
       
    74 // -----------------------------------------------------------
       
    75 //
       
    76 void CPhoneConferenceAndSingle::ConstructL()
       
    77     {
       
    78     CPhoneConference::ConstructL();
       
    79     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------
       
    83 // CPhoneConferenceAndSingle::NewL()
       
    84 // Constructor
       
    85 // (other items were commented in a header).
       
    86 // -----------------------------------------------------------
       
    87 //
       
    88 CPhoneConferenceAndSingle* CPhoneConferenceAndSingle::NewL( 
       
    89     MPhoneStateMachine* aStateMachine, 
       
    90     MPhoneViewCommandHandle* aViewCommandHandle,
       
    91     MPhoneCustomization* aPhoneCustomization )
       
    92     {
       
    93     CPhoneConferenceAndSingle* self = new( ELeave ) CPhoneConferenceAndSingle( 
       
    94         aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
    95     
       
    96     CleanupStack::PushL( self );
       
    97     self->ConstructL();
       
    98     CleanupStack::Pop( self );
       
    99     
       
   100     return self;
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------
       
   104 // CPhoneConferenceAndSingle::HandlePhoneEngineMessageL
       
   105 // -----------------------------------------------------------
       
   106 //
       
   107 void CPhoneConferenceAndSingle::HandlePhoneEngineMessageL( 
       
   108     const TInt aMessage, 
       
   109     TInt aCallId )
       
   110     {
       
   111     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::HandlePhoneEngineMessageL()");
       
   112     switch ( aMessage )
       
   113         {
       
   114         case MEngineMonitor::EPEMessageConnectedConference:
       
   115             HandleConnectedConferenceL();
       
   116             break;
       
   117             
       
   118         case MEngineMonitor::EPEMessageHeldConference:
       
   119             HandleHeldConferenceL();
       
   120             break;
       
   121             
       
   122         case MEngineMonitor::EPEMessageConnected:
       
   123             HandleConnectedL( aCallId );
       
   124             break;
       
   125             
       
   126         case MEngineMonitor::EPEMessageHeld:
       
   127             HandleHeldL( aCallId );
       
   128             break;
       
   129             
       
   130         case MEngineMonitor::EPEMessageInValidEmergencyNumber:              
       
   131             SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );                       
       
   132             break;
       
   133             
       
   134         case MEngineMonitor::EPEMessageValidEmergencyNumber:
       
   135             DialVoiceCallL();
       
   136             break;                          
       
   137            
       
   138         case MEngineMonitor::EPEMessageAddedConferenceMember:
       
   139             HandleAddedConferenceMemberL( aCallId );
       
   140             break;
       
   141             
       
   142         default:
       
   143             CPhoneConference::HandlePhoneEngineMessageL( aMessage, 
       
   144                 aCallId );
       
   145             break;
       
   146         }
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------
       
   150 // CPhoneConferenceAndSingle:HandleCommandL
       
   151 // -----------------------------------------------------------
       
   152 //
       
   153 TBool CPhoneConferenceAndSingle::HandleCommandL( TInt aCommand )
       
   154     {
       
   155     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleCommandL");
       
   156     TBool commandStatus = ETrue;
       
   157 
       
   158     switch( aCommand )
       
   159         {
       
   160         case EPhoneNumberAcqCmdCall:
       
   161         case EPhoneNumberAcqCmdSendCommand:
       
   162             HandleSendL();
       
   163             break;
       
   164                     
       
   165         case EAknSoftkeyCancel:
       
   166             commandStatus = CPhoneConference::HandleCommandL( aCommand );
       
   167             iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   168             SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons );
       
   169             break;
       
   170             
       
   171         case EPhoneInCallCmdJoin:
       
   172             iStateMachine->SendPhoneEngineMessage(
       
   173                 CPEPhoneModelIF::EPEMessageAddConferenceMember );
       
   174             break;
       
   175         
       
   176         case EPhoneInCallCmdParticipants:
       
   177             commandStatus = CPhoneConference::HandleCommandL( aCommand );
       
   178             SetTouchPaneButtonDisabled( EPhoneInCallCmdPrivate );
       
   179             break;
       
   180         
       
   181         default:
       
   182             commandStatus = CPhoneConference::HandleCommandL( aCommand );
       
   183             break;
       
   184         }
       
   185 
       
   186     return commandStatus;
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------
       
   190 // CPhoneConferenceAndSingle::OpenMenuBarL
       
   191 // -----------------------------------------------------------
       
   192 //
       
   193 void CPhoneConferenceAndSingle::OpenMenuBarL()
       
   194     {
       
   195     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::OpenMenuBarL");
       
   196     
       
   197     // Set Conference And Single specific flag to view
       
   198     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   199     conferenceAndSingleFlag.SetBoolean( ETrue );
       
   200     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   201         &conferenceAndSingleFlag );
       
   202     
       
   203     // Set specific flag to view so that DTMF menu item available
       
   204     TPhoneCmdParamBoolean dtmfSendFlag;
       
   205     dtmfSendFlag.SetBoolean( ETrue );
       
   206     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfOptionsFlag, 
       
   207         &dtmfSendFlag );        
       
   208     
       
   209     TPhoneViewResponseId response;
       
   210     TPhoneCmdParamCallStateData callStateData;
       
   211     TPhoneCmdParamBoolean booleaParam;
       
   212     TInt heldCallId( KErrNotFound );
       
   213     TInt connectedCallId( KErrNotFound );
       
   214     
       
   215     // Fetch active call's id from view
       
   216     callStateData.SetCallState( EPEStateConnected );
       
   217     response = iViewCommandHandle->HandleCommandL(
       
   218         EPhoneViewGetCallIdByState, &callStateData );
       
   219     if( response != EPhoneViewResponseSuccess )
       
   220         {
       
   221         // Unsuccesfull fetch - do nothing
       
   222         return;            
       
   223         }
       
   224     connectedCallId = callStateData.CallId();
       
   225     
       
   226     // Fetch held call's id from view
       
   227     callStateData.SetCallState( EPEStateHeld );
       
   228     response = iViewCommandHandle->HandleCommandL(
       
   229         EPhoneViewGetCallIdByState, &callStateData );
       
   230     if( response != EPhoneViewResponseSuccess )
       
   231         {
       
   232         // Unsuccesfull fetch - do nothing
       
   233         return;            
       
   234         }
       
   235     heldCallId = callStateData.CallId();
       
   236 
       
   237     // Open the correct menubar according which call is active
       
   238     TInt resourceId;
       
   239     if( connectedCallId == KConferenceCallId )
       
   240         {
       
   241         if ( IsNumberEntryVisibleL() )
       
   242             {
       
   243             resourceId = EPhoneConfAndHeldCallMenubarWithNumberEntry;
       
   244             }
       
   245         else if ( IsConferenceBubbleInSelectionMode() )
       
   246             {
       
   247             resourceId = EPhoneConfCallParticipantsDropMenubar;    
       
   248             }
       
   249         else
       
   250             {
       
   251             resourceId = EPhoneConfAndHeldCallMenubar;
       
   252             }
       
   253         }
       
   254     else
       
   255         {
       
   256         if ( IsNumberEntryVisibleL() )
       
   257             {
       
   258             resourceId = EPhoneActiveAndHeldConfMenubarWithNumberEntry;
       
   259             }
       
   260         else if ( IsConferenceBubbleInSelectionMode() )
       
   261             {
       
   262             resourceId = EPhoneConfCallParticipantsDropMenubar;    
       
   263             }            
       
   264         else
       
   265             {
       
   266             resourceId = EPhoneActiveAndHeldConfMenubar;
       
   267             }            
       
   268         }
       
   269         
       
   270     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   271     
       
   272     // Check that calls are the same type (f.ex. both are CS calls)
       
   273     booleaParam.SetBoolean( 
       
   274         heldCallId != KErrNotFound && connectedCallId != KErrNotFound &&
       
   275         iStateMachine->PhoneEngineInfo()->CallType( heldCallId ) != 
       
   276         iStateMachine->PhoneEngineInfo()->CallType( connectedCallId ));
       
   277 
       
   278     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConfrenceOptionsFlag, 
       
   279         &booleaParam );
       
   280 
       
   281     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   282         {
       
   283         resourceId = EPhoneDtmfDialerMenubar;
       
   284         }
       
   285     else if ( iOnScreenDialer && IsCustomizedDialerVisibleL() )
       
   286         {  
       
   287         resourceId = CustomizedDialerMenuResourceIdL();         
       
   288         }
       
   289             
       
   290     TPhoneCmdParamInteger integerParam;
       
   291     integerParam.SetInteger( 
       
   292                 CPhoneMainResourceResolver::Instance()->
       
   293                 ResolveResourceID( resourceId ) );
       
   294     
       
   295     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, 
       
   296         &integerParam );
       
   297     }
       
   298 
       
   299 // -----------------------------------------------------------
       
   300 // CPhoneConferenceAndSingle::HandleConnectedConferenceL
       
   301 // -----------------------------------------------------------
       
   302 //
       
   303 void CPhoneConferenceAndSingle::HandleConnectedConferenceL()
       
   304     {
       
   305     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConnectedConferenceL");
       
   306     // Update call state
       
   307     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   308     callHeaderParam.SetCallState( EPEStateConnectedConference );
       
   309 
       
   310     TBuf<KPhoneCallHeaderLabelMaxLength> conferenceText( KNullDesC );
       
   311     TInt callLabelId = CPhoneMainResourceResolver::Instance()->
       
   312             ResolveResourceID( EPhoneCLIConferenceCall );
       
   313 
       
   314     StringLoader::Load( 
       
   315         conferenceText, 
       
   316         callLabelId, 
       
   317         CCoeEnv::Static() );        
       
   318     callHeaderParam.SetLabelText( conferenceText );
       
   319             
       
   320     // Conference call is no longer on hold
       
   321     TPhoneCmdParamBoolean holdFlag;
       
   322     holdFlag.SetBoolean( EFalse );
       
   323     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
       
   324     
       
   325     BeginUiUpdateLC();
       
   326     iViewCommandHandle->ExecuteCommandL( 
       
   327         EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam );
       
   328     
       
   329     SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons );
       
   330     
       
   331     EndUiUpdate();          
       
   332     }
       
   333 
       
   334 
       
   335 // -----------------------------------------------------------
       
   336 // CPhoneConferenceAndSingle::HandleHeldConferenceL
       
   337 // 
       
   338 // one of the calls is on hold all the time, conference or single call
       
   339 // -----------------------------------------------------------
       
   340 //
       
   341 void CPhoneConferenceAndSingle::HandleHeldConferenceL()
       
   342     {
       
   343     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleHeldConferenceL");
       
   344     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   345     callHeaderParam.SetCallState( EPEStateHeldConference );
       
   346     
       
   347     TInt callLabelId;
       
   348     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
       
   349     callLabelId = CPhoneMainResourceResolver::Instance()->
       
   350             ResolveResourceID( EPhoneCallOnHold );
       
   351 
       
   352     StringLoader::Load( 
       
   353         labelText, 
       
   354         callLabelId, 
       
   355         CCoeEnv::Static() );        
       
   356     callHeaderParam.SetLabelText( labelText );
       
   357          
       
   358     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   359 
       
   360     BeginUiUpdateLC();
       
   361      
       
   362     iViewCommandHandle->ExecuteCommandL( 
       
   363         EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam );
       
   364         
       
   365     SetTouchPaneButtons( EPhoneConferenceAndSingleButtons );    
       
   366     EndUiUpdate();     
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------
       
   370 // CPhoneConferenceAndSingle::HandleConnectedL
       
   371 // -----------------------------------------------------------
       
   372 //
       
   373 void CPhoneConferenceAndSingle::HandleConnectedL( TInt aCallId )
       
   374     {
       
   375     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConnectedL");
       
   376     
       
   377     UpdateInCallCbaL();
       
   378     
       
   379     
       
   380     // Display connected bubble
       
   381     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   382     callHeaderParam.SetCallState( EPEStateConnected );
       
   383     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   384         &callHeaderParam );
       
   385 
       
   386     SetTouchPaneButtons( EPhoneConferenceButtons );
       
   387     }
       
   388 
       
   389 // -----------------------------------------------------------
       
   390 // CPhoneConferenceAndSingle::HandleHeldL
       
   391 // -----------------------------------------------------------
       
   392 //
       
   393 void CPhoneConferenceAndSingle::HandleHeldL( TInt aCallId )
       
   394     {
       
   395     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleHeldL");
       
   396     // Display hold bubble
       
   397     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   398     callHeaderParam.SetCallState( EPEStateHeld );
       
   399     
       
   400     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
       
   401     TInt callLabelId = CPhoneMainResourceResolver::Instance()->
       
   402             ResolveResourceID( EPhoneCallOnHold );
       
   403 
       
   404     StringLoader::Load( 
       
   405         labelText, 
       
   406         callLabelId, 
       
   407         CCoeEnv::Static() );        
       
   408     callHeaderParam.SetLabelText( labelText );
       
   409 
       
   410     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   411         &callHeaderParam );      
       
   412     
       
   413     SetTouchPaneButtons( EPhoneConferenceButtons );
       
   414     }
       
   415 
       
   416 // -----------------------------------------------------------
       
   417 // CPhoneConferenceAndSingle::HandleAddedConferenceMemberL
       
   418 // -----------------------------------------------------------
       
   419 //
       
   420 void CPhoneConferenceAndSingle::HandleAddedConferenceMemberL( TInt aCallId )
       
   421     {
       
   422     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleAddedConferenceMemberL");
       
   423     
       
   424     BeginUiUpdateLC();
       
   425         
       
   426     // Update conference bubble
       
   427     iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference );
       
   428     
       
   429     UpdateConferenceSecurityStatusL( aCallId );
       
   430 
       
   431     SetTouchPaneButtons( EPhoneConferenceButtons );
       
   432     SetTouchPaneButtonEnabled( EPhoneInCallCmdPrivate );
       
   433     
       
   434     EndUiUpdate();
       
   435 
       
   436     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   437     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   438     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   439         &conferenceAndSingleFlag );
       
   440 
       
   441     UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   442     iStateMachine->ChangeState( EPhoneStateConference );        
       
   443     }
       
   444 
       
   445 // -----------------------------------------------------------
       
   446 // CPhoneConferenceAndSingle::UpdateInCallCbaL
       
   447 // -----------------------------------------------------------
       
   448 //
       
   449 void CPhoneConferenceAndSingle::UpdateInCallCbaL()
       
   450     {
       
   451     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::UpdateInCallCbaL() ");
       
   452     
       
   453     UpdateCbaL ( EPhoneCallHandlingNewCallSwapCBA );
       
   454     }
       
   455 
       
   456 // -----------------------------------------------------------
       
   457 // CPhoneConferenceAndSingle::HandleIncomingL
       
   458 // -----------------------------------------------------------
       
   459 //
       
   460 void CPhoneConferenceAndSingle::HandleIncomingL( TInt aCallId )
       
   461     {
       
   462     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   463         "CPhoneConferenceAndSingle::HandleIncomingL");
       
   464     
       
   465     BeginUiUpdateLC();  
       
   466     
       
   467     TPhoneCmdParamBoolean dialerParam;
       
   468     dialerParam.SetBoolean( ETrue );
       
   469     
       
   470     // Get allow waiting call header param value.
       
   471     AllowShowingOfWaitingCallHeaderL( dialerParam );
       
   472     
       
   473     // Close conference list
       
   474     TPhoneCmdParamBoolean booleanParam;
       
   475     booleanParam.SetBoolean( EFalse );
       
   476     iViewCommandHandle->ExecuteCommandL( 
       
   477         EPhoneViewOpenConferenceList, &booleanParam );
       
   478 
       
   479     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
       
   480     
       
   481     // Check if HW Keys or Call UI should be disabled
       
   482     CheckDisableHWKeysAndCallUIL();
       
   483     
       
   484     // Display incoming call
       
   485     DisplayIncomingCallL( aCallId, dialerParam  );
       
   486 
       
   487     // Set touch controls
       
   488     SetTouchPaneButtonDisabled( EPhoneCallComingCmdAnswer );
       
   489     SetTouchPaneButtons( EPhoneWaitingCallButtons );
       
   490     
       
   491     EndUiUpdate();
       
   492 
       
   493     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   494     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   495     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   496         &conferenceAndSingleFlag );
       
   497     
       
   498     // Go to Conference And Single And Waiting state
       
   499     UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
       
   500     iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );                
       
   501     }
       
   502 
       
   503 // -----------------------------------------------------------
       
   504 // CPhoneConferenceAndSingle::HandleIdleL
       
   505 // -----------------------------------------------------------
       
   506 //
       
   507 void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId )
       
   508     {
       
   509     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   510         "CPhoneConferenceAndSingle::HandleIdleL");
       
   511     
       
   512     // If dialler is not open then close menu bar.
       
   513     if ( !IsNumberEntryUsedL() )
       
   514         {
       
   515         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   516         }
       
   517     
       
   518     TPhoneCmdParamBoolean conferenceExistsForCallId;
       
   519     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
       
   520         aCallId, &conferenceExistsForCallId );
       
   521     
       
   522     if( conferenceExistsForCallId.Boolean() )
       
   523         {
       
   524         // Remove conference member from conference bubble
       
   525         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, 
       
   526             aCallId );                    
       
   527 
       
   528         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   529         }
       
   530     else
       
   531         {       
       
   532         // Remove call
       
   533         BeginUiUpdateLC(); 
       
   534         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   535 
       
   536         TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   537         conferenceAndSingleFlag.SetBoolean( EFalse );
       
   538         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   539             &conferenceAndSingleFlag );
       
   540         
       
   541         TPhoneCmdParamBoolean participantsVisibleFlag;
       
   542         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetConferenceListVisibleFlag,
       
   543                 &participantsVisibleFlag );
       
   544         
       
   545         // if participants list is visible - do not change buttons or cba
       
   546         if( !participantsVisibleFlag.Boolean() )
       
   547             {
       
   548             // Go to Conference state
       
   549             SetTouchPaneButtons( EPhoneConferenceButtons );
       
   550             SetTouchPaneButtonEnabled( EPhoneInCallCmdPrivate );  
       
   551             
       
   552             UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   553             }
       
   554       
       
   555 
       
   556         EndUiUpdate();
       
   557 
       
   558         iStateMachine->ChangeState( EPhoneStateConference );
       
   559         }
       
   560     
       
   561     }
       
   562 
       
   563 // -----------------------------------------------------------
       
   564 // CPhoneConferenceAndSingle::HandleConferenceIdleL
       
   565 // -----------------------------------------------------------
       
   566 //
       
   567 void CPhoneConferenceAndSingle::HandleConferenceIdleL()
       
   568     {
       
   569     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConferenceIdleL");
       
   570     
       
   571     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble );
       
   572     
       
   573     TPhoneCmdParamInteger intParam;
       
   574     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls,
       
   575         &intParam );
       
   576         
       
   577     switch( intParam.Integer() )
       
   578         {
       
   579         case EOneActiveCall:
       
   580             MakeStateTransitionToSingleL();
       
   581             break;
       
   582             
       
   583         case ETwoActiveCalls: // Fall through
       
   584         default:
       
   585             MakeStateTransitionToTwoSinglesL();
       
   586             break;
       
   587         }
       
   588     }
       
   589 
       
   590 // --------------------------------------------------------------
       
   591 // CPhoneConferenceAndSingle::HandleKeyMessageL
       
   592 // --------------------------------------------------------------
       
   593 //
       
   594 void CPhoneConferenceAndSingle::HandleKeyMessageL( 
       
   595     TPhoneKeyEventMessages aMessage,
       
   596     TKeyCode aCode )
       
   597     {
       
   598     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   599         "CPhoneConferenceAndSingle::HandleKeyMessageL()");
       
   600     switch ( aCode )
       
   601         {
       
   602         // send-key
       
   603         case EKeyYes:
       
   604             if( IsNumberEntryVisibleL() )
       
   605                 {
       
   606                 HandleSendL();
       
   607                 }
       
   608             else
       
   609                 {
       
   610                 // Number entry is below so swap the call
       
   611                 iStateMachine->SendPhoneEngineMessage(
       
   612                     CPEPhoneModelIF::EPEMessageSwap );        
       
   613                 }
       
   614             break;
       
   615             
       
   616         default:
       
   617             // do base operation
       
   618             CPhoneConference::HandleKeyMessageL( aMessage, aCode );
       
   619             break;
       
   620         }
       
   621     }
       
   622 
       
   623 
       
   624 
       
   625 // --------------------------------------------------------------
       
   626 // CPhoneConferenceAndSingle::HandleSendL 
       
   627 // --------------------------------------------------------------
       
   628 //
       
   629 void CPhoneConferenceAndSingle::HandleSendL()
       
   630     {
       
   631     // Get the number entry contents
       
   632     HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
   633     TPtr ptr( phoneNumber->Des() );
       
   634     TPhoneCmdParamString stringParam;
       
   635     stringParam.SetString( &ptr );
       
   636     
       
   637     iViewCommandHandle->ExecuteCommand(
       
   638         EPhoneViewGetNumberFromEntry,
       
   639         &stringParam );
       
   640     
       
   641     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ;
       
   642     
       
   643     if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() || 
       
   644          phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
       
   645         {  
       
   646         // Send a manual control sequence by providing number 
       
   647         // information with dial command
       
   648         CallFromNumberEntryL();
       
   649         }
       
   650     else
       
   651         {
       
   652         iStateMachine->SendPhoneEngineMessage( 
       
   653             MPEPhoneModel::EPEMessageCheckEmergencyNumber );
       
   654         }   
       
   655     CleanupStack::PopAndDestroy( phoneNumber );
       
   656     }
       
   657 
       
   658 // End of File