browserui/browser/BrowserAppSrc/BrowserContentViewContainer.cpp
changeset 0 84ad3b177aa3
child 1 57d5b8e231c4
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     1 /*
       
     2 * Copyright (c) 2002 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 *
       
    16 *
       
    17 */
       
    18 
       
    19 #include "BrowserContentViewContainer.h"
       
    20 #include "BrowserAppUi.h"
       
    21 #include "BrowserAppViewBase.h"
       
    22 #include "BrowserGotoPane.h"
       
    23 #include "CommonConstants.h"
       
    24 #include "BrowserContentView.h"
       
    25 #include "Display.h"
       
    26 #include "Preferences.h"
       
    27 #include "BrowserUtil.h"
       
    28 
       
    29 #include "BrowserPreferences.h"
       
    30 #include "BrowserWindow.h"
       
    31 #include "BrowserWindowManager.h"
       
    32 #include <FeatMgr.h>
       
    33 
       
    34 #include <eikrted.h>
       
    35 #include <eikbctrl.h>
       
    36 #include <Eikmenub.h>
       
    37 
       
    38 #include <aknutils.h>
       
    39 
       
    40 #include "BrowserUIVariant.hrh"
       
    41 
       
    42 #ifdef __SERIES60_HELP
       
    43 // Context-Sensitve Help File
       
    44 #include "BrowserApplication.h"
       
    45 #include <csxhelp/ope.hlp.hrh>
       
    46 #include <csxhelp/browser.hlp.hrh>
       
    47 #endif // __SERIES60_HELP
       
    48 
       
    49 #include "eikon.hrh"
       
    50 
       
    51 
       
    52 //Constant
       
    53 // The interval zoom tooltip is visible, it will disappear after KZoomLevelShowTime seconds
       
    54 const TInt KZoomLevelShowTime( 2 * 1000 ); // 2 seconds
       
    55 
       
    56 //---------------------------------------------------------------------------
       
    57 // CBrowserContentViewContainer::NewL()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CBrowserContentViewContainer*
       
    61 CBrowserContentViewContainer::NewL(CBrowserContentView* aView,
       
    62                                    MApiProvider& aApiProvider )
       
    63     {
       
    64     CBrowserContentViewContainer* container =
       
    65         new (ELeave) CBrowserContentViewContainer( aView, aApiProvider );
       
    66     CleanupStack::PushL( container );
       
    67     container->ConstructL();
       
    68     CleanupStack::Pop(); // container
       
    69 
       
    70     return container;
       
    71     }
       
    72 
       
    73 //---------------------------------------------------------------------------
       
    74 // CBrowserContentViewContainer::CBrowserContentViewContainer()
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CBrowserContentViewContainer::
       
    78 CBrowserContentViewContainer(CBrowserContentView* aView,
       
    79                              MApiProvider& aApiProvider ) :
       
    80     iView( aView ),
       
    81     iApiProvider( aApiProvider )
       
    82     {
       
    83     }
       
    84 
       
    85 //---------------------------------------------------------------------------
       
    86 // CBrowserContentViewContainer::~CBrowserContentViewContainer()
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 CBrowserContentViewContainer::~CBrowserContentViewContainer()
       
    90     {
       
    91     delete iGotoPane;
       
    92     delete iFindKeywordPane;
       
    93     iView = NULL; // Not owned
       
    94 
       
    95     iShortCutFuncMap.Close();
       
    96     }
       
    97 
       
    98 //---------------------------------------------------------------------------
       
    99 // CBrowserContentViewContainer::ConstructL()
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CBrowserContentViewContainer::ConstructL()
       
   103     {
       
   104     CreateWindowL();
       
   105     SetAllowStrayPointers();
       
   106     SetMopParent( iView );
       
   107 
       
   108     iGotoPane = CBrowserGotoPane::NewL( this,
       
   109                                         EMbmAvkonQgn_indi_find_goto,
       
   110                                         EMbmAvkonQgn_indi_find_goto_mask,
       
   111                                         GOTOPANE_POPUPLIST_ENABLE,
       
   112                                         iView );
       
   113 
       
   114     // Create the find pane with magnifier glass icon, and
       
   115     // without adaptive popup list...
       
   116     iFindKeywordPane = CBrowserGotoPane::NewL( this,
       
   117                                                EMbmAvkonQgn_indi_find_glass,
       
   118                                                EMbmAvkonQgn_indi_find_glass_mask,
       
   119                                                GOTOPANE_POPUPLIST_DISABLE,
       
   120                                                iView,
       
   121                                                ETrue );
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CBrowserContentViewContainer::HandlePointerEventL
       
   126 // Handles pointer events
       
   127 // -----------------------------------------------------------------------------
       
   128 void CBrowserContentViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   129     {
       
   130      switch ( aPointerEvent.iType )
       
   131         {
       
   132         case TPointerEvent::EButton1Down:
       
   133             {
       
   134             // Do nothing
       
   135             break;
       
   136             }
       
   137         case TPointerEvent::EDrag:
       
   138             {
       
   139             // Do nothing
       
   140             break;
       
   141             }
       
   142         case TPointerEvent::EButton1Up:
       
   143             {
       
   144             // Close the zoom silder when the user selects anywhere in the
       
   145             // BrowserContainerView
       
   146             if ( iView->ZoomSliderVisible() )
       
   147                 {
       
   148                 iView->MakeZoomSliderVisibleL( EFalse );
       
   149                 }
       
   150             break;
       
   151             }
       
   152         default:
       
   153             {
       
   154             break;
       
   155             }
       
   156         }   // end of switch
       
   157 
       
   158     // Must pass the pointer event to the CoeControl
       
   159     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   160     }
       
   161 
       
   162 //---------------------------------------------------------------------------
       
   163 // CBrowserContentViewContainer::OfferKeyEventL()
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 TKeyResponse CBrowserContentViewContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   167     {
       
   168     CBrowserAppUi* ui = CBrowserAppUi::Static();
       
   169     TKeyResponse result( EKeyWasNotConsumed );
       
   170 
       
   171     if (ui->OfferApplicationSpecificKeyEventL(aKeyEvent, aType) == EKeyWasConsumed)
       
   172         {
       
   173         return EKeyWasConsumed;
       
   174         }
       
   175 
       
   176     // For Short Cut
       
   177     if (!iShortCutFuncsReady)
       
   178     {
       
   179         CreateShortCutFuncsHashTable();
       
   180         iShortCutFuncsReady = ETrue;
       
   181     }
       
   182 
       
   183     // Turn off some controls, if we receive events
       
   184     if ( aType == EEventKey )
       
   185         {
       
   186         // Turn off the keymap if on
       
   187         if ( iView->KeymapIsUp() )
       
   188             {
       
   189             iView->HandleCommandL( EWmlCmdHideShortcutKeymap );
       
   190             }
       
   191 
       
   192         // Turn off the zoom slider if on
       
   193         if ( iView->ZoomSliderVisible() )
       
   194             {
       
   195             iView->MakeZoomSliderVisibleL( EFalse );
       
   196             }
       
   197         }
       
   198 
       
   199     // If goto pane is visible, offer key events to it
       
   200     if ( iGotoPane->IsVisible() )
       
   201         {
       
   202         return iGotoPane->OfferKeyEventL( aKeyEvent, aType );
       
   203         }
       
   204 
       
   205     TKeyEvent keyEvent( aKeyEvent );
       
   206 
       
   207     // Don't allow virtual keyboard backspace key event to close the window
       
   208     if ( !AknLayoutUtils::PenEnabled() && aType == EEventKey
       
   209         && keyEvent.iCode == EKeyBackspace )
       
   210         {
       
   211         if ( iApiProvider.Preferences().UiLocalFeatureSupported(
       
   212                                                     KBrowserMultipleWindows ) )
       
   213             {
       
   214             TInt winCount = iApiProvider.WindowMgr().WindowCount();
       
   215             if ( ( winCount > 1 ) && ( !iView->IsMiniatureViewUp() ) )
       
   216                 {
       
   217                 ui->CloseWindowL();
       
   218                 result = EKeyWasConsumed;
       
   219                 }
       
   220             }
       
   221         }
       
   222 
       
   223     // Handle zooming events
       
   224     // 1. RemConInterface will translate dedicated HW key press to OfferKeyEventL().
       
   225     // See eikon.hrh for mapping.
       
   226     // 2. When the browser is in Zoom Mode (slider or tooltip displayed), the
       
   227     // navi-keys will zoom.
       
   228     if ( aType == EEventKey )
       
   229         {
       
   230         // Handle dedicated HW key zoom-in: if not in zoom mode, HW zoom key takes
       
   231         // zooming immediately without going to zoom mode
       
   232         // if it's already in zoom mode, then HW zoom key acts the same as up
       
   233         // and down navigation key mode
       
   234         // Zoom mode can display tooltip (current) or slider (future)
       
   235         if ( iView->isZoomMode() )
       
   236             {
       
   237             }
       
   238         else if (!iView->IsHistoryViewUp() && !iView->IsMiniatureViewUp())
       
   239             {
       
   240             // Not in zoom mode, or history view, or page overview, and HW zoom key
       
   241             // pressed -  zoom immediately without entering zoom mode.
       
   242             if ( keyEvent.iCode == EKeyZoomIn )
       
   243                 {
       
   244                 iApiProvider.BrCtlInterface().HandleCommandL(
       
   245                         (TInt)TBrCtlDefs::ECommandZoomIn +
       
   246                         (TInt)TBrCtlDefs::ECommandIdBase );
       
   247                 iView->ZoomImagesInL(KZoomLevelShowTime);
       
   248                 result = EKeyWasConsumed;
       
   249                 }
       
   250             // Handle dedicated HW key zoom-out
       
   251             else if ( keyEvent.iCode == EKeyZoomOut )
       
   252                 {
       
   253                 iApiProvider.BrCtlInterface().HandleCommandL(
       
   254                         (TInt)TBrCtlDefs::ECommandZoomOut +
       
   255                         (TInt)TBrCtlDefs::ECommandIdBase );
       
   256                 iView->ZoomImagesOutL(KZoomLevelShowTime);
       
   257                 result = EKeyWasConsumed;
       
   258                 }
       
   259             }
       
   260 
       
   261         }   // End of handling key events for zooming
       
   262 
       
   263     // convert Enter key to KeyOk, this is only for emulator
       
   264     if ( aType == EEventKey &&  keyEvent.iCode == EKeyEnter )
       
   265         {
       
   266         keyEvent.iCode = EKeyOK;
       
   267         }
       
   268 
       
   269     // Web Engine opens the highlighted link into a new window. (long press)
       
   270     // Currently the option is disabled and the link is opened in the same window
       
   271     // The commented part below enables the "Open link in new window" option on long press.
       
   272     // UI change request AHUN-6U3NT4, S60 bug AHUN-6UYT6N
       
   273 
       
   274     if ( aType == EEventKey && keyEvent.iCode == EKeyOK )
       
   275         {
       
   276         if ( keyEvent.iRepeats && iSelectionKeyPressed )
       
   277             {
       
   278             TBrCtlDefs::TBrCtlElementType elementtype =
       
   279                 iApiProvider.BrCtlInterface().FocusedElementType();
       
   280             TInt command( KErrNotFound );
       
   281             switch( elementtype )
       
   282                 {
       
   283                 case TBrCtlDefs::EElementAnchor:
       
   284                     {
       
   285     //                command = TBrCtlDefs::ECommandOpenNewWindow;
       
   286                       command = TBrCtlDefs::ECommandOpen;
       
   287                     break;
       
   288                     }
       
   289                 default: break;
       
   290                 }
       
   291     //        if ( command == TBrCtlDefs::ECommandOpenNewWindow &&
       
   292     //          iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) &&
       
   293     //          !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows ))
       
   294               if ( command == TBrCtlDefs::ECommandOpen)
       
   295                 {
       
   296                 iSelectionKeyPressed = EFalse;
       
   297                 keyEvent.iCode = EKeyNull;
       
   298                 result = EKeyWasConsumed;
       
   299                 iApiProvider.BrCtlInterface().HandleCommandL(
       
   300                     command + TBrCtlDefs::ECommandIdBase );
       
   301                 }
       
   302             }
       
   303         }
       
   304 
       
   305     // stop the event handling when find item was actived
       
   306     if ( (keyEvent.iScanCode == EStdKeyDevice3 || keyEvent.iScanCode == EStdKeyXXX)
       
   307         && aType == EEventKeyDown && !iView->FindItemIsInProgress() )
       
   308         {
       
   309         iSelectionKeyPressed = ETrue;
       
   310         keyEvent.iCode = EKeyNull;
       
   311         }
       
   312 
       
   313     // Ignore key event in zoom mode
       
   314     if ( result == EKeyWasNotConsumed && !iView->isZoomMode())
       
   315         {
       
   316         TRAP_IGNORE(result = iApiProvider.BrCtlInterface().OfferKeyEventL(keyEvent, aType));
       
   317         }
       
   318 
       
   319     /**
       
   320     * When checking long or short key presses, iScanCode must be used, because
       
   321     * when EEventKeyUp/EEventKeyUp are handled, the iCode is not available.
       
   322     * iIsKeyLongPressed must be checked in short key presses because, when the
       
   323     * button is released short key code will be called again. And that time it
       
   324     * must be ignored.
       
   325     */
       
   326 
       
   327     /**
       
   328     // This key is inactive, only for testing short / long key presses.
       
   329     if ( keyEvent.iScanCode == 48 && keyEvent.iRepeats && !iIsKeyLongPressed)
       
   330         {
       
   331         iEikonEnv->InfoMsg(_L("0 Long"));
       
   332         iIsKeyLongPressed = ETrue;
       
   333         keyEvent.iCode = EKeyNull;
       
   334         result = EKeyWasConsumed;
       
   335         }
       
   336     if ( aType == EEventKeyUp && keyEvent.iScanCode == 48 && !keyEvent.iRepeats)
       
   337         {
       
   338         if ( !iIsKeyLongPressed )
       
   339             {
       
   340             iEikonEnv->InfoMsg(_L("0 Short"));
       
   341             keyEvent.iCode = EKeyNull;
       
   342             result = EKeyWasConsumed;
       
   343             }
       
   344         iIsKeyLongPressed = EFalse;
       
   345         }
       
   346     **/
       
   347 
       
   348     /*
       
   349     * Not processing short keys, if the History view, or the
       
   350     * Miniature View ( old name: Thumbnail View ) is up,
       
   351     * except short key: '8'.
       
   352     */
       
   353     if (!iApiProvider.Preferences().AccessKeys())
       
   354     {
       
   355         // Key short press, activate function based on keyEvent.iCode
       
   356         if ( aType == EEventKey && result == EKeyWasNotConsumed )
       
   357             {
       
   358             if (!AknLayoutUtils::PenEnabled())
       
   359                 {
       
   360                 if (iView->isZoomMode())
       
   361                     {
       
   362                     result = EKeyWasConsumed;
       
   363                     }
       
   364                 else
       
   365                     {
       
   366                     if (iApiProvider.Preferences().ShortcutKeysForQwerty())
       
   367                         {
       
   368                         result = InvokeFunction ( keyEvent.iCode );
       
   369                         }
       
   370                     else
       
   371                         {
       
   372                         if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() )
       
   373                             {
       
   374                             TInt function = -1;
       
   375                             switch(keyEvent.iCode)
       
   376                                 {
       
   377                                 case '0':
       
   378                                     {
       
   379                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey0Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   380                                     break;
       
   381                                     }
       
   382                                 case '1':
       
   383                                     {
       
   384                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey1Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   385                                     break;
       
   386                                     }
       
   387                                 case '2':
       
   388                                     {
       
   389                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey2Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   390                                     break;
       
   391                                     }
       
   392                                 case '3':
       
   393                                     {
       
   394                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey3Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   395                                     break;
       
   396                                     }
       
   397                                 case '4':
       
   398                                     {
       
   399                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey4Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   400                                     break;
       
   401                                     }
       
   402                                 case '5':
       
   403                                     {
       
   404                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey5Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   405                                     break;
       
   406                                     }
       
   407                                 case '6':
       
   408                                     {
       
   409                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey6Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   410                                     break;
       
   411                                     }
       
   412                                 case '7':
       
   413                                     {
       
   414                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey7Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   415                                     break;
       
   416                                     }
       
   417                                 case '8':
       
   418                                     {
       
   419                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey8Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   420                                     break;
       
   421                                     }
       
   422                                 case '9':
       
   423                                     {
       
   424                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey9Cmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   425                                     break;
       
   426                                     }
       
   427                                 case '*':
       
   428                                     {
       
   429                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyStarCmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   430                                     break;
       
   431                                     }
       
   432                                 case '#':
       
   433                                     {
       
   434                                     function = ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyHashCmd()][KShortcutsCommandDecodeMatrixCmdVal];
       
   435                                     break;
       
   436                                     }
       
   437                                 default:
       
   438                                     {
       
   439                                     break;
       
   440                                     }
       
   441                                 }
       
   442 
       
   443                             if (function != -1)
       
   444                                 {
       
   445                                 iView->HandleCommandL(function);
       
   446                                 result = EKeyWasConsumed;
       
   447                                 }
       
   448                             }
       
   449                         } //endof handle shortcut keys
       
   450 
       
   451                     if (result == EKeyWasConsumed)
       
   452                         {
       
   453                             keyEvent.iCode = EKeyNull;
       
   454                         }
       
   455                     }
       
   456                 }
       
   457             }
       
   458 
       
   459             if ( iView->IsHistoryViewUp() && result == EKeyWasConsumed )
       
   460                 {
       
   461                 if (    ( aType == EEventKey || aType == EEventKeyUp )
       
   462                      && (    keyEvent.iCode == EKeyLeftUpArrow       // Northwest
       
   463                           || keyEvent.iCode == EStdKeyDevice10       //   : Extra KeyEvent supports diagonal event simulator wedge
       
   464                           || keyEvent.iCode == EKeyLeftArrow         // West
       
   465                           || keyEvent.iCode == EKeyLeftDownArrow     // Southwest
       
   466                           || keyEvent.iCode == EStdKeyDevice13       //   : Extra KeyEvent supports diagonal event simulator wedge
       
   467 
       
   468                           || keyEvent.iCode == EKeyRightUpArrow      // Northeast
       
   469                           || keyEvent.iCode == EStdKeyDevice11       //   : Extra KeyEvent supports diagonal event simulator wedge
       
   470                           || keyEvent.iCode == EKeyRightArrow        // East
       
   471                           || keyEvent.iCode == EKeyRightDownArrow    // Southeast
       
   472                           || keyEvent.iCode == EStdKeyDevice12 ) )   //   : Extra KeyEvent supports diagonal event simulator wedge
       
   473                     {
       
   474                     iView->UpdateTitleL( iApiProvider );
       
   475                     }
       
   476                 }
       
   477 
       
   478             // If in zoom mode, then show the zoom tooltip
       
   479             if (iView->isZoomMode() && result == EKeyWasConsumed )
       
   480                 {
       
   481                 iView->SetZoomLevelTitleTextL(R_BROWSER_ZOOM_LEVEL);
       
   482                 }
       
   483 
       
   484         }   // if (!iApiProvider.Preferences().AccessKeys())
       
   485 
       
   486     if ( result == EKeyWasNotConsumed &&
       
   487          (keyEvent.iScanCode == EStdKeyDevice3 || keyEvent.iScanCode == EStdKeyXXX) &&
       
   488          aType == EEventKeyUp  &&
       
   489          iSelectionKeyPressed )
       
   490         {
       
   491         // Selection key was released and it is not a long press!
       
   492         iSelectionKeyPressed = EFalse;
       
   493         aType = EEventKey;
       
   494         keyEvent.iCode = EKeyOK;
       
   495 
       
   496         // first offer event to browser control, e.g. link activation
       
   497         // result = iApiProvider.BrCtlInterface().OfferKeyEventL(keyEvent, aType);
       
   498 
       
   499         iView->ResetPreviousViewFlag();
       
   500         }
       
   501     return result;
       
   502     }
       
   503 
       
   504 //---------------------------------------------------------------------------
       
   505 // CBrowserContentViewContainer::FocusChanged()
       
   506 // ---------------------------------------------------------------------------
       
   507 //
       
   508 void CBrowserContentViewContainer::FocusChanged(TDrawNow aDrawNow)
       
   509     {
       
   510     // do not proceed further if a browser app exit is in progress
       
   511     if ( iApiProvider.ExitInProgress() )
       
   512         {
       
   513         return;
       
   514         }
       
   515 
       
   516     if ( iApiProvider.StartedUp() )
       
   517         iApiProvider.BrCtlInterface().SetFocus(IsFocused());
       
   518     if ( iGotoPane->IsVisible() )
       
   519         {
       
   520         TRAP_IGNORE(iGotoPane->EnableKeyEventHandlerL( IsFocused() ));
       
   521         }
       
   522 
       
   523     CCoeControl::FocusChanged( aDrawNow );
       
   524     }
       
   525 
       
   526 //---------------------------------------------------------------------------
       
   527 // CBrowserContentViewContainer::SizeChanged()
       
   528 // ---------------------------------------------------------------------------
       
   529 //
       
   530 void CBrowserContentViewContainer::SizeChanged()
       
   531     {
       
   532     // BrCtl could be uninitialized
       
   533     if ( iApiProvider.StartedUp() )
       
   534         {
       
   535         if(iApiProvider.LastActiveViewId() != KUidBrowserFeedsFeedViewId)
       
   536             {
       
   537             const TRect& oldRect = iApiProvider.BrCtlInterface().Rect();
       
   538             iApiProvider.BrCtlInterface().SetRect( TRect( oldRect.iTl, Size() ) );
       
   539             }
       
   540         }
       
   541 
       
   542     if ( iFindKeywordPane->IsFocused() )
       
   543         {
       
   544         iFindKeywordPane->HandleFindSizeChanged();
       
   545         }
       
   546     else
       
   547         {
       
   548         iGotoPane->HandleFindSizeChanged();
       
   549         }
       
   550 
       
   551     }
       
   552 
       
   553 //---------------------------------------------------------------------------
       
   554 // CBrowserContentViewContainer::CountComponentControls()
       
   555 // ---------------------------------------------------------------------------
       
   556 //
       
   557 TInt CBrowserContentViewContainer::CountComponentControls() const
       
   558     {
       
   559     TInt ctrls = 0;
       
   560     ctrls++;        // iGotoPane
       
   561     if ( iApiProvider.StartedUp() )
       
   562         {
       
   563         ctrls++;
       
   564         }
       
   565     ctrls++;        // iFindKeywordPane
       
   566     return ctrls;
       
   567     }
       
   568 
       
   569 //---------------------------------------------------------------------------
       
   570 // CBrowserContentViewContainer::ComponentControl()
       
   571 // ---------------------------------------------------------------------------
       
   572 //
       
   573 CCoeControl* CBrowserContentViewContainer::ComponentControl( TInt aIndex ) const
       
   574     {
       
   575     CCoeControl *ctrl = NULL;
       
   576     switch( aIndex )
       
   577         {
       
   578         case 0:
       
   579             {
       
   580             ctrl = iGotoPane;
       
   581             break;
       
   582             }
       
   583         case 1:
       
   584             {
       
   585             if ( iApiProvider.StartedUp() )
       
   586                 ctrl = &(iApiProvider.BrCtlInterface());
       
   587             break;
       
   588             }
       
   589         case 2:
       
   590             {
       
   591             ctrl = iFindKeywordPane;
       
   592             break;
       
   593             }
       
   594 
       
   595         default:
       
   596             break;
       
   597         }
       
   598     return ctrl;
       
   599     }
       
   600 
       
   601 //---------------------------------------------------------------------------
       
   602 // CBrowserContentViewContainer::ShutDownGotoURLEditorL()
       
   603 // ---------------------------------------------------------------------------
       
   604 //
       
   605 void CBrowserContentViewContainer::ShutDownGotoURLEditorL()
       
   606     {
       
   607     iGotoPane->MakeVisible( EFalse );
       
   608     iGotoPane->SetFocus( EFalse );
       
   609     SetFocus( ETrue );
       
   610     }
       
   611 
       
   612 
       
   613 //---------------------------------------------------------------------------
       
   614 // CBrowserContentViewContainer::ShutDownFindKeywordEditorL()
       
   615 // ---------------------------------------------------------------------------
       
   616 //
       
   617 void CBrowserContentViewContainer::ShutDownFindKeywordEditorL()
       
   618     {
       
   619     iFindKeywordPane->MakeVisible( EFalse );
       
   620     iFindKeywordPane->SetFocus( EFalse );
       
   621     SetFocus( ETrue );
       
   622     }
       
   623 
       
   624 
       
   625 //---------------------------------------------------------------------------
       
   626 // CBrowserContentViewContainer::HandleResourceChange()
       
   627 // ---------------------------------------------------------------------------
       
   628 //
       
   629 void CBrowserContentViewContainer::HandleResourceChange(TInt aType)
       
   630     {
       
   631     CCoeControl::HandleResourceChange( aType );
       
   632     if ( aType == KEikDynamicLayoutVariantSwitch)
       
   633         {
       
   634         if (!iView->FindItemIsInProgress())
       
   635             {
       
   636             iView->UpdateFullScreenL();
       
   637             iApiProvider.Display().RestoreTitleL();
       
   638             }
       
   639 
       
   640         SetRect(iView->ClientRect());
       
   641         DrawDeferred();
       
   642 
       
   643         // For Touch only-If find pane open, force toolbar to show since avkon disables
       
   644         // touch toolbar whenever a dialog is open and a rotate event is handled.
       
   645         // ** This workaround was provided by Avkon toolbar group
       
   646         if ( AknLayoutUtils::PenEnabled() &&
       
   647              iFindKeywordPane->IsVisible() &&
       
   648              iView->Toolbar() )
       
   649             {
       
   650             iView->Toolbar()->DrawableWindow()->SetOrdinalPosition( 0 );
       
   651             }
       
   652         }
       
   653     }
       
   654 
       
   655 
       
   656 //---------------------------------------------------------------------------
       
   657 // CBrowserContentViewContainer::CreateShortCutFuncsHashTable()
       
   658 // ---------------------------------------------------------------------------
       
   659 //
       
   660 void CBrowserContentViewContainer::CreateShortCutFuncsHashTable()
       
   661     {
       
   662     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncHomePg(), EWmlSettingsShortCutsActivateHomepage);
       
   663     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncBkMark(), EWmlSettingsShortCutsActivateBkmkview);
       
   664     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncFindKeyWord(), EWmlSettingsShortCutsShowFindKeyword);
       
   665     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncPrePage(), EWmlSettingsShortCutsGotoPreviousPage);
       
   666     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncSwitchWin(), EWmlSettingsShortCutsShowSwitchWindowList);
       
   667     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncMiniImage(), EWmlSettingsShortCutsShowMiniature);
       
   668     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncFullScreen(), EWmlSettingsShortCutsShowFullScreen);
       
   669     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncGoAddr(), EWmlSettingsShortCutsGotoPane);
       
   670     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomIn(), EWmlSettingsShortCutsZoomIn);
       
   671     InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomOut(), EWmlSettingsShortCutsZoomOut);
       
   672     // InsertFuncToHashTable(iApiProvider.Preferences().ShortCutFuncZoomMode(), EWmlSettingsShortCutsZoomMode);
       
   673     }
       
   674 
       
   675 //---------------------------------------------------------------------------
       
   676 // CBrowserContentViewContainer::InsertFuncToHashTable()
       
   677 // ---------------------------------------------------------------------------
       
   678 //
       
   679 void CBrowserContentViewContainer::InsertFuncToHashTable(HBufC* aKeyStr, TInt aFunc)
       
   680     {
       
   681 
       
   682     __ASSERT_DEBUG( (aKeyStr != NULL), Util::Panic( Util::EUninitializedData ));
       
   683 
       
   684         if (aKeyStr->Length() == 0)
       
   685         {
       
   686             return;
       
   687         }
       
   688 
       
   689         TBuf<4> key1Str; //  Ex.: 0075
       
   690         TBuf<4> key2Str; //  Ex.: 0032
       
   691 
       
   692         // Get the position of the separator ',' character from '0075, 0032'.
       
   693         TInt pos = aKeyStr->LocateF( ',' );
       
   694         if ( ( pos != KErrNotFound ) )
       
   695         {    //we have two string
       
   696             // Extract the first unicode string
       
   697             key1Str.Copy( aKeyStr->Des().Left( pos ) );
       
   698             TUint key1 = MyAtoi(key1Str);
       
   699 
       
   700             // Extract the second unicode string; second "-1" below is for remove space
       
   701             key2Str.Copy( aKeyStr->Des().Right( aKeyStr->Des().Length() - pos - 1 -1) );
       
   702             TUint key2 = MyAtoi(key2Str);
       
   703 
       
   704             // insert key and function
       
   705             iShortCutFuncMap.Insert(key1, aFunc);
       
   706             iShortCutFuncMap.Insert(key2, aFunc);
       
   707         }
       
   708         else
       
   709         {    //we only have one string
       
   710             // Extract the first unicode string
       
   711             key1Str.Copy( aKeyStr->Des() );
       
   712             TUint key1 = MyAtoi(key1Str);
       
   713             // insert key and function
       
   714             iShortCutFuncMap.Insert(key1, aFunc);
       
   715         }
       
   716     }
       
   717 
       
   718 //---------------------------------------------------------------------------
       
   719 // CBrowserContentViewContainer::MyAtoi()
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 TUint CBrowserContentViewContainer::MyAtoi(TPtrC aData)
       
   723     {
       
   724         TLex lex(aData);
       
   725         TUint dataValue = 0;
       
   726         lex.Val(dataValue, EHex);
       
   727         return dataValue;
       
   728     }
       
   729 
       
   730 //---------------------------------------------------------------------------
       
   731 // CBrowserContentViewContainer::InvokeFunction()
       
   732 // ---------------------------------------------------------------------------
       
   733 //
       
   734 TKeyResponse CBrowserContentViewContainer::InvokeFunction(TUint aCode)
       
   735     {
       
   736     TInt function = -1;
       
   737     // if error, no function defined for this shortcut key
       
   738     TRAPD( err, function = iShortCutFuncMap.FindL(aCode) );
       
   739     if ( err != KErrNone )
       
   740         {
       
   741             return EKeyWasNotConsumed;
       
   742         }
       
   743 
       
   744     TBool embedded = iApiProvider.IsEmbeddedModeOn();
       
   745 
       
   746     if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() )
       
   747     {
       
   748         CBrowserAppUi* ui = CBrowserAppUi::Static();
       
   749 
       
   750         switch(function)
       
   751             {
       
   752             case EWmlSettingsShortCutsActivateHomepage:
       
   753                 {
       
   754                 TBool homepage = iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserUiHomePageSetting );
       
   755                 // home page
       
   756                 if ( homepage )
       
   757                     {
       
   758                     //
       
   759                     TWmlSettingsHomePage pgtype = iApiProvider.Preferences().HomePageType();
       
   760 
       
   761                     if ( !(embedded || pgtype == EWmlSettingsHomePageBookmarks) )
       
   762                         {
       
   763                         ui->LaunchHomePageL();
       
   764                         }
       
   765                     else
       
   766                         {
       
   767                         if ( pgtype == EWmlSettingsHomePageBookmarks )
       
   768                             {
       
   769                             iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId );
       
   770                             }
       
   771                         }
       
   772                     }
       
   773                 return EKeyWasConsumed;
       
   774                 }
       
   775             case EWmlSettingsShortCutsActivateBkmkview:
       
   776                 {
       
   777                 if ( !embedded )
       
   778                 {
       
   779                     iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId );
       
   780                 }
       
   781                 return EKeyWasConsumed;
       
   782                 }
       
   783             case EWmlSettingsShortCutsGotoPane:
       
   784                 {
       
   785                 iView->LaunchGotoAddressEditorL();
       
   786                 iView->MenuBar()->MenuPane()->MakeVisible(EFalse);
       
   787                 return EKeyWasConsumed;
       
   788                 }
       
   789             case EWmlSettingsShortCutsShowFindKeyword:
       
   790                 {
       
   791                 if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue /* is current page wml?*/))
       
   792                     {
       
   793                     iView->LaunchFindKeywordEditorL();
       
   794                     iView->MenuBar()->MenuPane()->MakeVisible(EFalse);
       
   795                     }
       
   796                 return EKeyWasConsumed;
       
   797                 }
       
   798             case EWmlSettingsShortCutsShowSwitchWindowList:
       
   799                 {
       
   800                 if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(EFalse /*is any page wml?*/))
       
   801                     {
       
   802                     if (iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) &&
       
   803                         !iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserMinimalMultipleWindows ) &&
       
   804                         iApiProvider.WindowMgr().WindowCount() > 1)
       
   805                         {
       
   806                         iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserWindowSelectionViewId );
       
   807                         }
       
   808                     else
       
   809                         {
       
   810                         if (iApiProvider.WindowMgr().WindowCount() > 1)
       
   811                             {
       
   812                             ui->SwitchWindowL();
       
   813                             }
       
   814                         }
       
   815                     }
       
   816                 return EKeyWasConsumed;
       
   817                 }
       
   818 
       
   819             case EWmlSettingsShortCutsZoomOut:
       
   820                 {
       
   821                 iView->ZoomImagesOutL();
       
   822                 return EKeyWasConsumed;
       
   823                 }
       
   824 
       
   825             case EWmlSettingsShortCutsZoomIn:
       
   826                 {
       
   827                 iView->ZoomImagesInL();
       
   828                 return EKeyWasConsumed;
       
   829                 }
       
   830 
       
   831             case EWmlSettingsShortCutsGotoPreviousPage:
       
   832                 {
       
   833                 if ( iApiProvider.BrCtlInterface().NavigationAvailable( TBrCtlDefs::ENavigationBack ) )
       
   834                     {
       
   835                         iApiProvider.LoadObserver().DoStartLoad( CBrowserLoadObserver::ELoadUrlTypeOther );
       
   836                         iApiProvider.BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandOneStepBack +
       
   837                                                             (TInt)TBrCtlDefs::ECommandIdBase );
       
   838                     }
       
   839                 return EKeyWasConsumed;
       
   840                 }
       
   841 
       
   842             case EWmlSettingsShortCutsShowFullScreen:
       
   843                 {
       
   844                 iView->HandleCommandL(EWmlCmdEnterFullScreenBrowsing);
       
   845                 return EKeyWasConsumed;
       
   846                 }
       
   847           }
       
   848     } // END if ( !iView->IsMiniatureViewUp() && !iView->IsHistoryViewUp() && !iView->isZoomMode())
       
   849 
       
   850 
       
   851     if ( function == EWmlSettingsShortCutsShowMiniature && !iView->IsHistoryViewUp() )
       
   852         {   // Process short key '8' only if History view is not shown.
       
   853             if (!iView->ApiProvider().WindowMgr().CurrentWindow()->HasWMLContent(ETrue /* is current page wml?*/))
       
   854                 {
       
   855                 iApiProvider.BrCtlInterface().HandleCommandL(
       
   856                         (TInt)TBrCtlDefs::ECommandShowThumbnailView + (TInt)TBrCtlDefs::ECommandIdBase );
       
   857                 }
       
   858             return EKeyWasConsumed;
       
   859         }
       
   860 
       
   861     return EKeyWasNotConsumed;
       
   862    }
       
   863 
       
   864 
       
   865 
       
   866 #ifdef __SERIES60_HELP
       
   867 // ---------------------------------------------------------
       
   868 // CBrowserContentViewContainer::GetHelpContext()
       
   869 // ---------------------------------------------------------
       
   870 //
       
   871 void CBrowserContentViewContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   872     {
       
   873     const TUid KUidOperatorMenuApp = { 0x10008D5E };
       
   874     aContext.iMajor = KUidBrowserApplication;
       
   875     if ( iApiProvider.IsEmbeddedModeOn() )
       
   876         {
       
   877         if ( CBrowserAppUi::Static()->IsEmbeddedInOperatorMenu() )
       
   878             {
       
   879             aContext.iMajor = KUidOperatorMenuApp;
       
   880             aContext.iContext = KOPERATOR_HLP_OPTIONS_LIST;
       
   881             }
       
   882         else
       
   883             {
       
   884             aContext.iContext = KOSS_HLP_PAGEVIEW_EMBED;
       
   885             }
       
   886 
       
   887         }
       
   888     else
       
   889         {
       
   890         aContext.iContext = KOSS_HLP_PAGEVIEW;
       
   891         }
       
   892     }
       
   893 
       
   894 #endif // __SERIES60_HELP
       
   895 
       
   896 // End of File