phoneapp/phoneuicontrol/src/cphonestatecallsetup.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
child 69 8baf28733c3d
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDES
    19 // INCLUDES
    20 #include <featmgr.h>
    20 #include <featmgr.h>
    21 #include <StringLoader.h>
    21 #include <StringLoader.h> 
       
    22 #include <ScreensaverInternalPSKeys.h>
    22 #include <AknUtils.h>
    23 #include <AknUtils.h>
    23 #include <mpeengineinfo.h>
    24 #include <mpeengineinfo.h>
    24 #include <mpeclientinformation.h>
    25 #include <mpeclientinformation.h>
    25 
    26 
    26 #include "cphonepubsubproxy.h"
    27 #include "cphonepubsubproxy.h"
    80     {
    81     {
    81     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
    82     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
    82         Panic( EPhoneCtrlInvariant ) );
    83         Panic( EPhoneCtrlInvariant ) );
    83     
    84     
    84     CPhoneState::BaseConstructL();
    85     CPhoneState::BaseConstructL();
    85 
    86     
       
    87     // Enable the volume display
       
    88     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNaviPaneAudioVolume );   
    86     HandleAudioOutputChangedL();
    89     HandleAudioOutputChangedL();
       
    90 
       
    91     TPhoneCmdParamCallStateData callStateData;
       
    92     callStateData.SetCallState( EPEStateDialing );
       
    93     iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, &callStateData );
       
    94     if ( callStateData.CallId() > KErrNotFound && IsVideoCall( callStateData.CallId() ) )
       
    95         {
       
    96         CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
    97                         KPSUidScreenSaver,
       
    98                         KScreenSaverAllowScreenSaver,
       
    99                         EPhoneScreensaverNotAllowed );
       
   100         }
    87     }
   101     }
    88 
   102 
    89 // -----------------------------------------------------------
   103 // -----------------------------------------------------------
    90 // CPhoneStateCallSetup::NewL()
   104 // CPhoneStateCallSetup::NewL()
    91 // Constructor
   105 // Constructor
   117         "CPhoneStateCallSetup::HandleCommandL()" );
   131         "CPhoneStateCallSetup::HandleCommandL()" );
   118     TBool commandStatus = ETrue;
   132     TBool commandStatus = ETrue;
   119     
   133     
   120     switch( aCommand )
   134     switch( aCommand )
   121         {
   135         {
   122         case EPhoneInCallCmdDialer:
       
   123             iViewCommandHandle->ExecuteCommandL( EPhoneViewOpenDialer );
       
   124             break;
       
   125             
       
   126         case EPhoneNumberAcqCmdAddToContacts:
   136         case EPhoneNumberAcqCmdAddToContacts:
   127             {
   137             {
   128             // If call setup is ongoing then add to contacts query should
   138             // If call setup is ongoing then add to contacts query should
   129             // not be opened -> do nothing here.
   139             // not be opened -> do nothing here.
   130             }
   140             }
   153                 iDtmfWaitCharTimer = CPhoneDtmfWaitCharTimer::NewL( 
   163                 iDtmfWaitCharTimer = CPhoneDtmfWaitCharTimer::NewL( 
   154                     iStateMachine );                    
   164                     iStateMachine );                    
   155                 }
   165                 }
   156             iDtmfWaitCharTimer->ButtonPressedL();
   166             iDtmfWaitCharTimer->ButtonPressedL();
   157             break;
   167             break;
   158 
   168                 
       
   169         case EPhoneDialerCmdHelpDtmf:
       
   170             {
       
   171             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   172                 {                
       
   173                 TPtrC contextName( KDATA_DIALER_HLP_SEND_DTMF );
       
   174                 iViewCommandHandle->ExecuteCommandL( 
       
   175                     EPhoneViewLaunchHelpApplication,
       
   176                     0,
       
   177                     contextName );
       
   178                 }
       
   179             }
       
   180             break;
   159         
   181         
   160         case EPhoneCmdOptions:
   182         case EPhoneCmdOptions:
       
   183             OpenMenuBarL();
   161             break;
   184             break;
   162         
   185         
   163         case EPhoneInCallCmdDtmfManualQuery:
   186         case EPhoneInCallCmdDtmfManualQuery:
       
   187              if ( iOnScreenDialer )
       
   188                  {
       
   189                  ShowDtmfDialerL();
       
   190                  }
   164               break;    
   191               break;    
   165             
   192             
   166         case EPhoneDtmfDialerExit:      // fall through
   193         case EPhoneDtmfDialerExit:      // fall through
   167         case EPhoneDtmfDialerCancel:
   194         case EPhoneDtmfDialerCancel:
   168             break;
   195             CloseDTMFEditorL();
   169 
       
   170         case EPhoneInCallCmdMute: // fall through
       
   171         case EPhoneInCallCmdUnmute:
       
   172             iStateMachine->PhoneEngineInfo()->SetAudioMuteCommand( 
       
   173                 ( aCommand == EPhoneInCallCmdMute ) );
       
   174             iStateMachine->SendPhoneEngineMessage( 
       
   175                 MPEPhoneModel::EPEMessageSetAudioMute );
       
   176             break;
   196             break;
   177                                    
   197                                    
   178         default:
   198         default:
   179             commandStatus = CPhoneState::HandleCommandL( aCommand );
   199             commandStatus = CPhoneState::HandleCommandL( aCommand );
   180             break;
   200             break;
   181         }
   201         }
   182 
   202 
   183     return commandStatus;
   203     return commandStatus;
   184     }
   204     }
   185 
   205 
       
   206 // -----------------------------------------------------------
       
   207 // CPhoneStateCallSetup::OpenMenuBarL   
       
   208 // -----------------------------------------------------------
       
   209 //
       
   210 EXPORT_C void CPhoneStateCallSetup::OpenMenuBarL()
       
   211     {
       
   212     __LOGMETHODSTARTEND(EPhoneControl,  
       
   213         "CPhoneStateCallSetup::OpenMenuBarL()" );
       
   214 
       
   215     if ( iOnScreenDialer )
       
   216         {
       
   217         if ( IsDTMFEditorVisibleL() && IsNumberEntryVisibleL() )
       
   218             {
       
   219             TInt resourceId = EPhoneDtmfDialerMenubar;
       
   220             
       
   221             TPhoneCmdParamInteger integerParam;
       
   222             integerParam.SetInteger( 
       
   223                 CPhoneMainResourceResolver::Instance()->
       
   224                 ResolveResourceID( resourceId ) );
       
   225             iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, 
       
   226                 &integerParam );
       
   227             }
       
   228         }
       
   229     }
   186 
   230 
   187 // -----------------------------------------------------------
   231 // -----------------------------------------------------------
   188 // CPhoneStateCallSetup::HandleNumberEntryClearedL()
   232 // CPhoneStateCallSetup::HandleNumberEntryClearedL()
   189 // -----------------------------------------------------------
   233 // -----------------------------------------------------------
   190 //
   234 //
   196     // Update call setup CBA when number entry is cleared
   240     // Update call setup CBA when number entry is cleared
   197     UpdateInCallCbaL();
   241     UpdateInCallCbaL();
   198     }
   242     }
   199 
   243 
   200 // -----------------------------------------------------------
   244 // -----------------------------------------------------------
       
   245 // CPhoneStateCallSetup::HandleCreateNumberEntryL
       
   246 // -----------------------------------------------------------
       
   247 //
       
   248 EXPORT_C void CPhoneStateCallSetup::HandleCreateNumberEntryL( 
       
   249         const TKeyEvent& /*aKeyEvent*/,
       
   250         TEventCode /*aEventCode*/)
       
   251     {
       
   252     __LOGMETHODSTARTEND(EPhoneControl,  
       
   253         "CPhoneStateCallSetup::HandleCreateNumberEntryL()" );
       
   254     }
       
   255 
       
   256 // -----------------------------------------------------------
   201 // CPhoneStateCallSetup::UpdateInCallCbaL
   257 // CPhoneStateCallSetup::UpdateInCallCbaL
   202 // -----------------------------------------------------------
   258 // -----------------------------------------------------------
   203 //
   259 //
   204 EXPORT_C void CPhoneStateCallSetup::UpdateInCallCbaL()
   260 EXPORT_C void CPhoneStateCallSetup::UpdateInCallCbaL()
   205     {
   261     {
   212 // -----------------------------------------------------------
   268 // -----------------------------------------------------------
   213 //
   269 //
   214 EXPORT_C void CPhoneStateCallSetup::UpdateCbaL( TInt aResource )
   270 EXPORT_C void CPhoneStateCallSetup::UpdateCbaL( TInt aResource )
   215     {
   271     {
   216     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::UpdateCbaL() ");
   272     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::UpdateCbaL() ");
   217     iCbaManager->UpdateCbaL( aResource );   
   273     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   274         {
       
   275         iCbaManager->SetCbaL( EPhoneDtmfDialerCBA );        
       
   276         }
       
   277     else
       
   278         {
       
   279         iCbaManager->UpdateCbaL( aResource );   
       
   280         }
   218     }
   281     }
   219 
   282 
   220 // -----------------------------------------------------------
   283 // -----------------------------------------------------------
   221 // CPhoneStateCallSetup::HandleKeyEventL
   284 // CPhoneStateCallSetup::HandleKeyEventL
   222 // -----------------------------------------------------------
   285 // -----------------------------------------------------------
   308                     MPEPhoneModel::EPEMessageTerminateAllConnections );
   371                     MPEPhoneModel::EPEMessageTerminateAllConnections );
   309                 
   372                 
   310                 // Remove number entry if long press
   373                 // Remove number entry if long press
   311                 if ( IsNumberEntryUsedL() )
   374                 if ( IsNumberEntryUsedL() )
   312                     {
   375                     {
   313                     iViewCommandHandle->ExecuteCommandL( 
   376                     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
   314                         EPhoneViewRemoveNumberEntry );
   377                         {
       
   378                         CloseDTMFEditorL();
       
   379                         } 
       
   380                     else
       
   381                         {
       
   382                         iViewCommandHandle->ExecuteCommandL( 
       
   383                             EPhoneViewRemoveNumberEntry );
       
   384                         }
   315                     }
   385                     }
   316                 }
   386                 }
   317             else
   387             else
   318                 {                
   388                 {                
   319                 // handle end key
   389                 // handle end key
   332                 CPhoneState::SetHandsfreeModeL( !handsfreeMode );
   402                 CPhoneState::SetHandsfreeModeL( !handsfreeMode );
   333                 }
   403                 }
   334             else // aMessage == EPhoneKeyLongPress
   404             else // aMessage == EPhoneKeyLongPress
   335                 {
   405                 {
   336                 // Display call in progress information note
   406                 // Display call in progress information note
   337                 CPhoneState::SendGlobalInfoNoteL( EPhoneCallInProgress, ETrue );
   407                 CPhoneState::SendGlobalInfoNoteL( EPhoneCallInProgress );
   338                 }
   408                 }
   339             break;
   409             break;
   340 
   410 
   341         default:
   411         default:
   342             break;
   412             break;
   498 // CPhoneStateCallSetup::HandleConnectedL
   568 // CPhoneStateCallSetup::HandleConnectedL
   499 // -----------------------------------------------------------
   569 // -----------------------------------------------------------
   500 //
   570 //
   501 void CPhoneStateCallSetup::HandleConnectedL( TInt aCallId )
   571 void CPhoneStateCallSetup::HandleConnectedL( TInt aCallId )
   502     {
   572     {
   503     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleConnectedL()");
   573     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleConnectedL()");        
   504     // Keep Phone in the foreground
   574 
   505     TPhoneCmdParamBoolean booleanParam;
   575     // Close menu bar, if it is displayed
   506     booleanParam.SetBoolean( EFalse );
   576     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   507     iViewCommandHandle->ExecuteCommandL( 
       
   508         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
       
   509     
   577     
   510     BeginUiUpdateLC();
   578     BeginUiUpdateLC();
   511  
   579         
       
   580     // Remove the number entry if it isn't DTMF dialer
       
   581     if ( !iOnScreenDialer || !IsNumberEntryVisibleL() || !IsDTMFEditorVisibleL() )
       
   582         {
       
   583         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   584         }
       
   585     
   512     // Update the single call
   586     // Update the single call
   513     CPhoneState::UpdateSingleActiveCallL( aCallId );
   587     CPhoneState::UpdateSingleActiveCallL( aCallId );
   514             
   588         
       
   589     // Complete sat request
       
   590     if ( iStateMachine->PhoneEngineInfo()->CallOrigin( aCallId ) == EPECallOriginSAT )
       
   591         {
       
   592         CompleteSatRequestL( aCallId );
       
   593         }
       
   594         
   515     // Update touch buttons
   595     // Update touch buttons
   516     SetTouchPaneButtons( EPhoneIncallButtons );        
   596     SetTouchPaneButtons( EPhoneIncallButtons );        
   517 
   597 
       
   598     SetToolbarDimming( EFalse );
       
   599 
   518     EndUiUpdate();
   600     EndUiUpdate();
   519     
   601     
   520     // Go to single state
   602     // Go to single state
   521     UpdateCbaL( EPhoneCallHandlingInCallCBA );    
   603     UpdateCbaL( EPhoneCallHandlingInCallCBA );    
   522 
   604 
   528 // -----------------------------------------------------------
   610 // -----------------------------------------------------------
   529 //
   611 //
   530 void CPhoneStateCallSetup::HandleIdleL( TInt aCallId )
   612 void CPhoneStateCallSetup::HandleIdleL( TInt aCallId )
   531     {
   613     {
   532     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleIdleL()");
   614     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleIdleL()");
   533     
   615     if ( !NeedToReturnToForegroundAppL() &&
   534     BeginUiUpdateLC ();
   616          IsNumberEntryUsedL() )
       
   617         {
       
   618         BeginTransEffectLC( ECallUiDisappear );
       
   619         }
       
   620     else 
       
   621         {
       
   622         BeginTransEffectLC( ENumberEntryOpen );
       
   623         }
       
   624     BeginUiUpdateLC();
   535     
   625     
   536     // Disable the volume display
   626     // Disable the volume display
   537     iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
   627     iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
   538 
   628 
   539     // Remove call 
   629     // Remove call 
   542        
   632        
   543     CheckIfRestoreNEContentAfterDtmfDialer();
   633     CheckIfRestoreNEContentAfterDtmfDialer();
   544       
   634       
   545     if ( IsNumberEntryUsedL() )
   635     if ( IsNumberEntryUsedL() )
   546         {
   636         {
   547         // Show the number entry if it exists
   637         if ( NeedToReturnToForegroundAppL() )
   548         SetNumberEntryVisibilityL(ETrue);    
   638             {
       
   639             // Return phone to the background if send to background is needed.
       
   640             iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground );
       
   641     
       
   642             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility );
       
   643     
       
   644             // Set Number Entry CBA
       
   645             iCbaManager->SetCbaL( EPhoneNumberAcqCBA );
       
   646             }
       
   647         else
       
   648             {
       
   649             // Show the number entry if it exists
       
   650             SetNumberEntryVisibilityL(ETrue);
       
   651             }
   549         }    
   652         }    
   550     else if ( NeedToSendToBackgroundL() )
   653     else if ( NeedToReturnToForegroundAppL() )
   551         {
   654         {
   552         __PHONELOG( EBasic,EPhoneControl,"CPhoneStateCallSetup::elseif1");
   655         __PHONELOG( EBasic,EPhoneControl,"CPhoneStateCallSetup::elseif1");
   553         // Continue displaying current app but set up the 
   656         // Continue displaying current app but set up the 
   554         // idle screen in the background
   657         // idle screen in the background
   555         SetupIdleScreenInBackgroundL();
   658         SetupIdleScreenInBackgroundL();
   560          // Display idle screen
   663          // Display idle screen
   561         DisplayIdleScreenL();
   664         DisplayIdleScreenL();
   562         }
   665         }
   563         
   666         
   564     EndUiUpdate();
   667     EndUiUpdate();
   565     // Go to idle state
   668     EndTransEffect(); 
   566     // No need update cba
   669     // No need update cba
   567     iStateMachine->ChangeState( EPhoneStateIdle );
   670     iStateMachine->ChangeState( EPhoneStateIdle );
   568     }
   671     }
   569 
   672 
   570 // -----------------------------------------------------------------------------
   673 // -----------------------------------------------------------------------------
   571 // CPhoneStateCallSetup::HandleRemoteTerminatedL
   674 // CPhoneStateCallSetup::HandleRemoteTerminatedL
   572 // -----------------------------------------------------------------------------
   675 // -----------------------------------------------------------------------------
   573 //
   676 //
   574 void CPhoneStateCallSetup::HandleRemoteTerminatedL( TInt /*aCallId*/ )
   677 void CPhoneStateCallSetup::HandleRemoteTerminatedL( TInt aCallId )
   575     {
   678     {
   576     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleRemoteTerminatedL( ) ");
   679     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleRemoteTerminatedL( ) ");
   577 
   680 
   578     // Remove call header
   681     // Remove call header
   579     /*iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   682     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   580     
   683     
   581     TPhoneCmdParamBoolean globalNotifierParam;
   684     TPhoneCmdParamBoolean globalNotifierParam;
   582     globalNotifierParam.SetBoolean( EFalse );
   685     globalNotifierParam.SetBoolean( EFalse );
   583     iViewCommandHandle->ExecuteCommandL( 
   686     iViewCommandHandle->ExecuteCommandL( 
   584         EPhoneViewSetGlobalNotifiersDisabled, &globalNotifierParam );*/
   687         EPhoneViewSetGlobalNotifiersDisabled, &globalNotifierParam );
   585 
   688 
   586     // Video call not possible note is shown by 
   689     // Video call not possible note is shown by 
   587     // CPhoneErrorMessagesHandler::ShowErrorSpecificNoteL method,
   690     // CPhoneErrorMessagesHandler::ShowErrorSpecificNoteL method,
   588     // if error ECCPErrorCCResourceNotAvailable occured.
   691     // if error ECCPErrorCCResourceNotAvailable occured.
   589     }    
   692     }    
   593 // -----------------------------------------------------------------------------
   696 // -----------------------------------------------------------------------------
   594 //    
   697 //    
   595 void CPhoneStateCallSetup::HandleAudioOutputChangedL()
   698 void CPhoneStateCallSetup::HandleAudioOutputChangedL()
   596     {
   699     {
   597     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleAudioOutputChangedL( ) ");
   700     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateCallSetup::HandleAudioOutputChangedL( ) ");
   598        
   701    
   599     CPhoneState::HandleAudioOutputChangedL();
       
   600     // Update the call setup CBA
   702     // Update the call setup CBA
   601     UpdateInCallCbaL();
   703     UpdateInCallCbaL();
   602     SetTouchPaneButtons(0);
   704     
       
   705     CPhoneState::HandleAudioOutputChangedL();
   603     }
   706     }
   604  
   707  
   605 // -----------------------------------------------------------
   708 // -----------------------------------------------------------
   606 // CPhoneStateCallSetup::SendDtmfL
   709 // CPhoneStateCallSetup::SendDtmfL
   607 // -----------------------------------------------------------
   710 // -----------------------------------------------------------
   617     TPhoneCmdParamString dtmfSequence;
   720     TPhoneCmdParamString dtmfSequence;
   618     HBufC *content = HBufC::NewLC( KPEDtmfMaxLength );
   721     HBufC *content = HBufC::NewLC( KPEDtmfMaxLength );
   619     TPtr ptr( content->Des() );
   722     TPtr ptr( content->Des() );
   620     dtmfSequence.SetString( &ptr );
   723     dtmfSequence.SetString( &ptr );
   621     
   724     
   622     if ( iOnScreenDialer )
   725     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
   623         {
   726         {
   624         iViewCommandHandle->ExecuteCommand(
   727         iViewCommandHandle->ExecuteCommand(
   625             EPhoneViewGetNumberFromEntry,
   728             EPhoneViewGetNumberFromEntry,
   626             &dtmfSequence );  
   729             &dtmfSequence );  
   627         }     
   730                     
       
   731         CloseDTMFEditorL();
       
   732         }
       
   733     else
       
   734         {
       
   735         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetTextQueryContent,
       
   736                                              &dtmfSequence );
       
   737         }        
   628 
   738 
   629     // Send the DTMF
   739     // Send the DTMF
   630     if ( ptr.Length() )
   740     if ( ptr.Length() )
   631         {
   741         {
   632         iStateMachine->PhoneEngineInfo()->SetDtmfStringCommand( ptr );
   742         iStateMachine->PhoneEngineInfo()->SetDtmfStringCommand( ptr );