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