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