phoneapp/phoneuistates/src/cphonesingleandwaiting.cpp
changeset 56 5bcb308bd24d
parent 37 ba76fc04e6c2
child 65 2a5d4ab426d3
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
    64 // (other items were commented in a header).
    64 // (other items were commented in a header).
    65 // -----------------------------------------------------------
    65 // -----------------------------------------------------------
    66 //
    66 //
    67 CPhoneSingleAndWaiting::~CPhoneSingleAndWaiting()
    67 CPhoneSingleAndWaiting::~CPhoneSingleAndWaiting()
    68     {
    68     {
    69     if ( iViewCommandHandle )
    69 
    70         {
       
    71         TPhoneCmdParamBoolean dtmfSendFlag;
       
    72         dtmfSendFlag.SetBoolean( EFalse );
       
    73         iViewCommandHandle->ExecuteCommand( EPhoneViewSetVideoCallDTMFVisibilityFlag,
       
    74                 &dtmfSendFlag );
       
    75         }
       
    76     }
    70     }
    77 
    71 
    78 // -----------------------------------------------------------
    72 // -----------------------------------------------------------
    79 // CPhoneSingleAndWaiting::ConstructL()
    73 // CPhoneSingleAndWaiting::ConstructL()
    80 // Constructor
    74 // Constructor
   189                 CPEPhoneModelIF::EPEMessageResume );
   183                 CPEPhoneModelIF::EPEMessageResume );
   190             break;
   184             break;
   191             }
   185             }
   192 
   186 
   193         case EPhoneInCallCmdNewCall:
   187         case EPhoneInCallCmdNewCall:
   194             LaunchNewCallQueryL();
       
   195             break;
   188             break;
   196 
   189 
   197         case EPhoneInCallCmdNewCallCall:
   190         case EPhoneInCallCmdNewCallCall:
   198             CallFromNewCallQueryL();
       
   199             break;
   191             break;
   200 
   192 
   201         case EPhoneCallComingCmdReject: // fall through
   193         case EPhoneCallComingCmdReject: // fall through
   202             {
   194             {
   203             // Get waiting callid
   195             // Get waiting callid
   226             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   218             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   227             break;
   219             break;
   228         }
   220         }
   229 
   221 
   230     return commandStatus;
   222     return commandStatus;
   231     }
       
   232 
       
   233 // -----------------------------------------------------------
       
   234 // CPhoneSingleAndWaiting::OpenMenuBarL
       
   235 // -----------------------------------------------------------
       
   236 //
       
   237 void CPhoneSingleAndWaiting::OpenMenuBarL()
       
   238     {
       
   239     __LOGMETHODSTARTEND( EPhoneUIStates,
       
   240         "CPhoneSingleAndWaiting::OpenMenuBarL() ");
       
   241     TInt resourceId ( KErrNone );
       
   242 
       
   243 
       
   244     if ( !IsAutoLockOn() )
       
   245         {
       
   246          if( IsVideoCallActiveL() || IsVideoCallRingingL() )
       
   247             {
       
   248             //DTMF hiding will be set to TRUE
       
   249             if( IsVideoCallActiveL() )
       
   250                 {
       
   251                 TPhoneCmdParamBoolean dtmfSendFlag;
       
   252                 dtmfSendFlag.SetBoolean( ETrue );
       
   253                 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetVideoCallDTMFVisibilityFlag,
       
   254                         &dtmfSendFlag );
       
   255                 }
       
   256             if ( IsNumberEntryVisibleL() )
       
   257                 {
       
   258                 resourceId = EPhoneVideoCallWaitingMenubarWithNumberEntry;
       
   259                 }
       
   260             else
       
   261                 {
       
   262                 resourceId = EPhoneVideoCallWaitingMenubar;
       
   263                 }
       
   264             }
       
   265 
       
   266         else // single voice and waiting voice
       
   267             {
       
   268             if ( IsNumberEntryVisibleL() )
       
   269                 {
       
   270                 resourceId = EPhoneCallWaitingMenubarWithNumberEntry;
       
   271                 }
       
   272             else
       
   273                 {
       
   274                 resourceId = EPhoneCallWaitingMenubar;
       
   275                 }
       
   276             }
       
   277         }
       
   278     else
       
   279         {
       
   280         resourceId = EPhoneCallWaitingLockMenubar;
       
   281         }
       
   282 
       
   283 
       
   284     TPhoneCmdParamInteger integerParam;
       
   285     integerParam.SetInteger(
       
   286         CPhoneMainResourceResolver::Instance()->
       
   287         ResolveResourceID( resourceId ) );
       
   288     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
       
   289         &integerParam );
       
   290     }
   223     }
   291 
   224 
   292 // --------------------------------------------------------------
   225 // --------------------------------------------------------------
   293 // CPhoneSingleAndWaiting::HandleKeyMessageL
   226 // CPhoneSingleAndWaiting::HandleKeyMessageL
   294 // --------------------------------------------------------------
   227 // --------------------------------------------------------------
   352 //
   285 //
   353 void CPhoneSingleAndWaiting::HandleIdleL( TInt aCallId )
   286 void CPhoneSingleAndWaiting::HandleIdleL( TInt aCallId )
   354     {
   287     {
   355     __LOGMETHODSTARTEND( EPhoneUIStates,
   288     __LOGMETHODSTARTEND( EPhoneUIStates,
   356         "CPhoneSingleAndWaiting::HandleIdleL() ");
   289         "CPhoneSingleAndWaiting::HandleIdleL() ");
   357     // Close menu bar, if it is displayed
       
   358     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   359 
   290 
   360     if ( iSingleCallId == KErrNotFound )
   291     if ( iSingleCallId == KErrNotFound )
   361         {
   292         {
   362         TPhoneCmdParamCallStateData callStateData;
   293         TPhoneCmdParamCallStateData callStateData;
   363         callStateData.SetCallState( EPEStateDisconnecting );
   294         callStateData.SetCallState( EPEStateDisconnecting );
   432 
   363 
   433             // Check if HW Keys or Call UI should be disabled
   364             // Check if HW Keys or Call UI should be disabled
   434             CheckDisableHWKeysAndCallUIL();
   365             CheckDisableHWKeysAndCallUIL();
   435             
   366             
   436             SetTouchPaneButtons( EPhoneIncomingCallButtons );
   367             SetTouchPaneButtons( EPhoneIncomingCallButtons );
   437             SetTouchPaneButtonEnabled( EPhoneCallComingCmdSilent );
       
   438             
   368             
   439             // Bring up callhandling view
   369             // Bring up callhandling view
   440             BringIncomingToForegroundL();
   370             BringIncomingToForegroundL();
   441 
   371 
   442             //Set incoming cba
   372             //Set incoming cba
   443             iCbaManager->UpdateIncomingCbaL( callStateData.CallId() );
   373             iCbaManager->UpdateIncomingCbaL( callStateData.CallId() );
   444             UpdateSilenceButtonDimming();
       
   445             
   374             
   446             // Play ringtone
   375             // Play ringtone
   447             SetRingingTonePlaybackL( callStateData.CallId() );
   376             SetRingingTonePlaybackL( callStateData.CallId() );
   448             }
   377             }
   449         SetToolbarDimming( ETrue );
   378 
   450         SetBackButtonActive(EFalse);
   379         SetBackButtonActive(EFalse);
   451         EndUiUpdate();
   380         EndUiUpdate();
   452 
   381 
   453         iStateMachine->ChangeState( EPhoneStateIncoming );
   382         iStateMachine->ChangeState( EPhoneStateIncoming );
   454         }
   383         }
   455     else
   384     else
   456         {
   385         {
   457         // Effect is shown when dialer exist.
       
   458         TBool effectStarted ( EFalse );
       
   459         if ( !NeedToSendToBackgroundL() )
       
   460             {
       
   461             BeginTransEffectLC( ENumberEntryOpen );
       
   462             effectStarted = ETrue;
       
   463             }
       
   464 
   386 
   465         BeginUiUpdateLC();
   387         BeginUiUpdateLC();
   466 
   388 
   467         // Remove call
   389         // Remove call
   468         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   390         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   472             {
   394             {
   473             if ( NeedToSendToBackgroundL() )
   395             if ( NeedToSendToBackgroundL() )
   474                 {
   396                 {
   475                 // Return phone to the background if send to background is needed.
   397                 // Return phone to the background if send to background is needed.
   476                 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   398                 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   477 
       
   478                 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
       
   479 
   399 
   480                 UpdateCbaL( EPhoneCallHandlingInCallCBA );
   400                 UpdateCbaL( EPhoneCallHandlingInCallCBA );
   481                 }
   401                 }
   482             else
   402             else
   483                 {
   403                 {
   507         // Reset blocked keys list
   427         // Reset blocked keys list
   508         iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   428         iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   509 
   429 
   510         SetTouchPaneButtons( EPhoneIncallButtons );
   430         SetTouchPaneButtons( EPhoneIncallButtons );
   511         EndUiUpdate();
   431         EndUiUpdate();
   512         if( effectStarted )
   432 
   513             {
       
   514             EndTransEffect();
       
   515             }
       
   516         // CBA updates in above if-else conditions
   433         // CBA updates in above if-else conditions
   517         iStateMachine->ChangeState( EPhoneStateSingle );
   434         iStateMachine->ChangeState( EPhoneStateSingle );
   518         }
   435         }
   519 
   436 
   520     }
   437     }
   588 //
   505 //
   589 void CPhoneSingleAndWaiting::HandleUnholdL( TInt aCallId )
   506 void CPhoneSingleAndWaiting::HandleUnholdL( TInt aCallId )
   590     {
   507     {
   591     __LOGMETHODSTARTEND( EPhoneUIStates,
   508     __LOGMETHODSTARTEND( EPhoneUIStates,
   592         "CPhoneSingleAndWaiting::HandleUnholdL() ");
   509         "CPhoneSingleAndWaiting::HandleUnholdL() ");
   593     // Close menu if focus is somewhere else than number entry.
       
   594     if ( !IsNumberEntryUsedL() )
       
   595         {
       
   596         // Close menubar
       
   597         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   598         }
       
   599 
   510 
   600     // Show bubble
   511     // Show bubble
   601     TPhoneCmdParamCallHeaderData callHeaderParam;
   512     TPhoneCmdParamCallHeaderData callHeaderParam;
   602     callHeaderParam.SetCallState( EPEStateConnected );
   513     callHeaderParam.SetCallState( EPEStateConnected );
   603     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   514     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   625 //
   536 //
   626 void CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL( TInt aCallId )
   537 void CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL( TInt aCallId )
   627     {
   538     {
   628     __LOGMETHODSTARTEND( EPhoneUIStates,
   539     __LOGMETHODSTARTEND( EPhoneUIStates,
   629         "CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL() ");
   540         "CPhoneSingleAndWaiting::MakeStateTransitionToTwoSinglesL() ");
   630 
       
   631     // Effect is shown when dialer exist.
       
   632     TBool effectStarted ( EFalse );
       
   633     if ( !NeedToSendToBackgroundL() )
       
   634         {
       
   635         BeginTransEffectLC( ENumberEntryOpen );
       
   636         effectStarted = ETrue;
       
   637         }
       
   638     
   541     
   639     // Reset blocked keys list
   542     // Reset blocked keys list
   640     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   543     iStateMachine->PhoneStorage()->ResetBlockedKeysList();
   641     
   544     
   642     BeginUiUpdateLC();
   545     BeginUiUpdateLC();
   658         if ( NeedToSendToBackgroundL() )
   561         if ( NeedToSendToBackgroundL() )
   659             {
   562             {
   660             // Return phone to the background if send to background is needed.
   563             // Return phone to the background if send to background is needed.
   661             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   564             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
   662 
   565 
   663             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
       
   664 
       
   665             UpdateCbaL( EPhoneCallHandlingInCallCBA );
   566             UpdateCbaL( EPhoneCallHandlingInCallCBA );
   666             }
   567             }
   667         else
   568         else
   668             {
   569             {
   669             // Show the number entry if it exists.
   570             // Show the number entry if it exists.
   674         {
   575         {
   675         // Set Two singles softkeys
   576         // Set Two singles softkeys
   676         UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA );
   577         UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA );
   677         }
   578         }
   678 
   579 
   679     // Close dtmf dialer if exist.
       
   680     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   681         {
       
   682         CloseDTMFEditorL();
       
   683         }
       
   684     else if ( iOnScreenDialer && IsCustomizedDialerVisibleL() )
       
   685         {
       
   686         CloseCustomizedDialerL();
       
   687         }
       
   688 
       
   689     SetTouchPaneButtons( EPhoneTwoSinglesButtons );
   580     SetTouchPaneButtons( EPhoneTwoSinglesButtons );
   690     EndUiUpdate();
   581     EndUiUpdate();
   691     if( effectStarted )
       
   692         {
       
   693         EndTransEffect();
       
   694         }
       
   695 
   582 
   696     // Go to two singles state
   583     // Go to two singles state
   697     // CBA updates in above if-else conditions
   584     // CBA updates in above if-else conditions
   698     iStateMachine->ChangeState( EPhoneStateTwoSingles );
   585     iStateMachine->ChangeState( EPhoneStateTwoSingles );
   699     }
   586     }
   700 
   587 
   701 // ---------------------------------------------------------
       
   702 // CPhoneSingleAndWaiting::CallFromNewCallQueryL
       
   703 // ---------------------------------------------------------
       
   704 //
       
   705 void CPhoneSingleAndWaiting::CallFromNewCallQueryL()
       
   706     {
       
   707     __LOGMETHODSTARTEND( EPhoneUIStates,
       
   708         "CPhoneSingleAndWaiting::CallFromNewCallQueryL() ");
       
   709     // First get the phone number from the dialog
       
   710     TPhoneCmdParamString phoneNumberParam;
       
   711     HBufC *content = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
   712     TPtr ptr( content->Des() );
       
   713     phoneNumberParam.SetString( &ptr );
       
   714     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetTextQueryContent,
       
   715         &phoneNumberParam );
       
   716 
       
   717     // Store the phone number
       
   718     iStateMachine->PhoneEngineInfo()->SetPhoneNumber( ptr );
       
   719 
       
   720     // clean up stack
       
   721     CleanupStack::PopAndDestroy( content );
       
   722 
       
   723     DialVoiceCallL();
       
   724     }
       
   725 
       
   726 // -----------------------------------------------------------
   588 // -----------------------------------------------------------
   727 // CPhoneSingleAndWaiting::HandleDiallingL
   589 // CPhoneSingleAndWaiting::HandleDiallingL
   728 // -----------------------------------------------------------
   590 // -----------------------------------------------------------
   729 //
   591 //
   730 void CPhoneSingleAndWaiting::HandleDiallingL( TInt aCallId )
   592 void CPhoneSingleAndWaiting::HandleDiallingL( TInt aCallId )
   731     {
   593     {
   732     __LOGMETHODSTARTEND( EPhoneUIStates,
   594     __LOGMETHODSTARTEND( EPhoneUIStates,
   733         "CPhoneSingleAndWaiting::HandleDiallingL() ");
   595         "CPhoneSingleAndWaiting::HandleDiallingL() ");
   734 
   596 
   735     BeginTransEffectLC( ENumberEntryClose );
       
   736     BeginUiUpdateLC();
   597     BeginUiUpdateLC();
   737 
   598 
   738     // Hide number entry if it exists
   599     // Hide number entry if it exists
   739     SetNumberEntryVisibilityL(EFalse);
   600     SetNumberEntryVisibilityL(EFalse);
   740 
   601 
   747     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
   608     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag );
   748 
   609 
   749     SetTouchPaneButtons( EPhoneCallSetupButtons );
   610     SetTouchPaneButtons( EPhoneCallSetupButtons );
   750 
   611 
   751     EndUiUpdate();
   612     EndUiUpdate();
   752     EndTransEffect();
       
   753 
   613 
   754     // Update call setup CBAs
   614     // Update call setup CBAs
   755     UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   615     UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   756 
   616 
   757     // Go to Single And Waiting And Call Setup state
   617     // Go to Single And Waiting And Call Setup state
   764 //
   624 //
   765 void CPhoneSingleAndWaiting::DisplayCallSetupL( TInt aCallId )
   625 void CPhoneSingleAndWaiting::DisplayCallSetupL( TInt aCallId )
   766     {
   626     {
   767     __LOGMETHODSTARTEND( EPhoneUIStates,
   627     __LOGMETHODSTARTEND( EPhoneUIStates,
   768         "CPhoneSingleAndWaiting::DisplayCallSetupL() ");
   628         "CPhoneSingleAndWaiting::DisplayCallSetupL() ");
   769     // Close menu bar, if it is displayed
       
   770     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   771 
   629 
   772     // Remove dialogs if necessary
   630     // Remove dialogs if necessary
   773     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   631     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemovePhoneDialogs );
   774 
   632 
   775     // Capture keys when the phone is dialling
   633     // Capture keys when the phone is dialling