phoneapp/phoneuiview/src/cphoneviewcontroller.cpp
branchRCL_3
changeset 23 40a3f856b14d
parent 22 94dc1107e8b2
equal deleted inserted replaced
22:94dc1107e8b2 23:40a3f856b14d
   141 // Kastor effect IDs, aknskincontent/101f84b9.sel
   141 // Kastor effect IDs, aknskincontent/101f84b9.sel
   142 // These effects cannot be used for internal transitions (Call UI<->Dialer)
   142 // These effects cannot be used for internal transitions (Call UI<->Dialer)
   143 const TInt KTouchDialerOpenEffect  = 3;
   143 const TInt KTouchDialerOpenEffect  = 3;
   144 const TInt KTouchDialerCloseEffect = 5;
   144 const TInt KTouchDialerCloseEffect = 5;
   145 
   145 
       
   146 const TInt KTouchCallUiOpenEffect  = 1000;
       
   147 const TInt KTouchCallUiCloseEffect = 1001;
       
   148 
   146 const TInt KDialerInputMaxChars( 100 );
   149 const TInt KDialerInputMaxChars( 100 );
   147 
   150 
   148 // ================= MEMBER FUNCTIONS =======================
   151 // ================= MEMBER FUNCTIONS =======================
   149 
   152 
   150 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   836 
   839 
   837         case EPhoneViewActivateMuteUIChanges:
   840         case EPhoneViewActivateMuteUIChanges:
   838             iMenuController->SetMuteFlag( aCommandParam );
   841             iMenuController->SetMuteFlag( aCommandParam );
   839             iBubbleWrapper->SetPhoneMuted( aCommandParam );
   842             iBubbleWrapper->SetPhoneMuted( aCommandParam );
   840             iIncallIndicator->HandleMuteChange( aCommandParam );
   843             iIncallIndicator->HandleMuteChange( aCommandParam );
   841             iAudioController->HandleMuteChange( aCommandParam );
       
   842             iToolbarController->SetMuteFlag( aCommandParam );
   844             iToolbarController->SetMuteFlag( aCommandParam );
   843             if ( iButtonsController )
   845             if ( iButtonsController )
   844                 {
   846                 {
   845                 iButtonsController->SetMuteFlag( aCommandParam );
   847                 iButtonsController->SetMuteFlag( aCommandParam );
   846                 }
   848                 }
  1117                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
  1119                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
  1118             iMenuController->SetAllowDtmfOptionsFlag(
  1120             iMenuController->SetAllowDtmfOptionsFlag(
  1119                                                 booleanParam->Boolean() );
  1121                                                 booleanParam->Boolean() );
  1120             break;
  1122             break;
  1121             }
  1123             }
  1122 
  1124 		 
       
  1125 		 case EPhoneViewSetVoipCallDTMFVisibilityFlag:
       
  1126             {
       
  1127             TPhoneCmdParamBoolean*  booleanParam =
       
  1128                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1129             iMenuController->SetHideVoipCallDTMFVisibilityFlag(
       
  1130                                                     booleanParam->Boolean() );
       
  1131             break;
       
  1132             }
  1123         case EPhoneViewSetVideoCallDTMFVisibilityFlag:
  1133         case EPhoneViewSetVideoCallDTMFVisibilityFlag:
  1124             {
  1134             {
  1125             TPhoneCmdParamBoolean*  booleanParam =
  1135             TPhoneCmdParamBoolean*  booleanParam =
  1126                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
  1136                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
  1127             iMenuController->SetHideVideoCallDTMFVisibilityFlag(
  1137             iMenuController->SetHideVideoCallDTMFVisibilityFlag(
  1581                 EPhoneViewResponseSuccess :
  1591                 EPhoneViewResponseSuccess :
  1582                 EPhoneViewResponseFailed;
  1592                 EPhoneViewResponseFailed;
  1583             break;
  1593             break;
  1584 
  1594 
  1585         case EPhoneViewGetNeedToReturnToForegroundAppStatus:
  1595         case EPhoneViewGetNeedToReturnToForegroundAppStatus:
  1586             viewResponse = GetNeedToReturnToForegroundAppAfterCall() ?
  1596             viewResponse = GetNeedToReturnToForegroundAppAfterCallL() ?
  1587                 EPhoneViewResponseSuccess :
  1597                 EPhoneViewResponseSuccess :
  1588                 EPhoneViewResponseFailed;
  1598                 EPhoneViewResponseFailed;
  1589             break;
  1599             break;
  1590 
  1600 
  1591         case EPhoneViewGetTopApplicationIsDisplayedStatus:
  1601         case EPhoneViewGetTopApplicationIsDisplayedStatus:
  2083 //
  2093 //
  2084 EXPORT_C TInt CPhoneViewController::DoFetchForegroundApplicationWindowGroupIdL(
  2094 EXPORT_C TInt CPhoneViewController::DoFetchForegroundApplicationWindowGroupIdL(
  2085     CEikonEnv& aEnv )
  2095     CEikonEnv& aEnv )
  2086     {
  2096     {
  2087     TInt result = 0;
  2097     TInt result = 0;
  2088 
       
  2089     RWsSession& wsSession = aEnv.WsSession();
  2098     RWsSession& wsSession = aEnv.WsSession();
  2090 
  2099     const TInt numWg = wsSession.NumWindowGroups(
  2091     const TInt numWg =
       
  2092         wsSession.NumWindowGroups(
       
  2093             KPhoneApplicationWindowGroupPriority );
  2100             KPhoneApplicationWindowGroupPriority );
  2094 
  2101 
  2095     CArrayFixFlat<TInt>* wgList =
  2102     CArrayFixFlat<TInt>* wgList =
  2096         new (ELeave) CArrayFixFlat<TInt>( numWg );
  2103         new (ELeave) CArrayFixFlat<TInt>( numWg );
  2097     CleanupStack::PushL( wgList );
  2104     CleanupStack::PushL( wgList );
  2424 
  2431 
  2425 // ---------------------------------------------------------------------------
  2432 // ---------------------------------------------------------------------------
  2426 // CPhoneViewController::FindAppByWgIDL
  2433 // CPhoneViewController::FindAppByWgIDL
  2427 // ---------------------------------------------------------------------------
  2434 // ---------------------------------------------------------------------------
  2428 //
  2435 //
  2429 TInt CPhoneViewController::FindAppByWgIDL( TInt aAppWgID )
  2436 TInt CPhoneViewController::FindAppByWgIDL( TInt aAppWgID ) const
  2430     {
  2437     {
  2431     __LOGMETHODSTARTEND( EPhoneUIView,
  2438     __LOGMETHODSTARTEND( EPhoneUIView,
  2432         "CPhoneViewController::FindAppByWgIDL() ")
  2439         "CPhoneViewController::FindAppByWgIDL() ")
  2433 
       
  2434     TInt appExists( KErrNotFound );
  2440     TInt appExists( KErrNotFound );
  2435 
       
  2436     RWsSession& wsSession = iEikEnv.WsSession();
  2441     RWsSession& wsSession = iEikEnv.WsSession();
  2437 
       
  2438     const TInt numWg = wsSession.NumWindowGroups(
  2442     const TInt numWg = wsSession.NumWindowGroups(
  2439             KPhoneApplicationWindowGroupPriority );
  2443             KPhoneApplicationWindowGroupPriority );
  2440 
  2444 
  2441     CArrayFixFlat<TInt>* wgList =
  2445     CArrayFixFlat<TInt>* wgList =
  2442         new (ELeave) CArrayFixFlat<TInt>( numWg );
  2446         new (ELeave) CArrayFixFlat<TInt>( numWg );
  2443     CleanupStack::PushL( wgList );
  2447     CleanupStack::PushL( wgList );
  2444     wgList->SetReserveL( numWg );
  2448     wgList->SetReserveL( numWg );
  2445 
  2449 
  2446     // Get list of window groups; all applications should be at priority 0.
  2450     // Get list of window groups; all applications should be at priority 0.
  2447     //
       
  2448     if ( wsSession.WindowGroupList(
  2451     if ( wsSession.WindowGroupList(
  2449         KPhoneApplicationWindowGroupPriority,
  2452         KPhoneApplicationWindowGroupPriority,
  2450         wgList ) == KErrNone )
  2453         wgList ) == KErrNone )
  2451         {
  2454         {
  2452         for( TInt i = 0; i < wgList->Count(); i++ )
  2455         for( TInt i = 0; i < wgList->Count(); i++ )
  2456                 appExists = i;
  2459                 appExists = i;
  2457                 break;
  2460                 break;
  2458                 }
  2461                 }
  2459             }
  2462             }
  2460         }
  2463         }
  2461 
       
  2462     CleanupStack::PopAndDestroy( wgList );
  2464     CleanupStack::PopAndDestroy( wgList );
  2463 
       
  2464     return appExists;
  2465     return appExists;
  2465     }
  2466     }
  2466 
  2467 
  2467 // ---------------------------------------------------------------------------
  2468 // ---------------------------------------------------------------------------
  2468 // CPhoneViewController::SetWindowGroupPosition
  2469 // CPhoneViewController::SetWindowGroupPosition
  3366     iMenuController->SetIhfFlag( &ihfParam );
  3367     iMenuController->SetIhfFlag( &ihfParam );
  3367     iToolbarController->SetIhfFlag( &ihfParam );
  3368     iToolbarController->SetIhfFlag( &ihfParam );
  3368 
  3369 
  3369     // btaa menu options
  3370     // btaa menu options
  3370     iMenuController->SetBTAccFlag( &btaaParam );
  3371     iMenuController->SetBTAccFlag( &btaaParam );
  3371 
  3372 	iToolbarController->SetBTAccFlag( &btaaParam );
  3372     iAudioController->HandleIhfChange( &ihfParam );
  3373     iAudioController->HandleIhfChange( &ihfParam );
  3373 
  3374 
  3374     if ( iButtonsController )
  3375     if ( iButtonsController )
  3375         {
  3376         {
  3376         iButtonsController->SetIhfFlag( &ihfParam );
  3377         iButtonsController->SetIhfFlag( &ihfParam );
  3406     iMenuController->SetWiredAccAvailableFlag( &wiredAvailableParam );
  3407     iMenuController->SetWiredAccAvailableFlag( &wiredAvailableParam );
  3407     iToolbarController->SetWiredAccFlag( &wiredAvailableParam );
  3408     iToolbarController->SetWiredAccFlag( &wiredAvailableParam );
  3408 
  3409 
  3409     // btaa menu options
  3410     // btaa menu options
  3410     iMenuController->SetBTAccAvailableFlag( &btAvailableParam );
  3411     iMenuController->SetBTAccAvailableFlag( &btAvailableParam );
  3411 
  3412 	iToolbarController->SetBTAccAvailableFlag( &btAvailableParam );
       
  3413 	
  3412     if ( iButtonsController )
  3414     if ( iButtonsController )
  3413         {
  3415         {
  3414         iButtonsController->SetBTAccAvailableFlag( &btAvailableParam );
  3416         iButtonsController->SetBTAccAvailableFlag( &btAvailableParam );
  3415         iButtonsController->ReplaceAudioButton();
  3417         iButtonsController->ReplaceAudioButton();
  3416         }
  3418         }
  3839 void CPhoneViewController::HandleTransitionEffect(
  3841 void CPhoneViewController::HandleTransitionEffect(
  3840     TPhoneTransEffectType aType, const TUid& aAppUidEffectParam )
  3842     TPhoneTransEffectType aType, const TUid& aAppUidEffectParam )
  3841     {
  3843     {
  3842     __LOGMETHODSTARTEND(EPhoneUIView,
  3844     __LOGMETHODSTARTEND(EPhoneUIView,
  3843         "CPhoneViewController::HandleTransitionEffect()" );
  3845         "CPhoneViewController::HandleTransitionEffect()" );
  3844 
  3846     __PHONELOG1( EBasic, EPhoneUIView,
  3845    switch ( aType )
  3847         "CPhoneViewController::HandleTransitionEffect aType:(%d)", aType );
       
  3848     TInt useEffect(KErrNotFound);
       
  3849     switch ( aType )
  3846         {
  3850         {
  3847         case EPhoneTransEffectDialerCreate:
  3851         case EPhoneTransEffectDialerCreate:
  3848         case EPhoneTransEffectDialerOpen:
  3852         case EPhoneTransEffectDialerOpen:
  3849             {
  3853             useEffect = KTouchDialerOpenEffect;
  3850             GfxTransEffect::BeginFullScreen(
  3854             break;
  3851                 KTouchDialerOpenEffect,
       
  3852                 TRect(),
       
  3853                 AknTransEffect::EParameterType,
       
  3854                 AknTransEffect::GfxTransParam( KUidPhoneApplication,
       
  3855                         AknTransEffect::TParameter::EActivateExplicitCancel ) );
       
  3856             iEffectOngoing = ETrue;
       
  3857             break;
       
  3858             }
       
  3859         case EPhoneTransEffectDialerClose:
  3855         case EPhoneTransEffectDialerClose:
  3860             {
  3856             useEffect = KTouchDialerCloseEffect;
  3861             GfxTransEffect::BeginFullScreen(
  3857             break;
  3862                 KTouchDialerCloseEffect,
       
  3863                 TRect(),
       
  3864                 AknTransEffect::EParameterType,
       
  3865                 AknTransEffect::GfxTransParam( KUidPhoneApplication,
       
  3866                         AknTransEffect::TParameter::EActivateExplicitCancel ) );
       
  3867             iEffectOngoing = ETrue;
       
  3868             break;
       
  3869             }
       
  3870         case EPhoneTransEffectAppStartFromDialer:
  3858         case EPhoneTransEffectAppStartFromDialer:
  3871             {
  3859             useEffect = AknTransEffect::EApplicationStart;
  3872             GfxTransEffect::BeginFullScreen(
  3860             break;
  3873                 AknTransEffect::EApplicationStart,
  3861         case EPhoneTransEffectCallUiAppear:
  3874                 TRect(),
  3862             useEffect = KTouchCallUiOpenEffect;
  3875                 AknTransEffect::EParameterType,
  3863             break;
  3876                 AknTransEffect::GfxTransParam( aAppUidEffectParam,
  3864         case EPhoneTransEffectCallUiDisappear:
  3877                     AknTransEffect::TParameter::EActivateExplicitCancel ) );
  3865             useEffect = KTouchCallUiCloseEffect;
  3878             iEffectOngoing = ETrue;
       
  3879             }
       
  3880             break;
  3866             break;
  3881         case EPhoneTransEffectStop:
  3867         case EPhoneTransEffectStop:
  3882             {
  3868             {
  3883             if ( iEffectOngoing )
  3869             if ( iEffectOngoing )
  3884                 {
  3870                 {
  3887                 }
  3873                 }
  3888             break;
  3874             break;
  3889             }
  3875             }
  3890         default:
  3876         default:
  3891             break;
  3877             break;
       
  3878         }
       
  3879     
       
  3880     if ( KErrNotFound < useEffect )
       
  3881         {
       
  3882         GfxTransEffect::BeginFullScreen(
       
  3883             useEffect,
       
  3884             TRect(),
       
  3885             AknTransEffect::EParameterType,
       
  3886             AknTransEffect::GfxTransParam( aAppUidEffectParam,
       
  3887                     AknTransEffect::TParameter::EActivateExplicitCancel ) );
       
  3888         iEffectOngoing = ETrue;
  3892         }
  3889         }
  3893     }
  3890     }
  3894 
  3891 
  3895 // ---------------------------------------------------------------------------
  3892 // ---------------------------------------------------------------------------
  3896 // CPhoneViewController::SetControltoDialerL
  3893 // CPhoneViewController::SetControltoDialerL
  4115 //
  4112 //
  4116 TBool CPhoneViewController::CanTransEffectBeUsed(
  4113 TBool CPhoneViewController::CanTransEffectBeUsed(
  4117     TPhoneTransEffectType aType )
  4114     TPhoneTransEffectType aType )
  4118     {
  4115     {
  4119     TBool okToUseEffect( EFalse );
  4116     TBool okToUseEffect( EFalse );
  4120 
  4117     TBool isPhoneForeground = iAppui->IsForeground();
  4121     TBool isForeground = iAppui->IsForeground();
  4118     TBool isIdleInForeground = 
  4122     // Check whether the idle is on foreground
  4119             ForegroundApplicationWindowGroupId() == IdleWindowGroupId() ?
  4123     TBool idleInFore = ForegroundApplicationWindowGroupId() ==  IdleWindowGroupId() ?
       
  4124             ETrue : EFalse;
  4120             ETrue : EFalse;
  4125 
  4121     if ( isPhoneForeground && 
  4126     if ( isForeground && // Newer run effect if not at front
  4122          IsOkToUseThisTypeOfEffectInsidePhoneApp( aType ) )
  4127          ( ( aType == EPhoneTransEffectDialerCreate && !iDialerActive ) ||
       
  4128            ( aType == EPhoneTransEffectDialerOpen && !iDialerActive &&
       
  4129              iBubbleWrapper->IsNumberEntryUsed() ) ||
       
  4130            ( aType == EPhoneTransEffectDialerClose && iDialerActive ) ) )
       
  4131         {
  4123         {
  4132         okToUseEffect = ETrue;
  4124         okToUseEffect = ETrue;
  4133         }
  4125         }
  4134     // In case transition is from idle to dialer show transition effects as well.
  4126     /* In case transition is from idle to dialer or to incoming call 
  4135     else if ( idleInFore && !iDialerActive &&
  4127     show transition effects as well. */
  4136               aType == EPhoneTransEffectDialerOpen )
  4128     else if ( isIdleInForeground && 
       
  4129               ( aType == EPhoneTransEffectDialerOpen ||
       
  4130                 aType == EPhoneTransEffectCallUiAppear ) )
  4137         {
  4131         {
  4138         okToUseEffect = ETrue;
  4132         okToUseEffect = ETrue;
  4139         }
  4133         }
  4140     else if ( isForeground && iDialerActive &&
  4134     /* isPhoneForeground/isIdleInForeground are false
  4141               aType == EPhoneTransEffectAppStartFromDialer )
  4135     when call is created from some other then phone app for example logs or from phonebook*/
       
  4136     else if ( !isPhoneForeground && 
       
  4137               !isIdleInForeground && 
       
  4138               ( aType == EPhoneTransEffectDialerOpen ||
       
  4139                 aType == EPhoneTransEffectCallUiAppear ) )
  4142         {
  4140         {
  4143         okToUseEffect = ETrue;
  4141         okToUseEffect = ETrue;
  4144         }
  4142         }
  4145 
       
  4146     return okToUseEffect;
  4143     return okToUseEffect;
       
  4144     }
       
  4145 
       
  4146 // -----------------------------------------------------------
       
  4147 // CPhoneViewController::IsOkToUseThisTypeOfEffectInsidePhoneApp
       
  4148 // -----------------------------------------------------------
       
  4149 //
       
  4150 TBool CPhoneViewController::IsOkToUseThisTypeOfEffectInsidePhoneApp(
       
  4151         TPhoneTransEffectType aType )
       
  4152     {
       
  4153     TBool okToUse(EFalse);
       
  4154     switch ( aType )
       
  4155         {
       
  4156         case EPhoneTransEffectDialerCreate:
       
  4157         case EPhoneTransEffectDialerOpen:
       
  4158             okToUse = !iDialerActive;
       
  4159             break;
       
  4160         case EPhoneTransEffectAppStartFromDialer:
       
  4161             okToUse = iDialerActive;
       
  4162             break;
       
  4163         /* No need to check dialer activity below because effects are 
       
  4164         common to callhandling/dialer */
       
  4165         case EPhoneTransEffectDialerClose:
       
  4166         case EPhoneTransEffectCallUiAppear:
       
  4167         case EPhoneTransEffectCallUiDisappear:
       
  4168             okToUse = ETrue;
       
  4169             break;
       
  4170         default:
       
  4171             break;
       
  4172         }
       
  4173     __PHONELOG1( EBasic, EPhoneUIView,
       
  4174                 "CPhoneViewController::IsOkToUseThisTypeOfEffectInsidePhoneApp(%d)",
       
  4175                 okToUse );
       
  4176     return okToUse;
  4147     }
  4177     }
  4148 
  4178 
  4149 // -----------------------------------------------------------
  4179 // -----------------------------------------------------------
  4150 // CPhoneViewController::BeginTransEffectForAppStartFromDialerLC
  4180 // CPhoneViewController::BeginTransEffectForAppStartFromDialerLC
  4151 // -----------------------------------------------------------
  4181 // -----------------------------------------------------------
  4200         "CPhoneViewController::SetNeedToReturnToForegroundAppAfterCall(%d)",
  4230         "CPhoneViewController::SetNeedToReturnToForegroundAppAfterCall(%d)",
  4201         iNeedToReturnToForegroundAppAfterCall );
  4231         iNeedToReturnToForegroundAppAfterCall );
  4202     }
  4232     }
  4203 
  4233 
  4204 // ---------------------------------------------------------------------------
  4234 // ---------------------------------------------------------------------------
  4205 // CPhoneViewController::GetNeedToReturnToForegroundAppAfterCall
  4235 // CPhoneViewController::GetNeedToReturnToForegroundAppAfterCallL
  4206 // ---------------------------------------------------------------------------
  4236 // ---------------------------------------------------------------------------
  4207 //
  4237 //
  4208 TBool CPhoneViewController::GetNeedToReturnToForegroundAppAfterCall() const
  4238 TBool CPhoneViewController::GetNeedToReturnToForegroundAppAfterCallL()
  4209     {
  4239     {
       
  4240     // Check that previous app still exists. It might be for example
       
  4241     // add to contact - dialog that is allready destroyed or user has closed
       
  4242     // app using task swapper.
       
  4243     if( KErrNotFound == FindAppByWgIDL( iPrevForegroundAppWg ) )
       
  4244         {
       
  4245         iNeedToReturnToForegroundAppAfterCall = EFalse;
       
  4246         }
  4210     return iNeedToReturnToForegroundAppAfterCall;
  4247     return iNeedToReturnToForegroundAppAfterCall;
  4211     }
  4248     }
  4212 
  4249 
  4213 // ---------------------------------------------------------------------------
  4250 // ---------------------------------------------------------------------------
  4214 // CPhoneViewController::AllowInCallBubbleInSpecialCases
  4251 // CPhoneViewController::AllowInCallBubbleInSpecialCases