browserui/browser/BrowserAppSrc/BrowserContentView.cpp
changeset 0 84ad3b177aa3
child 1 57d5b8e231c4
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     1 /*
       
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     Browser content view
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <CDownloadMgrUiDownloadsList.h>
       
    23 #include <CDownloadMgrUiDownloadMenu.h>
       
    24 #include <FeatMgr.h>
       
    25 #include <irmsgtypeuid.h>
       
    26 #include <SenduiMtmUids.h>
       
    27 #include <IrcMTM.h>
       
    28 #include <EikMenuP.h>
       
    29 #include <InternetConnectionManager.h>
       
    30 #include <DocumentHandler.h>
       
    31 #include <apmstd.h>
       
    32 #include <aknnavi.h>
       
    33 #include <EIKSPANE.H>
       
    34 #include <aknnavide.h>
       
    35 #include <bldvariant.hrh>
       
    36 #include <LayoutMetaData.cdl.h> // For Layout_Meta_Data landscape/portrait status
       
    37 
       
    38 #include <BrowserNG.rsg>
       
    39 #include <StringLoader.h>
       
    40 
       
    41 #include <aknviewappui.h>
       
    42 #include <aknlists.h>
       
    43 #include <akntitle.h>
       
    44 #include <aknPopup.h>
       
    45 #include <StringLoader.h>
       
    46 #include <uri16.h>
       
    47 #include <ApUtils.h>
       
    48 #include <btmsgtypeuid.h>
       
    49 #include "CommsModel.h"
       
    50 #include <AknNaviLabel.h>
       
    51 #include <FindItemMenu.h>
       
    52 #include <EIKMENUB.H>
       
    53 #include <avkon.hrh>
       
    54 
       
    55 #include <AknInfoPopupNoteController.h>
       
    56 #include <aknutils.h>
       
    57 #include <AknStylusPopUpMenu.h>
       
    58 
       
    59 #include <s32mem.h>
       
    60 #include <Uri16.h>
       
    61 
       
    62 #include "Browser.hrh"
       
    63 #include "BrowserContentView.h"
       
    64 #include "BrowserContentViewToolbar.h"
       
    65 #include "BrowserContentViewContainer.h"
       
    66 #include "BrowserContentViewZoomModeTimer.h"
       
    67 #include "BrowserBookmarksView.h"
       
    68 #include "CommonConstants.h"
       
    69 #include "BrowserAppUi.h"
       
    70 #include "BrowserGotoPane.h"
       
    71 #include "Preferences.h"
       
    72 #include "BrowserPreferences.h"
       
    73 #include "Display.h"
       
    74 #include "FavouritesWapAp.h"
       
    75 #include "BrowserBookmarksModel.h"
       
    76 #include "BrowserDialogs.h"
       
    77 #include "BrowserUtil.h"
       
    78 #include "BrowserBmOTABinSender.h"
       
    79 #include <FINDITEMMENU.RSG>
       
    80 #include "BrowserUiVariant.hrh"
       
    81 #include "BrowserAdaptiveListPopup.h"
       
    82 #include "BrowserApplication.h"
       
    83 #include "logger.h"
       
    84 #include "FavouritesFile.h"
       
    85 #include "BrowserWindowManager.h"
       
    86 #include "BrowserWindow.h"
       
    87 #include "BrowserPopupEngine.h"
       
    88 
       
    89 #include <BrCtlDialogsProvider.h>
       
    90 #include <BrowserDialogsProvider.h>
       
    91 #include <BrCtlDefs.h>
       
    92 #include <akntoolbar.h>
       
    93 #ifdef RD_SCALABLE_UI_V2
       
    94 #include <akntoolbarextension.h>
       
    95 #endif
       
    96 #include <akntouchpane.h>
       
    97 
       
    98 #include "BrowserShortcutKeyMap.h"
       
    99 _LIT( KSchemaIdentifier, "://" );
       
   100 const TInt KSchemaIdentifierLength = 3;
       
   101 
       
   102 // Time interval in milliseconds that status pane stays visible after download in fullscreen mode
       
   103 const TInt KFullScreenStatusPaneTimeout( 3 * 1000000 ); // 3 seconds
       
   104 
       
   105 const TInt KAutoFullScreenTimeout( 5 * 1000000 ); // 5 seconds
       
   106 
       
   107 const TInt KAutoFullScreenIdleTimeout( 10 * 1000000 ); // 10 seconds
       
   108 // ============================ MEMBER FUNCTIONS ===============================
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CBrowserContentView::NewLC
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 CBrowserContentView* CBrowserContentView::NewLC( MApiProvider& aApiProvider,
       
   115                                                  TRect& aRect )
       
   116     {
       
   117     CBrowserContentView* view =
       
   118         new (ELeave) CBrowserContentView( aApiProvider );
       
   119     CleanupStack::PushL(view);
       
   120     view->ConstructL( aRect );
       
   121 
       
   122     return view;
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CBrowserContentView::CBrowserContentView
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 // Scroll indicators may become deprecated
       
   130 CBrowserContentView::CBrowserContentView( MApiProvider& aApiProvider ) :
       
   131     CBrowserViewBase( aApiProvider ),
       
   132     iZoomMode(EFalse),
       
   133     iContentFullScreenMode( EFalse ),
       
   134     iIsPluginFullScreenMode( EFalse),
       
   135     iWasContentFullScreenMode( EFalse )
       
   136     {
       
   137     iFindItemIsInProgress = EFalse;
       
   138     iWasInFeedsView = EFalse;
       
   139     iPenEnabled = AknLayoutUtils::PenEnabled();
       
   140     }
       
   141 
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CBrowserContentView::Id
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 TUid CBrowserContentView::Id() const
       
   148     {
       
   149     return KUidBrowserContentViewId;
       
   150     }
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CBrowserContentView::~CBrowserContentView
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 CBrowserContentView::~CBrowserContentView()
       
   158     {
       
   159     delete iBrowserContentViewToolbar;
       
   160     delete iNaviDecorator;
       
   161     delete iBookmarksModel;
       
   162     delete iContainer;
       
   163     delete iEnteredURL;
       
   164     delete iEnteredKeyword;
       
   165     delete iTextZoomLevelArray;
       
   166     delete iFontSizeArray;
       
   167     delete iZoomModeTimer;
       
   168     iNaviPane = NULL;
       
   169     if ( iToolBarInfoNote )
       
   170         {
       
   171         iToolBarInfoNote->HideInfoPopupNote();
       
   172         }
       
   173     delete iToolBarInfoNote;
       
   174     delete iStylusPopupMenu;
       
   175     delete iPeriodic;
       
   176     delete iAutoFSPeriodic;
       
   177     delete iIdlePeriodic;
       
   178     }
       
   179 
       
   180 
       
   181 // -----------------------------------------------------------------------------
       
   182 // CBrowserContentView::ConstructL
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CBrowserContentView::ConstructL( TRect& aRect )
       
   186     {
       
   187 
       
   188     BaseConstructL( R_BROWSER_CONTENT_VIEW );
       
   189 
       
   190     ConstructMenuAndCbaEarlyL();
       
   191 
       
   192     iContainer = CBrowserContentViewContainer::NewL( this, ApiProvider() );
       
   193 
       
   194     iContainer->SetRect( aRect );
       
   195     iContainer->GotoPane()->SetGPObserver(this);
       
   196     iContainer->FindKeywordPane()->SetGPObserver(this);
       
   197     iEnteredKeyword = NULL;
       
   198 
       
   199     iEnteredURL = NULL;
       
   200     // get the StatusPane pointer
       
   201     if ( !iNaviPane )
       
   202         {
       
   203         CEikStatusPane *sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
       
   204         // Fetch pointer to the default navi pane control
       
   205         iNaviPane =
       
   206             (CAknNavigationControlContainer*)sp->ControlL(
       
   207                                             TUid::Uid(EEikStatusPaneUidNavi) );
       
   208         }
       
   209 
       
   210     // Array for zoom levels (..., 70%, 80%, 90%, 100%,... )
       
   211     iTextZoomLevelArray = new( ELeave )CArrayFixFlat<TInt> ( 1 );
       
   212     // Array for zoom font sizes ( 1, 2, ... )
       
   213     iFontSizeArray = new( ELeave )CArrayFixFlat<TInt> ( 1 );
       
   214 
       
   215     // Get the possibile zoom levels
       
   216     GetTextZoomLevelsL();
       
   217     iZoomModeTimer = CBrowserContentViewZoomModeTimer::NewL( this );
       
   218 
       
   219     iToolBarInfoNote = CAknInfoPopupNoteController::NewL();
       
   220     HBufC* str = StringLoader::LoadLC(R_BROWSER_TOOLTIP_TOOLBAR);
       
   221     iToolBarInfoNote->SetTextL(*str);
       
   222     CleanupStack::PopAndDestroy();
       
   223     iBrowserContentViewToolbar = CBrowserContentViewToolbar::NewL(this);
       
   224     if (iPenEnabled)
       
   225         {
       
   226         Toolbar()->SetToolbarObserver(this);
       
   227         Toolbar()->SetFocusing(EFalse);
       
   228         ShowToolbarOnViewActivation(ETrue);
       
   229         }
       
   230     iShortcutKeyMap = NULL;
       
   231     iHistoryAtBeginning = EFalse;
       
   232     iHistoryAtEnd = EFalse;
       
   233     iZoomSliderVisible = EFalse;
       
   234     iPeriodic = CPeriodic::NewL(CActive::EPriorityIdle);
       
   235     iAutoFSPeriodic = CPeriodic::NewL(CActive::EPriorityIdle);
       
   236     iIdlePeriodic = CPeriodic::NewL(CActive::EPriorityIdle);
       
   237     }
       
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // CBrowserContentView::HandleCommandL
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 void CBrowserContentView::HandleCommandL( TInt aCommand )
       
   244     {
       
   245     // Disabling FullScreen for non-touch devices, before processing some dialog-based shortcut and toolbar actions
       
   246     if ( !iPenEnabled && iContentFullScreenMode && ( ( aCommand == EWmlCmdFindKeyword ) ||
       
   247                                                      ( aCommand == EWmlCmdHistory ) ||
       
   248                                                      ( aCommand == EWmlCmdGoToAddress ) ||
       
   249                                                      ( aCommand == EWmlCmdShowShortcutKeymap ) ||
       
   250                                                      ( aCommand == EWmlCmdShowMiniature ) ) )
       
   251         {
       
   252         iWasContentFullScreenMode = iContentFullScreenMode;
       
   253         EnableFullScreenModeL( EFalse );
       
   254         }
       
   255 
       
   256 #ifdef RD_SCALABLE_UI_V2
       
   257     // Close the extended toolbar whenever any item on it is selected
       
   258     if ( iPenEnabled && Toolbar()->ToolbarExtension()->IsShown() )
       
   259         {
       
   260         Toolbar()->ToolbarExtension()->SetShown( EFalse );
       
   261         StartAutoFullScreenTimer();
       
   262         }
       
   263 #endif
       
   264 
       
   265 #ifdef __RSS_FEEDS
       
   266     // Handle the subscribe to submenu.
       
   267     TInt cmd = aCommand - TBrCtlDefs::ECommandIdBase;
       
   268 
       
   269     if ((cmd >= TBrCtlDefs::ECommandIdSubscribeToBase) &&
       
   270             (cmd < TBrCtlDefs::ECommandIdPluginBase))
       
   271         {
       
   272             HandleSubscribeToL(cmd);
       
   273             return;
       
   274         }
       
   275 #endif  // __RSS_FEEDS
       
   276 
       
   277     switch ( aCommand )
       
   278         {
       
   279         case EWmlCmdFavourites:
       
   280             {
       
   281             ApiProvider().SetViewToBeActivatedIfNeededL(
       
   282                 KUidBrowserBookmarksViewId );
       
   283             break;
       
   284             }
       
   285 
       
   286         case EWmlCmdHistory:
       
   287             {
       
   288             ViewHistoryL();
       
   289             break;
       
   290             }
       
   291 
       
   292         case EWmlCmdHistoryBack:
       
   293             {
       
   294             ApiProvider().BrCtlInterface().HandleCommandL(
       
   295                                             (TInt)TBrCtlDefs::ECommandHistoryNavigateBack +
       
   296                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   297             UpdateTitleL( iApiProvider );
       
   298             break;
       
   299             }
       
   300         case EWmlCmdHistoryForward:
       
   301             {
       
   302             ApiProvider().BrCtlInterface().HandleCommandL(
       
   303                                             (TInt)TBrCtlDefs::ECommandHistoryNavigateForward +
       
   304                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   305             UpdateTitleL( iApiProvider );
       
   306             break;
       
   307             }
       
   308 
       
   309         case EWmlCmdGoToAddress:
       
   310             {
       
   311             LaunchGotoAddressEditorL();
       
   312             break;
       
   313             }
       
   314 
       
   315         case EWmlCmdGotoPaneCancel:
       
   316             {
       
   317             CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() );
       
   318             // Cancel editing and sets Goto Pane text back.
       
   319             if (iContainer->GotoPane()->PopupList() != NULL)
       
   320                 {
       
   321                 iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
       
   322                 iContainer->GotoPane()->PopupList()->HidePopupL();
       
   323                 }
       
   324             iContainer->ShutDownGotoURLEditorL();
       
   325             UpdateCbaL();
       
   326             if (iPenEnabled)
       
   327                 {
       
   328                 Toolbar()->SetDimmed(EFalse);
       
   329                 Toolbar()->DrawNow();
       
   330                 iBrowserContentViewToolbar->UpdateButtonsStateL();
       
   331                 }
       
   332             if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen )
       
   333                 {
       
   334                 MakeCbaVisible( EFalse );
       
   335                 }
       
   336             if (iPenEnabled)
       
   337             	{
       
   338             	StartAutoFullScreenTimer();
       
   339             	}
       
   340         break;
       
   341         }
       
   342 
       
   343         case EWmlCmdGotoPaneGoTo:
       
   344             {
       
   345             HBufC* input = iContainer->GotoPane()->GetTextL();
       
   346             if ((input) && (input->CompareF(KWWWString)))
       
   347                 {
       
   348                 if (iPenEnabled)
       
   349                     {
       
   350                     Toolbar()->SetDimmed(EFalse);
       
   351                     Toolbar()->DrawNow();
       
   352                     }
       
   353                 CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() );
       
   354                 // Cancel editing and sets Goto Pane text back.
       
   355                 if (iContainer->GotoPane()->PopupList() != NULL)
       
   356                     {
       
   357                     iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
       
   358                     iContainer->GotoPane()->PopupList()->HidePopupL();
       
   359                     }
       
   360                 GotoUrlInGotoPaneL();
       
   361                 if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen )
       
   362                     {
       
   363                     MakeCbaVisible( EFalse );
       
   364                     }
       
   365                 }
       
   366             if (iPenEnabled)
       
   367               	{
       
   368                	StartAutoFullScreenTimer();
       
   369                 }
       
   370             break;
       
   371             }
       
   372 
       
   373         case EWmlCmdGotoPaneSelect:
       
   374             {
       
   375             // Cancel editing and sets Goto Pane text back.
       
   376             if (iContainer->GotoPane()->PopupList() != NULL)
       
   377                 {
       
   378                 iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
       
   379                 iContainer->GotoPane()->PopupList()->HidePopupL();
       
   380                 }
       
   381             // set LSK to GOTO now
       
   382             UpdateCbaL();
       
   383             break;
       
   384             }
       
   385 
       
   386        //adaptive popuplist
       
   387         case EWmlCmdOpenFolder:
       
   388             {
       
   389             if (iContainer->GotoPane()->PopupList() != NULL)
       
   390                 {
       
   391                 iContainer->GotoPane()->PopupList()->SetDirectoryModeL( EFalse );
       
   392                 }
       
   393             break;
       
   394             }
       
   395 
       
   396         case EAknSoftkeyCancel:
       
   397             {
       
   398             if ( isZoomMode() )
       
   399                 {
       
   400                 SaveCurrentZoomLevel(EFalse);
       
   401                 //reset the zooming to the original settings
       
   402                 SetZoomModeL( EFalse );
       
   403                 //Exit in zooming, enable the cursor
       
   404                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   405                     (TInt)TBrCtlDefs::ECommandZoomSliderHide +
       
   406                     (TInt)TBrCtlDefs::ECommandIdBase );
       
   407                 }
       
   408 
       
   409             if (iSynchRequestViewIsUp)
       
   410                 {
       
   411                 ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase );
       
   412                 }
       
   413             else
       
   414                 {
       
   415                 ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancel + (TInt)TBrCtlDefs::ECommandIdBase );
       
   416                  }
       
   417             break;
       
   418             }
       
   419 
       
   420         case EWmlCmdSaveAsBookmark:
       
   421             {
       
   422             AddNewBookmarkL(EFalse);
       
   423             break;
       
   424             }
       
   425 
       
   426         // UI notifies the BrCtl which calls the DialogsProvider with a list of images
       
   427         case EWmlCmdShowImages:
       
   428             {
       
   429             ApiProvider().BrCtlInterface().HandleCommandL(
       
   430                                             (TInt)TBrCtlDefs::ECommandShowImages +
       
   431                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   432             break;
       
   433             }
       
   434 
       
   435         case EWmlCmdShowMiniature:
       
   436             {
       
   437             if (ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) &&
       
   438             !ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue))
       
   439                 {
       
   440                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   441                                     (TInt)TBrCtlDefs::ECommandShowThumbnailView + (TInt)TBrCtlDefs::ECommandIdBase );
       
   442                 }
       
   443             break;
       
   444             }
       
   445 
       
   446         // Download Manager UI Library shows a list of ongoing downloads
       
   447         case EWmlCmdDownloads:
       
   448             {
       
   449             ApiProvider().BrCtlInterface().HandleCommandL(
       
   450                                             (TInt)TBrCtlDefs::ECommandShowDownloads +
       
   451                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   452             break;
       
   453             }
       
   454 
       
   455         // Loads images on a page
       
   456         case EWmlCmdLoadImages:
       
   457             {
       
   458             ApiProvider().BrCtlInterface().HandleCommandL(
       
   459                                         (TInt)TBrCtlDefs::ECommandLoadImages +
       
   460                                         (TInt)TBrCtlDefs::ECommandIdBase );
       
   461             ApiProvider().WindowMgr().CurrentWindow()->SetImagesLoaded(ETrue);
       
   462             break;
       
   463             }
       
   464 
       
   465         // UI notifies the BrCtl which calls the DialogsProvider to show the toolbar
       
   466         case EWmlCmdShowToolBar:
       
   467             {
       
   468             if ( !PenEnabled() && iApiProvider.Preferences().ShowToolbarOnOff() &&
       
   469                  !iApiProvider.WindowMgr().CurrentWindow()->WMLMode() )
       
   470                 {
       
   471                 iToolBarInfoNote->ShowInfoPopupNote();
       
   472                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   473                                             (TInt)TBrCtlDefs::ECommandShowToolBar +
       
   474                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   475                 }
       
   476 
       
   477             break;
       
   478             }
       
   479         //zoom in and set the cursor's position for non-touch
       
   480         case EWmlCmdZoomIn:
       
   481             {
       
   482             if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
   483             {
       
   484                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   485                                 (TInt)TBrCtlDefs::ECommandZoomIn +
       
   486                                 (TInt)TBrCtlDefs::ECommandIdBase );
       
   487                 ZoomImagesInL();
       
   488             }
       
   489             break;
       
   490             }
       
   491 
       
   492         //zoom out and set the cursor's position for non-touch
       
   493         case EWmlCmdZoomOut:
       
   494             {
       
   495             if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
   496             {
       
   497                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   498                     (TInt)TBrCtlDefs::ECommandZoomOut +
       
   499                     (TInt)TBrCtlDefs::ECommandIdBase );
       
   500                 ZoomImagesOutL();
       
   501             }
       
   502             break;
       
   503             }
       
   504 
       
   505         /* Zoom Mode currently disabled
       
   506         case EWmlCmdZoomMode:
       
   507             {
       
   508             // Disable the cursor: by using the zoom slider show cmd (temp)
       
   509             ApiProvider().BrCtlInterface().HandleCommandL(
       
   510                             (TInt)TBrCtlDefs::ECommandZoomSliderShow +
       
   511                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   512 
       
   513             // Disable any activated objects (i.e. plugins, input boxes)
       
   514             ApiProvider().BrCtlInterface().HandleCommandL(
       
   515                             (TInt)TBrCtlDefs::ECommandCancel +
       
   516                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   517 
       
   518             // Display softkeys if in full screen mode. i.e. go to normal screen
       
   519             if ( !iPenEnabled && iContentFullScreenMode )
       
   520                 {
       
   521                 iWasContentFullScreenMode = iContentFullScreenMode;
       
   522                 EnableFullScreenModeL( EFalse );
       
   523                 }
       
   524 
       
   525             // Enter zoom mode
       
   526             ZoomModeImagesL();
       
   527             break;
       
   528             }
       
   529         */
       
   530 
       
   531         case EWmlCmdZoomSliderShow:
       
   532             {
       
   533             // Toggle displaying the zoom slider, when the zoom button
       
   534             // on toolbar is selected
       
   535             MakeZoomSliderVisibleL( !iZoomSliderVisible );
       
   536             break;
       
   537             }
       
   538         case EWmlCmdZoomSliderHide:
       
   539             {
       
   540             // Currently not used
       
   541             MakeZoomSliderVisibleL( EFalse );
       
   542             break;
       
   543             }
       
   544 
       
   545         // Find keyword commands
       
   546         case EWmlCmdFindKeyword:
       
   547             {
       
   548             LaunchFindKeywordEditorL();
       
   549             break;
       
   550             }
       
   551 
       
   552         case EWmlCmdFindKeywordPaneFind :
       
   553             {
       
   554             break;
       
   555             }
       
   556 
       
   557         case EWmlCmdFindKeywordPaneClose :
       
   558             {
       
   559             CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->FindKeywordPane() );
       
   560             // Cancel editing and sets Goto Pane text back.
       
   561             iContainer->ShutDownFindKeywordEditorL();
       
   562             UpdateCbaL();
       
   563             if (iPenEnabled)
       
   564                 {
       
   565                 iBrowserContentViewToolbar->UpdateButtonsStateL();
       
   566                 }
       
   567 
       
   568             ApiProvider().BrCtlInterface().HandleCommandL(
       
   569                                         (TInt)TBrCtlDefs::ECommandClearFind +
       
   570                                         (TInt)TBrCtlDefs::ECommandIdBase );
       
   571 
       
   572             if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen )
       
   573                 {
       
   574                 MakeCbaVisible( EFalse );
       
   575                 }
       
   576             if (iPenEnabled)
       
   577 	            {
       
   578 	            StartAutoFullScreenTimer();
       
   579 	            }
       
   580             break;
       
   581             }
       
   582 
       
   583         case EWmlCmdFindNext :
       
   584             {
       
   585             // Find next keyword
       
   586             FindKeywordL( NULL, ETrue );
       
   587             break;
       
   588             }
       
   589         case EWmlCmdFindPrevious :
       
   590             {
       
   591             // Find previous keyword
       
   592             FindKeywordL( NULL, EFalse );
       
   593             break;
       
   594             }
       
   595 
       
   596         case EAknSoftkeySelect:
       
   597             {
       
   598             if( iHistoryViewIsUp )
       
   599                 {
       
   600                 if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode )
       
   601                         {
       
   602                         EnableFullScreenModeL( ETrue );
       
   603                         iWasContentFullScreenMode = EFalse;
       
   604                         }
       
   605 
       
   606                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   607                     (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase );
       
   608                 }
       
   609 
       
   610             // Save zoom factor and quit the zoom mode
       
   611             if ( isZoomMode() )
       
   612                 {
       
   613                 SaveCurrentZoomLevel(ETrue);
       
   614                 // Disable the zoom mode
       
   615                 SetZoomModeL( EFalse );
       
   616                 // Return to full screen, if we were in full screen before
       
   617                 if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode )
       
   618                     {
       
   619                     EnableFullScreenModeL( ETrue );
       
   620                     iWasContentFullScreenMode = EFalse;
       
   621                     }
       
   622                 // Exiting zoom mode, enable the cursor
       
   623                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   624                     (TInt)TBrCtlDefs::ECommandZoomSliderHide +
       
   625                     (TInt)TBrCtlDefs::ECommandIdBase );
       
   626                 }
       
   627             break;
       
   628             }
       
   629         case EAknSoftkeyOk:
       
   630             {
       
   631             if( iThumbnailViewIsUp )
       
   632                 {
       
   633                 if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode )
       
   634                     {
       
   635                     EnableFullScreenModeL( ETrue );
       
   636                     iWasContentFullScreenMode = EFalse;
       
   637                     }
       
   638 
       
   639                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   640                     (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase );
       
   641                 }
       
   642             break;
       
   643             }
       
   644 
       
   645         case EAknSoftkeyClose:
       
   646             {
       
   647             if( iWasInFeedsView)
       
   648                 {
       
   649                 // FeedsView library
       
   650 
       
   651                 }
       
   652             else
       
   653                 {
       
   654                 if ( isZoomMode() )
       
   655                     {
       
   656                     SetZoomModeL( EFalse );
       
   657                     }
       
   658                 AppUi()->HandleCommandL( EWmlCmdCloseWindow );
       
   659                 }
       
   660             break;
       
   661             }
       
   662 
       
   663         case EWmlCmdSendAddressViaUnifiedMessage:
       
   664             {
       
   665             SendAddressL( );
       
   666             }
       
   667             break;
       
   668 
       
   669         case EWmlCmdBack:
       
   670             {
       
   671             if( iWasInFeedsView)
       
   672                 {
       
   673                 // FeedsView library
       
   674 
       
   675                 }
       
   676             else if( iImageMapActive )
       
   677                 {
       
   678                 ApiProvider().BrCtlInterface().HandleCommandL(
       
   679                                         (TInt)TBrCtlDefs::ECommandBack +
       
   680                                         (TInt)TBrCtlDefs::ECommandIdBase );
       
   681                 }
       
   682             else if( ApiProvider().BrCtlInterface().NavigationAvailable(
       
   683                         TBrCtlDefs::ENavigationBack ) )
       
   684                 {
       
   685                 AppUi()->HandleCommandL( aCommand );
       
   686                 }
       
   687             else
       
   688                 {
       
   689                 AppUi()->HandleCommandL( EWmlCmdCloseWindow );
       
   690                 }
       
   691             break;
       
   692             }
       
   693 
       
   694         case EWmlCmdOneStepBack:
       
   695             {
       
   696             if( ApiProvider().BrCtlInterface().NavigationAvailable(TBrCtlDefs::ENavigationBack ) )
       
   697                 {
       
   698                 AppUi()->HandleCommandL( aCommand );
       
   699                 }
       
   700             break;
       
   701             }
       
   702 
       
   703         case EAknCmdHelp:
       
   704             {
       
   705             if ( HELP )
       
   706                 {
       
   707                 AppUi()->HandleCommandL( EAknCmdHelp );
       
   708                 }
       
   709             break;
       
   710             }
       
   711 
       
   712         case EWmlCmdCancelFetch:
       
   713             {
       
   714             // give it to AppUi
       
   715             AppUi()->HandleCommandL( aCommand );
       
   716             break;
       
   717             }
       
   718 
       
   719         case EWmlCmdOpenLinkInNewWindow:
       
   720             {
       
   721             iApiProvider.BrCtlInterface().HandleCommandL(
       
   722                 (TInt)TBrCtlDefs::ECommandOpenNewWindow + (TInt)TBrCtlDefs::ECommandIdBase );
       
   723             break;
       
   724             }
       
   725 
       
   726         case EWmlCmdOpenLink:
       
   727             {
       
   728             iApiProvider.BrCtlInterface().HandleCommandL(
       
   729                 (TInt)TBrCtlDefs::ECommandOpen + (TInt)TBrCtlDefs::ECommandIdBase );
       
   730             break;
       
   731             }
       
   732 
       
   733         case EWmlCmdShowSubscribeList:
       
   734             {
       
   735             const RPointerArray<TBrCtlSubscribeTo>& subscribeToList = iApiProvider.BrCtlInterface().SubscribeToMenuItemsL();
       
   736             TInt len(subscribeToList.Count());
       
   737             if (len > 0)
       
   738                 {
       
   739                 CArrayFixFlat<TBrCtlSelectOptionData>* optList = new( ELeave ) CArrayFixFlat<TBrCtlSelectOptionData>(10);
       
   740                 CleanupStack::PushL( optList );
       
   741                 HBufC* title = StringLoader::LoadLC(R_BROWSER_SUBSCRIBE_LIST);
       
   742                 TInt i;
       
   743                 for(i = 0; i < len; i++)
       
   744                     {
       
   745                     if(subscribeToList[i]->Title().Length())
       
   746                         {
       
   747                         TBrCtlSelectOptionData t(subscribeToList[i]->Title(), EFalse, EFalse, EFalse);
       
   748                         optList->AppendL(t);
       
   749                         }
       
   750                     else
       
   751                         {
       
   752                         TBrCtlSelectOptionData t(subscribeToList[i]->Url(), EFalse, EFalse, EFalse);
       
   753                         optList->AppendL(t);
       
   754                         }
       
   755                     }
       
   756                 TBool ret(ApiProvider().DialogsProvider().DialogSelectOptionL( *title, ESelectTypeNone, *optList));
       
   757                 if( ret )
       
   758                     {
       
   759                     TInt i;
       
   760                     for (i = 0; i < optList->Count(); i++)
       
   761                         {
       
   762                         if ((*optList)[i].IsSelected())
       
   763                             {
       
   764                             HandleSubscribeToL(subscribeToList[i]->CommandID() - TBrCtlDefs::ECommandIdBase);
       
   765                             break;
       
   766                             }
       
   767                         }
       
   768                     }
       
   769                 optList->Reset();
       
   770                 CleanupStack::PopAndDestroy( 2 ); // optList, title
       
   771                 }
       
   772             break;
       
   773             }
       
   774 
       
   775         case EWmlCmdHome:
       
   776             if (ApiProvider().Preferences().HomePageType() ==  EWmlSettingsHomePageAddress )
       
   777                 {
       
   778                 HBufC* url = HBufC::NewLC( KMaxHomePgUrlLength );
       
   779                 TPtr ptr( url->Des() );
       
   780                 User::LeaveIfError(ApiProvider().Preferences().HomePageUrlL( ptr ));
       
   781                 ApiProvider().FetchL( ptr );
       
   782                 CleanupStack::PopAndDestroy(); // url
       
   783                 }
       
   784             else
       
   785                 {
       
   786                 HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoUrl);
       
   787                 if ( url && url->Length() && TBrowserDialogs::ConfirmQueryYesNoL(R_BROWSER_QUERY_SET_AS_HOME_PAGE))
       
   788                     {
       
   789                     ApiProvider().Preferences().SetHomePageUrlL(url->Des());
       
   790                     ApiProvider().Preferences().SetHomePageTypeL( EWmlSettingsHomePageAddress );
       
   791                     }
       
   792                 CleanupStack::PopAndDestroy(); // url
       
   793                 }
       
   794             break;
       
   795 
       
   796         case EWmlCmdGo:
       
   797             break;
       
   798 
       
   799         case EWmlCmdConfigureShortcutKeymap:
       
   800             {
       
   801             ApiProvider().SetViewToBeActivatedIfNeededL( KUidBrowserSettingsViewId, KUidSettingsGotoShortcutsGroup.iUid );
       
   802             break;
       
   803             }
       
   804 
       
   805         case EWmlCmdShowShortcutKeymap:
       
   806             {
       
   807             ShowKeymap();
       
   808             break;
       
   809             }
       
   810 
       
   811         case EWmlCmdHideShortcutKeymap:
       
   812             {
       
   813             HideKeymap();
       
   814             break;
       
   815             }
       
   816 
       
   817         case EWmlCmdOpenFeedsFolder:
       
   818             // Launch into feeds view, telling it that we came from content view
       
   819             ApiProvider().FeedsClientUtilities().ShowFolderViewL(KUidBrowserContentViewId);
       
   820             break;
       
   821 
       
   822         case EWmlCmdEnterFullScreenBrowsing:
       
   823             {
       
   824             if ( iPenEnabled )
       
   825                 {
       
   826                 EnableFullScreenModeL( ETrue );
       
   827                 }
       
   828             else
       
   829                 {
       
   830                 if ( iContentFullScreenMode )
       
   831                     {
       
   832                     EnableFullScreenModeL( EFalse );
       
   833                     }
       
   834                 else
       
   835                     {
       
   836                     EnableFullScreenModeL( ETrue );
       
   837                     }
       
   838                 }
       
   839             break;
       
   840             }
       
   841 
       
   842         case EWmlCmdExitFullScreenBrowsing:
       
   843             EnableFullScreenModeL( EFalse );
       
   844             break;
       
   845 
       
   846         default:
       
   847             {
       
   848             // DO element and toolbar commands are passed to BrCtl via AppUi
       
   849             AppUi()->HandleCommandL( aCommand );
       
   850             break;
       
   851             }
       
   852         }   // end of switch (aCommand)
       
   853 
       
   854     // Enabling FullScreen for non-touch devices, after processing some dialog-based shortcut and toolbar actions
       
   855     if ( !iPenEnabled && iWasContentFullScreenMode && !iContentFullScreenMode &&
       
   856                                                    ( ( aCommand == EWmlCmdFindKeywordPaneClose )  ||
       
   857                                                      ( aCommand == EWmlCmdHideShortcutKeymap )  ||
       
   858                                                      ( aCommand == EWmlCmdGotoPaneGoTo )  ||
       
   859                                                      ( aCommand == EWmlCmdGotoPaneCancel ) ||
       
   860                                                      ( aCommand == EAknSoftkeyCancel ) ) )
       
   861         {
       
   862         EnableFullScreenModeL( ETrue );
       
   863         iWasContentFullScreenMode = EFalse;
       
   864         }
       
   865 
       
   866     // Any other commands must cause the zoom slider to be hidden (if it is
       
   867     // currently visible).
       
   868    switch ( aCommand )
       
   869         {
       
   870         // case EWmlCmdZoomMode:
       
   871         case EWmlCmdZoomSliderShow:
       
   872             {
       
   873             // Do nothing, we want to display zoom indicator
       
   874             break;
       
   875             }
       
   876         default:
       
   877             {
       
   878             // If any other command and zoom indicator is displayed, close it
       
   879             if ( ZoomSliderVisible() )
       
   880                 {
       
   881                 MakeZoomSliderVisibleL( EFalse );
       
   882                 }
       
   883             break;
       
   884             }
       
   885         }   // end of switch
       
   886     }
       
   887 
       
   888 // -----------------------------------------------------------------------------
       
   889 // CBrowserContentView::ViewHistoryL
       
   890 // -----------------------------------------------------------------------------
       
   891 //
       
   892 void CBrowserContentView::ViewHistoryL()
       
   893     {
       
   894     ApiProvider().BrCtlInterface().HandleCommandL(
       
   895                                             (TInt)TBrCtlDefs::ECommandShowHistory +
       
   896                                                     (TInt)TBrCtlDefs::ECommandIdBase );
       
   897     }
       
   898 
       
   899 // -----------------------------------------------------------------------------
       
   900 // CBrowserContentView::DoActivateL
       
   901 // -----------------------------------------------------------------------------
       
   902 //
       
   903 void CBrowserContentView::DoActivateL(
       
   904                                       const TVwsViewId& /*aPrevViewId*/,
       
   905                                       TUid /*aCustomMessageId*/,
       
   906                                       const TDesC8& /*aCustomMessage*/ )
       
   907     {
       
   908 PERFLOG_LOCAL_INIT
       
   909 PERFLOG_STOPWATCH_START
       
   910     CBrowserAppUi* ui;
       
   911 
       
   912     ui = STATIC_CAST( CBrowserAppUi*, AppUi() );
       
   913     iPreviousViewID = ApiProvider().LastActiveViewId();
       
   914     if ( ui->LastActiveViewId() == KUidBrowserNullViewId )
       
   915         {
       
   916         //No view has been yet set as startup view -> use bookmarks view
       
   917         ui->SetLastActiveViewId ( KUidBrowserBookmarksViewId );
       
   918         ui->SetViewToBeActivatedIfNeededL( ui->LastActiveViewId() );
       
   919         ApiProvider().SetLastActiveViewId ( ui->LastActiveViewId() );
       
   920         }
       
   921     else
       
   922         {
       
   923         UpdateFullScreenL();
       
   924         ApiProvider().SetLastActiveViewId(Id());
       
   925         }
       
   926 
       
   927     iContainer->ActivateL();
       
   928 
       
   929     AppUi()->AddToViewStackL( *this, iContainer );
       
   930 
       
   931     UpdateTitleL( ApiProvider() );
       
   932 
       
   933     ApiProvider().BrCtlInterface().MakeVisible(ETrue);
       
   934     ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandGainFocus +
       
   935                                                     (TInt)TBrCtlDefs::ECommandIdBase);
       
   936 
       
   937     if( ui->Connection().Connected() &&
       
   938         !ui->Preferences().HttpSecurityWarningsStatSupressed() )
       
   939         {
       
   940         // Update security indicators
       
   941         if ( ui->SomeItemsNotSecure() )
       
   942             {
       
   943             ui->Display().UpdateSecureIndicatorL( EAknIndicatorStateOff );
       
   944             }
       
   945         else
       
   946             {
       
   947             ui->Display().UpdateSecureIndicatorL(
       
   948                                 ui->LoadObserver().LoadStatus(
       
   949                                 CBrowserLoadObserver::ELoadStatusSecurePage ) ?
       
   950                             EAknIndicatorStateOn : EAknIndicatorStateOff );
       
   951             }
       
   952         }
       
   953     UpdateCbaL();
       
   954     if(KeymapIsUp())
       
   955         {
       
   956         RedrawKeymap();
       
   957         }
       
   958 
       
   959 	if (iPenEnabled)
       
   960 		{
       
   961 		StartAutoFullScreenTimer();
       
   962 		}
       
   963 PERFLOG_STOP_WRITE("ContentView::DoActivate")
       
   964     }
       
   965 
       
   966 
       
   967 // -----------------------------------------------------------------------------
       
   968 // CBrowserContentView::UpdateFullScreenL
       
   969 // -----------------------------------------------------------------------------
       
   970 //
       
   971 void CBrowserContentView::UpdateFullScreenL()
       
   972     {
       
   973     TVwsViewId activeViewId;
       
   974     if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone )
       
   975         {
       
   976         if ( activeViewId.iViewUid == KUidBrowserContentViewId )
       
   977             {
       
   978             TBool sizeChangedCba = EFalse;
       
   979             TBool sizeChangedSP = EFalse;
       
   980             TBool resIdChanged = EFalse;
       
   981             TInt resId = StatusPane()->CurrentLayoutResId();
       
   982 
       
   983             if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   984                 {
       
   985                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_USUAL;
       
   986                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
   987                 }
       
   988             else //Portrait
       
   989                 {
       
   990                 resIdChanged = resId != R_AVKON_STATUS_PANE_LAYOUT_SMALL;
       
   991                 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
       
   992                 }
       
   993 
       
   994             if ( iContentFullScreenMode )
       
   995                 {
       
   996                 sizeChangedCba = Cba()->IsVisible();
       
   997                 Cba()->MakeVisible( EFalse );
       
   998                 UpdateCbaL();
       
   999 
       
  1000                 if (!ApiProvider().Fetching())
       
  1001                     {
       
  1002                     sizeChangedSP = StatusPane()->IsVisible();
       
  1003                     StatusPane()->MakeVisible( EFalse );
       
  1004                     }
       
  1005                 else
       
  1006                     {
       
  1007                     sizeChangedSP = !StatusPane()->IsVisible();
       
  1008                     ShowFsStatusPane(ETrue);
       
  1009                     }
       
  1010                 }
       
  1011             else
       
  1012                 {
       
  1013                 sizeChangedCba = !Cba()->IsVisible();
       
  1014                 Cba()->MakeVisible( ETrue );
       
  1015                 sizeChangedSP = !StatusPane()->IsVisible();
       
  1016                 StatusPane()->MakeVisible( ETrue );
       
  1017                 }
       
  1018 
       
  1019             ApiProvider().Display().FSPaneOnL( );
       
  1020             ApiProvider().Display().SetGPRSIndicatorOnL();
       
  1021             ApiProvider().Display().RestoreTitleL();
       
  1022             StatusPane()->ApplyCurrentSettingsL();
       
  1023             if ( resIdChanged || sizeChangedCba || sizeChangedSP  )
       
  1024                 {
       
  1025                 iContainer->SetRect( ClientRect() );
       
  1026                 }
       
  1027             }
       
  1028         }
       
  1029     }
       
  1030 
       
  1031 // -----------------------------------------------------------------------------
       
  1032 // CBrowserContentView::SetFullScreenOffL
       
  1033 // -----------------------------------------------------------------------------
       
  1034 //
       
  1035 void CBrowserContentView::SetFullScreenOffL()
       
  1036     {
       
  1037     TVwsViewId activeViewId;
       
  1038     if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone )
       
  1039         {
       
  1040         if ( activeViewId.iViewUid == KUidBrowserContentViewId )
       
  1041             {
       
  1042             Cba()->MakeVisible( ETrue );
       
  1043             UpdateCbaL();
       
  1044             if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1045 	            StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
       
  1046             StatusPane()->ApplyCurrentSettingsL();
       
  1047             StatusPane()->MakeVisible( ETrue );
       
  1048             iContainer->SetRect( ClientRect() );
       
  1049             }
       
  1050         }
       
  1051     }
       
  1052 
       
  1053 // -----------------------------------------------------------------------------
       
  1054 // CBrowserContentView::SetZoomLevelL
       
  1055 // -----------------------------------------------------------------------------
       
  1056 //
       
  1057 void CBrowserContentView::SetZoomLevelL()
       
  1058     {
       
  1059         // Get the current index of the array.
       
  1060         iCurrentZoomLevel = ApiProvider().BrCtlInterface().
       
  1061         BrowserSettingL(TBrCtlDefs::ESettingsCurrentZoomLevelIndex);
       
  1062     }
       
  1063 
       
  1064 // -----------------------------------------------------------------------------
       
  1065 // CBrowserContentView::DoDeactivate
       
  1066 // -----------------------------------------------------------------------------
       
  1067 //
       
  1068 void CBrowserContentView::DoDeactivate()
       
  1069     {
       
  1070     if ( !ApiProvider().ExitInProgress() )
       
  1071         {
       
  1072         TBrCtlDefs::TBrCtlElementType focusedElementType =
       
  1073                 ApiProvider().BrCtlInterface().FocusedElementType();
       
  1074         if (focusedElementType == TBrCtlDefs::EElementActivatedInputBox)
       
  1075             {
       
  1076             ApiProvider().BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandAccept +
       
  1077                                  (TInt)TBrCtlDefs::ECommandIdBase );
       
  1078             }
       
  1079         TRAP_IGNORE( ApiProvider().Display().UpdateSecureIndicatorL(
       
  1080             EAknIndicatorStateOff ));
       
  1081         iContainer->SetFocus( EFalse );
       
  1082 
       
  1083         TRAP_IGNORE( ApiProvider().BrCtlInterface().HandleCommandL(
       
  1084             (TInt)TBrCtlDefs::ECommandLoseFocus +
       
  1085             (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  1086         ApiProvider().BrCtlInterface().MakeVisible(EFalse);
       
  1087         }
       
  1088 
       
  1089     AppUi()->RemoveFromViewStack( *this, iContainer );
       
  1090     }
       
  1091 
       
  1092 // ----------------------------------------------------------------------------
       
  1093 // CBrowserContentView::CommandSetResourceIdL
       
  1094 // ----------------------------------------------------------------------------
       
  1095 //
       
  1096 TInt CBrowserContentView::CommandSetResourceIdL()
       
  1097     {
       
  1098     LOG_ENTERFN("ContentView::CommandSetResourceIdL");
       
  1099 
       
  1100     // default case for normal screen
       
  1101     TInt result( R_BROWSER_DEFAULT_BUTTONS );
       
  1102 
       
  1103     // default case for full screen
       
  1104     if ( iContentFullScreenMode )
       
  1105         {
       
  1106         result = R_BROWSER_SOFTKEYS_EXIT_FULL_SCREEN;
       
  1107         }
       
  1108     if ( isZoomMode() )
       
  1109         {
       
  1110         return R_BROWSER_DEFAULT_BUTTONS_AT_ZOOM_MODE_ON;
       
  1111         }
       
  1112     if( KeymapIsUp() )
       
  1113         {
       
  1114         return R_BROWSER_SOFTKEYS_CONFIGURE_HIDE;
       
  1115         }
       
  1116     if( iHistoryViewIsUp )
       
  1117         {
       
  1118         return R_BROWSER_SOFTKEYS_SELECT_CANCEL_SELECT;
       
  1119         }
       
  1120     if( iPluginPlayerIsUp )
       
  1121         {
       
  1122         return R_BROWSER_SOFTKEYS_CANCEL;
       
  1123         }
       
  1124     if( iSmartTextViewIsUp )
       
  1125         {
       
  1126         return R_INPUT_ELEMENT_BUTTONS;
       
  1127         }
       
  1128     if( iThumbnailViewIsUp )
       
  1129         {
       
  1130         return R_BROWSER_DEFAULT_BUTTONS_AT_THUMBNAIL_VIEW_ON;
       
  1131         }
       
  1132     if( iImageMapActive )
       
  1133         {
       
  1134         return R_BROWSER_DEFAULT_BUTTONS;
       
  1135         }
       
  1136     if( iSynchRequestViewIsUp )
       
  1137         {
       
  1138         if ( !iContentFullScreenMode )
       
  1139             {
       
  1140             result = R_BROWSER_SOFTKEYS_CANCEL;
       
  1141             }
       
  1142         return result;
       
  1143         }
       
  1144 
       
  1145     if( iContainer->GotoPane()->IsVisible() )
       
  1146         // when goto pane is up there is no focusable element or active fetching
       
  1147         // process in place
       
  1148         {
       
  1149         //check wheter there is an active popuplist
       
  1150         if( (iContainer->GotoPane()->PopupList() != NULL) &&
       
  1151                    ( iContainer->GotoPane()->PopupList()->IsOpenDirToShow() ))
       
  1152             {
       
  1153             result = R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_OPENDIR_CANCEL;
       
  1154             }
       
  1155         else if(iContainer->GotoPane()->PopupList() &&
       
  1156                 iContainer->GotoPane()->PopupList()->IsPoppedUp() &&
       
  1157                 !iPenEnabled)
       
  1158             {
       
  1159             // LSK Select is only for non-touch devices
       
  1160             result =  R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_SELECT_CANCEL;
       
  1161             }
       
  1162         else
       
  1163             {
       
  1164             result =  R_BROWSER_BOOKMARKS_CBA_GOTO_PANE_GOTO_CANCEL;
       
  1165             }
       
  1166         }
       
  1167     else if ( iContainer->FindKeywordPane()->IsVisible() )
       
  1168         {
       
  1169         result = R_BROWSER_CBA_FIND_KEYWORD_PANE_OPTION_CLOSE;
       
  1170         }
       
  1171     else if ( ApiProvider().Fetching() )
       
  1172         {
       
  1173         if ( !iContentFullScreenMode )
       
  1174             {
       
  1175             // Enable Options menu during download can be done here
       
  1176             // otherwise use defualt Full Screen buttons
       
  1177             result = R_BROWSER_OPTIONS_MENU_DURING_DOWNLOAD;
       
  1178             }
       
  1179         }
       
  1180     else
       
  1181         {
       
  1182         TBrCtlDefs::TBrCtlElementType elementtype =
       
  1183             ApiProvider().BrCtlInterface().FocusedElementType();
       
  1184         if( (elementtype == TBrCtlDefs::EElementActivatedInputBox ) ||
       
  1185             (elementtype == TBrCtlDefs::EElementActivatedObjectBox ) )
       
  1186             {
       
  1187             if ( !iContentFullScreenMode )
       
  1188                 {
       
  1189                 result = R_INPUT_ELEMENT_BUTTONS;
       
  1190                 }
       
  1191             }
       
  1192         else if ( !ApiProvider().BrCtlInterface().NavigationAvailable(
       
  1193                 TBrCtlDefs::ENavigationBack ) )
       
  1194             // at the beginning of the  history list
       
  1195             {
       
  1196             if ( !iContentFullScreenMode )
       
  1197                 {
       
  1198                 // Options + Close
       
  1199                 result = R_BROWSER_DEFAULT_BUTTONS_AT_BEGINNING_OF_HISTORY;
       
  1200                 }
       
  1201             }
       
  1202         }
       
  1203 BROWSER_LOG( ( _L(" ContentView's buttons:%d"), result ) );
       
  1204     return result;
       
  1205     }
       
  1206 
       
  1207 // -----------------------------------------------------------------------------
       
  1208 // CBrowserContentView::ProcessCommandL
       
  1209 // -----------------------------------------------------------------------------
       
  1210 //
       
  1211 void CBrowserContentView::ProcessCommandL(TInt aCommand)
       
  1212     {
       
  1213     CBrowserViewBase::ProcessCommandL( aCommand );
       
  1214     }
       
  1215 
       
  1216 // -----------------------------------------------------------------------------
       
  1217 // CBrowserContentView::DynInitMenuPaneL
       
  1218 // -----------------------------------------------------------------------------
       
  1219 void CBrowserContentView::DynInitMenuPaneL( TInt aResourceId,
       
  1220                                             CEikMenuPane* aMenuPane )
       
  1221     {
       
  1222     LOG_ENTERFN("CBrowserContentView::DynInitMenuPaneL");
       
  1223     __ASSERT_DEBUG(aMenuPane, Util::Panic(Util::EUninitializedData));
       
  1224 
       
  1225     if ( aResourceId == R_MENU_PANE )
       
  1226         {
       
  1227         // web feeds
       
  1228         #ifndef __RSS_FEEDS
       
  1229         aMenuPane->SetItemDimmed( EWmlCmdShowSubscribeList, ETrue );
       
  1230         #else
       
  1231         const RPointerArray<TBrCtlSubscribeTo>& items = ApiProvider().BrCtlInterface().SubscribeToMenuItemsL();
       
  1232         if ( items.Count() == 0 )
       
  1233             {
       
  1234             aMenuPane->SetItemDimmed( EWmlCmdShowSubscribeList, ETrue );
       
  1235             }
       
  1236         #endif  // __RSS_FEEDS
       
  1237 
       
  1238         // downloads
       
  1239         aMenuPane->SetItemDimmed( EWmlCmdDownloads,
       
  1240             !ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads ) );
       
  1241 
       
  1242         // If we have a touch device, check to see if the zoom slider is up, if so disable
       
  1243         if ( PenEnabled() && ZoomSliderVisible() )
       
  1244             {
       
  1245             MakeZoomSliderVisibleL( EFalse );
       
  1246             }
       
  1247 
       
  1248         // find
       
  1249         aMenuPane->SetItemDimmed( EWmlCmdFindNext, ETrue );
       
  1250         aMenuPane->SetItemDimmed( EWmlCmdFindPrevious, ETrue );
       
  1251 
       
  1252 /*
       
  1253         // help menu sub-menu - depending if Independent Application Update is available
       
  1254         if (BRDO_BROWSER_UPDATE_UI_FF)
       
  1255            {
       
  1256            aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
  1257            }
       
  1258         else
       
  1259            {
       
  1260            aMenuPane->SetItemDimmed( EWmlCmdHelpMenu, ETrue );
       
  1261            }
       
  1262 */
       
  1263         if ( iContainer->FindKeywordPane()->IsVisible() )
       
  1264             {
       
  1265             CEikMenuPaneItem::SData menuFindNext =
       
  1266                 aMenuPane->ItemData( EWmlCmdFindNext );
       
  1267             CEikMenuPaneItem::SData menuFindPrevious =
       
  1268                 aMenuPane->ItemData( EWmlCmdFindPrevious );
       
  1269 
       
  1270             // Delete all menu items
       
  1271             aMenuPane->DeleteBetweenMenuItems( 0,
       
  1272             aMenuPane->NumberOfItemsInPane() - 1 );
       
  1273 
       
  1274             aMenuPane->AddMenuItemL( menuFindNext );
       
  1275             aMenuPane->AddMenuItemL( menuFindPrevious );
       
  1276             aMenuPane->SetItemDimmed( EWmlCmdFindNext, EFalse );
       
  1277             aMenuPane->SetItemDimmed( EWmlCmdFindPrevious, EFalse );
       
  1278             return;
       
  1279             }
       
  1280 
       
  1281         // wml option menu items
       
  1282         if ( ApiProvider().BrCtlInterface().WMLOptionMenuItemsL()->Count() < 1 )
       
  1283             {
       
  1284             // there isn't DO element, or only the first one with PREV exist
       
  1285             aMenuPane->SetItemDimmed( EWmlCmdServiceOptions, ETrue );
       
  1286             }
       
  1287 
       
  1288         // find window
       
  1289         if (ApiProvider().WindowMgr().CurrentWindow()->WMLMode())
       
  1290             {
       
  1291             aMenuPane->SetItemDimmed(EWmlCmdFindKeyword, ETrue);
       
  1292             }
       
  1293 
       
  1294         // shortcut key map
       
  1295         if (PenEnabled() || ApiProvider().IsEmbeddedModeOn())
       
  1296             {
       
  1297             aMenuPane->SetItemDimmed( EWmlCmdShowShortcutKeymap, ETrue);
       
  1298             }
       
  1299 
       
  1300         // BrCtl adds menu items to UI options menu list
       
  1301         ApiProvider().BrCtlInterface().AddOptionMenuItemsL( *aMenuPane, aResourceId );
       
  1302         }
       
  1303     else if ( aResourceId == R_DO_ELEMENTS )
       
  1304         {
       
  1305         RPointerArray<TBrCtlWmlServiceOption>* wmlElements;
       
  1306         wmlElements = ApiProvider().BrCtlInterface().WMLOptionMenuItemsL();
       
  1307 
       
  1308         for ( TInt i=0; i<wmlElements->Count(); i++ )
       
  1309             {
       
  1310             TBrCtlWmlServiceOption* option = (*wmlElements)[i];
       
  1311             if ( option != NULL)
       
  1312                 {
       
  1313                 CEikMenuPaneItem::SData item;
       
  1314                 item.iText.Copy( option->Text() );
       
  1315                 item.iCommandId = option->ElemID();
       
  1316                 item.iFlags = 0;
       
  1317                 item.iCascadeId = 0;
       
  1318                 aMenuPane->InsertMenuItemL(item, 0);
       
  1319                 }
       
  1320             }
       
  1321         }
       
  1322     else if ( aResourceId == R_GOTO_SUBMENU )
       
  1323         {
       
  1324         // back to page
       
  1325         aMenuPane->SetItemDimmed( EWmlCmdBackToPage, ETrue );
       
  1326 
       
  1327         // bookmarks/webfeeds
       
  1328         if( ApiProvider().IsEmbeddedModeOn() )
       
  1329             {
       
  1330             aMenuPane->SetItemDimmed( EWmlCmdFavourites, ETrue );
       
  1331             aMenuPane->SetItemDimmed( EWmlCmdOpenFeedsFolder, ETrue );
       
  1332             }
       
  1333 
       
  1334         // home
       
  1335         aMenuPane->SetItemDimmed( EWmlCmdLaunchHomePage, ApiProvider().IsLaunchHomePageDimmedL() );
       
  1336         }
       
  1337     else if ( aResourceId == R_PAGEACTIONS_SUBMENU )
       
  1338         {
       
  1339         // bookmark
       
  1340         if ( ApiProvider().IsEmbeddedModeOn() && CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu() )
       
  1341             {
       
  1342             aMenuPane->SetItemDimmed( EWmlCmdSaveAsBookmark, ETrue );
       
  1343             }
       
  1344         HBufC *pageUrl = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl );
       
  1345         if( ( pageUrl == NULL ) || ( pageUrl->Length() == 0 ) )
       
  1346             {
       
  1347             aMenuPane->SetItemDimmed( EWmlCmdSaveAsBookmark, ETrue );
       
  1348             }
       
  1349         CleanupStack::PopAndDestroy( pageUrl );
       
  1350 
       
  1351         // send
       
  1352         aMenuPane->SetItemDimmed( EWmlCmdSendBookmarkViaUnifiedMessage, ETrue );
       
  1353 
       
  1354         if (ApiProvider().IsEmbeddedModeOn())
       
  1355             {
       
  1356             aMenuPane->SetItemDimmed( EWmlCmdSendAddressViaUnifiedMessage, ETrue );
       
  1357             }
       
  1358 
       
  1359         // set as home page
       
  1360         aMenuPane->SetItemDimmed( EWmlCmdSetAsHomePage, ETrue);
       
  1361 
       
  1362         // pop-up blocking
       
  1363         if ( ApiProvider().IsEmbeddedModeOn() || ApiProvider().WindowMgr().CurrentWindow()->WMLMode())
       
  1364             {
       
  1365             aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, ETrue );
       
  1366             aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, ETrue );
       
  1367             }
       
  1368         else
       
  1369             {
       
  1370             aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, EFalse );
       
  1371             aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, EFalse );
       
  1372 
       
  1373             if ( ApiProvider().Preferences().PopupBlocking())
       
  1374                 {
       
  1375                 HBufC* url = ApiProvider().WindowMgr().CurrentWindow()->BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl );
       
  1376                 TBool dimAllow = EFalse;
       
  1377                 if( url )
       
  1378                     {
       
  1379                     // 'Allow Popups' needed if the current URL is not on the whitelist
       
  1380                     TRAPD( errWhite, dimAllow = ApiProvider().PopupEngine().IsUrlOnWhiteListL( *url ););
       
  1381                     // Error handling
       
  1382                     if ( !errWhite )
       
  1383                         {
       
  1384                         aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, !dimAllow );
       
  1385                         aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, dimAllow );
       
  1386                         }
       
  1387                     }
       
  1388                 // else no url (strange case), so no popup specific menuitem
       
  1389                 CleanupStack::PopAndDestroy( url );
       
  1390                 }
       
  1391                 else
       
  1392                   {
       
  1393                   //not shown any popupblocks related menu items when it's setting noblock
       
  1394                   aMenuPane->SetItemDimmed( EWmlCmdBlockPopups, ETrue );
       
  1395                   aMenuPane->SetItemDimmed( EWmlCmdAllowPopups, ETrue );
       
  1396                   }
       
  1397             }
       
  1398         }
       
  1399     else if ( aResourceId == R_VIEW_SUBMENU )
       
  1400         {
       
  1401         // toolbar
       
  1402         if ( !PenEnabled() && iApiProvider.Preferences().ShowToolbarOnOff() )
       
  1403             {
       
  1404             aMenuPane->SetItemDimmed( EWmlCmdShowToolBar, ApiProvider().WindowMgr().CurrentWindow()->WMLMode() );
       
  1405             }
       
  1406         else
       
  1407             {
       
  1408             aMenuPane->SetItemDimmed( EWmlCmdShowToolBar, ETrue);
       
  1409             }
       
  1410 
       
  1411         // disable fullscreen mode for touch only -- which has auto fullscreen now
       
  1412         if (iPenEnabled)
       
  1413             {
       
  1414             aMenuPane->SetItemDimmed(EWmlCmdEnterFullScreenBrowsing, ETrue);
       
  1415             }
       
  1416 
       
  1417         // rotate
       
  1418         if (!ApiProvider().Preferences().RotateDisplay() )
       
  1419             {
       
  1420             aMenuPane->SetItemDimmed( EWmlCmdRotateDisplay, ETrue );
       
  1421             }
       
  1422 
       
  1423         // page overview
       
  1424         if ( !ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserGraphicalPage ) ||
       
  1425              ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
  1426             {
       
  1427             aMenuPane->SetItemDimmed( EWmlCmdShowMiniature, ETrue);
       
  1428             }
       
  1429 
       
  1430         // show images
       
  1431         if( !ApiProvider().BrCtlInterface().ImageCountL() )
       
  1432             {
       
  1433             aMenuPane->SetItemDimmed( EWmlCmdShowImages, ETrue );
       
  1434             }
       
  1435 
       
  1436         // load images
       
  1437         if (( ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadImagesNoFlash) ||
       
  1438               (ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadAll) ||
       
  1439               ApiProvider().WindowMgr().CurrentWindow()->HasLoadedImages() )
       
  1440             {
       
  1441             aMenuPane->SetItemDimmed( EWmlCmdLoadImages, ETrue );
       
  1442             }
       
  1443 
       
  1444         // window
       
  1445         if ( !ApiProvider().Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) ||
       
  1446              ApiProvider().IsEmbeddedModeOn() ||
       
  1447              ApiProvider().WindowMgr().WindowCount() < 2)
       
  1448             {
       
  1449             aMenuPane->SetItemDimmed( EWmlCmdSwitchWindow, ETrue );
       
  1450             }
       
  1451         }
       
  1452     }
       
  1453 
       
  1454 // -----------------------------------------------------------------------------
       
  1455 // CBrowserContentView::CheckForEmptyWindowsMenuL
       
  1456 // Checks for the existence of Windows Submenu Items return true if no submenu items exist
       
  1457 // -----------------------------------------------------------------------------
       
  1458 //
       
  1459 TBool CBrowserContentView::CheckForEmptyWindowsMenuL(TWindowsMenuItemsDimCheck* aWindowMenuItems)
       
  1460     {
       
  1461 
       
  1462     __ASSERT_DEBUG( (aWindowMenuItems != NULL), Util::Panic( Util::EUninitializedData ));
       
  1463 
       
  1464     // 'OpenLinkInNewWindow is not available for 'non-anchor' elements or
       
  1465     // if current page has wml content.
       
  1466     //TBrCtlDefs::TBrCtlElementType elementtype =
       
  1467     //    ApiProvider().BrCtlInterface().FocusedElementType();
       
  1468 
       
  1469     // The commented part below enables the "Open link in new window" option.
       
  1470     // Currently the option is permanently dimmed
       
  1471     // UI change request AHUN-6U3NT4, S60 bug AHUN-6UYT6N
       
  1472     aWindowMenuItems->dimOpenInNewWin =  ETrue; /*( (elementtype != TBrCtlDefs::EElementAnchor) ||
       
  1473                          (ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse)) ); */
       
  1474 
       
  1475 
       
  1476     // Multiple Windows Supported
       
  1477     if ( ApiProvider().Preferences().UiLocalFeatureSupported(
       
  1478                                                     KBrowserMultipleWindows ) )
       
  1479         {
       
  1480         TInt winCount = ApiProvider().WindowMgr().WindowCount();
       
  1481 
       
  1482         // 'Close Window' & Switch Window needed if are 2+ open windows
       
  1483         if ( winCount > 1 )
       
  1484             {
       
  1485             aWindowMenuItems->dimCloseWin = EFalse;
       
  1486             // don't allow window switching if current window has wml.  must close this window first
       
  1487             aWindowMenuItems->dimSwitchWin = ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse /*is any page wml?*/);//EFalse;
       
  1488             }
       
  1489 
       
  1490         // Pop-up blocking is enabled
       
  1491         if ( ApiProvider().Preferences().PopupBlocking() )
       
  1492             {
       
  1493             //---------------------------------------------------------------------
       
  1494             // Popup Blocking Menu items
       
  1495             HBufC* url = ApiProvider().WindowMgr().CurrentWindow()->
       
  1496                 BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl );
       
  1497             if( url )
       
  1498                 {
       
  1499                 // 'Allow Popups' needed if the current URL is not on the whitelist
       
  1500                 TRAPD( errWhite,
       
  1501                 aWindowMenuItems->dimAllowPopups = ApiProvider().PopupEngine().IsUrlOnWhiteListL( *url );
       
  1502                             );
       
  1503                 // Error handling
       
  1504                 if ( errWhite )
       
  1505                     {
       
  1506                     // Better to have the menu item than not
       
  1507                     aWindowMenuItems->dimAllowPopups = aWindowMenuItems->dimBlockPopups = EFalse;
       
  1508                     }
       
  1509                 else
       
  1510                     {
       
  1511                     aWindowMenuItems->dimBlockPopups = !aWindowMenuItems->dimAllowPopups;
       
  1512                     }
       
  1513                 }
       
  1514             // else no url (strange case), so no popup specific menuitem
       
  1515 
       
  1516             CleanupStack::PopAndDestroy( url );
       
  1517             }
       
  1518         //=========================================================================
       
  1519         }
       
  1520     return (aWindowMenuItems->dimOpenInNewWin &&
       
  1521             aWindowMenuItems->dimSwitchWin &&
       
  1522             aWindowMenuItems->dimCloseWin &&
       
  1523             aWindowMenuItems->dimAllowPopups &&
       
  1524             aWindowMenuItems->dimBlockPopups);
       
  1525     }
       
  1526 
       
  1527 
       
  1528 // -----------------------------------------------------------------------------
       
  1529 // CBrowserContentView::DimMultipleWindowsMenuItems
       
  1530 // Dims the items of the windows submenu according to aWindowMenuItems
       
  1531 // -----------------------------------------------------------------------------
       
  1532 //
       
  1533 void CBrowserContentView::DimMultipleWindowsMenuItems( CEikMenuPane& aMenuPane, TWindowsMenuItemsDimCheck aWindowMenuItems )
       
  1534     {
       
  1535     aMenuPane.SetItemDimmed( EWmlCmdOpenLinkInNewWindow, aWindowMenuItems.dimOpenInNewWin );
       
  1536     aMenuPane.SetItemDimmed( EWmlCmdSwitchWindow,  aWindowMenuItems.dimSwitchWin );
       
  1537     aMenuPane.SetItemDimmed( EWmlCmdCloseWindow,   aWindowMenuItems.dimCloseWin );
       
  1538     aMenuPane.SetItemDimmed( EWmlCmdAllowPopups,   aWindowMenuItems.dimAllowPopups );
       
  1539     aMenuPane.SetItemDimmed( EWmlCmdBlockPopups,   aWindowMenuItems.dimBlockPopups );
       
  1540     }
       
  1541 
       
  1542 // -----------------------------------------------------------------------------
       
  1543 // CBrowserContentView::OptionListInit
       
  1544 // Callback - we should initialize the list of DO elements
       
  1545 // -----------------------------------------------------------------------------
       
  1546 //
       
  1547 void CBrowserContentView::OptionListInitL()
       
  1548     {
       
  1549     }
       
  1550 
       
  1551 // -----------------------------------------------------------------------------
       
  1552 // CBrowserContentView::HandleGotoPaneEventL
       
  1553 // -----------------------------------------------------------------------------
       
  1554 //
       
  1555 void CBrowserContentView::HandleGotoPaneEventL(
       
  1556                                                CBrowserGotoPane* /*aGotoPane*/,
       
  1557                                                MGotoPaneObserver::TEvent aEvent )
       
  1558     {
       
  1559     switch ( aEvent )
       
  1560         {
       
  1561         case MGotoPaneObserver::EEventEnterKeyPressed:
       
  1562             {
       
  1563              if( !MenuBar()->MenuPane()->IsVisible() )
       
  1564                 {
       
  1565                 if (iContainer->GotoPane()->PopupList() != NULL)
       
  1566                     {
       
  1567                     if ( iContainer->GotoPane()->PopupList()->IsOpenDirToShow() )
       
  1568                         {
       
  1569                         HandleCommandL( EWmlCmdOpenFolder );
       
  1570                         }
       
  1571                     else
       
  1572                         {
       
  1573                         HandleCommandL( EWmlCmdGotoPaneGoTo );
       
  1574                         }
       
  1575                     }
       
  1576                 }
       
  1577             break;
       
  1578             }
       
  1579 
       
  1580         default:
       
  1581             {
       
  1582             break;
       
  1583             }
       
  1584         }
       
  1585     }
       
  1586 
       
  1587 
       
  1588 // -----------------------------------------------------------------------------
       
  1589 // CBrowserContentView::OnScreenPosition
       
  1590 // -----------------------------------------------------------------------------
       
  1591 //
       
  1592 TPoint CBrowserContentView::OnScreenPosition()
       
  1593     {
       
  1594     TRect rect = AppUi()->ApplicationRect();
       
  1595     TPoint point (rect.iTl);
       
  1596     if (iPenEnabled)
       
  1597         {
       
  1598         if (AppUi()->TouchPane())
       
  1599             {
       
  1600             TRect touchRect = AppUi()->TouchPane()->Rect();
       
  1601             if (touchRect.iTl == rect.iTl)
       
  1602                 {
       
  1603                 if (touchRect.Width() > touchRect.Height()) // Horizontal, on top
       
  1604                     {
       
  1605                     point = TPoint(rect.iTl.iX, touchRect.iBr.iY);
       
  1606                     }
       
  1607                 else // Vertical, on the left
       
  1608                     {
       
  1609                     point = TPoint(touchRect.iBr.iX, rect.iTl.iY);
       
  1610                     }
       
  1611                 }
       
  1612             }
       
  1613         }
       
  1614     return point;
       
  1615     }
       
  1616 
       
  1617 // -----------------------------------------------------------------------------
       
  1618 // CBrowserContentView::GotoUrlInGotoPaneL
       
  1619 // -----------------------------------------------------------------------------
       
  1620 //
       
  1621 void CBrowserContentView::GotoUrlInGotoPaneL()
       
  1622     {
       
  1623     if ( iContainer->GotoPane() )
       
  1624         {
       
  1625         delete iEnteredURL;
       
  1626         iEnteredURL = NULL;
       
  1627         iEnteredURL = iContainer->GotoPane()->GetTextL(); // the url
       
  1628         if( iEnteredURL )
       
  1629             {
       
  1630             iContainer->ShutDownGotoURLEditorL();
       
  1631 
       
  1632             TFavouritesWapAp accessPoint;
       
  1633             // if current ap exists then use it. other ways use default ap.
       
  1634             if( ApiProvider().Connection().CurrentAPId() )
       
  1635                 {
       
  1636                 TUint apId = ApiProvider().Connection().CurrentAPId();
       
  1637                 apId = Util::WapIdFromIapIdL( ApiProvider(), apId );
       
  1638                 accessPoint.SetApId( apId );
       
  1639                 }
       
  1640             else
       
  1641                 {
       
  1642                 accessPoint.SetApId(
       
  1643                 ApiProvider().Preferences().DefaultAccessPoint() );
       
  1644                 }
       
  1645             UpdateCbaL();
       
  1646             UpdateFullScreenL();
       
  1647 
       
  1648             ApiProvider().FetchL(   iEnteredURL->Des(),
       
  1649                                     KNullDesC,
       
  1650                                     KNullDesC,
       
  1651                                     accessPoint,
       
  1652                                     CBrowserLoadObserver::ELoadUrlTypeOther );
       
  1653 
       
  1654             }
       
  1655         else  // no URL entered
       
  1656             {
       
  1657             iContainer->ShutDownGotoURLEditorL();
       
  1658             UpdateCbaL();
       
  1659             UpdateFullScreenL();
       
  1660             }
       
  1661         }
       
  1662     }
       
  1663 
       
  1664 // -----------------------------------------------------------------------------
       
  1665 // CBrowserContentView::UpdateGotoPaneL
       
  1666 // -----------------------------------------------------------------------------
       
  1667 //
       
  1668 void CBrowserContentView::UpdateGotoPaneL()
       
  1669     {
       
  1670     // Reset goto pane content
       
  1671     if( AUTOCOMP ) //ask the feature manager
       
  1672         {
       
  1673         //2.1 does not put http:// there
       
  1674         iContainer->GotoPane()->SetTextL( KNullDesC );
       
  1675         }
       
  1676     else
       
  1677         {
       
  1678         //2.0 does need http://
       
  1679         iContainer->GotoPane()->SetTextL( KHttpString );
       
  1680         }
       
  1681     }
       
  1682 
       
  1683 // -----------------------------------------------------------------------------
       
  1684 // CBrowserContentView::LaunchGotoAddressEditorL
       
  1685 // -----------------------------------------------------------------------------
       
  1686 //
       
  1687 void CBrowserContentView::LaunchGotoAddressEditorL()
       
  1688     {
       
  1689     // Cancel editing and sets Goto Pane text back.
       
  1690     if (iContainer->GotoPane()->PopupList() != NULL)
       
  1691         {
       
  1692         iContainer->GotoPane()->PopupList()->SetDirectoryModeL( ETrue );
       
  1693         iContainer->GotoPane()->PopupList()->HidePopupL();
       
  1694         }
       
  1695 
       
  1696     if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen )
       
  1697         {
       
  1698         MakeCbaVisible( ETrue );
       
  1699         }
       
  1700 
       
  1701     CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->GotoPane() );
       
  1702     CCoeEnv::Static()->AppUi()->AddToStackL( iContainer->GotoPane(), ECoeStackPriorityMenu );
       
  1703     iContainer->GotoPane()->MakeVisible( ETrue );
       
  1704     if ( iEnteredURL && iEnteredURL->Length() )
       
  1705        {
       
  1706             iContainer->GotoPane()->SetTextL(*iEnteredURL);
       
  1707             iContainer->GotoPane()->SelectAllL();
       
  1708        }
       
  1709     else
       
  1710         {
       
  1711             // nor iEnteredURL; use default name.
       
  1712             // set "http://www." per Browser UI spec
       
  1713             iContainer->GotoPane()->SetTextL(KWWWString  );
       
  1714         }
       
  1715     iContainer->GotoPane()->SetFocus( ETrue );
       
  1716     UpdateCbaL();
       
  1717 
       
  1718     if (iPenEnabled)
       
  1719         {
       
  1720         Toolbar()->SetDimmed(ETrue);
       
  1721         Toolbar()->DrawNow();
       
  1722         }
       
  1723 
       
  1724     }
       
  1725 
       
  1726 
       
  1727 // -----------------------------------------------------------------------------
       
  1728 // CBrowserContentView::LaunchFindKeywordEditorL
       
  1729 // -----------------------------------------------------------------------------
       
  1730 //
       
  1731 void CBrowserContentView::LaunchFindKeywordEditorL()
       
  1732     {
       
  1733     // Cancel editing and sets Goto Pane text back.
       
  1734     if (iContainer->FindKeywordPane()->PopupList() != NULL)
       
  1735         {
       
  1736         iContainer->FindKeywordPane()->PopupList()->SetDirectoryModeL( ETrue );
       
  1737         iContainer->FindKeywordPane()->PopupList()->HidePopupL();
       
  1738         }
       
  1739 
       
  1740     if ( ApiProvider().Preferences().FullScreen() == EWmlSettingsFullScreenFullScreen )
       
  1741         {
       
  1742         MakeCbaVisible( ETrue );
       
  1743         }
       
  1744 
       
  1745     CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer->FindKeywordPane() );
       
  1746     CCoeEnv::Static()->AppUi()->AddToStackL( iContainer->FindKeywordPane(), ECoeStackPriorityMenu );
       
  1747     iContainer->FindKeywordPane()->MakeVisible( ETrue );
       
  1748     iContainer->FindKeywordPane()->SetFocus( ETrue );
       
  1749     UpdateCbaL();
       
  1750     if (iPenEnabled)
       
  1751         {
       
  1752 #ifdef RD_SCALABLE_UI_V2
       
  1753         Toolbar()->ToolbarExtension()->SetShown(EFalse);
       
  1754 #endif
       
  1755         iBrowserContentViewToolbar->UpdateButtonsStateL();
       
  1756         }
       
  1757     }
       
  1758 
       
  1759 // -----------------------------------------------------------------------------
       
  1760 // CBrowserContentView::UpdateTitleL
       
  1761 // -----------------------------------------------------------------------------
       
  1762 //
       
  1763 void CBrowserContentView::UpdateTitleL( MApiProvider& aApiProvider )
       
  1764     {
       
  1765     HBufC* title = aApiProvider.BrCtlInterface().PageInfoLC(
       
  1766         TBrCtlDefs::EPageInfoTitle );
       
  1767     if ( title && title->Length() )
       
  1768         {
       
  1769         aApiProvider.Display().SetTitleL( title->Des() );
       
  1770         }
       
  1771     else
       
  1772         {
       
  1773 
       
  1774         TInt offset = 0;
       
  1775         HBufC* titleUrl = aApiProvider.BrCtlInterface().PageInfoLC(
       
  1776             TBrCtlDefs::EPageInfoUrl );
       
  1777         if( titleUrl == NULL )  // is this really possible?
       
  1778             {
       
  1779             CleanupStack::PopAndDestroy( titleUrl );
       
  1780             titleUrl = KNullDesC().AllocLC();
       
  1781             }
       
  1782         offset = titleUrl->Find( KSchemaIdentifier );
       
  1783         if(offset != KErrNotFound )
       
  1784             {
       
  1785             titleUrl->Des().Delete(0,offset + KSchemaIdentifierLength);
       
  1786             }
       
  1787         aApiProvider.Display().SetTitleL( titleUrl->Des() );
       
  1788         CleanupStack::PopAndDestroy( );  // titleUrl
       
  1789         }
       
  1790 
       
  1791     CleanupStack::PopAndDestroy(); // title
       
  1792     }
       
  1793 
       
  1794 // -----------------------------------------------------------------------------
       
  1795 // CBrowserContentView::AddNewBookmarkL
       
  1796 // -----------------------------------------------------------------------------
       
  1797 //
       
  1798 void CBrowserContentView::AddNewBookmarkL( TBool aAsLastVisited, HBufC* aUrl )
       
  1799     {
       
  1800     TInt pop = 0;
       
  1801     HBufC* cardTitle = NULL;
       
  1802     TPtrC cardTitlePtr( KNullDesC );
       
  1803 
       
  1804     // Make a bookmark model.
       
  1805     iBookmarksModel = CBrowserBookmarksModel::NewL(ApiProvider());
       
  1806 
       
  1807     // Create a bookmark item.
       
  1808     CFavouritesItem* item = CFavouritesItem::NewLC();
       
  1809 
       
  1810     HBufC* theUrl = NULL;
       
  1811     if (aUrl == NULL)
       
  1812         {
       
  1813         // Set URL.
       
  1814         theUrl = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl );
       
  1815         if( !theUrl || !theUrl->Length() )
       
  1816             {
       
  1817             CleanupStack::PopAndDestroy( theUrl );
       
  1818             theUrl = KNullDesC().AllocLC();
       
  1819             }
       
  1820         pop++;
       
  1821         // Get the title
       
  1822         cardTitle = ApiProvider().BrCtlInterface().PageInfoLC(TBrCtlDefs::EPageInfoTitle );
       
  1823         pop++;
       
  1824         }
       
  1825     else
       
  1826         {
       
  1827         theUrl = aUrl;
       
  1828         }
       
  1829 
       
  1830     if ( cardTitle )
       
  1831         {
       
  1832         cardTitle->Des().Trim();
       
  1833         cardTitlePtr.Set( cardTitle->Des() );
       
  1834         }
       
  1835 
       
  1836     if ( cardTitlePtr.Length() )
       
  1837         {
       
  1838         // Current card has non-empty title, use that as bookmark name.
       
  1839         item->SetNameL( cardTitlePtr.Left(KFavouritesMaxName) );
       
  1840         }
       
  1841     else
       
  1842         {
       
  1843         // Get the URL
       
  1844         HBufC* url = theUrl->AllocLC();
       
  1845         pop++;
       
  1846 
       
  1847         if ( url && url->Length() )
       
  1848             {
       
  1849             TUriParser16 urlParser;
       
  1850             urlParser.Parse(*url);
       
  1851             url->Des().SetLength( 0 );
       
  1852             url->Des().Append( urlParser.Extract( EUriHost) );
       
  1853             url->Des().Append( urlParser.Extract( EUriPath ) );
       
  1854             item->SetNameL( url->Left(KFavouritesMaxName) );
       
  1855             }
       
  1856         else
       
  1857             {
       
  1858             // No title, nor url; use default name.
       
  1859             iBookmarksModel->SetNameToDefaultL( *item );
       
  1860             }
       
  1861         }
       
  1862 
       
  1863     // set url, username, password
       
  1864     Util::RetreiveUsernameAndPasswordFromUrlL( *theUrl, *item );
       
  1865     CleanupStack::PopAndDestroy(pop);  // url, cardTitle, theUrl
       
  1866 
       
  1867     item->SetParentFolder( KFavouritesRootUid );
       
  1868 
       
  1869     // Set WAP AP.
       
  1870     TFavouritesWapAp ap;    // default AP
       
  1871     item->SetWapAp( ap );
       
  1872 
       
  1873     if ( aAsLastVisited )
       
  1874         {
       
  1875         iBookmarksModel->SetLastVisitedL( *item, EFalse,
       
  1876         CBrowserFavouritesModel::EAutoRename );
       
  1877         }
       
  1878 
       
  1879     else
       
  1880         {
       
  1881         HBufC* prompt = StringLoader::LoadLC( R_WML_ENTER_BOOKMARK_NAME );
       
  1882         TBuf<KBrowserMaxPrompt+1> retString;
       
  1883         retString.Copy( item->Name() );
       
  1884 
       
  1885         TBool queryName = ETrue;
       
  1886         while( queryName )
       
  1887             {
       
  1888             TInt result = TBrowserDialogs::DialogPromptReqL(
       
  1889                 prompt->Des(),
       
  1890                 &retString,
       
  1891                 EFalse,
       
  1892                 KFavouritesMaxBookmarkNameDefine );
       
  1893             if( result )
       
  1894                 {
       
  1895                 item->SetNameL(retString.Left(KFavouritesMaxName));
       
  1896                 TInt err = iBookmarksModel->AddL(
       
  1897                     *item,
       
  1898                     ETrue,
       
  1899                     CBrowserFavouritesModel::EDontRename );
       
  1900                 if ( !err )
       
  1901                     {
       
  1902                     TBrowserDialogs::InfoNoteL(
       
  1903                                 R_BROWSER_OK_NOTE,
       
  1904                                 iBookmarksModel->StringResourceId
       
  1905                                 ( *item, CBrowserFavouritesModel::ESaved ) );
       
  1906                     queryName = EFalse;
       
  1907                     AddBMUidToLastPlaceToCurrentListL( item->Uid() );
       
  1908                     }
       
  1909                 else if( KErrAlreadyExists == err )
       
  1910                     {
       
  1911                     TBrowserDialogs::InfoNoteL(
       
  1912                             R_BROWSER_INFO_NOTE, R_WML_NAME_ALREADY_IN_USE );
       
  1913                     }
       
  1914                 else
       
  1915                     {
       
  1916                     TBrowserDialogs::ErrorNoteL(
       
  1917                         iBookmarksModel->StringResourceId(
       
  1918                         *item,
       
  1919                         CBrowserFavouritesModel::ENotSaved ) );
       
  1920 
       
  1921                     }
       
  1922                 }
       
  1923             else
       
  1924                 queryName = EFalse;
       
  1925             }
       
  1926         CleanupStack::PopAndDestroy();  // prompt
       
  1927         }
       
  1928 
       
  1929     CleanupStack::PopAndDestroy();   // item
       
  1930 
       
  1931     delete iBookmarksModel;
       
  1932     iBookmarksModel = NULL;
       
  1933     }
       
  1934 
       
  1935 // -----------------------------------------------------------------------------
       
  1936 // CBrowserContentView::AddBMUidToLastPlaceToCurrentListL
       
  1937 // -----------------------------------------------------------------------------
       
  1938 //
       
  1939 void CBrowserContentView::AddBMUidToLastPlaceToCurrentListL(const TInt aUid )
       
  1940     {
       
  1941     CArrayFixFlat<TInt>* orderArray = new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh);
       
  1942     CleanupStack::PushL( orderArray );
       
  1943 
       
  1944     CBrowserBookmarksOrder* currentOrder = CBrowserBookmarksOrder::NewLC();
       
  1945     if ( iBookmarksModel->Database().GetData( KFavouritesRootUid ,*currentOrder ) == KErrNone)
       
  1946         {
       
  1947         if ( currentOrder->GetBookMarksOrder().Count() > 0 )
       
  1948             {
       
  1949             orderArray->AppendL( &( currentOrder->GetBookMarksOrder()[0] ),
       
  1950                 currentOrder->GetBookMarksOrder().Count() );
       
  1951             }
       
  1952         }
       
  1953     iBookmarksModel->AddUidToLastPlaceL(aUid, orderArray, currentOrder );
       
  1954     currentOrder->SetBookMarksOrderL( *orderArray );
       
  1955     iBookmarksModel->Database().SetData( KFavouritesRootUid ,*currentOrder );
       
  1956     CleanupStack::PopAndDestroy( 2 );// currentOrder, orderArray
       
  1957     }
       
  1958 
       
  1959 // -----------------------------------------------------------------------------
       
  1960 // CBrowserContentView::SendAddressL
       
  1961 // -----------------------------------------------------------------------------
       
  1962 //
       
  1963 void CBrowserContentView::SendAddressL( )
       
  1964     {
       
  1965     HBufC* url = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoUrl );
       
  1966     if( url == NULL )
       
  1967         {
       
  1968         CleanupStack::PopAndDestroy( url );  // remove previous
       
  1969         url = KNullDesC().AllocLC();
       
  1970         }
       
  1971 
       
  1972 #ifndef _BOOKMARK_SENT_ASCII
       
  1973     if( url->Length() <= KMaxUrlLenghtInOTA )
       
  1974 #endif  // _BOOKMARK_SENT_ASCII
       
  1975         {
       
  1976         HBufC* title = ApiProvider().BrCtlInterface().PageInfoLC( TBrCtlDefs::EPageInfoTitle );
       
  1977         if( title == NULL )
       
  1978             {
       
  1979             CleanupStack::PopAndDestroy( title );  // remove previous
       
  1980             title = KNullDesC().AllocLC();
       
  1981             }
       
  1982 
       
  1983         //CBrowserAppUi* ui = reinterpret_cast<CBrowserAppUi*>(AppUi());
       
  1984         MBmOTABinSender& sender = ApiProvider().BmOTABinSenderL();
       
  1985 
       
  1986         sender.ResetAndDestroy();
       
  1987         sender.AppendL( url->Des(), title->Des() );
       
  1988         sender.SendAddressL( );
       
  1989         CleanupStack::PopAndDestroy( title );  // title
       
  1990         }
       
  1991 #ifndef _BOOKMARK_SENT_ASCII
       
  1992     else
       
  1993         {
       
  1994 #pragma message ( __FILE__ ": Length of bookmark addr cannot exceed 255bytes!")
       
  1995         _LIT( KErrMsg, "URL address of bookmark is too long. It cannot be sent.");
       
  1996 
       
  1997         TBrowserDialogs::ErrorNoteL( KErrMsg );
       
  1998         }
       
  1999 #endif  // _BOOKMARK_SENT_ASCII
       
  2000     CleanupStack::PopAndDestroy( url );  // url
       
  2001     }
       
  2002 
       
  2003 
       
  2004 // -----------------------------------------------------------------------------
       
  2005 // CBrowserContentView::UpdateOptionMenuItemLabelL
       
  2006 // -----------------------------------------------------------------------------
       
  2007 //
       
  2008 void CBrowserContentView::UpdateOptionMenuItemLabelL(CEikMenuPane* aMenuPane, const TInt aCommandId, const TInt aResourceId)
       
  2009     {
       
  2010 
       
  2011      __ASSERT_DEBUG( (aMenuPane != NULL), Util::Panic( Util::EUninitializedData ));
       
  2012 
       
  2013     HBufC* browserLabel = CCoeEnv::Static()->AllocReadResourceLC(aResourceId);
       
  2014     aMenuPane->SetItemTextL(aCommandId, *browserLabel);
       
  2015     CleanupStack::PopAndDestroy();
       
  2016     }
       
  2017 
       
  2018 
       
  2019 // -----------------------------------------------------------------------------
       
  2020 // CBrowserContentView::DoSearchL
       
  2021 // Do search for specified items in current page
       
  2022 // -----------------------------------------------------------------------------
       
  2023 //
       
  2024 void CBrowserContentView::DoSearchL(
       
  2025                             CFindItemEngine::TFindItemSearchCase aSearchCase )
       
  2026     {
       
  2027     HBufC* findText = NULL;
       
  2028     findText = ApiProvider().BrCtlInterface().PageInfoLC(
       
  2029                                                 TBrCtlDefs::EPageInfoContent );
       
  2030     if( findText == NULL )
       
  2031         {
       
  2032         CleanupStack::PopAndDestroy( findText );
       
  2033         return;
       
  2034         }
       
  2035 
       
  2036     if( findText->Length() != 0 )
       
  2037         {
       
  2038 
       
  2039         TPtr findTextDes = findText->Des();
       
  2040 
       
  2041         for( int i = 0; i < findText->Length(); ++i )
       
  2042             {
       
  2043             if( (*findText)[i] == TUint16( 0x0a ) )
       
  2044                 {
       
  2045                 findTextDes[i] = TUint16( CEditableText::EParagraphDelimiter );
       
  2046                 }
       
  2047 
       
  2048             else if( (*findText)[i] == TUint16( CEditableText::ETabCharacter ) )
       
  2049                 {
       
  2050                 findTextDes[i] = TUint16( CEditableText::ESpace );
       
  2051                 }
       
  2052             else if( (*findText)[i] == TUint16( CEditableText::ELineBreak ) )
       
  2053                 {
       
  2054                 findTextDes[i] = TUint16( CEditableText::EParagraphDelimiter );
       
  2055                 }
       
  2056             }
       
  2057         }
       
  2058 
       
  2059     SetFullScreenOffL();
       
  2060     CFindItemDialog* dialog =  CFindItemDialog::NewL( *findText, aSearchCase );
       
  2061     dialog->ExecuteLD();
       
  2062     UpdateFullScreenL();
       
  2063     UpdateTitleL( ApiProvider() );
       
  2064 
       
  2065     CleanupStack::PopAndDestroy( findText );
       
  2066     }
       
  2067 
       
  2068 
       
  2069 // -----------------------------------------------------------------------------
       
  2070 // CBrowserContentView::SetLastVisitedBookmarkL
       
  2071 // -----------------------------------------------------------------------------
       
  2072 //
       
  2073 void CBrowserContentView::SetLastVisitedBookmarkL()
       
  2074     {
       
  2075     AddNewBookmarkL( ETrue );
       
  2076     }
       
  2077 
       
  2078 // -----------------------------------------------------------------------------
       
  2079 // CBrowserContentView::UpdateNaviPaneL
       
  2080 // -----------------------------------------------------------------------------
       
  2081 //
       
  2082 void CBrowserContentView::UpdateNaviPaneL( TDesC& aStatusMsg )
       
  2083     {
       
  2084     //Set text that will be shown in navipane
       
  2085     iStatusMsg.Des().Copy(aStatusMsg.Left(KStatusMessageMaxLength));//Might be longer than iStatusMsg
       
  2086     SetNavipaneViewL();
       
  2087     }
       
  2088 
       
  2089 // -----------------------------------------------------------------------------
       
  2090 // CBrowserContentView::SetNavipaneViewL
       
  2091 // -----------------------------------------------------------------------------
       
  2092 //
       
  2093 void CBrowserContentView::SetNavipaneViewL()
       
  2094     {
       
  2095     TVwsViewId activeViewId;
       
  2096     if ( AppUi()->GetActiveViewId( activeViewId ) == KErrNone )
       
  2097         {
       
  2098         if ( (activeViewId.iViewUid == KUidBrowserContentViewId) )
       
  2099             {
       
  2100             if (!iNaviDecorator)
       
  2101                 {
       
  2102                 delete iNaviDecorator;
       
  2103                 iNaviDecorator = NULL;
       
  2104 
       
  2105                 if( iNaviPane )
       
  2106                     {
       
  2107                     if (iStatusMsg.Length())
       
  2108                         {
       
  2109                         iNaviDecorator = iNaviPane->CreateNavigationLabelL(
       
  2110                             iStatusMsg );
       
  2111                         }
       
  2112                     else
       
  2113                         {
       
  2114                         iNaviDecorator = iNaviPane->CreateNavigationLabelL(_L(""));
       
  2115                         }
       
  2116                     }
       
  2117                 iNaviPane->PushL( *iNaviDecorator );
       
  2118                 }
       
  2119             else
       
  2120                 {
       
  2121                 CAknNaviLabel* naviLabel = STATIC_CAST( CAknNaviLabel*,
       
  2122                     iNaviDecorator->DecoratedControl());
       
  2123                 naviLabel->SetTextL(iStatusMsg);
       
  2124                 // make sure at top and redraw
       
  2125                 iNaviPane->PushL( *iNaviDecorator );
       
  2126                 }
       
  2127 
       
  2128             iNaviDecorator->MakeScrollButtonVisible(ETrue);
       
  2129             }
       
  2130         }
       
  2131     }
       
  2132 
       
  2133 // -----------------------------------------------------------------------------
       
  2134 // CBrowserContentView::FindItemIsInProgress
       
  2135 // -----------------------------------------------------------------------------
       
  2136 //
       
  2137 TBool CBrowserContentView::FindItemIsInProgress()
       
  2138     {
       
  2139     return iFindItemIsInProgress;
       
  2140     }
       
  2141 
       
  2142 // ---------------------------------------------------------------------------
       
  2143 //  CBrowserContentView::HandleStatusPaneSizeChange
       
  2144 // ---------------------------------------------------------------------------
       
  2145 //
       
  2146 void CBrowserContentView::HandleStatusPaneSizeChange()
       
  2147     {
       
  2148     iContainer->SetRect(ClientRect());
       
  2149     }
       
  2150 
       
  2151 // ---------------------------------------------------------------------------
       
  2152 // CBrowserContentView::StateChanged
       
  2153 // ---------------------------------------------------------------------------
       
  2154 //
       
  2155 void CBrowserContentView::StateChanged(
       
  2156         TBrCtlDefs::TBrCtlState aState,
       
  2157         TInt aValue )
       
  2158     {
       
  2159 LOG_ENTERFN(" CBrowserContentView::StateChanged" );
       
  2160 LOG_WRITE_FORMAT(" state: %d", aState );
       
  2161 LOG_WRITE_FORMAT(" value: %d", aValue );
       
  2162     switch(aState)
       
  2163         {
       
  2164         case TBrCtlDefs::EStateImageMapView:
       
  2165             {
       
  2166             iImageMapActive = (TBool) aValue;
       
  2167             TRAP_IGNORE( UpdateCbaL() );
       
  2168             break;
       
  2169             }
       
  2170         case TBrCtlDefs::EStateHistoryView:
       
  2171             {
       
  2172             iHistoryViewIsUp = (TBool) aValue;
       
  2173             iHistoryAtBeginning = EFalse;
       
  2174             iHistoryAtEnd = EFalse;
       
  2175             if ( iPenEnabled )
       
  2176                 {
       
  2177                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2178                 }
       
  2179             TRAP_IGNORE( UpdateCbaL() );
       
  2180             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2181 			if (iPenEnabled)
       
  2182 				{
       
  2183 	            StartAutoFullScreenTimer();
       
  2184 				}
       
  2185             break;
       
  2186             }
       
  2187         case TBrCtlDefs::EStateThumbnailView:
       
  2188             {
       
  2189             iThumbnailViewIsUp = (TBool) aValue;
       
  2190             if ( iPenEnabled )
       
  2191                 {
       
  2192                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2193                 }
       
  2194             TRAP_IGNORE( UpdateCbaL() );
       
  2195             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2196 			if (iPenEnabled)
       
  2197 				{
       
  2198 	            StartAutoFullScreenTimer();
       
  2199 				}
       
  2200             break;
       
  2201             }
       
  2202         case TBrCtlDefs::EStatePluginPlayer:
       
  2203             {
       
  2204             iPluginPlayerIsUp = (TBool) aValue;
       
  2205             TRAP_IGNORE( UpdateCbaL() );
       
  2206             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2207             break;
       
  2208             }
       
  2209         case TBrCtlDefs::EStateSmartTextView:
       
  2210             {
       
  2211             iSmartTextViewIsUp = (TBool) aValue;
       
  2212             TRAP_IGNORE( UpdateCbaL() );
       
  2213             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2214             break;
       
  2215             }
       
  2216         case TBrCtlDefs::EStateToolBarMode:
       
  2217             {
       
  2218             if(!aValue)
       
  2219                 {
       
  2220                 TRAP_IGNORE( UpdateCbaL() );
       
  2221                 }
       
  2222             break;
       
  2223             }
       
  2224         case TBrCtlDefs::EStateScriptLog:
       
  2225             {
       
  2226             TRAP_IGNORE( ApiProvider().Preferences().SetScriptLogL( aValue ) );
       
  2227             break;
       
  2228             }
       
  2229         case TBrCtlDefs::EStateZoomSliderMode:
       
  2230             {
       
  2231             if ( aValue )
       
  2232                 {
       
  2233                 iZoomSliderVisible = ETrue;
       
  2234                 }
       
  2235             else
       
  2236                 {
       
  2237                 iZoomSliderVisible = EFalse;
       
  2238 				if (iPenEnabled)
       
  2239 					{
       
  2240 	    	        StartAutoFullScreenTimer();
       
  2241 					}
       
  2242                 }
       
  2243             // Inform Toolbar of this fact
       
  2244             if ( iPenEnabled )
       
  2245                 {
       
  2246                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2247                 }
       
  2248             break;
       
  2249             }
       
  2250         case TBrCtlDefs::EStateFullscreenBrowsing:
       
  2251             {
       
  2252             if ( !aValue )
       
  2253                 {
       
  2254                 TRAP_IGNORE( EnableFullScreenModeL( EFalse ) );
       
  2255                 }
       
  2256             break;
       
  2257             }
       
  2258         case TBrCtlDefs::EStateHistoryBeginning:
       
  2259             {
       
  2260             if(aValue)
       
  2261                 {
       
  2262                 iHistoryAtBeginning = ETrue;
       
  2263                 }
       
  2264             else
       
  2265                 {
       
  2266                 iHistoryAtBeginning = EFalse;
       
  2267                 }
       
  2268             if (iPenEnabled)
       
  2269                 {
       
  2270                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2271                 }
       
  2272             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2273             break;
       
  2274             }
       
  2275         case TBrCtlDefs::EStateHistoryEnd:
       
  2276             {
       
  2277             if(aValue)
       
  2278                 {
       
  2279                 iHistoryAtEnd = ETrue;
       
  2280                 }
       
  2281             else
       
  2282                 {
       
  2283                 iHistoryAtEnd = EFalse;
       
  2284                 }
       
  2285             if (iPenEnabled)
       
  2286                 {
       
  2287                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2288                 }
       
  2289             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2290             break;
       
  2291             }
       
  2292         case TBrCtlDefs::EStateSynchRequestMode:
       
  2293             {
       
  2294             iSynchRequestViewIsUp = (TBool) aValue;
       
  2295             if (iPenEnabled)
       
  2296                 {
       
  2297                 TRAP_IGNORE( iBrowserContentViewToolbar->UpdateButtonsStateL() );
       
  2298                 }
       
  2299             TRAP_IGNORE( UpdateCbaL() );
       
  2300             TRAP_IGNORE( UpdateTitleL( ApiProvider() ) );
       
  2301             break;
       
  2302             }
       
  2303         case TBrCtlDefs::EStatePluginFullScreen:
       
  2304             HandlePluginFullScreen((TBool) aValue);
       
  2305             break;
       
  2306         default:
       
  2307             break;
       
  2308         }
       
  2309 
       
  2310     ApiProvider().WindowMgr().SetCurrentWindowViewState(aState, aValue);
       
  2311     if (iPenEnabled && ApiProvider().WindowMgr().CurrentWindow()->WMLMode())
       
  2312     	{
       
  2313         EnableFullScreenModeL( EFalse );
       
  2314     	}
       
  2315 
       
  2316     }
       
  2317 
       
  2318 // -------------------------------------------------------------------
       
  2319 // CBrowserContentView::HandleCommandL
       
  2320 // ---------------------------------------------------------------------------
       
  2321 //
       
  2322 void CBrowserContentView::HandleCommandL(
       
  2323     TBrCtlDefs::TBrCtlClientCommands aCommand,
       
  2324     const CArrayFix<TPtrC>& /*aAttributesNames*/,
       
  2325     const CArrayFix<TPtrC>& aAttributeValues)
       
  2326     {
       
  2327     switch(aCommand)
       
  2328         {
       
  2329         case TBrCtlDefs::EClientCommandLaunchFindKeyword:
       
  2330             {
       
  2331             // Find Keyword not initiated from options menu so don't set menupane to visible.
       
  2332             LaunchFindKeywordEditorL();
       
  2333             MenuBar()->MenuPane()->MakeVisible(EFalse);
       
  2334             break;
       
  2335             }
       
  2336         case TBrCtlDefs::EClientCommandGotoWebAddress:
       
  2337             {
       
  2338             HandleCommandL(EWmlCmdGoToAddress);
       
  2339             break;
       
  2340             }
       
  2341 
       
  2342         case TBrCtlDefs::EClientCommandSaveAsBookmark:
       
  2343             {
       
  2344             HandleCommandL(EWmlCmdSaveAsBookmark);
       
  2345             break;
       
  2346             }
       
  2347 
       
  2348         case TBrCtlDefs::EClientCommandManageBookmarks:
       
  2349             {
       
  2350             HandleCommandL(EWmlCmdFavourites);
       
  2351             break;
       
  2352             }
       
  2353 
       
  2354         case TBrCtlDefs::EClientCommandZoomIn:
       
  2355             {
       
  2356             ZoomImagesInL();
       
  2357             break;
       
  2358             }
       
  2359 
       
  2360         case TBrCtlDefs::EClientCommandZoomOut:
       
  2361             {
       
  2362             ZoomImagesOutL();
       
  2363             break;
       
  2364             }
       
  2365 
       
  2366         case TBrCtlDefs::EClientCommandZoomMode:
       
  2367             {
       
  2368             ZoomModeImagesL();
       
  2369             break;
       
  2370             }
       
  2371 
       
  2372         case TBrCtlDefs::EClientCommandGoToHompage:
       
  2373             {
       
  2374             HandleCommandL(EWmlCmdLaunchHomePage);
       
  2375             break;
       
  2376             }
       
  2377         case TBrCtlDefs::EClientCommandRotateScreen:
       
  2378             {
       
  2379             HandleCommandL(EWmlCmdRotateDisplay);
       
  2380             break;
       
  2381             }
       
  2382         case TBrCtlDefs::EClientCommandSavePage:
       
  2383             {
       
  2384             HandleCommandL(EWmlCmdSavePage);
       
  2385             break;
       
  2386             }
       
  2387         case TBrCtlDefs::EClientCommandSwitchWindow:
       
  2388             {
       
  2389             HandleCommandL(EWmlCmdSwitchWindow);
       
  2390             break;
       
  2391             }
       
  2392         case TBrCtlDefs::EClientCommandShowHelp:
       
  2393             {
       
  2394             HandleCommandL(EAknCmdHelp);
       
  2395             break;
       
  2396             }
       
  2397 
       
  2398         case TBrCtlDefs::EClientCommandToolbarConfigure:
       
  2399             {
       
  2400             // open settings view in toolbar group
       
  2401             AppUi()->HandleCommandL( EWmlCmdPreferencesToolbar );
       
  2402             break;
       
  2403             }
       
  2404 
       
  2405         case TBrCtlDefs::EClientCommandToolbarShowKeymap:
       
  2406             {
       
  2407             ShowKeymap();
       
  2408             break;
       
  2409             }
       
  2410 
       
  2411         case TBrCtlDefs::EClientCommandSubscribeToFeeds:
       
  2412             {
       
  2413 #ifdef __RSS_FEEDS
       
  2414             const TPtrC16  name(aAttributeValues.At(0));
       
  2415             const TPtrC16  url(aAttributeValues.At(1));
       
  2416 
       
  2417             ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId );
       
  2418             ApiProvider().FeedsClientUtilities().SubscribeToL( name, url );
       
  2419             // switch back to FeedsView, so change layout
       
  2420             SetFullScreenOffL();
       
  2421 #endif
       
  2422             break;
       
  2423             }
       
  2424 
       
  2425         case TBrCtlDefs::EClientCommandShowContextMenu:
       
  2426             {
       
  2427             // Get ElementType
       
  2428             const TPtrC elTypePtr(aAttributeValues.At(0));
       
  2429             TLex lex(elTypePtr);
       
  2430             TInt elType;
       
  2431             TInt resourceId = 0;
       
  2432             if (lex.Val(elType) == KErrNone)
       
  2433                 {
       
  2434                 switch (elType)
       
  2435                     {
       
  2436                     case TBrCtlDefs::EElementNone:
       
  2437                         resourceId = R_BROWSER_EMPTY_SPACE_STYLUS_POPUP_MENU;
       
  2438                         break;
       
  2439                     case TBrCtlDefs::EElementAnchor:
       
  2440                     case TBrCtlDefs::EElementTelAnchor:
       
  2441                     case TBrCtlDefs::EElementMailtoAnchor:
       
  2442                         resourceId = R_BROWSER_ANCHOR_STYLUS_POPUP_MENU;
       
  2443                         break;
       
  2444                     case TBrCtlDefs::EElementSmartLinkTel:
       
  2445                         resourceId = R_BROWSER_PHONE_NUMBER_STYLUS_POPUP_MENU;
       
  2446                         break;
       
  2447                     case TBrCtlDefs::EElementSmartLinkEmail:
       
  2448                         resourceId = R_BROWSER_EMAIL_ADDRESS_STYLUS_POPUP_MENU;
       
  2449                         break;
       
  2450                     case TBrCtlDefs::EElementImageBox:
       
  2451                         resourceId = R_BROWSER_IMAGE_STYLUS_POPUP_MENU;
       
  2452                         break;
       
  2453                     case TBrCtlDefs::EElementBrokenImage:
       
  2454                         if (ApiProvider().Preferences().AutoLoadContent() == EWmlSettingsAutoloadText)
       
  2455                             {
       
  2456                             if (ApiProvider().FlashPresent())
       
  2457                                 {
       
  2458                                 resourceId = R_BROWSER_IMAGE_PLACEHOLDER_STYLUS_POPUP_MENU_WITH_FLASH;
       
  2459                                 }
       
  2460                             else
       
  2461                                 {
       
  2462                                 resourceId = R_BROWSER_IMAGE_PLACEHOLDER_STYLUS_POPUP_MENU_NO_FLASH;
       
  2463                                 }
       
  2464                             }
       
  2465                         break;
       
  2466                     case TBrCtlDefs::EElementAreaBox:
       
  2467                         resourceId = R_BROWSER_IMAGEMAP_STYLUS_POPUP_MENU;
       
  2468                         break;
       
  2469                     default:
       
  2470                         break;
       
  2471                     }
       
  2472                 if (resourceId != 0)
       
  2473                     {
       
  2474                     TPoint point;
       
  2475                     // Get point X
       
  2476                     const TPtrC xPtr(aAttributeValues.At(1));
       
  2477                     lex.Assign(xPtr);
       
  2478                     lex.Val(point.iX);
       
  2479                     // Get point Y
       
  2480                     const TPtrC yPtr(aAttributeValues.At(2));
       
  2481                     lex.Assign(yPtr);
       
  2482                     lex.Val(point.iY);
       
  2483 
       
  2484                     delete iStylusPopupMenu;
       
  2485                     iStylusPopupMenu = NULL;
       
  2486                     iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this, point);
       
  2487                     TResourceReader rr;
       
  2488                     CCoeEnv::Static()->CreateResourceReaderLC(rr, resourceId);
       
  2489                     iStylusPopupMenu->ConstructFromResourceL( rr );
       
  2490                     CleanupStack::PopAndDestroy(); // resource reader
       
  2491                     iStylusPopupMenu->SetPosition( point);
       
  2492                     iStylusPopupMenu->ShowMenu();
       
  2493                     }
       
  2494                 }
       
  2495             break;
       
  2496             }
       
  2497 
       
  2498         case TBrCtlDefs::EClientCommandToolbarSettings:
       
  2499             {
       
  2500             // Launch Settings View
       
  2501             HandleCommandL(EWmlCmdPreferences);
       
  2502             break;
       
  2503             }
       
  2504 
       
  2505         case TBrCtlDefs::EClientCommandFullScreen:
       
  2506             {
       
  2507             HandleCommandL(EWmlCmdEnterFullScreenBrowsing);
       
  2508             break;
       
  2509             }
       
  2510 
       
  2511         default:
       
  2512             break;
       
  2513         }
       
  2514     }
       
  2515 
       
  2516 // -----------------------------------------------------------------------------
       
  2517 // CBrowserContentView::HandleSubscribeToL
       
  2518 // Handles a selection from the subscribe to sub-menu.
       
  2519 // -----------------------------------------------------------------------------
       
  2520 //
       
  2521 void CBrowserContentView::HandleSubscribeToL( TInt aCommand )
       
  2522     {
       
  2523 #ifndef __RSS_FEEDS
       
  2524     (void) aCommand;
       
  2525 #else  // __RSS_FEEDS
       
  2526     TInt index;
       
  2527 
       
  2528     // Get the corresponding feed info.
       
  2529     const RPointerArray<TBrCtlSubscribeTo>& items = ApiProvider().
       
  2530             BrCtlInterface().SubscribeToMenuItemsL();
       
  2531 
       
  2532     index = aCommand - TBrCtlDefs::ECommandIdSubscribeToBase;
       
  2533     if ((index >= 0) && (index < items.Count()))
       
  2534         {
       
  2535         const TPtrC16  name(items[index]->Title());
       
  2536         const TPtrC16  url(items[index]->Url());
       
  2537 
       
  2538         ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId );
       
  2539         ApiProvider().FeedsClientUtilities().SubscribeToL( name, url );
       
  2540         // switch back to FeedsView, so change layout
       
  2541         SetFullScreenOffL();
       
  2542         }
       
  2543 #endif  // __RSS_FEEDS
       
  2544     }
       
  2545 
       
  2546 // -----------------------------------------------------------------------------
       
  2547 // CBrowserContentView::HandleSubscribeToUrlL
       
  2548 // Handles subscribing to a feed from a ur
       
  2549 // -----------------------------------------------------------------------------
       
  2550 //
       
  2551 void CBrowserContentView::HandleSubscribeToWithUrlL( TPtrC aUrl )
       
  2552     {
       
  2553 #ifndef __RSS_FEEDS
       
  2554     (void) aUrl;
       
  2555 #else  // __RSS_FEEDS
       
  2556 
       
  2557     ApiProvider().SetLastActiveViewId( KUidBrowserFeedsFolderViewId );
       
  2558 
       
  2559     //Get the 'Title' info by comparing aUrl with the url's populated in array 'items'
       
  2560     const RPointerArray<TBrCtlSubscribeTo>& items = ApiProvider().BrCtlInterface().SubscribeToMenuItemsL();
       
  2561     TInt index = 0;
       
  2562     TInt itemCount = items.Count();
       
  2563 
       
  2564     while (itemCount != 0 && index < itemCount)
       
  2565         {
       
  2566         if (!(aUrl.Compare(items[index]->Url())))
       
  2567             {
       
  2568             break;
       
  2569             }
       
  2570         else
       
  2571             {
       
  2572             index++;
       
  2573             }
       
  2574         }
       
  2575 
       
  2576 
       
  2577     if (itemCount == 0 || index >= itemCount )
       
  2578         {
       
  2579         ApiProvider().FeedsClientUtilities().SubscribeToL( KNullDesC, aUrl );
       
  2580         }
       
  2581     else
       
  2582         {
       
  2583         const TPtrC16  name(items[index]->Title());
       
  2584         ApiProvider().FeedsClientUtilities().SubscribeToL(name , aUrl );
       
  2585         }
       
  2586 
       
  2587 #endif  // __RSS_FEEDS
       
  2588     }
       
  2589 
       
  2590 // ---------------------------------------------------------------------------
       
  2591 // CBrowserContentView::DynInitToolbarL
       
  2592 // ---------------------------------------------------------------------------
       
  2593 //
       
  2594 void CBrowserContentView::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* /*aToolbar*/ )
       
  2595     {
       
  2596     // If we have a touch device, check to see if the zoom slider is up,
       
  2597     // if displayed, close it, so the extended toolbar shows without the
       
  2598     // zoomslider displaying on top of it.
       
  2599     if ( PenEnabled() && ZoomSliderVisible() )
       
  2600         {
       
  2601         MakeZoomSliderVisibleL( EFalse );
       
  2602         }
       
  2603 
       
  2604     if ( iPenEnabled )
       
  2605         {
       
  2606         iBrowserContentViewToolbar->UpdateButtonsStateL() ;
       
  2607         }
       
  2608     }
       
  2609 
       
  2610 // ---------------------------------------------------------------------------
       
  2611 // CBrowserContentView::WindowEventHandlerL
       
  2612 // ---------------------------------------------------------------------------
       
  2613 //
       
  2614 void CBrowserContentView::WindowEventHandlerL( TWindowEvent /*aEvent*/, TInt aWindowId )
       
  2615     {
       
  2616     if ( aWindowId == ApiProvider().WindowMgr().CurrentWindow()->WindowId() )
       
  2617         {
       
  2618         if ( iPenEnabled )
       
  2619             {
       
  2620             iBrowserContentViewToolbar->UpdateButtonsStateL();
       
  2621             }
       
  2622         }
       
  2623     }
       
  2624 
       
  2625 // ---------------------------------------------------------------------------
       
  2626 // CBrowserContentView::IsHistoryViewUp
       
  2627 // ---------------------------------------------------------------------------
       
  2628 //
       
  2629 TBool CBrowserContentView::IsHistoryViewUp()
       
  2630     {
       
  2631     return iHistoryViewIsUp;
       
  2632     }
       
  2633 
       
  2634 // ---------------------------------------------------------------------------
       
  2635 // CBrowserContentView::IsHistoryAtBeginning
       
  2636 // ---------------------------------------------------------------------------
       
  2637 //
       
  2638 TBool CBrowserContentView::IsHistoryAtBeginning()
       
  2639     {
       
  2640     return iHistoryAtBeginning;
       
  2641     }
       
  2642 
       
  2643 // ---------------------------------------------------------------------------
       
  2644 // CBrowserContentView::IsHistoryAtEnd
       
  2645 // ---------------------------------------------------------------------------
       
  2646 //
       
  2647 TBool CBrowserContentView::IsHistoryAtEnd()
       
  2648     {
       
  2649     return iHistoryAtEnd;
       
  2650     }
       
  2651 
       
  2652 
       
  2653 // ---------------------------------------------------------------------------
       
  2654 // CBrowserContentView::FindKeywordL
       
  2655 // ---------------------------------------------------------------------------
       
  2656 //
       
  2657 void CBrowserContentView::FindKeywordL( HBufC* aFindString, TBool aFindDirection )
       
  2658     {
       
  2659     TInt findResponse = 0;
       
  2660 
       
  2661     if ( aFindString )
       
  2662         {
       
  2663         // Find string
       
  2664         delete iEnteredKeyword;
       
  2665         iEnteredKeyword = NULL;
       
  2666         iEnteredKeyword = aFindString;
       
  2667         findResponse = ApiProvider().BrCtlInterface().FindKeyword( iEnteredKeyword->Des() );
       
  2668         }
       
  2669     else
       
  2670         {
       
  2671         // Search next/previous
       
  2672         findResponse = ApiProvider().BrCtlInterface().FindKeywordAgain( aFindDirection );
       
  2673         }
       
  2674 
       
  2675     HBufC* toolTipText = NULL;
       
  2676 
       
  2677     switch ( findResponse )
       
  2678         {
       
  2679         case TBrCtlDefs::EFindNoMatches:
       
  2680             toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_NO_MATCHES );
       
  2681             break;
       
  2682         case TBrCtlDefs::EFindWrapAround:
       
  2683             toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_WRAPAROUND );
       
  2684             break;
       
  2685         case TBrCtlDefs::EFindAllMatches:
       
  2686             toolTipText = StringLoader::LoadLC( R_QTN_BROWSER_KEYWORD_FIND_ALL_CONTENT_SEARCHED );
       
  2687             break;
       
  2688         }
       
  2689 
       
  2690     // Show the result of the search.
       
  2691     if ( toolTipText )
       
  2692         {
       
  2693         ApiProvider().DialogsProvider().ShowTooltipL( *toolTipText );
       
  2694         CleanupStack::PopAndDestroy( toolTipText );
       
  2695         }
       
  2696 
       
  2697     }
       
  2698 
       
  2699 // ---------------------------------------------------------------------------
       
  2700 // CBrowserContentView::HandleClientRectChange
       
  2701 // ---------------------------------------------------------------------------
       
  2702 //
       
  2703 void CBrowserContentView::HandleClientRectChange()
       
  2704     {
       
  2705     if( iContainer )
       
  2706         {
       
  2707         iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
  2708         UpdateFullScreenL();
       
  2709         }
       
  2710     }
       
  2711 
       
  2712 // ---------------------------------------------------------------------------
       
  2713 // CBrowserContentView::SetZoomModeL
       
  2714 // ---------------------------------------------------------------------------
       
  2715 //
       
  2716 void CBrowserContentView::SetZoomModeL( TBool aZoomMode )
       
  2717     {
       
  2718     // if ( !ApiProvider().Fetching() )
       
  2719     if (ApiProvider().ContentDisplayed())
       
  2720         {
       
  2721         iZoomMode = aZoomMode;
       
  2722         TRAP_IGNORE( UpdateCbaL() );
       
  2723         if ( aZoomMode )
       
  2724             {
       
  2725             // Show the current zoom level in tooltip
       
  2726             SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL);
       
  2727             //MakeZoomSliderVisibleL( ETrue );
       
  2728             }
       
  2729         }
       
  2730     }
       
  2731 
       
  2732 // ---------------------------------------------------------------------------
       
  2733 // CBrowserContentView::MakeZoomSliderVisibleL
       
  2734 // Informs Browser Control if the Zoom Slider should be visible or not.
       
  2735 // ---------------------------------------------------------------------------
       
  2736 //
       
  2737 void CBrowserContentView::MakeZoomSliderVisibleL( TBool aVisible )
       
  2738     {
       
  2739     if ( aVisible && !iZoomSliderVisible )
       
  2740         {
       
  2741         // If the page is being fetched then don't show the zoom slider
       
  2742         if ( ApiProvider().ContentDisplayed())
       
  2743             {
       
  2744             ApiProvider().BrCtlInterface().HandleCommandL(
       
  2745                                     (TInt)TBrCtlDefs::ECommandZoomSliderShow +
       
  2746                                     (TInt)TBrCtlDefs::ECommandIdBase );
       
  2747             iZoomSliderVisible = ETrue;
       
  2748             }
       
  2749         }
       
  2750     // Set the zoom slider to invisible only if the toggle is false,
       
  2751     // and the zoom slider used to be visible
       
  2752     else if (!aVisible && iZoomSliderVisible )
       
  2753         {
       
  2754         ApiProvider().BrCtlInterface().HandleCommandL(
       
  2755                                     (TInt)TBrCtlDefs::ECommandZoomSliderHide +
       
  2756                                     (TInt)TBrCtlDefs::ECommandIdBase );
       
  2757         iZoomSliderVisible = EFalse;
       
  2758         }
       
  2759 
       
  2760         if ( iPenEnabled )
       
  2761             {
       
  2762             iBrowserContentViewToolbar->UpdateButtonsStateL();
       
  2763             }
       
  2764     }
       
  2765 
       
  2766 // ---------------------------------------------------------------------------
       
  2767 // CBrowserContentView::ZoomImagesInL
       
  2768 // ---------------------------------------------------------------------------
       
  2769 //
       
  2770 void CBrowserContentView::ZoomImagesInL( TInt aDuration )
       
  2771     {
       
  2772         if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
  2773         {
       
  2774             iZoomLevelArray = ApiProvider().BrCtlInterface().ZoomLevels();
       
  2775 
       
  2776             // Change zoom level
       
  2777             ZoomImagesL( 1, 0, iZoomLevelArray->Count()-2, aDuration );
       
  2778         }
       
  2779     }
       
  2780 
       
  2781 // ---------------------------------------------------------------------------
       
  2782 // CBrowserContentView::ZoomImagesOutL
       
  2783 // ---------------------------------------------------------------------------
       
  2784 //
       
  2785 void CBrowserContentView::ZoomImagesOutL( TInt aDuration )
       
  2786     {
       
  2787         if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
  2788         {
       
  2789         iZoomLevelArray = ApiProvider().BrCtlInterface().ZoomLevels();
       
  2790 
       
  2791         // Change zoom level
       
  2792         ZoomImagesL( -1, 1, iZoomLevelArray->Count()-1, aDuration );
       
  2793         }
       
  2794     }
       
  2795 
       
  2796 // ---------------------------------------------------------------------------
       
  2797 // CBrowserContentView::ZoomModeImagesL
       
  2798 // ---------------------------------------------------------------------------
       
  2799 //
       
  2800 void CBrowserContentView::ZoomModeImagesL()
       
  2801     {
       
  2802     if ( ApiProvider().ContentDisplayed() && !ApiProvider().WindowMgr().CurrentWindow()->WMLMode() )
       
  2803         {
       
  2804         // Retrieve the current zooming index value
       
  2805         iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL(
       
  2806                                 TBrCtlDefs::ESettingsCurrentZoomLevelIndex );
       
  2807         iSavedZoomLevel = iCurrentZoomLevel;
       
  2808 
       
  2809         // Toggle current zoom mode. Zoom Mode allows the user to change
       
  2810         // the zoom level using the navikey or HW zoom key
       
  2811         SetZoomModeL( ETrue );
       
  2812         }
       
  2813     }
       
  2814 
       
  2815 // ---------------------------------------------------------------------------
       
  2816 // CBrowserContentView::ZoomImagesL
       
  2817 // ---------------------------------------------------------------------------
       
  2818 //
       
  2819 void CBrowserContentView::ZoomImagesL( TInt aDirection, TUint aLow,
       
  2820                                        TUint aHigh, TInt aDuration )
       
  2821     {
       
  2822     // Retrieve the current zooming index value, it takes effect right away
       
  2823     iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL(
       
  2824                             TBrCtlDefs::ESettingsCurrentZoomLevelIndex );
       
  2825     TInt currentZoomIndex = FindCurrentZoomIndex(iCurrentZoomLevel);
       
  2826 
       
  2827     // Zoom can be increment, decrement or a direct change to a specific value.
       
  2828     if ( currentZoomIndex >= aLow && currentZoomIndex <= aHigh )
       
  2829         {
       
  2830         // Set current zoom level.
       
  2831         currentZoomIndex += aDirection;
       
  2832         iCurrentZoomLevel = (*iZoomLevelArray)[currentZoomIndex];
       
  2833 
       
  2834         // Set actual zoom level.
       
  2835         ApiProvider().BrCtlInterface().SetBrowserSettingL(
       
  2836             TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel );
       
  2837 
       
  2838         // Retrieve the current zooming index value, because each page has its
       
  2839         // minimum zoom level, if smaller than it, engine will ignore
       
  2840         // so we have to retrieve the correct zoom level
       
  2841         iCurrentZoomLevel = ApiProvider().BrCtlInterface().BrowserSettingL(
       
  2842                                 TBrCtlDefs::ESettingsCurrentZoomLevelIndex );
       
  2843         }
       
  2844 
       
  2845     // Display the zoom indicator
       
  2846     if ( currentZoomIndex <= 0 )
       
  2847         {
       
  2848         // Display minimum zoom indicator, it will dismiss after aDuration
       
  2849         SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL_MIN, aDuration );
       
  2850         }
       
  2851     else if ( currentZoomIndex >= iZoomLevelArray->Count()-1 )
       
  2852         {
       
  2853         TInt arrayCount =  iZoomLevelArray->Count()-1;
       
  2854         // Display maximum zoom indicator, it will dismiss after aDuration
       
  2855         SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL_MAX, aDuration );
       
  2856         }
       
  2857     else
       
  2858         {
       
  2859         // Display zoom percentage indicator, it will dismiss after aDuration
       
  2860         // We turned off displaying zoom indicator for each level
       
  2861         // SetZoomLevelTitleTextL( R_BROWSER_ZOOM_LEVEL, aDuration );
       
  2862         }
       
  2863     }
       
  2864 
       
  2865 // ---------------------------------------------------------------------------
       
  2866 // SaveCurrentZoomLevel
       
  2867 // ---------------------------------------------------------------------------
       
  2868 void CBrowserContentView::SaveCurrentZoomLevel(TBool saveZoom)
       
  2869 {
       
  2870     if (saveZoom)
       
  2871         {
       
  2872         //save the current zoom level by clicking softkey to confirm
       
  2873         ApiProvider().BrCtlInterface().SetBrowserSettingL(
       
  2874             TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel );
       
  2875         }
       
  2876     else
       
  2877         {
       
  2878         iCurrentZoomLevel = iSavedZoomLevel;
       
  2879         ApiProvider().BrCtlInterface().SetBrowserSettingL(
       
  2880             TBrCtlDefs::ESettingsCurrentZoomLevelIndex, iCurrentZoomLevel );
       
  2881         }
       
  2882 }
       
  2883 
       
  2884 // ---------------------------------------------------------------------------
       
  2885 // FindCurrentZoomIndex
       
  2886 // ---------------------------------------------------------------------------
       
  2887 TInt CBrowserContentView::FindCurrentZoomIndex(TInt aCurrentZoomLevel)
       
  2888 {
       
  2889     TInt aIndex = -1;
       
  2890 
       
  2891     for (aIndex=0; aIndex<iZoomLevelArray->Count()-1; aIndex++)
       
  2892     {
       
  2893         TInt tmpZoomLevel = (*iZoomLevelArray)[aIndex];
       
  2894         if (aCurrentZoomLevel ==(*iZoomLevelArray)[aIndex] )
       
  2895         {
       
  2896             break;
       
  2897         }
       
  2898     }
       
  2899     return aIndex;
       
  2900 }
       
  2901 
       
  2902 // ---------------------------------------------------------------------------
       
  2903 // CBrowserContentView::SetZoomLevelTitleTextL
       
  2904 // ---------------------------------------------------------------------------
       
  2905 //
       
  2906 void CBrowserContentView::SetZoomLevelTitleTextL( TInt aResourceId, TInt aDuration )
       
  2907     {
       
  2908     HBufC* zoomLevelFormat = NULL;
       
  2909 
       
  2910     if ( aResourceId == R_BROWSER_ZOOM_LEVEL_MIN ||
       
  2911          aResourceId == R_BROWSER_ZOOM_LEVEL_MAX )
       
  2912         {
       
  2913         // Display the zoom max or min string
       
  2914         zoomLevelFormat = StringLoader::LoadLC( aResourceId );
       
  2915 
       
  2916         // Show zoom indicator for aDuration seconds
       
  2917         ApiProvider().WindowMgr().CurrentWindow()->ChangeTitlePaneTextUntilL( zoomLevelFormat->Des(), aDuration );
       
  2918 
       
  2919         CleanupStack::PopAndDestroy( ); // zoomLevelFormat
       
  2920         }
       
  2921     }
       
  2922 
       
  2923 // ---------------------------------------------------------------------------
       
  2924 // CBrowserContentView::GetTextZoomLevelsL
       
  2925 // ---------------------------------------------------------------------------
       
  2926 //
       
  2927 void CBrowserContentView::GetTextZoomLevelsL( )
       
  2928     {
       
  2929     // Creating the text level
       
  2930     // Levels must be equal to TFontSize, with step percent 25% or 50%
       
  2931     // depending on chinese build.
       
  2932     // This is a temporary solution until make sure if engine
       
  2933     // provides text zoom levels. So it is currently hardcoded.
       
  2934     //------
       
  2935     // China build has only three font sizes:
       
  2936     // 0, 2, 4 (all small, normal, all large)
       
  2937     TInt fontSize = 0;
       
  2938     if ( !AVKONAPAC )
       
  2939         {
       
  2940         // font sizes 0,1,2,3,4
       
  2941         for ( TInt level = 50; level <= 150; level = level + 25 )
       
  2942             {
       
  2943             iTextZoomLevelArray->AppendL( level );
       
  2944             iFontSizeArray->AppendL( fontSize );
       
  2945             fontSize++;
       
  2946             }
       
  2947         }
       
  2948     else
       
  2949         {
       
  2950         // font sizes 0,2,4
       
  2951         for ( TInt level = 50; level <= 150; level = level + 50 )
       
  2952             {
       
  2953             iTextZoomLevelArray->AppendL( level );
       
  2954             iFontSizeArray->AppendL( fontSize );
       
  2955             fontSize = fontSize + 2;
       
  2956             }
       
  2957         }
       
  2958 
       
  2959     // Get initial text zoom level index, bt comparing
       
  2960     // the preferences value, with the one in iFontSizeArray,
       
  2961     // and get the index (i)
       
  2962     TBool found = EFalse;
       
  2963     for ( TInt i = 0; i < iFontSizeArray->Count(); i++ )
       
  2964         {
       
  2965         if ( ApiProvider().Preferences().FontSize() == (*iFontSizeArray)[i] )
       
  2966             {
       
  2967             iCurrentTextZoomLevelIndex = i;
       
  2968             found = ETrue;
       
  2969             }
       
  2970         }
       
  2971     // If the initial font size value is not found, then the cenrep
       
  2972     // default is not right, by default initial cenrep font size value
       
  2973     // should be 0,2,4. So general, and chinese values are the same.
       
  2974     // Because if for example default cenrep value of font size is 1,
       
  2975     // then that is not supported in chinese build.
       
  2976     // General font size values are: 0,1,2,3,4
       
  2977     // Chinese font size values are: 0,2,4
       
  2978     if ( !found )
       
  2979         {
       
  2980         User::Leave( KErrGeneral );
       
  2981         }
       
  2982     }
       
  2983 
       
  2984 // ---------------------------------------------------------------------------
       
  2985 // CBrowserContentView::KeymapIsUp
       
  2986 // ---------------------------------------------------------------------------
       
  2987 //
       
  2988 TBool CBrowserContentView::KeymapIsUp()
       
  2989     {
       
  2990     return (iShortcutKeyMap != NULL);
       
  2991     }
       
  2992 
       
  2993 // ---------------------------------------------------------------------------
       
  2994 // CBrowserContentView::isZoomMode
       
  2995 // ---------------------------------------------------------------------------
       
  2996 //
       
  2997 TBool CBrowserContentView::isZoomMode()
       
  2998     {
       
  2999     // Zoom Mode currently disabled
       
  3000     // return iZoomMode;
       
  3001     return EFalse;
       
  3002     }
       
  3003 
       
  3004 // ---------------------------------------------------------------------------
       
  3005 // CBrowserContentView::ShowKeymap
       
  3006 // ---------------------------------------------------------------------------
       
  3007 //
       
  3008 void CBrowserContentView::ShowKeymap()
       
  3009     {
       
  3010     iShortcutKeyMap = CBrowserShortcutKeyMap::NewL(iContainer, iApiProvider);
       
  3011     UpdateCbaL();
       
  3012     }
       
  3013 
       
  3014 // ---------------------------------------------------------------------------
       
  3015 // CBrowserContentView::HideKeymap
       
  3016 // ---------------------------------------------------------------------------
       
  3017 //
       
  3018 void CBrowserContentView::HideKeymap()
       
  3019     {
       
  3020     delete(iShortcutKeyMap);
       
  3021     iShortcutKeyMap = NULL;
       
  3022     UpdateCbaL();
       
  3023     }
       
  3024 
       
  3025 // ---------------------------------------------------------------------------
       
  3026 // CBrowserContentView::RedrawKeymap
       
  3027 // ---------------------------------------------------------------------------
       
  3028 //
       
  3029 void CBrowserContentView::RedrawKeymap()
       
  3030     {
       
  3031     HideKeymap();
       
  3032     ShowKeymap();
       
  3033     }
       
  3034 
       
  3035 // -----------------------------------------------------------------------------
       
  3036 // CBrowserContentView::EnableFullScreenModeL
       
  3037 // -----------------------------------------------------------------------------
       
  3038 //
       
  3039 void CBrowserContentView::EnableFullScreenModeL( TBool aEnableFullScreen )
       
  3040     {
       
  3041     TInt command( KErrNotFound );
       
  3042     if ( aEnableFullScreen )
       
  3043         {
       
  3044         if (iPenEnabled)
       
  3045             {
       
  3046             Toolbar()->SetToolbarVisibility( EFalse, EFalse );
       
  3047             Toolbar()->MakeVisible( EFalse );
       
  3048             }
       
  3049         iContentFullScreenMode = ETrue;
       
  3050         UpdateFullScreenL();
       
  3051         command = TBrCtlDefs::ECommandEnterFullscreenBrowsing;
       
  3052         }
       
  3053     else
       
  3054         {
       
  3055         if (iPenEnabled)
       
  3056             {
       
  3057             Toolbar()->SetToolbarVisibility( ETrue, EFalse );
       
  3058             }
       
  3059         iContentFullScreenMode = EFalse;
       
  3060         SetFullScreenOffL();
       
  3061         command = TBrCtlDefs::ECommandLeaveFullscreenBrowsing;
       
  3062         if (iPenEnabled)
       
  3063         	{
       
  3064         	StartAutoFullScreenIdleTimer();
       
  3065         	}
       
  3066         }
       
  3067     ApiProvider().BrCtlInterface().HandleCommandL(
       
  3068         command + (TInt)TBrCtlDefs::ECommandIdBase );
       
  3069     }
       
  3070 
       
  3071 // -----------------------------------------------------------------------------
       
  3072 // CBrowserContentView::HandlePluginFullScreen
       
  3073 // -----------------------------------------------------------------------------
       
  3074 //
       
  3075 void CBrowserContentView::HandlePluginFullScreen(TBool aFullScreen)
       
  3076 {
       
  3077   iIsPluginFullScreenMode = aFullScreen;
       
  3078   if (aFullScreen) {
       
  3079     iOrientation = AppUi()->Orientation();
       
  3080     TRAP_IGNORE( AppUi()->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape));
       
  3081     if (iPenEnabled) {
       
  3082       Toolbar()->SetToolbarVisibility( EFalse, EFalse );
       
  3083     }
       
  3084     iContentFullScreenMode = ETrue;
       
  3085     UpdateFullScreenL();
       
  3086   }
       
  3087   else {
       
  3088     TRAP_IGNORE(AppUi()->SetOrientationL(iOrientation));
       
  3089     if (iPenEnabled) {
       
  3090       Toolbar()->SetToolbarVisibility( ETrue, EFalse );
       
  3091     }
       
  3092     iContentFullScreenMode = EFalse;
       
  3093     SetFullScreenOffL();
       
  3094   }
       
  3095 
       
  3096 }
       
  3097 
       
  3098 // -----------------------------------------------------------------------------
       
  3099 // CBrowserContentView::ShowFsStatusPane
       
  3100 // -----------------------------------------------------------------------------
       
  3101 //
       
  3102 void CBrowserContentView::ShowFsStatusPane(TBool aShow)
       
  3103     {
       
  3104 
       
  3105     if (aShow)
       
  3106         {
       
  3107 #ifdef RD_SCALABLE_UI_V2
       
  3108         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  3109            StatusPane()->SwitchLayoutL(R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS);
       
  3110 #endif
       
  3111         StatusPane()->MakeVisible( ETrue );
       
  3112         iContainer->SetRect(ClientRect());
       
  3113         }
       
  3114     else
       
  3115         {
       
  3116         // Kick off timer for 3 seconds before hiding status pane again
       
  3117         if ( iPeriodic )
       
  3118             {
       
  3119                 iPeriodic->Cancel();
       
  3120             }
       
  3121         iPeriodic->Start(KFullScreenStatusPaneTimeout, 0,TCallBack(CallHideFsStatusPane,this));
       
  3122         }
       
  3123     }
       
  3124 
       
  3125 // -----------------------------------------------------------------------------
       
  3126 // CBrowserContentView::CallHideFsStatusPane
       
  3127 // -----------------------------------------------------------------------------
       
  3128 TInt CBrowserContentView::CallHideFsStatusPane(TAny* aCBrowserContentView)
       
  3129     {
       
  3130     __ASSERT_DEBUG(aCBrowserContentView, Util::Panic( Util::EUninitializedData ));
       
  3131     TRAP_IGNORE(
       
  3132                 ((CBrowserContentView*)aCBrowserContentView)->HideFsStatusPane();
       
  3133                 );
       
  3134     return KErrNone;
       
  3135     }
       
  3136 
       
  3137 // -----------------------------------------------------------------------------
       
  3138 // CBrowserContentView::HideFsStatusPane
       
  3139 // -----------------------------------------------------------------------------
       
  3140 void CBrowserContentView::HideFsStatusPane()
       
  3141     {
       
  3142     iPeriodic->Cancel();
       
  3143     if (iContentFullScreenMode && ApiProvider().LastActiveViewId() == KUidBrowserContentViewId )
       
  3144         {
       
  3145         StatusPane()->MakeVisible( EFalse );
       
  3146         iContainer->SetRect(ClientRect());
       
  3147         }
       
  3148     }
       
  3149 // -----------------------------------------------------------------------------
       
  3150 // CBrowserContentView::StartAutoFullScreenTimer
       
  3151 // -----------------------------------------------------------------------------
       
  3152 //
       
  3153 void CBrowserContentView::StartAutoFullScreenTimer()
       
  3154 	{
       
  3155     SuspendAutoFullScreenIdleTimer();
       
  3156     if ( iAutoFSPeriodic )
       
  3157         {
       
  3158             iAutoFSPeriodic->Cancel();
       
  3159         }
       
  3160     iAutoFSPeriodic->Start(KAutoFullScreenTimeout, 0,TCallBack(CallActivateAutoFullScreen,this));
       
  3161 
       
  3162 	}
       
  3163 
       
  3164 // -----------------------------------------------------------------------------
       
  3165 // CBrowserContentView::StartAutoFullScreenIdleTimer
       
  3166 // -----------------------------------------------------------------------------
       
  3167 //
       
  3168 void CBrowserContentView::StartAutoFullScreenIdleTimer()
       
  3169 	{
       
  3170     if ( iIdlePeriodic )
       
  3171         {
       
  3172             iIdlePeriodic->Cancel();
       
  3173         }
       
  3174     iIdlePeriodic->Start(KAutoFullScreenIdleTimeout, 0,TCallBack(CallActivateAutoFullScreen,this));
       
  3175 
       
  3176 	}
       
  3177 
       
  3178 // -----------------------------------------------------------------------------
       
  3179 // CBrowserContentView::SuspendAutoFullScreenTimer
       
  3180 // -----------------------------------------------------------------------------
       
  3181 //
       
  3182 void CBrowserContentView::SuspendAutoFullScreenTimer()
       
  3183 	{
       
  3184     if ( iAutoFSPeriodic )
       
  3185         {
       
  3186             iAutoFSPeriodic->Cancel();
       
  3187         }
       
  3188 	}
       
  3189 
       
  3190 // -----------------------------------------------------------------------------
       
  3191 // CBrowserContentView::SuspendAutoFullScreenIdleTimer
       
  3192 // -----------------------------------------------------------------------------
       
  3193 //
       
  3194 void CBrowserContentView::SuspendAutoFullScreenIdleTimer()
       
  3195 	{
       
  3196     if ( iIdlePeriodic )
       
  3197         {
       
  3198             iIdlePeriodic->Cancel();
       
  3199         }
       
  3200 	}
       
  3201 
       
  3202 
       
  3203 // -----------------------------------------------------------------------------
       
  3204 // CBrowserContentView::CallSwitchToAutoFullScreen
       
  3205 // -----------------------------------------------------------------------------
       
  3206 //
       
  3207 TInt CBrowserContentView::CallActivateAutoFullScreen(TAny* aCBrowserContentView)
       
  3208     {
       
  3209     __ASSERT_DEBUG(aCBrowserContentView, Util::Panic( Util::EUninitializedData ));
       
  3210     TRAP_IGNORE(
       
  3211                 ((CBrowserContentView*)aCBrowserContentView)->ActivateAutoFullScreenMode();
       
  3212                 );
       
  3213     return KErrNone;
       
  3214     }
       
  3215 
       
  3216 // -----------------------------------------------------------------------------
       
  3217 // CBrowserContentView::ActivateAutoFullScreen
       
  3218 // -----------------------------------------------------------------------------
       
  3219 void CBrowserContentView::ActivateAutoFullScreenMode()
       
  3220     {
       
  3221     if ( iAutoFSPeriodic )
       
  3222         {
       
  3223             iAutoFSPeriodic->Cancel();
       
  3224         }
       
  3225     if ( iIdlePeriodic )
       
  3226         {
       
  3227             iIdlePeriodic->Cancel();
       
  3228         }
       
  3229 
       
  3230     if (  ApiProvider().LastActiveViewId() == KUidBrowserContentViewId )
       
  3231     	{
       
  3232     	if( IsForeground()
       
  3233     		&& ApiProvider().LoadObserver().ContentDisplayed()
       
  3234     		&& !iZoomSliderVisible
       
  3235     		&& !iHistoryViewIsUp
       
  3236     		&& !iContainer->GotoPane()->IsVisible()
       
  3237 			&& !iContainer->FindKeywordPane()->IsVisible()
       
  3238 #ifdef RD_SCALABLE_UI_V2
       
  3239 			&& !Toolbar()->ToolbarExtension()->IsShown()
       
  3240 #endif
       
  3241 		 	&& !iThumbnailViewIsUp
       
  3242 		 	&& !iOptionsMenuActive
       
  3243 		 	&& !ApiProvider().IsDisplayingMenuOrDialog()
       
  3244 			&& !ApiProvider().WindowMgr().CurrentWindow()->WMLMode()
       
  3245 			&& !IsEditMode()
       
  3246 			&& !iIsPluginFullScreenMode)
       
  3247     		{
       
  3248 			EnableFullScreenModeL( ETrue);
       
  3249 			}
       
  3250 		else
       
  3251 			{
       
  3252 			if (iIsPluginFullScreenMode || !IsForeground())
       
  3253 				{
       
  3254 				//Hide the FullscreenExit Button
       
  3255 					ApiProvider().BrCtlInterface().HandleCommandL(
       
  3256 						TBrCtlDefs::ECommandLeaveFullscreenBrowsing
       
  3257 						+ (TInt)TBrCtlDefs::ECommandIdBase );
       
  3258 				}
       
  3259 			StartAutoFullScreenTimer();
       
  3260 			}
       
  3261     	}
       
  3262     }
       
  3263 
       
  3264 // -----------------------------------------------------------------------------
       
  3265 // CBrowserContentView::SetEmphasis
       
  3266 // -----------------------------------------------------------------------------
       
  3267 
       
  3268 void CBrowserContentView::SetEmphasis(CCoeControl* aMenuControl, TBool aEmphasis)
       
  3269 	{
       
  3270 	if (iPenEnabled)
       
  3271 		{
       
  3272 		if(aEmphasis)
       
  3273 			{
       
  3274 			iOptionsMenuActive = ETrue;
       
  3275 			SuspendAutoFullScreenTimer();
       
  3276 			}
       
  3277 		else
       
  3278 			{
       
  3279 			iOptionsMenuActive = EFalse;
       
  3280 			StartAutoFullScreenTimer();
       
  3281 			}
       
  3282 		}
       
  3283 	CAknView::SetEmphasis(aMenuControl, aEmphasis);
       
  3284 	}
       
  3285 
       
  3286 // -----------------------------------------------------------------------------
       
  3287 // CBrowserContentView::IsEditMode
       
  3288 // -----------------------------------------------------------------------------
       
  3289 TBool CBrowserContentView::IsEditMode()
       
  3290 	{
       
  3291 	TBrCtlDefs::TBrCtlElementType focusedElementType =
       
  3292                 ApiProvider().BrCtlInterface().FocusedElementType();
       
  3293 
       
  3294 	return  (focusedElementType == TBrCtlDefs:: EElementActivatedInputBox);
       
  3295 	}
       
  3296 
       
  3297 // End of File