phoneapp/phoneuiview/src/cphoneviewcontroller.cpp
branchRCL_3
changeset 12 b68fcd923911
parent 10 ba54057fe027
child 14 b8d67d6176f5
equal deleted inserted replaced
10:ba54057fe027 12:b68fcd923911
   140 // Kastor effect IDs, aknskincontent/101f84b9.sel
   140 // Kastor effect IDs, aknskincontent/101f84b9.sel
   141 // These effects cannot be used for internal transitions (Call UI<->Dialer)
   141 // These effects cannot be used for internal transitions (Call UI<->Dialer)
   142 const TInt KTouchDialerOpenEffect  = 3;
   142 const TInt KTouchDialerOpenEffect  = 3;
   143 const TInt KTouchDialerCloseEffect = 5;
   143 const TInt KTouchDialerCloseEffect = 5;
   144 
   144 
       
   145 const TInt KDialerInputMaxChars( 100 );
       
   146 
   145 // ================= MEMBER FUNCTIONS =======================
   147 // ================= MEMBER FUNCTIONS =======================
   146 
   148 
   147 // ---------------------------------------------------------------------------
   149 // ---------------------------------------------------------------------------
   148 // CPhoneViewController::CPhoneViewController
   150 // CPhoneViewController::CPhoneViewController
   149 // C++ default constructor can NOT contain any code, that
   151 // C++ default constructor can NOT contain any code, that
   176     // Create the status pane singleton
   178     // Create the status pane singleton
   177     iStatusPane = CPhoneStatusPane::Instance();
   179     iStatusPane = CPhoneStatusPane::Instance();
   178     // Reserve the title pane
   180     // Reserve the title pane
   179     iStatusPane->AddTitlePaneHandlerL( *this );
   181     iStatusPane->AddTitlePaneHandlerL( *this );
   180     iStatusPane->ReserveTitlePane( *this );
   182     iStatusPane->ReserveTitlePane( *this );
       
   183     // Set status pane dimming
       
   184     iStatusPane->StatusPane().SetDimmed( iSecurityMode );
   181 
   185 
   182     iAppui = (CAknAppUi*)iEikEnv.EikAppUi();
   186     iAppui = (CAknAppUi*)iEikEnv.EikAppUi();
   183     iCba = iEikEnv.AppUiFactory()->Cba();
   187     iCba = iEikEnv.AppUiFactory()->Cba();
   184 
   188 
   185 	iPhoneView = CPhoneView::NewL( aRect, *iCba, this );
   189 	iPhoneView = CPhoneView::NewL( aRect, *iCba, this );
  2165     iToolbarController->DimToolbar( aIsEnabled );			
  2169     iToolbarController->DimToolbar( aIsEnabled );			
  2166 	iPhoneView->SetSecurityMode( aIsEnabled );
  2170 	iPhoneView->SetSecurityMode( aIsEnabled );
  2167 	iMenuController->SetSecurityMode( aIsEnabled );
  2171 	iMenuController->SetSecurityMode( aIsEnabled );
  2168 	if ( iDialer )
  2172 	if ( iDialer )
  2169 		{
  2173 		{
  2170 		iDialerController->SetRestrictedDialer( aIsEnabled );
  2174         CDialingExtensionInterface* easyDialing = iDialer->GetEasyDialingInterface();
       
  2175         if ( easyDialing )
       
  2176             {
       
  2177             if ( aIsEnabled )
       
  2178                 {
       
  2179                 // Reset the Easy Dialing just in case, this clears the existing matches
       
  2180                 // when restricted mode is activated
       
  2181                 easyDialing->Reset();
       
  2182                 }
       
  2183             else
       
  2184                 {
       
  2185                 if ( easyDialing->IsEnabled() )
       
  2186                     {
       
  2187                     // If Easy Dialing is enabled, set the input from the numeric entry
       
  2188                     // field for updating the search result when restricted mode is
       
  2189                     // deactivated.
       
  2190                     TBuf<KDialerInputMaxChars> buf;
       
  2191                     iDialer->NumberEntry()->GetTextFromNumberEntry( buf );
       
  2192                     easyDialing->SetInputL( buf );
       
  2193                     }
       
  2194                 }
       
  2195             }
       
  2196         iDialerController->SetRestrictedDialer( aIsEnabled );
  2171 		if ( iSecurityMode != aIsEnabled )
  2197 		if ( iSecurityMode != aIsEnabled )
  2172 			{
  2198 			{
  2173 			iDialer->RelayoutAndDraw();
  2199 			iDialer->RelayoutAndDraw();
  2174 			}
  2200 			}
  2175 		}
  2201 		}
       
  2202     if ( iSecurityMode != aIsEnabled )
       
  2203         {
       
  2204         // Update status pane dimming
       
  2205         iStatusPane->StatusPane().SetDimmed( aIsEnabled );
       
  2206         }
  2176 	iSecurityMode = aIsEnabled;
  2207 	iSecurityMode = aIsEnabled;
  2177 	}
  2208 	}
  2178 
  2209 
  2179 // ---------------------------------------------------------------------------
  2210 // ---------------------------------------------------------------------------
  2180 // CPhoneViewController::IdleAppUid
  2211 // CPhoneViewController::IdleAppUid
  3621 void CPhoneViewController::SwitchLayoutToFlatStatusPaneL( TBool aSwitch )
  3652 void CPhoneViewController::SwitchLayoutToFlatStatusPaneL( TBool aSwitch )
  3622     {
  3653     {
  3623     __LOGMETHODSTARTEND(EPhoneUIView,
  3654     __LOGMETHODSTARTEND(EPhoneUIView,
  3624         "CPhoneViewController::SwitchLayoutToFlatStatusPaneL()" );
  3655         "CPhoneViewController::SwitchLayoutToFlatStatusPaneL()" );
  3625 
  3656 
  3626     TInt currentLayout = iStatusPane->StatusPane().CurrentLayoutResId();
       
  3627 
       
  3628     if ( aSwitch )
  3657     if ( aSwitch )
  3629         {
  3658         {
  3630         // If current layout is different than flat layout then we
  3659         SwapEmptyIndicatorPaneInSecureStateL( ETrue );
  3631         // need to do PushDefault for navipane and SwitchLayoutL for
  3660         if ( !Layout_Meta_Data::IsLandscapeOrientation() )
  3632         // statuspane.
  3661             {
  3633         if ( currentLayout != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ||
  3662             iStatusPane->StatusPane().SwitchLayoutL
  3634              currentLayout != R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT )
  3663                     ( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
  3635             {
  3664             }
  3636             SwapEmptyIndicatorPaneInSecureStateL( ETrue );
  3665         else
  3637 
  3666             {
  3638             // Push default so that Operator name can be shown in title pane.
  3667             iStatusPane->StatusPane().SwitchLayoutL
  3639             iStatusPane->NaviPane().PushDefaultL();
  3668                     ( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT );
  3640 
       
  3641             if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  3642                 {
       
  3643                 iStatusPane->StatusPane().SwitchLayoutL
       
  3644                 ( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
       
  3645                 }
       
  3646             else
       
  3647                 {
       
  3648                 iStatusPane->StatusPane().SwitchLayoutL
       
  3649                         ( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT );
       
  3650                 }
       
  3651             }
  3669             }
  3652         }
  3670         }
  3653     else
  3671     else
  3654         {
  3672         {
  3655         // If current layout is flat layout then do Pop for navipane,
  3673         SwapEmptyIndicatorPaneInSecureStateL( EFalse );
  3656         // layout is something else there is no need to do Pop and
  3674         if ( !Layout_Meta_Data::IsLandscapeOrientation() )
  3657         // SwitchLayoutL for statuspane.
  3675             {
  3658         if ( currentLayout == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ||
  3676             iStatusPane->StatusPane().SwitchLayoutL
  3659              currentLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT )
  3677                     ( R_AVKON_STATUS_PANE_LAYOUT_IDLE );
  3660             {
  3678             }
  3661             SwapEmptyIndicatorPaneInSecureStateL( EFalse );
  3679         else
  3662             
  3680             {
  3663             if ( !Layout_Meta_Data::IsLandscapeOrientation() )
  3681             iStatusPane->StatusPane().SwitchLayoutL
  3664                 {
  3682                     ( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT );
  3665                 iStatusPane->StatusPane().SwitchLayoutL
       
  3666                         ( R_AVKON_STATUS_PANE_LAYOUT_IDLE );
       
  3667                 }
       
  3668             else
       
  3669                 {
       
  3670                 iStatusPane->StatusPane().SwitchLayoutL
       
  3671                         ( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT );
       
  3672                 }
       
  3673             }
  3683             }
  3674         }
  3684         }
  3675     // ApplyCurrentSettingsL is called whenever statuspane
  3685     // ApplyCurrentSettingsL is called whenever statuspane
  3676     // visibility status or pane layout changes.
  3686     // visibility status or pane layout changes.
  3677     iStatusPane->StatusPane().ApplyCurrentSettingsL();
  3687     iStatusPane->StatusPane().ApplyCurrentSettingsL();
  3783     SetIncallBubbleVisibility( ETrue );
  3793     SetIncallBubbleVisibility( ETrue );
  3784 
  3794 
  3785     if ( !iDialerActive )
  3795     if ( !iDialerActive )
  3786         {
  3796         {
  3787         iDialerActive = ETrue;
  3797         iDialerActive = ETrue;
  3788 
       
  3789         // Hide in-call view toolbar
       
  3790         iToolbarController->HideToolbar();
       
  3791 
  3798 
  3792         // Ensure that toolbar and menu commands are up-to-date 
  3799         // Ensure that toolbar and menu commands are up-to-date 
  3793         TBuf<1> temp; // we are only interested if the text is empty or not
  3800         TBuf<1> temp; // we are only interested if the text is empty or not
  3794         iDialer->GetTextFromNumberEntry( temp );
  3801         iDialer->GetTextFromNumberEntry( temp );
  3795         NumberEntryStateChanged( temp.Length() > 0 );
  3802         NumberEntryStateChanged( temp.Length() > 0 );
  3796         
  3803         
  3797         // Make dialer view top most
  3804         // Make dialer view top most
  3798         iDialerView->DrawableWindow()->SetOrdinalPosition(
  3805         iDialerView->DrawableWindow()->SetOrdinalPosition(
  3799             iPhoneView->DrawableWindow()->OrdinalPosition() );
  3806             iPhoneView->DrawableWindow()->OrdinalPosition() );
  3800 
  3807 
       
  3808         // Hide in-call view toolbar
       
  3809         iToolbarController->HideToolbar();
       
  3810         
  3801         SwitchLayoutToFlatStatusPaneL( ETrue );
  3811         SwitchLayoutToFlatStatusPaneL( ETrue );
  3802 
       
  3803         iPhoneView->DrawableWindow()->SetOrdinalPosition( -1 );
       
  3804         iPhoneView->MakeVisible( EFalse );
       
  3805 
       
  3806         // Update control stack
       
  3807         iAppui->AddToStackL( iDialerView );
       
  3808         iAppui->RemoveFromStack( iPhoneView );
       
  3809 
  3812 
  3810         // Don't make dialer view visible before status pane is updated.
  3813         // Don't make dialer view visible before status pane is updated.
  3811         // This prevents unnecessary resizings.
  3814         // This prevents unnecessary resizings.
       
  3815         // But do it right away after it. Otherwice a black toolbar area is shortly shown.
  3812         iDialerView->MakeVisible( ETrue );
  3816         iDialerView->MakeVisible( ETrue );
  3813         // Number entry is emptied when dialer is hidden but drawing doesn't
  3817         // Number entry is emptied when dialer is hidden but drawing doesn't
  3814         // succeed at that point as dialer is hidden first. So must draw
  3818         // succeed at that point as dialer is hidden first. So must draw
  3815         // dialer as soon as it becomes visible to prevent the flashing of
  3819         // dialer as soon as it becomes visible to prevent the flashing of
  3816         // number entry (DrawDeferred() isn't fast enough here).
  3820         // number entry (DrawDeferred() isn't fast enough here).
  3817         iDialerView->DrawNow();
  3821         iDialerView->DrawNow();
       
  3822       
       
  3823         iPhoneView->DrawableWindow()->SetOrdinalPosition( -1 );
       
  3824         iPhoneView->MakeVisible( EFalse );
       
  3825 
       
  3826         // Update control stack
       
  3827         iAppui->AddToStackL( iDialerView );
       
  3828         iAppui->RemoveFromStack( iPhoneView );
  3818         }
  3829         }
  3819     }
  3830     }
  3820 
  3831 
  3821 // ---------------------------------------------------------------------------
  3832 // ---------------------------------------------------------------------------
  3822 // CPhoneViewController::SetControltoCallHandlingL
  3833 // CPhoneViewController::SetControltoCallHandlingL