diff -r 41a7f70b3818 -r 5266b1f337bd phoneapp/phoneuivoipextension/src/cphonecustomizationvoip.cpp --- a/phoneapp/phoneuivoipextension/src/cphonecustomizationvoip.cpp Tue Aug 31 15:14:29 2010 +0300 +++ b/phoneapp/phoneuivoipextension/src/cphonecustomizationvoip.cpp Wed Sep 01 12:30:10 2010 +0100 @@ -22,10 +22,14 @@ #include #include #include -#include "phoneresourceids.h" +#include +#include #include +#include #include #include +#include +#include #include "cphonecustomizationvoip.h" #include "tphonecmdparaminteger.h" @@ -33,6 +37,7 @@ #include "tphonecmdparamstring.h" #include "cphonemainresourceresolver.h" #include "mphonestatemachine.h" +#include "mphonesecuritymodeobserver.h" #include "cphonelogger.h" #include "cphonecenrepproxy.h" #include "phoneui.pan" @@ -53,8 +58,10 @@ #include "cphoneunattendedtransfercmdhandler.h" #include "tphonecmdparampointer.h" #include "cphonenewcallcmdhandler.h" +#include "cphonevcchandler.h" #include "cphonecallforwardqueryhandler.h" #include "cphonekeys.h" +#include "phoneui.hrh" // CONSTANTS const TInt KMaxLengthForSIPURIFirstLine = 15; @@ -90,6 +97,7 @@ delete iPhoneViewCustomization; delete iTransferCmdHandler; delete iNewCallCmdHandler; + delete iVccHandler; } @@ -124,7 +132,12 @@ iNewCallCmdHandler = CPhoneNewCallCmdHandler::NewL( iStateMachine, iViewCommandHandle ); - + + if ( FeatureManager::FeatureSupported( KFeatureIdFfVoiceCallContinuity ) ) + { + iVccHandler = CPhoneVccHandler::NewL( iStateMachine, iViewCommandHandle ); + } + iCallForwardHandler = CPhoneCallForwardQueryHandler::NewL( iStateMachine, iViewCommandHandle ); } @@ -188,7 +201,7 @@ TInt menuItemCount = menuPane->NumberOfItemsInPane(); for ( TInt i( 0 ); i < menuItemCount; i++ ) { - menuItemArray.AppendL( menuPane->MenuItemCommandId( i ) ); + menuItemArray.Append( menuPane->MenuItemCommandId( i ) ); } // Menu items to be deleted @@ -198,7 +211,7 @@ { case EPhoneDialerCmdTouchInput: { - if ( !AllowAlphaNumericMode() ) + if ( !VoIPSupportedL() || iStateMachine.SecurityMode()->IsSecurityMode() ) { menuPane->DeleteMenuItem( menuItemArray[ i ] ); } @@ -223,7 +236,7 @@ case EPhoneInCallCmdNewCall: { if ( !FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) && - AllowAlphaNumericMode() && + VoIPSupportedL() && R_PHONEUI_NEW_CALL_MENU_VOIP != aResourceId ) { @@ -254,7 +267,7 @@ // Added HO menu items if needed AddHandoverMenuItemIfNeededL( aResourceId, *aMenuPane ); - + if ( iViewCommandHandle.HandleCommandL( EPhoneViewGetNumberEntryIsVisibleStatus ) != EPhoneViewResponseSuccess ) @@ -281,7 +294,7 @@ // void CPhoneCustomizationVoip::ModifyCallHeaderTexts( TInt aCallId, TPhoneCmdParamCallHeaderData* aCommandParam, - const TDesC& aInCallNumberText ) + const TDesC& /*aInCallNumberText*/ ) { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::ModifyCallHeaderTexts" ); @@ -294,51 +307,54 @@ engineInfo.RemoteName( aCallId ).Length() || engineInfo.RemoteCompanyName( aCallId ).Length(); - if ( !contactInfoAvailable ) + if ( EPEStateRinging == aCommandParam->CallState() && + !contactInfoAvailable ) { - if ( EPEStateRinging == aCommandParam->CallState() ) + if ( KNullDesC() != engineInfo.RemotePartyName( aCallId ) ) { - if ( KNullDesC() != engineInfo.RemotePartyName( aCallId ) ) - { - // Telephone UI specification, 4.2.1 Call identification: - // display name is used as the CLI if available. - aCommandParam->SetCLIText( - engineInfo.RemotePartyName( aCallId ), - TPhoneCmdParamCallHeaderData::ERight ); - // use line reserved for CNAP to show SIP URI - aCommandParam->SetCNAPText( - engineInfo.RemotePhoneNumber( aCallId ), - TPhoneCmdParamCallHeaderData::ERight - ); - } - else - { - TBuf sipURI; - TBuf sipURIDomainPart; - HandleURIFittingToCallBubble( - aCommandParam->CLIText(), - sipURI, - sipURIDomainPart ); - - aCommandParam->SetCLIText( sipURI, TPhoneCmdParamCallHeaderData::ERight ); - aCommandParam->SetCNAPText( sipURIDomainPart, - TPhoneCmdParamCallHeaderData::ERight ); - } + // Telephone UI specification, 4.2.1 Call identification: + // display name is used as the CLI if available. + aCommandParam->SetCLIText( + engineInfo.RemotePartyName( aCallId ), + CBubbleManager::ERight ); + // use line reserved for CNAP to show SIP URI + aCommandParam->SetCNAPText( + engineInfo.RemotePhoneNumber( aCallId ), + CBubbleManager::ERight ); + } + else if( KNullDesC() != engineInfo.RemotePhoneNumber( aCallId ) ) + { + // Fit address to two rows if it doesnt fit to one + TBuf sipURI; + TBuf sipURIDomainPart; + HandleURIFittingToCallBubble( + aCommandParam->CLIText(), + sipURI, + sipURIDomainPart ); + + aCommandParam->SetCLIText( sipURI, CBubbleManager::ERight ); + aCommandParam->SetCNAPText( + sipURIDomainPart, + CBubbleManager::ERight ); } else { - if ( KNullDesC() == engineInfo.RemotePartyName( aCallId ) ) - { - // Display name not available, set incall number text as a - // CLI text. Text could be 'Call 1', 'Call 2', ... - aCommandParam->SetCLIText( aInCallNumberText, - TPhoneCmdParamCallHeaderData::ERight ); - aCommandParam->SetCNAPText( - aCommandParam->CNAPText(), - TPhoneCmdParamCallHeaderData::ERight ); - } + // No address or display name specified + // Do nothing } } + else + { + // Change clipping direction + aCommandParam->SetCLIText( + aCommandParam->CLIText(), + CBubbleManager::ERight ); + + // Change clipping direction + aCommandParam->SetCNAPText( + aCommandParam->CNAPText(), + CBubbleManager::ERight ); + } } } @@ -371,11 +387,19 @@ handled = ETrue; } break; + case EPhoneCmdUnattendedTransferCallBackCancel: + if ( NeedToRestoreKeyLock() ) + { + SetKeyLockEnabledL( ETrue ); + SetNeedToRestoreKeyLock( EFalse ); + } + // intended fall-through case EPhoneInCallCmdUnattendedTransfer: case EPhoneCmdTransferDialerOk: case EPhoneCmdTransferDialerExit: case EPhoneCmdTransferDialerSearch: case EPhoneCmdTransferDialerContactFetch: + case EPhoneCmdUnattendedTransferCallBackOk: // intended fall-through iTransferCmdHandler->HandleCommandL( aCommand ); handled = ETrue; @@ -403,14 +427,25 @@ break; case EPhoneCmdHandoverToGsm: + iVccHandler->StartManualHandoverL( EPhoneVoIPWaitHandoverFromWlan ); handled = ETrue; break; case EPhoneCmdHandoverToWlan: + iVccHandler->StartManualHandoverL( EPhoneVoIPWaitHandoverFromGsm ); handled = ETrue; break; + case EPhoneCmdRejectUnattendedTransfer: + if ( NeedToRestoreKeyLock() ) + { + SetKeyLockEnabledL( ETrue ); + SetNeedToRestoreKeyLock( EFalse ); + } + handled = ETrue; + break; + default: { RArray array; @@ -443,6 +478,11 @@ TBool alphaModeSupported( EFalse ); TRAP_IGNORE( alphaModeSupported = VoIPSupportedL() ); + + if ( !alphaModeSupported ) + { + alphaModeSupported = EasyDialingEnabled(); + } return alphaModeSupported; } @@ -457,7 +497,7 @@ { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::CustomizeSoftKeys" ); - + return CPhoneMainResourceResolver::Instance()-> ResolveResourceID( EPhoneVoIPNumberAcqInternetSoftkey ); } @@ -472,7 +512,7 @@ { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::CustomizeCallHeaderText" ); - + return EPhoneVoIPPrivateAddress; } @@ -575,6 +615,11 @@ case MEngineMonitor::EPEMessageTransferring: { iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote ); + break; + } + case MEngineMonitor::EPEMessageTransferDone: + { + iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote ); SendGlobalInfoNoteL( EPhoneInCallTransferred ); break; } @@ -583,6 +628,30 @@ SendGlobalErrorNoteL( EPhoneRemoteForwarding ); break; } + case MEngineMonitor::EPEMessageTransferCallBackRequest: + { + if ( iStateMachine.State()->IsKeyLockOn() ) + { + SetNeedToRestoreKeyLock( ETrue ); + SetKeyLockEnabledL( EFalse ); + } + iTransferCmdHandler->LaunchCallBackQueryL(); + break; + } + case MEngineMonitor::EPEMessageIdle: + { + TPhoneCmdParamInteger activeCallCount; + iViewCommandHandle.ExecuteCommandL( + EPhoneViewGetCountOfActiveCalls, &activeCallCount ); + + if ( ENoActiveCalls == activeCallCount.Integer() + && NeedToRestoreKeyLock() ) + { + SetKeyLockEnabledL( ETrue ); + SetNeedToRestoreKeyLock( EFalse ); + } + break; + } default: handled = EFalse; break; @@ -608,12 +677,43 @@ // CPhoneCustomizationVoip::CustomizeTouchPaneButtons // ----------------------------------------------------------- // -void CPhoneCustomizationVoip::CustomizeTouchPaneButtons() +void CPhoneCustomizationVoip::CustomizeTouchPaneButtons( + MBubbleTouchPaneInterface& aTouchPane ) { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::CustomizeTouchPaneButtons" ); + + TRAPD( err, CustomizeTouchPaneUsingExtensionL( aTouchPane ) ); + + if ( KErrNone != err ) + { + // Extension plugin didn't handle touch pane dimming. + TInt buttonCount = aTouchPane.NumberOfButtonsInPane(); + + for ( TInt i=0; i < buttonCount; i++ ) + { + TInt commandId = aTouchPane.ButtonCommandId( i ); + + switch ( commandId ) + { + case EPhoneInCallCmdCreateConference: + case EPhoneInCallCmdJoin: + { + if ( !IsFeatureSupported( EFeatureConference ) ) + { + // Conference not supported -> set item dimmed + aTouchPane.SetButtonDimmed( commandId, ETrue ); + } + break; + } + default: + break; + } // switch + } // for + } } + // ----------------------------------------------------------- // CPhoneCustomizationVoip::VoIPSupportedL // ----------------------------------------------------------- @@ -633,6 +733,30 @@ return voipSupported; } +// ----------------------------------------------------------- +// CPhoneCustomizationVoip::EasyDialingEnabled +// ----------------------------------------------------------- +// +TBool CPhoneCustomizationVoip::EasyDialingEnabled() + { + __LOGMETHODSTARTEND( PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::EasyDialingEnabled" ); + + TBool easyDialingEnabled( EFalse ); + if ( FeatureManager::FeatureSupported( KFeatureIdProductIncludesHomeScreenEasyDialing ) ) + { + TInt easyDialingSetting; + TInt err = CPhoneCenRepProxy::Instance()->GetInt( + KCRUidEasyDialSettings, + KEasyDialing, + easyDialingSetting); + if ( !err && easyDialingSetting ) + { + easyDialingEnabled = ETrue; + } + } + return easyDialingEnabled; + } // ----------------------------------------------------------- // CPhoneCustomizationVoip::ModifyInCallMenuL @@ -678,9 +802,7 @@ __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::ModifyNumberAcquisitionMenuL"); - if ( ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_CALL_MENU || - aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_MENU || - aResourceId == R_PHONEUIDIALER_OPTIONS_MENU ) && + if ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_CALL_MENU && VoIPSupportedL() ) { InsertInternetCallMenuItemL( aResourceId, aMenuPane ); @@ -701,7 +823,7 @@ // ----------------------------------------------------------- // void CPhoneCustomizationVoip::InsertInternetCallMenuItemL( - TInt aResourceId, CEikMenuPane& aMenuPane ) + TInt /* aResourceId */, CEikMenuPane& aMenuPane ) { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::InsertInternetCallMenuItemL" ); @@ -729,37 +851,13 @@ HBufC* phoneNumber = PhoneNumberFromEntryLC(); - if ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_CALL_MENU ) + TInt index(KErrNotFound); + + // If number entry is empty don't add internet call option + if ( phoneNumber->Length() ) { - if ( !CPhoneKeys::Validate( phoneNumber->Des() ) ) - { - TInt index(KErrNotFound); - if ( aMenuPane.MenuItemExists( EPhoneNumberAcqCmdCall, index ) ) - { - aMenuPane.DeleteMenuItem( EPhoneNumberAcqCmdCall ); - } - - if ( aMenuPane.MenuItemExists( EPhoneNumberAcqCmdVideoCall, index ) ) - { - aMenuPane.DeleteMenuItem( EPhoneNumberAcqCmdVideoCall ); - } - } - aMenuPane.AddMenuItemL( voipMenuItem->iData ); } - else if ( iStateMachine.PhoneEngineInfo()->PhoneNumberIsServiceCode() ) - { - // When user writes string recognized as service code (eg.*#31# -> clir off) - // call menu is not visible. Internet call must still be possible so - // internet call option is added here to the menu. - - // If number entry is empty don't add internet call option - if ( phoneNumber->Length() ) - { - // Internet call item must be on the top of the menu - aMenuPane.InsertMenuItemL( voipMenuItem->iData, 0 ); - } - } CleanupStack::PopAndDestroy( 3, &voipServices ); } @@ -770,11 +868,43 @@ // ----------------------------------------------------------- // void CPhoneCustomizationVoip::InsertTextInputModeChangeMenuItemL( - CEikMenuPane& /*aMenuPane*/ ) + CEikMenuPane& aMenuPane ) { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::InsertTextInputModeChangeMenuItemL" ); - + + TInt modeChangeOptionIndex = KErrNotFound; + if ( aMenuPane.MenuItemExists( + EPhoneNumberAcqCmdToggleNeAlphaMode, modeChangeOptionIndex ) || + aMenuPane.MenuItemExists( + EPhoneNumberAcqCmdToggleNeNumericMode, modeChangeOptionIndex ) ) + { + __PHONELOG( EBasic, PhoneUIVoIPExtension, + "InsertTextInputModeChangeMenuItemL, MENU ITEM ALREADY EXISTS" ); + __ASSERT_DEBUG( EFalse, Panic( EPhoneCtrlInvariant ) ); + } + + CEikMenuPaneItem* menuItem = NULL; + TBool numberEntryInNumericMode = iViewCommandHandle.HandleCommandL( + EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess; + if ( numberEntryInNumericMode ) + { + menuItem = CreateMenuPaneItemLC( + EPhoneNumberAcqCmdToggleNeAlphaMode, + R_PHONEUI_NUMBERACQ_OPTIONS_MENU_ITEM_ALPHA_MODE ); + } + else + { + menuItem = CreateMenuPaneItemLC( + EPhoneNumberAcqCmdToggleNeNumericMode, + R_PHONEUI_NUMBERACQ_OPTIONS_MENU_ITEM_NUMERIC_MODE ); + } + + // alpha/numeric mode option is always second item in number entry menu + const TInt KTextInputModeChangeMenuItemIndex = 1; + aMenuPane.InsertMenuItemL( + menuItem->iData, KTextInputModeChangeMenuItemIndex ); + CleanupStack::PopAndDestroy( menuItem ); } @@ -866,7 +996,7 @@ if( callInfo.iCallState != CTelMenuExtension::ENone ) { - aArray.AppendL( callInfo ); + aArray.Append( callInfo ); } } @@ -1010,7 +1140,16 @@ if( array[i].iCallState == CTelMenuExtension::EOutgoing || array[i].iCallState == CTelMenuExtension::EActive || array[i].iCallState == CTelMenuExtension::EOnHold ) - { + { + if( aFeature == EFeatureTransfer && + array[i].iCallState == CTelMenuExtension::EOutgoing && + array[i].iCallType == CTelMenuExtension::EPsVoice ) + { + // If there is outgoing VoIP call then transfer is not supported + supported = EFalse; + break; + } + if( firstCallType == CTelMenuExtension::EUninitialized ) { // Memorize first found call type @@ -1031,6 +1170,35 @@ return supported; } + +// ----------------------------------------------------------- +// CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL +// ----------------------------------------------------------- +// +void CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL( + MBubbleTouchPaneInterface& aTouchPane ) + { + __LOGMETHODSTARTEND( PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL" ); + + RArray array; + CleanupClosePushL( array ); + + GetActiveCallArrayL( array ); + + // Use extensions for touch pane buttons dimming + iExtensionHandler->CustomizeTouchPaneButtonsL( + ServiceIdForActivestCallL( array ), + array, + aTouchPane ); + + __PHONELOG( EBasic, PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::ModifyInCallMenuL() plugin exists" ); + + CleanupStack::PopAndDestroy( &array ); + } + + // ----------------------------------------------------------- // CPhoneCustomizationVoip::LaunchEnablingServiceNoteL // ----------------------------------------------------------- @@ -1062,9 +1230,8 @@ queryParam.SetDataText( ¬eText ); queryParam.SetDefaultCba( R_AVKON_SOFTKEYS_CANCEL ); - const TInt KEnableServiceTimeOutInMilliSecs = 60000; - queryParam.SetTimeOut( KEnableServiceTimeOutInMilliSecs ); - + const TInt KEnableServiceTimeOutInSecs = 60; + queryParam.SetTimeOut( KEnableServiceTimeOutInSecs ); // configure custom command mappings for user responses queryParam.SetCbaCommandMapping( EAknSoftkeyCancel, EPhoneCmdCancelServiceEnabling ); @@ -1089,10 +1256,10 @@ __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) ); - CPhoneState* phoneState = - static_cast< CPhoneState* >( iStateMachine.State() ); - - phoneState->SendGlobalErrorNoteL( aResourceId ); + CPhoneState* phoneState = + static_cast< CPhoneState* >( iStateMachine.State() ); + + phoneState->SendGlobalErrorNoteL( aResourceId ); } @@ -1266,13 +1433,31 @@ // CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL // ----------------------------------------------------------- // -void CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL( TInt /*aResourceId*/, - CEikMenuPane& /*aMenuPane*/ ) +void CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL( TInt aResourceId, + CEikMenuPane& aMenuPane ) { __LOGMETHODSTARTEND( PhoneUIVoIPExtension, "CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL" ); + + // Menu items to be added + if ( iVccHandler && VoIPSupportedL() && + ( aResourceId == R_PHONEUI_CALLHANDLING_INCALL_OPTIONS_MENU || + aResourceId == R_PHONEUI_CALLWAITING_OPTIONS_MENU || + aResourceId == R_PHONEUI_ACTIVEANDHELDCALL_OPTIONS_MENU || + aResourceId == R_PHONEUI_ACTIVEANDHELDCONFCALL_OPTIONS_MENU || + aResourceId == R_PHONEUI_CALLACTIVEHELDANDWAITING_OPTIONS_MENU + )) + { + RArray array; + CleanupClosePushL( array ); + GetActiveCallArrayL( array ); + + iVccHandler->AddHandoverMenuItemL( array, aResourceId, aMenuPane ); + CleanupStack::PopAndDestroy( &array ); + } } - + + // ----------------------------------------------------------- // CPhoneCustomizationVoip::GetVoIPServiceIdsL // ----------------------------------------------------------- @@ -1338,6 +1523,7 @@ CleanupStack::PopAndDestroy( 2, settingsApi ); } + // ----------------------------------------------------------- // CPhoneCustomizationVoip::PhoneNumberFromEntryLC // ----------------------------------------------------------- @@ -1356,4 +1542,50 @@ return phoneNumber; } +// --------------------------------------------------------------------------- +// CPhoneCustomizationVoip::SetKeyLockEnabledL +// --------------------------------------------------------------------------- +// +void CPhoneCustomizationVoip::SetKeyLockEnabledL( TBool aEnabled ) + { + __LOGMETHODSTARTEND( PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::CPhoneCustomizationVoip::SetKeyLockEnabledL" ); + if ( aEnabled ) + { + iViewCommandHandle.ExecuteCommandL( + EPhoneViewEnableKeyLock ); + } + else + { + iViewCommandHandle.ExecuteCommandL( + EPhoneViewDisableKeyLockWithoutNote ); + } + } + +// --------------------------------------------------------------------------- +// CPhoneCustomizationVoip::SetNeedToRestoreKeyLock +// --------------------------------------------------------------------------- +// +void CPhoneCustomizationVoip::SetNeedToRestoreKeyLock( TBool aRestore ) + { + __LOGMETHODSTARTEND( PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::CPhoneCustomizationVoip::SetNeedToRestoreKeyLock" ); + __PHONELOG1( EBasic, PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::AwrNeedToRestoreKeyLock:%d", aRestore ); + iNeedToRestoreKeyLock = aRestore; + } + +// ----------------------------------------------------------- +// CPhoneCustomizationVoip::NeedToRestoreKeyLock +// ----------------------------------------------------------- +// +TBool CPhoneCustomizationVoip::NeedToRestoreKeyLock() const + { + __LOGMETHODSTARTEND( PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::CPhoneCustomizationVoip::NeedToRestoreKeyLock" ); + __PHONELOG1( EBasic, PhoneUIVoIPExtension, + "CPhoneCustomizationVoip::NeedToRestoreKeyLock:%d", iNeedToRestoreKeyLock ); + return iNeedToRestoreKeyLock; + } + // End of File