browserui/browser/BrowserAppSrc/BrowserContentView.cpp
branchRCL_3
changeset 58 aead3f7e1bb0
parent 56 3154c14a33db
child 60 b149f0820e5a
equal deleted inserted replaced
56:3154c14a33db 58:aead3f7e1bb0
   130 CBrowserContentView::CBrowserContentView( MApiProvider& aApiProvider ) :
   130 CBrowserContentView::CBrowserContentView( MApiProvider& aApiProvider ) :
   131     CBrowserViewBase( aApiProvider ),
   131     CBrowserViewBase( aApiProvider ),
   132     iZoomMode(EFalse),
   132     iZoomMode(EFalse),
   133     iContentFullScreenMode( EFalse ),
   133     iContentFullScreenMode( EFalse ),
   134     iIsPluginFullScreenMode( EFalse),
   134     iIsPluginFullScreenMode( EFalse),
   135     iWasContentFullScreenMode( EFalse )
   135     iWasContentFullScreenMode( EFalse ),
       
   136     iTitle( NULL )
   136     {
   137     {
   137     iFindItemIsInProgress = EFalse;
   138     iFindItemIsInProgress = EFalse;
   138     iWasInFeedsView = EFalse;
   139     iWasInFeedsView = EFalse;
   139     iPenEnabled = AknLayoutUtils::PenEnabled();
   140     iPenEnabled = AknLayoutUtils::PenEnabled();
   140     iFullScreenBeforeEditModeEntry = EFalse;
   141     iFullScreenBeforeEditModeEntry = EFalse;
   173     delete iToolBarInfoNote;
   174     delete iToolBarInfoNote;
   174     delete iStylusPopupMenu;
   175     delete iStylusPopupMenu;
   175     delete iPeriodic;
   176     delete iPeriodic;
   176     delete iAutoFSPeriodic;
   177     delete iAutoFSPeriodic;
   177     delete iIdlePeriodic;
   178     delete iIdlePeriodic;
       
   179     delete iTitle;
   178     }
   180     }
   179 
   181 
   180 
   182 
   181 // -----------------------------------------------------------------------------
   183 // -----------------------------------------------------------------------------
   182 // CBrowserContentView::ConstructL
   184 // CBrowserContentView::ConstructL
   189 
   191 
   190     ConstructMenuAndCbaEarlyL();
   192     ConstructMenuAndCbaEarlyL();
   191 
   193 
   192     iContainer = CBrowserContentViewContainer::NewL( this, ApiProvider() );
   194     iContainer = CBrowserContentViewContainer::NewL( this, ApiProvider() );
   193 
   195 
   194     iContainer->SetRect( aRect );
       
   195     iContainer->GotoPane()->SetGPObserver(this);
       
   196     iContainer->FindKeywordPane()->SetGPObserver(this);
       
   197     iEnteredKeyword = NULL;
   196     iEnteredKeyword = NULL;
   198 
   197 
   199     // get the StatusPane pointer
   198     // get the StatusPane pointer
   200     if ( !iNaviPane )
   199     if ( !iNaviPane )
   201         {
   200         {
   970         ui->SetViewToBeActivatedIfNeededL( ui->LastActiveViewId() );
   969         ui->SetViewToBeActivatedIfNeededL( ui->LastActiveViewId() );
   971         ApiProvider().SetLastActiveViewId ( ui->LastActiveViewId() );
   970         ApiProvider().SetLastActiveViewId ( ui->LastActiveViewId() );
   972         }
   971         }
   973     else
   972     else
   974         {
   973         {
   975         UpdateFullScreenL();
   974         HandleStatusPaneCallBack();
   976         ApiProvider().SetLastActiveViewId(Id());
   975         ApiProvider().SetLastActiveViewId(Id());
   977         }
   976         }
   978 
   977 
   979     iContainer->ActivateL();
   978     iContainer->ActivateL();
   980 
   979 
   981     AppUi()->AddToViewStackL( *this, iContainer );
   980     AppUi()->AddToViewStackL( *this, iContainer );
   982 
   981 
       
   982     //Reset the title before updating the title in case of view activation
       
   983     delete iTitle;
       
   984     iTitle = NULL;
       
   985     
   983     UpdateTitleL( ApiProvider() );
   986     UpdateTitleL( ApiProvider() );
   984 
   987 
   985     ApiProvider().BrCtlInterface().MakeVisible(ETrue);
   988     ApiProvider().BrCtlInterface().MakeVisible(ETrue);
   986     ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandGainFocus +
   989     ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandGainFocus +
   987                                                     (TInt)TBrCtlDefs::ECommandIdBase);
   990                                                     (TInt)TBrCtlDefs::ECommandIdBase);
  1028         {
  1031         {
  1029         if ( activeViewId.iViewUid == KUidBrowserContentViewId )
  1032         if ( activeViewId.iViewUid == KUidBrowserContentViewId )
  1030             {
  1033             {
  1031             TBool sizeChangedCba = EFalse;
  1034             TBool sizeChangedCba = EFalse;
  1032             TBool sizeChangedSP = EFalse;
  1035             TBool sizeChangedSP = EFalse;
  1033             TBool resIdChanged = EFalse;
  1036             
  1034             TInt resId = StatusPane()->CurrentLayoutResId();
       
  1035 
       
  1036             if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1037                 {
       
  1038                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_USUAL;
       
  1039                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
  1040                 }
       
  1041             else //Portrait
       
  1042                 {
       
  1043                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_SMALL;
       
  1044                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
       
  1045                 }
       
  1046 
       
  1047             if ( iContentFullScreenMode )
  1037             if ( iContentFullScreenMode )
  1048                 {
  1038                 {
  1049                 sizeChangedCba = Cba()->IsVisible();
  1039                 SetContentContainerRect();
       
  1040                 if (iPenEnabled)
       
  1041                     {
       
  1042 					Toolbar()->SetToolbarVisibility( EFalse, EFalse );
       
  1043                     Toolbar()->MakeVisible( EFalse );
       
  1044                     }
       
  1045                 if(Cba()->IsVisible())
       
  1046                 {
  1050                 Cba()->MakeVisible( EFalse );
  1047                 Cba()->MakeVisible( EFalse );
  1051                 UpdateCbaL();
  1048                 UpdateCbaL();
  1052 
  1049                 }
  1053                 if (!ApiProvider().Fetching())
  1050                 if (!ApiProvider().Fetching())
  1054                     {
  1051                     {
  1055                     sizeChangedSP = StatusPane()->IsVisible();
  1052                     if(StatusPane()->IsVisible())
  1056                     StatusPane()->MakeVisible( EFalse );
  1053                         {
       
  1054                         sizeChangedSP = ETrue;
       
  1055                         StatusPane()->MakeVisible(EFalse);
       
  1056                         }
  1057                     }
  1057                     }
  1058                 else
  1058                 else
  1059                     {
  1059                     {
  1060                     sizeChangedSP = !StatusPane()->IsVisible();
  1060                     if(!StatusPane()->IsVisible())
  1061                     ShowFsStatusPane(ETrue);
  1061                         {
       
  1062                         sizeChangedSP = ETrue;
       
  1063                         ShowFsStatusPane(ETrue);
       
  1064                         }
  1062                     }
  1065                     }
  1063                 }
  1066                 }
  1064             else
  1067             else
  1065                 {
  1068                 {
  1066                 sizeChangedCba = !Cba()->IsVisible();
  1069                 sizeChangedCba = !Cba()->IsVisible();
  1069                 StatusPane()->MakeVisible( ETrue );
  1072                 StatusPane()->MakeVisible( ETrue );
  1070                 }
  1073                 }
  1071 
  1074 
  1072             ApiProvider().Display().FSPaneOnL( );
  1075             ApiProvider().Display().FSPaneOnL( );
  1073             ApiProvider().Display().SetGPRSIndicatorOnL();
  1076             ApiProvider().Display().SetGPRSIndicatorOnL();
       
  1077             
       
  1078             //Reset the title before updating the title in case of view activation
       
  1079             delete iTitle;
       
  1080             iTitle = NULL;
  1074             UpdateTitleL(ApiProvider());
  1081             UpdateTitleL(ApiProvider());
  1075             ApiProvider().Display().RestoreTitleL();
  1082             ApiProvider().Display().RestoreTitleL();
  1076             StatusPane()->ApplyCurrentSettingsL();
  1083             StatusPane()->ApplyCurrentSettingsL();
  1077             if ( resIdChanged || sizeChangedCba || sizeChangedSP  )
       
  1078                 {
       
  1079                 
       
  1080                 SetContentContainerRect();
       
  1081                 }
       
  1082             }
  1084             }
  1083         }
  1085         }
  1084     }
  1086     }
  1085 
  1087 
  1086 TRect CBrowserContentView::ResizeClientRect()
  1088 TRect CBrowserContentView::ResizeClientRect()
  1087     {
  1089     {
  1088     TRect clientRect = ClientRect();
  1090     TRect clientRect = ClientRect();
  1089         
  1091 	
       
  1092     if(iContentFullScreenMode &&  (Toolbar() && Toolbar()->IsVisible()) && Cba()->IsVisible()) 
       
  1093         {
       
  1094         TRect screenRect;
       
  1095         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, screenRect);
       
  1096         clientRect = screenRect;
       
  1097         }
       
  1098 		
  1090     if (Layout_Meta_Data::IsLandscapeOrientation() &&
  1099     if (Layout_Meta_Data::IsLandscapeOrientation() &&
  1091          StatusPane()->IsVisible() && !Cba()->IsVisible())
  1100         (StatusPane() && StatusPane()->IsVisible()) && !Cba()->IsVisible())
  1092         {
  1101         {
  1093         TRect screenRect;
  1102         TRect screenRect;
  1094         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect);
  1103         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect);
  1095         clientRect.iBr.iY = screenRect.iBr.iY;
  1104         clientRect.iBr.iY = screenRect.iBr.iY;
  1096     
  1105     
  1857     {
  1866     {
  1858     HBufC* title = aApiProvider.BrCtlInterface().PageInfoLC(
  1867     HBufC* title = aApiProvider.BrCtlInterface().PageInfoLC(
  1859         TBrCtlDefs::EPageInfoTitle );
  1868         TBrCtlDefs::EPageInfoTitle );
  1860     if ( title && title->Length() )
  1869     if ( title && title->Length() )
  1861         {
  1870         {
  1862         aApiProvider.Display().SetTitleL( title->Des() );
  1871             if( !iTitle || (iTitle && (iTitle->Des().Compare( title->Des())!= 0)))
       
  1872               {
       
  1873               delete iTitle;
       
  1874               iTitle = title->Des().AllocL();
       
  1875               aApiProvider.Display().SetTitleL( title->Des() );
       
  1876               }
  1863         }
  1877         }
  1864     else
  1878     else
  1865         {
  1879         {
  1866 
  1880 
  1867         TInt offset = 0;
  1881         TInt offset = 0;
  3157 void CBrowserContentView::EnableFullScreenModeL( TBool aEnableFullScreen )
  3171 void CBrowserContentView::EnableFullScreenModeL( TBool aEnableFullScreen )
  3158     {
  3172     {
  3159     TInt command( KErrNotFound );
  3173     TInt command( KErrNotFound );
  3160     if ( aEnableFullScreen )
  3174     if ( aEnableFullScreen )
  3161         {
  3175         {
  3162         if (iPenEnabled)
       
  3163             {
       
  3164             Toolbar()->SetToolbarVisibility( EFalse, EFalse );
       
  3165             Toolbar()->MakeVisible( EFalse );
       
  3166             }
       
  3167         iContentFullScreenMode = ETrue;
  3176         iContentFullScreenMode = ETrue;
  3168         UpdateFullScreenL();
  3177         UpdateFullScreenL();
  3169         command = TBrCtlDefs::ECommandEnterFullscreenBrowsing;
  3178         command = TBrCtlDefs::ECommandEnterFullscreenBrowsing;
  3170         }
  3179         }
  3171     else
  3180     else
  3429                     (focusedElementType == TBrCtlDefs:: EElementInputBox) ||
  3438                     (focusedElementType == TBrCtlDefs:: EElementInputBox) ||
  3430                     (focusedElementType == TBrCtlDefs:: EElementTextAreaBox));
  3439                     (focusedElementType == TBrCtlDefs:: EElementTextAreaBox));
  3431 	return  (retVal);
  3440 	return  (retVal);
  3432 	}
  3441 	}
  3433 
  3442 
       
  3443 void  CBrowserContentView::HandleStatusPaneCallBack()
       
  3444     {
       
  3445     TVwsViewId activeViewId;
       
  3446     TBool resIdChanged(EFalse);
       
  3447     TInt resId = StatusPane()->CurrentLayoutResId();
       
  3448 
       
  3449     if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone )
       
  3450         {
       
  3451         if ( activeViewId.iViewUid == KUidBrowserContentViewId )
       
  3452             {
       
  3453             if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  3454                 {
       
  3455                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_USUAL;
       
  3456                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
  3457                 }
       
  3458             else //Portrait
       
  3459                 {
       
  3460                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_SMALL;
       
  3461                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
       
  3462                 }
       
  3463             }
       
  3464         }
       
  3465     if(resIdChanged)
       
  3466     SetContentContainerRect();
       
  3467 }
       
  3468 
  3434 // End of File
  3469 // End of File