phoneapp/phoneuicontrol/src/cphonecbamanager.cpp
branchRCL_3
changeset 25 5266b1f337bd
parent 24 41a7f70b3818
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
    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>
    25 
    26 
    26 #include "phonerssbase.h"
    27 #include "phonerssbase.h"
    27 #include "phoneui.pan"
    28 #include "phoneui.pan"
    28 #include "phonelogger.h"
    29 #include "phonelogger.h"
    29 
    30 
    35 #include "phoneui.hrh"
    36 #include "phoneui.hrh"
    36 
    37 
    37 #include "tphonecmdparamboolean.h"
    38 #include "tphonecmdparamboolean.h"
    38 #include "tphonecmdparaminteger.h"
    39 #include "tphonecmdparaminteger.h"
    39 #include "tphonecmdparamcallstatedata.h"
    40 #include "tphonecmdparamcallstatedata.h"
    40 #include "tphonecmdparamboolean.h"
    41 #include "mphonesecuritymodeobserver.h"
    41 
    42 
    42 
    43 
    43 // ======== MEMBER FUNCTIONS ========
    44 // ======== MEMBER FUNCTIONS ========
    44 
    45 
    45 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
   111     const TPEAudioOutput audioOutput =
   112     const TPEAudioOutput audioOutput =
   112         iStateMachine.PhoneEngineInfo()->AudioOutput();
   113         iStateMachine.PhoneEngineInfo()->AudioOutput();
   113 
   114 
   114     TBool btAvailable = iStateMachine.PhoneEngineInfo()->AudioOutputAvailable(
   115     TBool btAvailable = iStateMachine.PhoneEngineInfo()->AudioOutputAvailable(
   115         EPEBTAudioAccessory );
   116         EPEBTAudioAccessory );
       
   117 
       
   118     // Call setup cases
   116     
   119     
   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     
       
   126     // Call setup cases
       
   127     if ( EPhoneCallHandlingCallSetupCBA == aResource )
   120     if ( EPhoneCallHandlingCallSetupCBA == aResource )
   128         {
   121         {
   129         if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling) )
   122         if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling) )
   130             {
   123             {
   131             if ( audioOutput == EPELoudspeaker )
   124             if ( audioOutput == EPELoudspeaker )
   138                 }
   131                 }
   139             }
   132             }
   140         }
   133         }
   141 
   134 
   142     // Is numberentry visible
   135     // Is numberentry visible
   143     else if ( iState->IsNumberEntryUsedL() )
   136     else if ( iState->IsNumberEntryUsedL() && iState->IsNumberEntryVisibleL() )
   144         {
   137         {
   145         if ( iState->IsAutoLockOn() || !(iState->IsSimOk()) )
   138         if ( iState->IsAutoLockOn() || !(iState->IsSimOk()) )
   146             {
   139             {
   147             resourceId = EPhoneEmptyBackCBA;
   140             resourceId = EPhoneEmptyBackCBA;
   148             }
   141             }
   149         else
   142         else
   150             {
   143             {
   151             TPhoneCmdParamInteger activeCallCount;
   144             resourceId = GetNumberEntryCbaIdL();
   152             iViewCommandHandle.ExecuteCommandL(
   145             }
   153                     EPhoneViewGetCountOfActiveCalls, &activeCallCount );
   146         }
   154             
   147 
   155             TPhoneCmdParamCallStateData callStateData;
   148     // Check if Audio is muted
   156             callStateData.SetCallState( EPEStateRinging );
   149     else if ( iStateMachine.PhoneEngineInfo()->AudioMute() &&
   157             iViewCommandHandle.HandleCommandL(
   150         !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ))
   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() )
       
   180         {
   151         {
   181         resourceId = EPhoneCallHandlingInCallUnmuteCBA;
   152         resourceId = EPhoneCallHandlingInCallUnmuteCBA;
   182         }
   153         }
   183 
   154 
   184     // Multicall swap
   155     // Multicall swap
   268 
   239 
   269     // Update soft reject flag
   240     // Update soft reject flag
   270     TBool softRejectActivated( ETrue );
   241     TBool softRejectActivated( ETrue );
   271     // VoIP calls do not support sms sending
   242     // VoIP calls do not support sms sending
   272     if ( iStateMachine.PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP 
   243     if ( iStateMachine.PhoneEngineInfo()->CallType( aCallId ) == EPECallTypeVoIP 
   273         || iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() == 0 )
   244     	|| iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() == 0 )
   274         {
   245     	{
   275         softRejectActivated = EFalse;
   246     	softRejectActivated = EFalse;
   276         }
   247     	}
       
   248     TPhoneCmdParamBoolean softRejectParam;
       
   249     softRejectParam.SetBoolean( softRejectActivated );
       
   250     iViewCommandHandle.ExecuteCommandL( EPhoneViewSetSoftRejectFlag,
       
   251         &softRejectParam );
   277 
   252 
   278     TInt incomingCbaResourceId;
   253     TInt incomingCbaResourceId;
       
   254     
       
   255     TBool securityMode = iStateMachine.SecurityMode()->IsSecurityMode();
   279 
   256 
   280     if ( iState->IsSwivelClosed() )
   257     if ( iState->IsSwivelClosed() )
   281         {
   258         {
   282         if ( !callIsAlerting || iRingtoneSilenced )
   259         if ( securityMode )
       
   260         	{
       
   261         	incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSliderCBA;
       
   262         	}
       
   263         else if ( !callIsAlerting || iRingtoneSilenced )
   283             {
   264             {
   284             incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSwivelClosedCBA;
   265             incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSwivelClosedCBA;
   285             }
   266             }
   286         else
   267         else
   287             {
   268             {
   289             }
   270             }
   290         }
   271         }
   291 
   272 
   292     else if ( coverHideSendEndKey )
   273     else if ( coverHideSendEndKey )
   293         {
   274         {
   294         if ( callIsAlerting )
   275         if ( securityMode )
       
   276         	{
       
   277         	// Set CBA to Options..Reject
       
   278         	incomingCbaResourceId = EPhoneCallHandlingIncomingSilentSliderCBA;
       
   279         	}
       
   280         else if ( callIsAlerting )
   295             {
   281             {
   296             // Set CBA to Options..Silence
   282             // Set CBA to Options..Silence
   297             incomingCbaResourceId = EPhoneCallHandlingIncomingSliderCBA;
   283             incomingCbaResourceId = EPhoneCallHandlingIncomingSliderCBA;
   298             }
   284             }
   299         else if ( softRejectActivated )
   285         else if ( softRejectActivated )
   308             }
   294             }
   309         }
   295         }
   310 
   296 
   311     else
   297     else
   312         {
   298         {
   313         if ( callIsAlerting )
   299         if ( securityMode && callIsAlerting )
       
   300             {
       
   301             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
       
   302             }
       
   303         else if ( securityMode )
       
   304             {
       
   305             incomingCbaResourceId = EPhoneCallHandlingIncomingRejectCBA;
       
   306             }
       
   307         else if ( callIsAlerting )
   314             {
   308             {
   315             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
   309             incomingCbaResourceId = GetIncomingCallSilenceCBA( softRejectActivated );
   316             }
   310             }
   317         else if ( softRejectActivated )
   311         else if ( softRejectActivated )
   318             {
   312             {
   338 
   332 
   339     __PHONELOG1( EBasic, EPhoneControl,
   333     __PHONELOG1( EBasic, EPhoneControl,
   340             "CPhoneCbaManager::SetCbaL : %d",aResource );
   334             "CPhoneCbaManager::SetCbaL : %d",aResource );
   341 
   335 
   342     TPhoneCmdParamInteger integerParam;
   336     TPhoneCmdParamInteger integerParam;
   343     integerParam.SetInteger(
   337     
   344         CPhoneMainResourceResolver::Instance()->ResolveResourceID(
   338     if ( EPhoneEasyDialingCba == aResource )
   345         aResource ) );
   339         {
       
   340         iViewCommandHandle.ExecuteCommandL( EPhoneViewGetEasyDialingCbaId, &integerParam );
       
   341         }
       
   342     else
       
   343         {
       
   344         integerParam.SetInteger(
       
   345             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
       
   346             aResource ) );
       
   347         }
       
   348 
   346     iViewCommandHandle.ExecuteCommandL( EPhoneViewUpdateCba,
   349     iViewCommandHandle.ExecuteCommandL( EPhoneViewUpdateCba,
   347         &integerParam );
   350         &integerParam );
   348     }
   351     }
   349 
   352 
   350 // -----------------------------------------------------------
   353 // -----------------------------------------------------------
   449 // -----------------------------------------------------------
   452 // -----------------------------------------------------------
   450 // CPhoneCbaManager::GetIncomingCallSilenceCBA
   453 // CPhoneCbaManager::GetIncomingCallSilenceCBA
   451 // -----------------------------------------------------------
   454 // -----------------------------------------------------------
   452 //
   455 //
   453 TInt CPhoneCbaManager::GetIncomingCallSilenceCBA( 
   456 TInt CPhoneCbaManager::GetIncomingCallSilenceCBA( 
   454         const TBool /*aSoftRejectActivated*/ )
   457         const TBool aSoftRejectActivated )
   455     {
   458     {
   456     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::GetIncomingCallSilenceCBA ()" );
   459     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneCbaManager::GetIncomingCallSilenceCBA ()" );
   457     TInt ret = EPhoneCallHandlingIncomingCBA;
   460     TInt ret = EPhoneCallHandlingIncomingSoftRejectCBA;
       
   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 
   458     return ret;
   491     return ret;
   459     }
   492     }
   460 
   493 
       
   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 
   461 // ======== LOCAL FUNCTIONS ========
   544 // ======== LOCAL FUNCTIONS ========
   462 
   545 
   463 
   546