phoneapp/phoneuicontrol/src/cphonecbamanager.cpp
branchRCL_3
changeset 24 41a7f70b3818
parent 10 ba54057fe027
child 25 5266b1f337bd
equal deleted inserted replaced
23:40a3f856b14d 24:41a7f70b3818
    20 #include "mpeengineinfo.h"
    20 #include "mpeengineinfo.h"
    21 #include "mphoneviewcommandhandle.h"
    21 #include "mphoneviewcommandhandle.h"
    22 #include "mphonestatemachine.h"
    22 #include "mphonestatemachine.h"
    23 
    23 
    24 #include <featmgr.h>
    24 #include <featmgr.h>
    25 #include <callhandlingui.rsg>
       
    26 
    25 
    27 #include "phonerssbase.h"
    26 #include "phonerssbase.h"
    28 #include "phoneui.pan"
    27 #include "phoneui.pan"
    29 #include "phonelogger.h"
    28 #include "phonelogger.h"
    30 
    29 
    36 #include "phoneui.hrh"
    35 #include "phoneui.hrh"
    37 
    36 
    38 #include "tphonecmdparamboolean.h"
    37 #include "tphonecmdparamboolean.h"
    39 #include "tphonecmdparaminteger.h"
    38 #include "tphonecmdparaminteger.h"
    40 #include "tphonecmdparamcallstatedata.h"
    39 #include "tphonecmdparamcallstatedata.h"
    41 #include "mphonesecuritymodeobserver.h"
    40 #include "tphonecmdparamboolean.h"
    42 
    41 
    43 
    42 
    44 // ======== MEMBER FUNCTIONS ========
    43 // ======== MEMBER FUNCTIONS ========
    45 
    44 
    46 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
   112     const TPEAudioOutput audioOutput =
   111     const TPEAudioOutput audioOutput =
   113         iStateMachine.PhoneEngineInfo()->AudioOutput();
   112         iStateMachine.PhoneEngineInfo()->AudioOutput();
   114 
   113 
   115     TBool btAvailable = iStateMachine.PhoneEngineInfo()->AudioOutputAvailable(
   114     TBool btAvailable = iStateMachine.PhoneEngineInfo()->AudioOutputAvailable(
   116         EPEBTAudioAccessory );
   115         EPEBTAudioAccessory );
   117 
   116     
       
   117     TPhoneCmdParamBoolean btParam;
       
   118     btParam.SetBoolean( audioOutput == EPEBTAudioAccessory );        
       
   119     iViewCommandHandle.ExecuteCommand(EPhoneViewSetBlueToothFlag,&btParam);
       
   120 
       
   121     TPhoneCmdParamBoolean btAvailableParam;
       
   122     btAvailableParam.SetBoolean( btAvailable );        
       
   123     iViewCommandHandle.ExecuteCommand(
       
   124             EPhoneViewSetBluetoothAvailableFlag,&btAvailableParam);
       
   125     
   118     // Call setup cases
   126     // Call setup cases
   119     
       
   120     if ( EPhoneCallHandlingCallSetupCBA == aResource )
   127     if ( EPhoneCallHandlingCallSetupCBA == aResource )
   121         {
   128         {
   122         if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling) )
   129         if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling) )
   123             {
   130             {
   124             if ( audioOutput == EPELoudspeaker )
   131             if ( audioOutput == EPELoudspeaker )
   131                 }
   138                 }
   132             }
   139             }
   133         }
   140         }
   134 
   141 
   135     // Is numberentry visible
   142     // Is numberentry visible
   136     else if ( iState->IsNumberEntryUsedL() && iState->IsNumberEntryVisibleL() )
   143     else if ( iState->IsNumberEntryUsedL() )
   137         {
   144         {
   138         if ( iState->IsAutoLockOn() || !(iState->IsSimOk()) )
   145         if ( iState->IsAutoLockOn() || !(iState->IsSimOk()) )
   139             {
   146             {
   140             resourceId = EPhoneEmptyBackCBA;
   147             resourceId = EPhoneEmptyBackCBA;
   141             }
   148             }
   142         else
   149         else
   143             {
   150             {
   144             resourceId = GetNumberEntryCbaIdL();
   151             TPhoneCmdParamInteger activeCallCount;
   145             }
   152             iViewCommandHandle.ExecuteCommandL(
   146         }
   153                     EPhoneViewGetCountOfActiveCalls, &activeCallCount );
   147 
   154             
   148     // Check if Audio is muted
   155             TPhoneCmdParamCallStateData callStateData;
   149     else if ( iStateMachine.PhoneEngineInfo()->AudioMute() &&
   156             callStateData.SetCallState( EPEStateRinging );
   150         !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ))
   157             iViewCommandHandle.HandleCommandL(
       
   158                     EPhoneViewGetCallIdByState, &callStateData );
       
   159             
       
   160             TInt incomingCall = callStateData.CallId();
       
   161 
       
   162             if( activeCallCount.Integer() == ENoActiveCalls )
       
   163                 {
       
   164                 resourceId = EPhoneNumberAcqCBA;
       
   165                 }
       
   166             else if ( activeCallCount.Integer() > ENoActiveCalls &&  
       
   167                       incomingCall > KErrNotFound )
       
   168                 {
       
   169                 resourceId = EPhoneCallHandlingCallWaitingCBA;
       
   170                 }
       
   171             else
       
   172                 {
       
   173                 resourceId = EPhoneInCallNumberAcqCBA;
       
   174                 }
       
   175             }
       
   176         }
       
   177 
       
   178     // Check is Audio muted
       
   179     else if ( iStateMachine.PhoneEngineInfo()->AudioMute() )
   151         {
   180         {
   152         resourceId = EPhoneCallHandlingInCallUnmuteCBA;
   181         resourceId = EPhoneCallHandlingInCallUnmuteCBA;
   153         }
   182         }
   154 
   183 
   155     // Multicall swap
   184     // Multicall swap
   239 
   268 
   240     // Update soft reject flag
   269     // Update soft reject flag
   241     TBool softRejectActivated( ETrue );
   270     TBool softRejectActivated( ETrue );
   242     // VoIP calls do not support sms sending
   271     // VoIP calls do not support sms sending
   243     if ( iStateMachine.PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP 
   272     if ( iStateMachine.PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP 
   244     	|| iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() == 0 )
   273         || iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() == 0 )
   245     	{
   274         {
   246     	softRejectActivated = EFalse;
   275         softRejectActivated = EFalse;
   247     	}
   276         }
   248     TPhoneCmdParamBoolean softRejectParam;
       
   249     softRejectParam.SetBoolean( softRejectActivated );
       
   250     iViewCommandHandle.ExecuteCommandL( EPhoneViewSetSoftRejectFlag,
       
   251         &softRejectParam );
       
   252 
   277 
   253     TInt incomingCbaResourceId;
   278     TInt incomingCbaResourceId;
   254     
       
   255     TBool securityMode = iStateMachine.SecurityMode()->IsSecurityMode();
       
   256 
   279 
   257     if ( iState->IsSwivelClosed() )
   280     if ( iState->IsSwivelClosed() )
   258         {
   281         {
   259         if ( securityMode )
   282         if ( !callIsAlerting || iRingtoneSilenced )
   260         	{
       
   261         	incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSliderCBA;
       
   262         	}
       
   263         else if ( !callIsAlerting || iRingtoneSilenced )
       
   264             {
   283             {
   265             incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSwivelClosedCBA;
   284             incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSwivelClosedCBA;
   266             }
   285             }
   267         else
   286         else
   268             {
   287             {
   270             }
   289             }
   271         }
   290         }
   272 
   291 
   273     else if ( coverHideSendEndKey )
   292     else if ( coverHideSendEndKey )
   274         {
   293         {
   275         if ( securityMode )
   294         if ( callIsAlerting )
   276         	{
       
   277         	// Set CBA to Options..Reject
       
   278         	incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSliderCBA;
       
   279         	}
       
   280         else if ( callIsAlerting )
       
   281             {
   295             {
   282             // Set CBA to Options..Silence
   296             // Set CBA to Options..Silence
   283             incomingCbaResourceId = EPhoneCallHandlingIncomingSliderCBA;
   297             incomingCbaResourceId = EPhoneCallHandlingIncomingSliderCBA;
   284             }
   298             }
   285         else if ( softRejectActivated )
   299         else if ( softRejectActivated )
   294             }
   308             }
   295         }
   309         }
   296 
   310 
   297     else
   311     else
   298         {
   312         {
   299         if ( securityMode && callIsAlerting )
   313         if ( callIsAlerting )
   300             {
       
   301             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
       
   302             }
       
   303         else if ( securityMode )
       
   304             {
       
   305             incomingCbaResourceId = EPhoneCallHandlingIncomingRejectCBA;
       
   306             }
       
   307         else if ( callIsAlerting )
       
   308             {
   314             {
   309             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
   315             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
   310             }
   316             }
   311         else if ( softRejectActivated )
   317         else if ( softRejectActivated )
   312             {
   318             {
   332 
   338 
   333     __PHONELOG1( EBasic, EPhoneControl,
   339     __PHONELOG1( EBasic, EPhoneControl,
   334             "CPhoneCbaManager::SetCbaL : %d",aResource );
   340             "CPhoneCbaManager::SetCbaL : %d",aResource );
   335 
   341 
   336     TPhoneCmdParamInteger integerParam;
   342     TPhoneCmdParamInteger integerParam;
   337     
   343     integerParam.SetInteger(
   338     if ( EPhoneEasyDialingCba == aResource )
   344         CPhoneMainResourceResolver::Instance()->ResolveResourceID(
   339         {
   345         aResource ) );
   340         iViewCommandHandle.ExecuteCommandL( EPhoneViewGetEasyDialingCbaId, &integerParam );
       
   341         }
       
   342     else
       
   343         {
       
   344         integerParam.SetInteger(
       
   345             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
       
   346             aResource ) );
       
   347         }
       
   348 
       
   349     iViewCommandHandle.ExecuteCommandL( EPhoneViewUpdateCba,
   346     iViewCommandHandle.ExecuteCommandL( EPhoneViewUpdateCba,
   350         &integerParam );
   347         &integerParam );
   351     }
   348     }
   352 
   349 
   353 // -----------------------------------------------------------
   350 // -----------------------------------------------------------
   452 // -----------------------------------------------------------
   449 // -----------------------------------------------------------
   453 // CPhoneCbaManager::GetIncomingCallSilenceCBA
   450 // CPhoneCbaManager::GetIncomingCallSilenceCBA
   454 // -----------------------------------------------------------
   451 // -----------------------------------------------------------
   455 //
   452 //
   456 TInt CPhoneCbaManager::GetIncomingCallSilenceCBA( 
   453 TInt CPhoneCbaManager::GetIncomingCallSilenceCBA( 
   457         const TBool aSoftRejectActivated )
   454         const TBool /*aSoftRejectActivated*/ )
   458     {
   455     {
   459     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::GetIncomingCallSilenceCBA ()" );
   456     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::GetIncomingCallSilenceCBA ()" );
   460     TInt ret = EPhoneCallHandlingIncomingSoftRejectCBA;
   457     TInt ret = EPhoneCallHandlingIncomingCBA;
   461     
       
   462     //Get incoming call touchpane button set
       
   463     TPhoneCmdParamInteger touchpaneButtonsParam;
       
   464     touchpaneButtonsParam.SetInteger( CPhoneMainResourceResolver::Instance()->
       
   465                              ResolveResourceID( EPhoneIncomingCallButtons ) );
       
   466 
       
   467     if ( iStateMachine.SecurityMode()->IsSecurityMode() )
       
   468         {
       
   469         ret = EPhoneCallHandlingIncomingCBA;
       
   470         }
       
   471     else if ( touchpaneButtonsParam.Integer() 
       
   472          == R_PHONEUI_INCOMING_CALL_SILENCE_BUTTONS )
       
   473         {
       
   474         aSoftRejectActivated ? 
       
   475         ret = EPhoneCallHandlingIncomingSoftRejectCBA:
       
   476         ret = EPhoneCallHandlingIncomingRejectCBA;
       
   477         }
       
   478     else
       
   479         {
       
   480         // Check if the ringtone has been silenced. If it is, then show
       
   481         // "Send Message" in RSK, else show "Silence".
       
   482         iRingtoneSilenced ?
       
   483             ret = EPhoneCallHandlingIncomingSoftRejectCBA :
       
   484             ret = EPhoneCallHandlingIncomingCBA;
       
   485         }
       
   486 
       
   487     // reset the iRingtoneSilence so it won't cause any problems with
       
   488     // next calls.
       
   489     SetRingtoneSilencedStatus( EFalse );
       
   490 
       
   491     return ret;
   458     return ret;
   492     }
   459     }
   493 
   460 
   494 // -----------------------------------------------------------
       
   495 // CPhoneCbaManager::GetNumberEntryCbaIdL
       
   496 // -----------------------------------------------------------
       
   497 //
       
   498 TInt CPhoneCbaManager::GetNumberEntryCbaIdL()
       
   499     {
       
   500     TInt ret( EPhoneNumberAcqCBA );
       
   501     
       
   502     if ( iState->IsDialingExtensionInFocusL() )
       
   503         {
       
   504         ret = EPhoneEasyDialingCba;
       
   505         }
       
   506     else
       
   507         {
       
   508         TBool dtmfEditorVisible = iViewCommandHandle.HandleCommandL(
       
   509                 EPhoneViewIsDTMFEditorVisible ) ==
       
   510                 EPhoneViewResponseSuccess;
       
   511         TPhoneCmdParamInteger activeCallCount;
       
   512         iViewCommandHandle.ExecuteCommandL(
       
   513                 EPhoneViewGetCountOfActiveCalls, &activeCallCount );
       
   514 
       
   515         TPhoneCmdParamCallStateData callStateData;
       
   516         callStateData.SetCallState( EPEStateRinging );
       
   517         iViewCommandHandle.HandleCommandL(
       
   518                 EPhoneViewGetCallIdByState, &callStateData );
       
   519 
       
   520         TInt incomingCall = callStateData.CallId();
       
   521 
       
   522         if( dtmfEditorVisible )
       
   523             {
       
   524             ret = EPhoneDtmfDialerCBA;
       
   525             }                    
       
   526         else if( activeCallCount.Integer() == ENoActiveCalls )
       
   527             {
       
   528             ret = EPhoneNumberAcqCBA;
       
   529             }
       
   530         else if ( activeCallCount.Integer() > ENoActiveCalls &&  
       
   531                 incomingCall > KErrNotFound )
       
   532             {
       
   533             ret = EPhoneCallHandlingCallWaitingCBA;
       
   534             }
       
   535         else
       
   536             {
       
   537             ret = EPhoneInCallNumberAcqCBA;
       
   538             }
       
   539         }
       
   540     
       
   541     return ret;
       
   542     }
       
   543 
       
   544 // ======== LOCAL FUNCTIONS ========
   461 // ======== LOCAL FUNCTIONS ========
   545 
   462 
   546 
   463