phoneapp/phoneuistates/src/cphoneconferenceandsingle.cpp
changeset 56 5bcb308bd24d
parent 46 bc5a64e5bc3c
child 65 2a5d4ab426d3
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
    55 // (other items were commented in a header).
    55 // (other items were commented in a header).
    56 // -----------------------------------------------------------
    56 // -----------------------------------------------------------
    57 //
    57 //
    58 CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
    58 CPhoneConferenceAndSingle::~CPhoneConferenceAndSingle()
    59     {
    59     {
    60     // Reset flag 
       
    61     if ( iViewCommandHandle )
       
    62         {
       
    63         TPhoneCmdParamBoolean dtmfSendFlag;
       
    64         dtmfSendFlag.SetBoolean( EFalse );
       
    65         iViewCommandHandle->ExecuteCommand( EPhoneViewSetDtmfOptionsFlag, 
       
    66             &dtmfSendFlag );
       
    67         }
       
    68     }
    60     }
    69 
    61 
    70 // -----------------------------------------------------------
    62 // -----------------------------------------------------------
    71 // CPhoneConferenceAndSingle::ConstructL()
    63 // CPhoneConferenceAndSingle::ConstructL()
    72 // Constructor
    64 // Constructor
    74 // -----------------------------------------------------------
    66 // -----------------------------------------------------------
    75 //
    67 //
    76 void CPhoneConferenceAndSingle::ConstructL()
    68 void CPhoneConferenceAndSingle::ConstructL()
    77     {
    69     {
    78     CPhoneConference::ConstructL();
    70     CPhoneConference::ConstructL();
    79     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
    80     }
    71     }
    81 
    72 
    82 // -----------------------------------------------------------
    73 // -----------------------------------------------------------
    83 // CPhoneConferenceAndSingle::NewL()
    74 // CPhoneConferenceAndSingle::NewL()
    84 // Constructor
    75 // Constructor
   162             HandleSendL();
   153             HandleSendL();
   163             break;
   154             break;
   164                     
   155                     
   165         case EAknSoftkeyCancel:
   156         case EAknSoftkeyCancel:
   166             commandStatus = CPhoneConference::HandleCommandL( aCommand );
   157             commandStatus = CPhoneConference::HandleCommandL( aCommand );
   167             iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   168             SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons );
   158             SetTouchPaneButtons( EPhoneConferenceAndHeldSingleButtons );
   169             break;
   159             break;
   170             
   160             
   171         case EPhoneInCallCmdJoin:
   161         case EPhoneInCallCmdJoin:
   172             iStateMachine->SendPhoneEngineMessage(
   162             iStateMachine->SendPhoneEngineMessage(
   173                 CPEPhoneModelIF::EPEMessageAddConferenceMember );
   163                 CPEPhoneModelIF::EPEMessageAddConferenceMember );
   174             break;
   164             break;
   175         
   165         
   176         case EPhoneInCallCmdParticipants:
   166         case EPhoneInCallCmdParticipants:
   177             commandStatus = CPhoneConference::HandleCommandL( aCommand );
       
   178             SetTouchPaneButtonDisabled( EPhoneInCallCmdPrivate );
       
   179             break;
   167             break;
   180         
   168         
   181         default:
   169         default:
   182             commandStatus = CPhoneConference::HandleCommandL( aCommand );
   170             commandStatus = CPhoneConference::HandleCommandL( aCommand );
   183             break;
   171             break;
   184         }
   172         }
   185 
   173 
   186     return commandStatus;
   174     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     }
   175     }
   298 
   176 
   299 // -----------------------------------------------------------
   177 // -----------------------------------------------------------
   300 // CPhoneConferenceAndSingle::HandleConnectedConferenceL
   178 // CPhoneConferenceAndSingle::HandleConnectedConferenceL
   301 // -----------------------------------------------------------
   179 // -----------------------------------------------------------
   352     StringLoader::Load( 
   230     StringLoader::Load( 
   353         labelText, 
   231         labelText, 
   354         callLabelId, 
   232         callLabelId, 
   355         CCoeEnv::Static() );        
   233         CCoeEnv::Static() );        
   356     callHeaderParam.SetLabelText( labelText );
   234     callHeaderParam.SetLabelText( labelText );
   357          
       
   358     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   359 
   235 
   360     BeginUiUpdateLC();
   236     BeginUiUpdateLC();
   361      
   237      
   362     iViewCommandHandle->ExecuteCommandL( 
   238     iViewCommandHandle->ExecuteCommandL( 
   363         EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam );
   239         EPhoneViewUpdateBubble, KConferenceCallId, &callHeaderParam );
   425     iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference );
   301     iViewCommandHandle->ExecuteCommandL( EPhoneViewAddToConference );
   426     
   302     
   427     UpdateConferenceSecurityStatusL( aCallId );
   303     UpdateConferenceSecurityStatusL( aCallId );
   428 
   304 
   429     SetTouchPaneButtons( EPhoneConferenceButtons );
   305     SetTouchPaneButtons( EPhoneConferenceButtons );
   430     SetTouchPaneButtonEnabled( EPhoneInCallCmdPrivate );
       
   431     
   306     
   432     EndUiUpdate();
   307     EndUiUpdate();
   433 
       
   434     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   435     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   436     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   437         &conferenceAndSingleFlag );
       
   438 
   308 
   439     UpdateCbaL( EPhoneCallHandlingInCallCBA );
   309     UpdateCbaL( EPhoneCallHandlingInCallCBA );
   440     iStateMachine->ChangeState( EPhoneStateConference );        
   310     iStateMachine->ChangeState( EPhoneStateConference );        
   441     }
   311     }
   442 
   312 
   466     dialerParam.SetBoolean( ETrue );
   336     dialerParam.SetBoolean( ETrue );
   467     
   337     
   468     // Get allow waiting call header param value.
   338     // Get allow waiting call header param value.
   469     AllowShowingOfWaitingCallHeaderL( dialerParam );
   339     AllowShowingOfWaitingCallHeaderL( dialerParam );
   470     
   340     
   471     // Close conference list
       
   472     TPhoneCmdParamBoolean booleanParam;
       
   473     booleanParam.SetBoolean( EFalse );
       
   474     iViewCommandHandle->ExecuteCommandL( 
       
   475         EPhoneViewOpenConferenceList, &booleanParam );
       
   476 
       
   477     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   341     iViewCommandHandle->ExecuteCommandL( EPhoneViewCloseFSW );
   478     
   342     
   479     // Check if HW Keys or Call UI should be disabled
   343     // Check if HW Keys or Call UI should be disabled
   480     CheckDisableHWKeysAndCallUIL();
   344     CheckDisableHWKeysAndCallUIL();
   481     
   345     
   482     // Display incoming call
   346     // Display incoming call
   483     DisplayIncomingCallL( aCallId, dialerParam  );
   347     DisplayIncomingCallL( aCallId, dialerParam  );
   484 
   348 
   485     // Set touch controls
   349     // Set touch controls
   486     SetTouchPaneButtonDisabled( EPhoneCallComingCmdAnswer );
       
   487     SetTouchPaneButtons( EPhoneWaitingCallButtons );
   350     SetTouchPaneButtons( EPhoneWaitingCallButtons );
   488     
   351     
   489     EndUiUpdate();
   352     EndUiUpdate();
   490 
       
   491     TPhoneCmdParamBoolean conferenceAndSingleFlag;
       
   492     conferenceAndSingleFlag.SetBoolean( EFalse );
       
   493     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
       
   494         &conferenceAndSingleFlag );
       
   495     
   353     
   496     // Go to Conference And Single And Waiting state
   354     // Go to Conference And Single And Waiting state
   497     UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
   355     UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
   498     iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );                
   356     iStateMachine->ChangeState( EPhoneStateConferenceAndSingleAndWaiting );                
   499     }
   357     }
   505 void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId )
   363 void CPhoneConferenceAndSingle::HandleIdleL( TInt aCallId )
   506     {
   364     {
   507     __LOGMETHODSTARTEND( EPhoneUIStates, 
   365     __LOGMETHODSTARTEND( EPhoneUIStates, 
   508         "CPhoneConferenceAndSingle::HandleIdleL");
   366         "CPhoneConferenceAndSingle::HandleIdleL");
   509     
   367     
   510     // If dialler is not open then close menu bar.
       
   511     if ( !IsNumberEntryUsedL() )
       
   512         {
       
   513         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   514         }
       
   515     
       
   516     TPhoneCmdParamBoolean conferenceExistsForCallId;
   368     TPhoneCmdParamBoolean conferenceExistsForCallId;
   517     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
   369     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCallExistsInConference,
   518         aCallId, &conferenceExistsForCallId );
   370         aCallId, &conferenceExistsForCallId );
   519     
   371     
   520     if( conferenceExistsForCallId.Boolean() )
   372     if( conferenceExistsForCallId.Boolean() )
   521         {
   373         {
   522         // Remove conference member from conference bubble
   374         // Remove conference member from conference bubble
   523         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, 
   375         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveFromConference, 
   524             aCallId );                    
   376             aCallId );                    
   525 
       
   526         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateMaxConfMemberFlag );
       
   527         }
   377         }
   528     else
   378     else
   529         {       
   379         {       
   530         // Remove call
   380         // Remove call
   531         BeginUiUpdateLC(); 
   381         BeginUiUpdateLC(); 
   532         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   382         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   533 
   383 
   534         TPhoneCmdParamBoolean conferenceAndSingleFlag;
   384         SetTouchPaneButtons( EPhoneConferenceButtons );
   535         conferenceAndSingleFlag.SetBoolean( EFalse );
   385         
   536         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetConferenceAndSingleFlag, 
   386         UpdateCbaL( EPhoneCallHandlingInCallCBA );
   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       
   387       
   553 
   388 
   554         EndUiUpdate();
   389         EndUiUpdate();
   555 
   390 
   556         iStateMachine->ChangeState( EPhoneStateConference );
   391         iStateMachine->ChangeState( EPhoneStateConference );