phoneapp/phoneuistates/src/cphoneconferenceandsingle.cpp
changeset 0 5f000ab63145
child 9 8871b09be73b
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 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->ExecuteCommandL( 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( EPEStateConnected );
       
   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( EPEStateHeld );
       
   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     }
       
   387 
       
   388 // -----------------------------------------------------------
       
   389 // CPhoneConferenceAndSingle::HandleHeldL
       
   390 // -----------------------------------------------------------
       
   391 //
       
   392 void CPhoneConferenceAndSingle::HandleHeldL( TInt aCallId )
       
   393     {
       
   394     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleHeldL");
       
   395     // Display hold bubble
       
   396     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   397     callHeaderParam.SetCallState( EPEStateHeld );
       
   398     
       
   399     TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
       
   400     TInt callLabelId = CPhoneMainResourceResolver::Instance()->
       
   401             ResolveResourceID( EPhoneCallOnHold );
       
   402 
       
   403     StringLoader::Load( 
       
   404         labelText, 
       
   405         callLabelId, 
       
   406         CCoeEnv::Static() );        
       
   407     callHeaderParam.SetLabelText( labelText );
       
   408 
       
   409     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   410         &callHeaderParam );        
       
   411     }
       
   412 
       
   413 // -----------------------------------------------------------
       
   414 // CPhoneConferenceAndSingle::HandleAddedConferenceMemberL
       
   415 // -----------------------------------------------------------
       
   416 //
       
   417 void CPhoneConferenceAndSingle::HandleAddedConferenceMemberL( TInt aCallId )
       
   418     {
       
   419     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleAddedConferenceMemberL");
       
   420     
       
   421     BeginUiUpdateLC();
       
   422         
       
   423     // Update conference bubble
       
   424     iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference );
       
   425     
       
   426     UpdateConferenceSecurityStatusL( aCallId );
       
   427 
       
   428     SetTouchPaneButtons( EPhoneConferenceButtons );
       
   429     SetTouchPaneButtonEnabled( EPhoneInCallCmdPrivate );
       
   430     
       
   431     EndUiUpdate();
       
   432 
       
   433     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   434     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   435     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   436     	&conferenceAndSingleFlag );
       
   437 
       
   438     UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   439     iStateMachine->ChangeState( EPhoneStateConference );        
       
   440     }
       
   441 
       
   442 // -----------------------------------------------------------
       
   443 // CPhoneConferenceAndSingle::UpdateInCallCbaL
       
   444 // -----------------------------------------------------------
       
   445 //
       
   446 void CPhoneConferenceAndSingle::UpdateInCallCbaL()
       
   447     {
       
   448     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneConferenceAndSingle::UpdateInCallCbaL() ");
       
   449     
       
   450     UpdateCbaL ( EPhoneCallHandlingNewCallSwapCBA );
       
   451     }
       
   452 
       
   453 // -----------------------------------------------------------
       
   454 // CPhoneConferenceAndSingle::HandleIncomingL
       
   455 // -----------------------------------------------------------
       
   456 //
       
   457 void CPhoneConferenceAndSingle::HandleIncomingL( TInt aCallId )
       
   458     {
       
   459     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   460     	"CPhoneConferenceAndSingle::HandleIncomingL");
       
   461     
       
   462     BeginUiUpdateLC();  
       
   463     
       
   464     TPhoneCmdParamBoolean dialerParam;
       
   465     dialerParam.SetBoolean( ETrue );
       
   466     
       
   467     // Get allow waiting call header param value.
       
   468     AllowShowingOfWaitingCallHeaderL( dialerParam );
       
   469     
       
   470     // Close conference list
       
   471     TPhoneCmdParamBoolean booleanParam;
       
   472     booleanParam.SetBoolean( EFalse );
       
   473     iViewCommandHandle->ExecuteCommandL( 
       
   474     	EPhoneViewOpenConferenceList, &booleanParam );
       
   475 
       
   476     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
       
   477     
       
   478     // Set touch controls
       
   479     SetTouchPaneButtonDisabled( EPhoneCallComingCmdAnswer );
       
   480 
       
   481     // Check if HW Keys or Call UI should be disabled
       
   482     CheckDisableHWKeysAndCallUIL();
       
   483 
       
   484     SetTouchPaneButtons( EPhoneWaitingCallButtons );
       
   485         
       
   486     // Display incoming call
       
   487     DisplayIncomingCallL( aCallId, dialerParam  );
       
   488 
       
   489     EndUiUpdate();
       
   490 
       
   491     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   492     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   493     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   494     	&conferenceAndSingleFlag );
       
   495     
       
   496     // Go to Conference And Single And Waiting state
       
   497     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
       
   498     iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );                
       
   499     }
       
   500 
       
   501 // -----------------------------------------------------------
       
   502 // CPhoneConferenceAndSingle::HandleIdleL
       
   503 // -----------------------------------------------------------
       
   504 //
       
   505 void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId )
       
   506     {
       
   507     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   508     	"CPhoneConferenceAndSingle::HandleIdleL");
       
   509     
       
   510     // If dialler is not open then close menu bar.
       
   511     if ( !IsNumberEntryUsedL() )
       
   512         {
       
   513         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   514         }
       
   515     
       
   516     TPhoneCmdParamBoolean conferenceExistsForCallId;
       
   517     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
       
   518         aCallId, &conferenceExistsForCallId );
       
   519     
       
   520     if( conferenceExistsForCallId.Boolean() )
       
   521         {
       
   522         // Remove conference member from conference bubble
       
   523         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, 
       
   524             aCallId );                    
       
   525 
       
   526         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   527         }
       
   528     else
       
   529         {       
       
   530         // Remove call
       
   531         BeginUiUpdateLC(); 
       
   532         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
       
   533 
       
   534 	    TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   535 	    conferenceAndSingleFlag.SetBoolean( EFalse );
       
   536 	    iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   537 	    	&conferenceAndSingleFlag );
       
   538         
       
   539 	    TPhoneCmdParamBoolean participantsVisibleFlag;
       
   540 	    iViewCommandHandle->ExecuteCommandL( EPhoneViewGetConferenceListVisibleFlag,
       
   541 	            &participantsVisibleFlag );
       
   542 	    
       
   543 	    // if participants list is visible - do not change buttons or cba
       
   544 	    if( !participantsVisibleFlag.Boolean() )
       
   545 	        {
       
   546 	        // Go to Conference state
       
   547 	        SetTouchPaneButtons( EPhoneConferenceButtons );
       
   548 	        SetTouchPaneButtonEnabled( EPhoneInCallCmdPrivate );  
       
   549 	        
       
   550 	        UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   551 	        }
       
   552       
       
   553 
       
   554         EndUiUpdate();
       
   555 
       
   556         iStateMachine->ChangeState( EPhoneStateConference );
       
   557         }
       
   558     
       
   559     }
       
   560 
       
   561 // -----------------------------------------------------------
       
   562 // CPhoneConferenceAndSingle::HandleConferenceIdleL
       
   563 // -----------------------------------------------------------
       
   564 //
       
   565 void CPhoneConferenceAndSingle::HandleConferenceIdleL()
       
   566     {
       
   567     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneConferenceAndSingle::HandleConferenceIdleL");
       
   568     
       
   569     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveConferenceBubble );
       
   570     
       
   571     TPhoneCmdParamInteger intParam;
       
   572     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls,
       
   573     	&intParam );
       
   574     	
       
   575     switch( intParam.Integer() )
       
   576 	    {
       
   577 	    case EOneActiveCall:
       
   578 	    	MakeStateTransitionToSingleL();
       
   579 	    	break;
       
   580 	    	
       
   581 	    case ETwoActiveCalls: // Fall through
       
   582 	    default:
       
   583 	    	MakeStateTransitionToTwoSinglesL();
       
   584 	    	break;
       
   585 	    }
       
   586     }
       
   587 
       
   588 // --------------------------------------------------------------
       
   589 // CPhoneConferenceAndSingle::HandleKeyMessageL
       
   590 // --------------------------------------------------------------
       
   591 //
       
   592 void CPhoneConferenceAndSingle::HandleKeyMessageL( 
       
   593     TPhoneKeyEventMessages aMessage,
       
   594     TKeyCode aCode )
       
   595     {
       
   596     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   597         "CPhoneConferenceAndSingle::HandleKeyMessageL()");
       
   598     switch ( aCode )
       
   599         {
       
   600         // send-key
       
   601         case EKeyYes:
       
   602             if( IsNumberEntryVisibleL() )
       
   603 				{
       
   604                 HandleSendL();
       
   605                 }
       
   606  			else
       
   607 	 			{
       
   608                 // Number entry is below so swap the call
       
   609                 iStateMachine->SendPhoneEngineMessage(
       
   610                 	CPEPhoneModelIF::EPEMessageSwap );        
       
   611 	 			}
       
   612             break;
       
   613             
       
   614         default:
       
   615             // do base operation
       
   616             CPhoneConference::HandleKeyMessageL( aMessage, aCode );
       
   617             break;
       
   618         }
       
   619     }
       
   620 
       
   621 
       
   622 
       
   623 // --------------------------------------------------------------
       
   624 // CPhoneConferenceAndSingle::HandleSendL 
       
   625 // --------------------------------------------------------------
       
   626 //
       
   627 void CPhoneConferenceAndSingle::HandleSendL()
       
   628     {
       
   629     // Get the number entry contents
       
   630     HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
   631     TPtr ptr( phoneNumber->Des() );
       
   632     TPhoneCmdParamString stringParam;
       
   633     stringParam.SetString( &ptr );
       
   634     
       
   635     iViewCommandHandle->ExecuteCommand(
       
   636         EPhoneViewGetNumberFromEntry,
       
   637         &stringParam );
       
   638     
       
   639     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr ) ;
       
   640     
       
   641     if ( iStateMachine->PhoneEngineInfo()->PhoneNumberIsServiceCode() || 
       
   642          phoneNumber->Des().Length() < KPhoneValidPhoneNumberLength )
       
   643         {  
       
   644         // Send a manual control sequence by providing number 
       
   645         // information with dial command
       
   646         CallFromNumberEntryL();
       
   647         }
       
   648     else
       
   649         {
       
   650         iStateMachine->SendPhoneEngineMessage( 
       
   651             MPEPhoneModel::EPEMessageCheckEmergencyNumber );
       
   652         } 	
       
   653     CleanupStack::PopAndDestroy( phoneNumber );
       
   654     }
       
   655 
       
   656 // End of File