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