browserui/browser/BrowserAppSrc/BrowserGotoPane.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 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <Browser_Platform_Variant.hrh>
       
    23 #include <eikmenub.h>
       
    24 #include <eikdef.h>
       
    25 #include <akninfrm.h>
       
    26 #include <eikon.rsg>
       
    27 #include <eikenv.h>
       
    28 #include <txtglobl.h>
       
    29 #include <gulfont.h>
       
    30 #include <txtfrmat.h>
       
    31 #include <eikgted.h>
       
    32 #include <aknconsts.h>
       
    33 #include <akneditstateindicator.h>
       
    34 #include <AknsListBoxBackgroundControlContext.h>
       
    35 #include <BrowserNG.rsg>
       
    36 #include <Featmgr.h>
       
    37 #include <fepbase.h>
       
    38 #include <aknutils.h>
       
    39 #include <browseruisdkcrkeys.h>
       
    40 
       
    41 #include <AknLayout2ScalableDef.h>
       
    42 #include <aknlayoutfont.h>
       
    43 #include <aknlayoutscalable_avkon.cdl.h>
       
    44 
       
    45 #include "CommonConstants.h"
       
    46 #include "BrowserGotoPane.h"
       
    47 #include "BrowserAppUi.h"
       
    48 #include "BrowserUtil.h"
       
    49 #include "browser.hrh"
       
    50 #include <favouriteslimits.h>
       
    51 #include "BrowserAdaptiveListPopup.h"
       
    52 #include "BrowserContentView.h"
       
    53 
       
    54 #include "eikon.hrh"
       
    55 
       
    56 #include <StringLoader.h>
       
    57 
       
    58 const TInt KMaxTitleLength = 512;
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CBrowserGotoPane::NewL
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CBrowserGotoPane* CBrowserGotoPane::NewL(
       
    65         const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId,
       
    66         TBool aPopupListStatus, CBrowserContentView* aContentView,
       
    67         TBool aFindKeywordMode )
       
    68     {
       
    69     CBrowserGotoPane* gotoPane = new(ELeave)
       
    70         CBrowserGotoPane( aContentView, aFindKeywordMode );
       
    71 
       
    72     CleanupStack::PushL( gotoPane );
       
    73     gotoPane->ConstructL( aParent, aIconBitmapId, aIconMaskId, aPopupListStatus );
       
    74     gotoPane->MakeVisibleL( EFalse );
       
    75     gotoPane->SetFocus( EFalse );
       
    76     CleanupStack::Pop();    // gotoPane
       
    77 
       
    78     return gotoPane;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CBrowserGotoPane::MakeVisibleL
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CBrowserGotoPane::MakeVisibleL( TBool aVisible )
       
    86     {
       
    87     if ( aVisible )
       
    88         {
       
    89         if ( iSearchEditor )
       
    90             {
       
    91             ConstructSearchPaneL();
       
    92             }
       
    93         HandleFindSizeChanged();
       
    94         if ( AUTOCOMP ) //ask the feature manager
       
    95         {
       
    96         //2.1 does not put http:// there
       
    97             SetTextL( KNullDesC );
       
    98         }
       
    99         else
       
   100         {
       
   101         //2.0 does put the http:// there
       
   102             SetTextL( KHttpString );
       
   103             }
       
   104         }
       
   105     else
       
   106         {
       
   107         // Clear the search text if goto is cancelled ( hidden ).
       
   108         if ( iSearchEditor )
       
   109             {
       
   110             SetSearchTextL( KNullDesC );
       
   111             }
       
   112         }
       
   113     
       
   114     SetPointerCapture(aVisible);
       
   115     if (AknLayoutUtils::PenEnabled() &&  ( !iSearchEditor )  )
       
   116         {      
       
   117         if (aVisible)
       
   118             {
       
   119             ActivateVKB();
       
   120             }
       
   121         }
       
   122 
       
   123     CCoeControl::MakeVisible( aVisible );
       
   124 
       
   125     iGotoKeyHandled->Reset();
       
   126     iGotoKeyHandled->EnableL( aVisible );
       
   127 
       
   128 
       
   129     if ( iSearchEditor )
       
   130         {
       
   131         SetTextModeItalicL();
       
   132         }
       
   133     // To avoid Flickring Effect when SearchInputFrame is
       
   134     // re-created with new search provider icon.
       
   135     DrawNow( );
       
   136 
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CBrowserGotoPane::MakeVisible
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CBrowserGotoPane::MakeVisible( TBool aVisible )
       
   144     {
       
   145     TRAP_IGNORE( MakeVisibleL( aVisible ) );
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // CBrowserGotoPane::~CBrowserGotoPane
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 CBrowserGotoPane::~CBrowserGotoPane()
       
   153     {
       
   154     if (iAvkonAppUi!=NULL)
       
   155         {
       
   156         iAvkonAppUi->RemoveFromStack( iGotoKeyHandled );
       
   157         }
       
   158     delete iSearchEditor;
       
   159     delete iSearchInputFrame;
       
   160 
       
   161     delete iGotoKeyHandled;
       
   162     delete iEditor;
       
   163     delete iInputFrame;
       
   164     delete iPrevKeyword;
       
   165     delete iBAdaptiveListPopup;
       
   166     delete iDefaultSearchText;
       
   167     iContentView = NULL;
       
   168     CCoeEnv::Static()->RemoveFepObserver(static_cast<MCoeFepObserver &>(*this));
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CBrowserGotoPane::CBrowserGotoPane
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 CBrowserGotoPane::CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode )
       
   176 :   iContentView( aContentView),
       
   177     iFindKeywordMode( aFindKeywordMode ),
       
   178     iHandleFEPFind( ETrue ),
       
   179     iBAdaptiveListPopup( NULL ),
       
   180     iGotoPaneActive( ETrue ),
       
   181     iSearchPaneActive( EFalse),
       
   182     iSearchIconId( 0 )
       
   183     {
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // CBrowserGotoPane::ConstructL
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 void CBrowserGotoPane::ConstructL ( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId,
       
   191             TBool
       
   192             aPopupListStatus
       
   193             )
       
   194     {
       
   195     CreateWindowL();
       
   196 
       
   197     // remove 'const' modifier and set parent control
       
   198     SetMopParent( CONST_CAST( CCoeControl*, aParent ) );
       
   199 
       
   200     iEditor = new (ELeave) CEikGlobalTextEditor;
       
   201 
       
   202     iInputFrame = CAknInputFrame::NewL(
       
   203         iEditor,
       
   204         EFalse,
       
   205         KAvkonBitmapFile,
       
   206         aIconBitmapId,
       
   207         aIconMaskId,
       
   208         CAknInputFrame::EPopupLayout );
       
   209 
       
   210     iInputFrame->SetContainerWindowL( *this );
       
   211 
       
   212     AknEditUtils::ConstructEditingL (   iEditor,
       
   213                                         KFavouritesMaxUrlGotoPaneDefine,
       
   214                                         1,
       
   215                                         EAknEditorCharactersLowerCase,
       
   216                                         EAknEditorAlignRight,
       
   217                                         EFalse,
       
   218                                         ETrue,
       
   219                                         EFalse );
       
   220 
       
   221     iEditor->SetContainerWindowL( *this );
       
   222     iEditor->SetObserver( this );
       
   223     iEditor->SetBorder( TGulBorder::ENone );
       
   224     iEditor->SetAknEditorCase( EAknEditorLowerCase );
       
   225     iEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
       
   226 
       
   227     if (AVKONAPAC)
       
   228         {
       
   229         // Disallow chinese input.
       
   230         iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
       
   231                                             EAknEditorNumericInputMode );
       
   232         }
       
   233     TInt editorFlags =  ((iFindKeywordMode) ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) |EAknEditorFlagUseSCTNumericCharmap;
       
   234 
       
   235     // Always disable T9 input for goto url
       
   236     editorFlags = (editorFlags | EAknEditorFlagNoT9);
       
   237 
       
   238     iEditor->SetAknEditorFlags( editorFlags );
       
   239 
       
   240     iEditor->SetAknEditorPermittedCaseModes (   EAknEditorUpperCase |
       
   241                                                 EAknEditorLowerCase );
       
   242 
       
   243     iGotoKeyHandled = new (ELeave) CBrowserKeyEventHandled( *this );
       
   244     iAvkonAppUi->AddToStackL( iGotoKeyHandled,
       
   245                                 ECoeStackPriorityFep + 1,
       
   246                                 ECoeStackFlagRefusesFocus );
       
   247     iEditor->SetEdwinObserver( iGotoKeyHandled );
       
   248     iEditor->SetSkinBackgroundControlContextL(NULL);
       
   249 
       
   250     TBool searchFeature = iContentView->ApiProvider().Preferences().SearchFeature();
       
   251     if (  searchFeature && !iFindKeywordMode )
       
   252         {
       
   253         iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH );
       
   254         ConstructSearchPaneL();
       
   255         }
       
   256 
       
   257       //adaptive popuplist
       
   258     if ( aPopupListStatus && AUTOCOMP )
       
   259         {
       
   260         iBAdaptiveListPopup =
       
   261             new (ELeave) CBrowserAdaptiveListPopup( iEditor, this, EGotoPane, searchFeature );
       
   262         iBAdaptiveListPopup->ConstructL();
       
   263         iEditor->SetObserver( iBAdaptiveListPopup );
       
   264         if (iContentView)
       
   265             {
       
   266             iBAdaptiveListPopup->SetUrlSuffixList(iContentView->ApiProvider().Preferences().URLSuffixList());
       
   267             iBAdaptiveListPopup->SetMaxRecentUrls(iContentView->ApiProvider().Preferences().MaxRecentUrls());
       
   268             }
       
   269         }
       
   270 
       
   271     CCoeEnv::Static()->AddFepObserverL(static_cast<MCoeFepObserver &>(*this));
       
   272     iPrevKeyword = KNullDesC().AllocL();
       
   273     }
       
   274 
       
   275 // ---------------------------------------------------------------------------
       
   276 // CBrowserGotoPane::SetOrdinalPosition
       
   277 // ---------------------------------------------------------------------------
       
   278 //
       
   279 void CBrowserGotoPane::SetOrdinalPosition( TInt aPos )
       
   280     {
       
   281     Window().SetOrdinalPosition( aPos );
       
   282     if ( iBAdaptiveListPopup )
       
   283         {
       
   284         iBAdaptiveListPopup->SetOrdinalPosition( aPos );
       
   285         }
       
   286     }
       
   287 
       
   288 // ---------------------------------------------------------------------------
       
   289 // CBrowserGotoPane::HandleFindSizeChanged
       
   290 // ---------------------------------------------------------------------------
       
   291 //
       
   292 void CBrowserGotoPane::HandleFindSizeChanged()
       
   293     {
       
   294     
       
   295     if ( iSearchEditor && !iFindKeywordMode)
       
   296         {
       
   297             TRect clientRect = CBrowserAppUi::Static()->ClientRect();
       
   298             TAknWindowLineLayout findWindow = AknLayout::popup_find_window();
       
   299 
       
   300             TRect findWindowRect = AknLayoutUtils::RectFromCoords( clientRect,findWindow.il, findWindow.it,
       
   301                     findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH);
       
   302 
       
   303             // Now Increase the height of rect to make room for two editors (Goto + search)//
       
   304             findWindowRect.iTl.iY -= ( findWindow.iH  );
       
   305             SetRect( findWindowRect );
       
   306         }
       
   307 
       
   308     else if ( !AknLayoutUtils::PenEnabled() )
       
   309         {
       
   310         
       
   311             TRect parentrect = iAvkonAppUi->ApplicationRect();
       
   312 
       
   313             TAknLayoutRect lrect;
       
   314             lrect.LayoutRect( parentrect,
       
   315                         AknLayout::main_pane( CBrowserAppUi::Static()->ApplicationRect(), 0, 1, 1 )
       
   316                         );
       
   317             AknLayoutUtils::LayoutControl ( this,
       
   318                                         lrect.Rect(),
       
   319                                         AknLayout::popup_find_window() );
       
   320         }
       
   321     else if( AknLayoutUtils::PenEnabled() )
       
   322         {
       
   323         // The ClientRect() will be the application rectangle minus any
       
   324         // toolbars/menu bars etc.
       
   325         AknLayoutUtils::LayoutControl ( this,
       
   326                                         CBrowserAppUi::Static()->ClientRect(),
       
   327                                         AknLayout::popup_find_window() );
       
   328         }
       
   329 
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // CBrowserGotoPane::EnableKeyEventHandler
       
   334 // ---------------------------------------------------------------------------
       
   335 //
       
   336 void CBrowserGotoPane::EnableKeyEventHandlerL( TBool aEnable )
       
   337     {
       
   338     iGotoKeyHandled->EnableL( aEnable );
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // CBrowserGotoPane::HandleControlEventL
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 void CBrowserGotoPane::HandleControlEventL ( CCoeControl* /*aControl*/,
       
   346                                                         TCoeEvent aEventType )
       
   347     {
       
   348     if ( iFindKeywordMode )
       
   349         {
       
   350         if ( iEditor->AknEditorCurrentInputMode() == EAknEditorCalculatorNumberModeKeymap
       
   351             // When the user copies and paste's content to the find dialog, the editor
       
   352             // is in Text Input mode, The engine should still get the find keyword request
       
   353             || iEditor->AknEditorCurrentInputMode() == EAknEditorTextInputMode
       
   354             // Also Chinese and Japanese input modes should apply here
       
   355             || iEditor->AknEditorCurrentInputMode() == EAknEditorFullWidthKatakanaInputMode 
       
   356             || iEditor->AknEditorCurrentInputMode() == EAknEditorHiraganaInputMode 
       
   357             )
       
   358             {
       
   359             if ( aEventType == MCoeControlObserver::EEventStateChanged )
       
   360                 {
       
   361                 HBufC* newText = GetTextL();
       
   362                 if (!newText)
       
   363                     {
       
   364                     newText = KNullDesC().AllocL();
       
   365                     }
       
   366 
       
   367                 if ( iPrevKeyword->Compare( *newText ) )
       
   368                     {
       
   369                     delete iPrevKeyword;
       
   370                     iPrevKeyword = NULL;
       
   371                     iPrevKeyword = newText;
       
   372                     // Find the typed keyword.
       
   373                     iContentView->FindKeywordL( GetTextL() );
       
   374                     iHandleFEPFind = EFalse;
       
   375                     }
       
   376                 else
       
   377                     {
       
   378                     delete newText;
       
   379                     }
       
   380                 }
       
   381             }
       
   382         }
       
   383 
       
   384     switch (aEventType)
       
   385         {
       
   386         case EEventRequestFocus:
       
   387             {
       
   388             FocusChanged( EDrawNow );
       
   389             break;
       
   390             }
       
   391 
       
   392         default:
       
   393             break;
       
   394         }
       
   395     }
       
   396 
       
   397 // ----------------------------------------------------------------------------
       
   398 // CBrowserGotoPane::OfferKeyEventL
       
   399 // ----------------------------------------------------------------------------
       
   400 //
       
   401 TKeyResponse CBrowserGotoPane::OfferKeyEventL
       
   402 ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   403     {
       
   404     TKeyResponse resp = EKeyWasNotConsumed;
       
   405 
       
   406     if (    AknLayoutUtils::PenEnabled()
       
   407          && PopupList()
       
   408          && PopupList()->DrawableWindow()->OrdinalPosition() > 0 )
       
   409         {
       
   410         PopupList()->SetOrdinalPosition(0);
       
   411         }
       
   412 
       
   413     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )  // Escape key event handling
       
   414         {
       
   415         CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
       
   416         if ( PopupList() )
       
   417             {
       
   418             PopupList()->SetDirectoryModeL( ETrue );
       
   419             PopupList()->HidePopupL();
       
   420             }
       
   421         MakeVisible( EFalse );                                  // Hide Goto pane
       
   422         SetFocus( EFalse );
       
   423         resp = EKeyWasConsumed;                                 // should set the focus of container to ETrue...how?
       
   424         }
       
   425 
       
   426     if ( iFindKeywordMode )
       
   427         {
       
   428         if ( iContentView->MenuBar()->MenuPane()->IsVisible() )
       
   429             {
       
   430             return iContentView->MenuBar()->MenuPane()->OfferKeyEventL(  aKeyEvent, aType );
       
   431             }
       
   432         else
       
   433             {
       
   434             if ( aType == EEventKey )                           // Handle up and down arow keys to search for
       
   435                 {                                               //   next and previous keywords.
       
   436 
       
   437                 if (    aKeyEvent.iCode == EKeyLeftUpArrow      // Northwest
       
   438                      || aKeyEvent.iCode == EStdKeyDevice10      //   : Extra KeyEvent supports diagonal event simulator wedge
       
   439                      || aKeyEvent.iCode == EKeyUpArrow          // North
       
   440                      || aKeyEvent.iCode == EKeyRightUpArrow     // Northeast
       
   441                      || aKeyEvent.iCode == EStdKeyDevice11 )    //   : Extra KeyEvent supports diagonal event simulator wedge
       
   442                     {                                           // Any of those? If so, then...
       
   443                     iContentView->FindKeywordL( NULL, EFalse ); // Find previous keyword
       
   444                     iHandleFEPFind = EFalse;                    //   :
       
   445                     return EKeyWasConsumed;                     // And that consumes the key
       
   446                     }
       
   447 
       
   448                 if (    aKeyEvent.iCode == EKeyLeftDownArrow    // Southwest
       
   449                      || aKeyEvent.iCode == EStdKeyDevice13      //   : Extra KeyEvent supports diagonal event simulator wedge
       
   450                      || aKeyEvent.iCode == EKeyDownArrow        // South
       
   451                      || aKeyEvent.iCode == EKeyRightDownArrow   // Southeast
       
   452                      || aKeyEvent.iCode == EStdKeyDevice12 )    //   : Extra KeyEvent supports diagonal event simulator wedge
       
   453                     {                                           // Any of those? If so, then...
       
   454                     iContentView->FindKeywordL( NULL, ETrue );  // Find next keyword
       
   455                     iHandleFEPFind = EFalse;                    //   :
       
   456                     return EKeyWasConsumed;                     // And that consumes the key
       
   457                     }
       
   458 
       
   459                 if ( aKeyEvent.iCode == EKeyDevice3 )           // Select key?
       
   460                     {                                           // If so, then...
       
   461                     return EKeyWasConsumed;                     // Ignore select key
       
   462                     }
       
   463 
       
   464                 }
       
   465             return iEditor->OfferKeyEventL( aKeyEvent, aType );  // Otherwise, just pass the key on to the editor
       
   466             }
       
   467         }
       
   468 
       
   469     else                                                        // *NOT* iFindKeywordMode
       
   470         {
       
   471 
       
   472         if (    aKeyEvent.iCode == EKeyRightUpArrow             // Northeast
       
   473              || aKeyEvent.iCode == EStdKeyDevice11              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   474              || aKeyEvent.iCode == EKeyRightDownArrow           // Southeast
       
   475              || aKeyEvent.iCode == EStdKeyDevice12              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   476              || aKeyEvent.iCode == EKeyLeftDownArrow            // Southwest
       
   477              || aKeyEvent.iCode == EStdKeyDevice13              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   478              || aKeyEvent.iCode == EKeyLeftUpArrow              // Northwest
       
   479              || aKeyEvent.iCode == EStdKeyDevice10 )            //   : Extra KeyEvent supports diagonal event simulator wedge
       
   480             {                                                   // Any of those? If so, then...
       
   481             return EKeyWasConsumed;                             // Ignore diagonal navigation events here
       
   482             }
       
   483 
       
   484         // For touch UI, handle enter key from VKB as a "GOTO"
       
   485         if (AknLayoutUtils::PenEnabled() && aKeyEvent.iCode == EKeyEnter)
       
   486             {
       
   487             CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo);
       
   488             return EKeyWasConsumed;
       
   489             }
       
   490         else if ( ((aKeyEvent.iCode == EKeyOK ) || (aKeyEvent.iCode == EKeyEnter))
       
   491              && iGPObserver 
       
   492              && IsFocused() )
       
   493             {
       
   494             if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() )
       
   495                 {
       
   496                 return CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType );
       
   497                 }
       
   498             else
       
   499                 {
       
   500                 // If there is an observer and we have the focus, enter key is
       
   501                 // consumed and observer is notified.
       
   502                 iGPObserver->HandleGotoPaneEventL
       
   503                                 ( this, MGotoPaneObserver::EEventEnterKeyPressed );
       
   504                 return EKeyWasConsumed;
       
   505                 }
       
   506             }        
       
   507 
       
   508         if ( iSearchEditor && iSearchPaneActive )
       
   509             {
       
   510             resp = iSearchEditor->OfferKeyEventL( aKeyEvent, aType );
       
   511             }
       
   512         else
       
   513             {
       
   514             resp = iEditor->OfferKeyEventL( aKeyEvent, aType );
       
   515             }
       
   516 
       
   517         if ((iBAdaptiveListPopup ) && (resp != EKeyWasConsumed))
       
   518           {
       
   519           resp = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType );
       
   520           }
       
   521 
       
   522 
       
   523         if ( iSearchEditor )
       
   524             {
       
   525             if (    ( iGotoPaneActive || iSearchPaneActive)
       
   526                  && (resp != EKeyWasConsumed) )
       
   527                 {
       
   528 
       
   529                 if (  aKeyEvent.iCode == EKeyUpArrow )
       
   530                     {
       
   531                     resp = EKeyWasConsumed;
       
   532                     if ( iSearchPaneActive )
       
   533                         {
       
   534                         SetGotoPaneActiveL();
       
   535 
       
   536 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
   537                         iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB );
       
   538 #endif
       
   539 
       
   540                         }
       
   541                     }
       
   542                 if ( aKeyEvent.iCode == EKeyDownArrow )
       
   543                     {
       
   544                     resp = EKeyWasConsumed;
       
   545                     if ( iGotoPaneActive )
       
   546                         {
       
   547                         SetSearchPaneActiveL();
       
   548 
       
   549 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
   550                         iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB );
       
   551 #endif
       
   552 
       
   553                         }
       
   554                     }
       
   555                 }
       
   556             }
       
   557 
       
   558         }
       
   559 
       
   560     return resp;
       
   561 
       
   562     }
       
   563 
       
   564 // ----------------------------------------------------------------------------
       
   565 // CBrowserGotoPane::HandlePointerEventL
       
   566 // ----------------------------------------------------------------------------
       
   567 //
       
   568 void CBrowserGotoPane::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   569     {
       
   570     if ( !AknLayoutUtils::PenEnabled() )
       
   571         {
       
   572         return;
       
   573         }
       
   574 
       
   575     // ponter is in goto pane
       
   576     if (Rect().Contains(aPointerEvent.iPosition))
       
   577         {
       
   578         iGotoKeyHandled->EnableL(ETrue);
       
   579 
       
   580         // If search feature exists, check and route to appropriate editor //
       
   581         if ( iSearchEditor  )
       
   582             {
       
   583             if ( iSearchInputFrame->Rect().Contains(aPointerEvent.iPosition))
       
   584                 {
       
   585                 if ( !iSearchPaneActive )
       
   586                     {
       
   587                     SetSearchPaneActiveL();
       
   588                     }
       
   589 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
   590                 else
       
   591                     {
       
   592 #endif
       
   593                     iSearchEditor->HandlePointerEventL(aPointerEvent);
       
   594 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
   595                     }
       
   596 #endif
       
   597 
       
   598 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
   599                 iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB);
       
   600 #endif
       
   601                 }
       
   602             else
       
   603                 {
       
   604                 if ( !iGotoPaneActive )
       
   605                     {
       
   606                     SetGotoPaneActiveL();
       
   607                     }
       
   608 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
   609                 else
       
   610                     {
       
   611 #endif
       
   612                     iEditor->HandlePointerEventL(aPointerEvent);
       
   613 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF
       
   614                     }
       
   615 #endif
       
   616 
       
   617 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
   618                 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB);
       
   619 #endif
       
   620                 }
       
   621             }
       
   622         else
       
   623             {
       
   624             iEditor->HandlePointerEventL(aPointerEvent);
       
   625             }
       
   626         iGotoKeyHandled->SetFirstKeyEvent(EFalse);
       
   627         }
       
   628     else
       
   629         {
       
   630         // pointer outside of control
       
   631         if ( iFindKeywordMode )
       
   632             {
       
   633             CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdFindKeywordPaneClose);
       
   634             ResetPrevText();
       
   635             }
       
   636         else
       
   637             {
       
   638             CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel);
       
   639             }
       
   640         }
       
   641     }
       
   642 
       
   643 // ----------------------------------------------------------------------------
       
   644 // CBrowserGotoPane::CountComponentControls
       
   645 // ----------------------------------------------------------------------------
       
   646 //
       
   647 TInt CBrowserGotoPane::CountComponentControls() const
       
   648     {
       
   649     if ( iSearchEditor && !iFindKeywordMode )
       
   650         {
       
   651         return 4; // iEditor, input frame, SearchEditor and Searchinput frame.
       
   652         }
       
   653     return 2;   // iEditor and input frame
       
   654     }
       
   655 
       
   656 // ----------------------------------------------------------------------------
       
   657 // CBrowserGotoPane::ComponentControl
       
   658 // ----------------------------------------------------------------------------
       
   659 //
       
   660 CCoeControl* CBrowserGotoPane::ComponentControl ( TInt aIndex ) const
       
   661     {
       
   662     switch(aIndex)
       
   663         {
       
   664         case 0:
       
   665             {
       
   666             return iInputFrame;
       
   667             }
       
   668         case 1:
       
   669             {
       
   670             return iEditor;
       
   671             }
       
   672         case 2:
       
   673             {
       
   674             return iSearchInputFrame;
       
   675             }
       
   676         case 3:
       
   677             {
       
   678             return iSearchEditor;
       
   679             }
       
   680 
       
   681         default:
       
   682             return NULL;
       
   683         }
       
   684     }
       
   685 
       
   686 // ----------------------------------------------------------------------------
       
   687 // CBrowserGotoPane::SizeChanged
       
   688 // ----------------------------------------------------------------------------
       
   689 //
       
   690 void CBrowserGotoPane::SizeChanged()
       
   691     {
       
   692     if (iSearchEditor && !iFindKeywordMode )
       
   693         {
       
   694         // We need height and width of FindWindow
       
   695         TAknWindowLineLayout findWindow = AknLayout::popup_find_window();
       
   696         TRect findWindowRect = AknLayoutUtils::RectFromCoords( Rect(), findWindow.il,
       
   697                 findWindow.it, findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH);
       
   698 
       
   699         TSize gotoSize( findWindowRect.Size() );
       
   700         TRect gotoRect( TPoint( 0,0 ), gotoSize );
       
   701         iInputFrame->SetRect( gotoRect );
       
   702 
       
   703         // Now set SearchPane right below GoTo pane //
       
   704         TRect searchRect( TPoint( 0, gotoRect.iBr.iY ), gotoSize );
       
   705         iSearchInputFrame->SetRect( searchRect );
       
   706         }
       
   707     else
       
   708         {
       
   709         iInputFrame->SetRect( Rect() );
       
   710         }
       
   711     }
       
   712 
       
   713 // ----------------------------------------------------------------------------
       
   714 // CBrowserGotoPane::FocusChanged
       
   715 // ----------------------------------------------------------------------------
       
   716 //
       
   717 void CBrowserGotoPane::FocusChanged( TDrawNow aDrawNow )
       
   718     {
       
   719     // this is a workaround
       
   720     TRAP_IGNORE( iGotoKeyHandled->EnableL( IsFocused() ) );
       
   721     CCoeControl::FocusChanged( aDrawNow );
       
   722     if ( iGotoPaneActive )
       
   723         {
       
   724         iEditor->SetFocus( IsFocused() );
       
   725         }
       
   726     else if ( iSearchEditor && !iFindKeywordMode && iSearchPaneActive )
       
   727         {
       
   728         iSearchEditor->SetFocus( IsFocused() );
       
   729         }
       
   730     }
       
   731 
       
   732 
       
   733 
       
   734 // ----------------------------------------------------------------------------
       
   735 // CBrowserGotoPane::TextLength
       
   736 // ----------------------------------------------------------------------------
       
   737 //
       
   738 TInt CBrowserGotoPane::SearchTextLength() const
       
   739     {
       
   740     TInt len = 0;
       
   741     if ( iSearchEditor )
       
   742         {
       
   743         len = iSearchEditor->TextLength();
       
   744         }
       
   745     return len;
       
   746     }
       
   747 
       
   748 // ----------------------------------------------------------------------------
       
   749 // CBrowserGotoPane::TextLength
       
   750 // ----------------------------------------------------------------------------
       
   751 //
       
   752 TInt CBrowserGotoPane::TextLength() const
       
   753     {
       
   754     return iEditor->TextLength();
       
   755     }
       
   756 
       
   757 // ----------------------------------------------------------------------------
       
   758 // CBrowserGotoPane::GetText
       
   759 // ----------------------------------------------------------------------------
       
   760 //
       
   761 HBufC* CBrowserGotoPane::GetTextL() const
       
   762     {
       
   763     HBufC *retVal = NULL;
       
   764 
       
   765     if ( TextLength()
       
   766             || SearchTextLength()
       
   767             || iFindKeywordMode)
       
   768         {
       
   769         if ( iSearchEditor && iSearchPaneActive )
       
   770             {
       
   771             retVal = HBufC::NewL( SearchTextLength() + 1 );
       
   772             }
       
   773         else
       
   774             {
       
   775             retVal = HBufC::NewL( TextLength() + 1 );
       
   776             }
       
   777         TPtr ptr = retVal->Des();
       
   778         if ( iSearchEditor && iSearchPaneActive )
       
   779             {
       
   780             iSearchEditor->GetText( ptr );
       
   781             }
       
   782         else
       
   783             {
       
   784             iEditor->GetText( ptr );
       
   785             }
       
   786         ptr.ZeroTerminate();
       
   787         if ( !iFindKeywordMode && !iSearchPaneActive )
       
   788             {
       
   789             Util::EncodeSpaces(retVal);
       
   790             }
       
   791         }
       
   792 
       
   793     return retVal;
       
   794     }
       
   795 
       
   796 
       
   797 // ----------------------------------------------------------------------------
       
   798 // CBrowserGotoPane::SetSearchTextL
       
   799 // ----------------------------------------------------------------------------
       
   800 //
       
   801 void CBrowserGotoPane::SetSearchTextL( const TDesC& aTxt )
       
   802     {
       
   803     // for search pane, no default text
       
   804     if ( aTxt == KHttpString || aTxt == KWWWString)
       
   805         {
       
   806         iSearchEditor->SetTextL( &KNullDesC );
       
   807         }
       
   808     else
       
   809         {
       
   810         iSearchEditor->SetTextL( &aTxt );
       
   811         }
       
   812     TInt curPos = SearchTextLength();
       
   813     // Cursor to end, no selection.
       
   814     iSearchEditor->SetSelectionL( curPos, curPos );
       
   815     iSearchEditor->DrawNow();
       
   816     }
       
   817 
       
   818 // ----------------------------------------------------------------------------
       
   819 // CBrowserGotoPane::SetTextL
       
   820 // ----------------------------------------------------------------------------
       
   821 //
       
   822 void CBrowserGotoPane::SetTextL( const TDesC& aTxt )
       
   823     {
       
   824     iEditor->SetTextL( &aTxt );
       
   825     TInt curPos = TextLength();
       
   826     // Cursor to end, no selection.
       
   827     iEditor->SetSelectionL( curPos, curPos );
       
   828     iEditor->DrawNow();
       
   829     }
       
   830 
       
   831 // ----------------------------------------------------------------------------
       
   832 // CBrowserGotoPane::SelectAllL
       
   833 // ----------------------------------------------------------------------------
       
   834 //
       
   835 void CBrowserGotoPane::SelectAllL()
       
   836     {
       
   837     if ( iSearchEditor && iSearchPaneActive )
       
   838         {
       
   839         iSearchEditor->SelectAllL();
       
   840         }
       
   841     else
       
   842         {
       
   843         iEditor->SelectAllL();
       
   844         }
       
   845     }
       
   846 
       
   847 // ----------------------------------------------------------------------------
       
   848 // CBrowserGotoPane::SetInfoTextL
       
   849 // ----------------------------------------------------------------------------
       
   850 //
       
   851 void CBrowserGotoPane::SetInfoTextL( const TDesC& aText )
       
   852     {
       
   853     iInputFrame->SetInfoTextL( aText );
       
   854     }
       
   855 
       
   856 // ----------------------------------------------------------------------------
       
   857 // CBrowserGotoPane::ClipboardL
       
   858 // ----------------------------------------------------------------------------
       
   859 //
       
   860 void CBrowserGotoPane::ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc )
       
   861     {
       
   862     iEditor->ClipboardL( aClipboardFunc );
       
   863     }
       
   864 
       
   865 // ----------------------------------------------------------------------------
       
   866 // CBrowserGotoPane::Editor
       
   867 // ----------------------------------------------------------------------------
       
   868 CEikEdwin* CBrowserGotoPane::Editor() const
       
   869     {
       
   870     return iEditor;
       
   871     }
       
   872 
       
   873 // ----------------------------------------------------------------------------
       
   874 // CBrowserGotoPane::SetGPObserver
       
   875 // ----------------------------------------------------------------------------
       
   876 //
       
   877 void CBrowserGotoPane::SetGPObserver( MGotoPaneObserver* aObserver )
       
   878     {
       
   879     __ASSERT_DEBUG( !iGPObserver, \
       
   880         Util::Panic( Util::EGotoPaneObserverAlreadySet ) );
       
   881     iGPObserver = aObserver;
       
   882     }
       
   883 
       
   884 // ----------------------------------------------------------------------------
       
   885 // CBrowserKeyEventHandled::CBrowserKeyEventHandled
       
   886 // ----------------------------------------------------------------------------
       
   887 //
       
   888 CBrowserKeyEventHandled::CBrowserKeyEventHandled(
       
   889                                     CBrowserGotoPane& aGotoPane ) :
       
   890     iEnabled( EFalse )
       
   891     ,iFirstKeyEvent( ETrue )
       
   892     ,iLeftRightEvent ( EFalse )
       
   893     ,iGotoPane( aGotoPane )
       
   894     {
       
   895     }
       
   896 
       
   897 
       
   898 // ----------------------------------------------------------------------------
       
   899 // CBrowserKeyEventHandled::OfferKeyEventL
       
   900 // ----------------------------------------------------------------------------
       
   901 //
       
   902 TKeyResponse
       
   903     CBrowserKeyEventHandled::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   904                                                 TEventCode aType)
       
   905     {
       
   906     TKeyResponse response( EKeyWasNotConsumed );
       
   907     iLeftRightEvent = EFalse;
       
   908 
       
   909     if ( iEnabled && aType == EEventKey )
       
   910         {
       
   911         switch( aKeyEvent.iCode )
       
   912             {
       
   913             case    EKeyUpArrow:
       
   914             case    EKeyDownArrow:
       
   915                 {
       
   916                 iFirstKeyEvent = EFalse;
       
   917                 break;
       
   918                 }
       
   919 
       
   920             case    EKeyLeftArrow:
       
   921             case    EKeyRightArrow:
       
   922                 {
       
   923                 iFirstKeyEvent = EFalse;
       
   924                 iLeftRightEvent = ETrue;
       
   925 
       
   926                 // Below added to compensate for a weird key event situation:
       
   927                 //   For some reason the CBrowserGotoPane::OfferKeyEventL function
       
   928                 //   is not being called for an EEventKey when you press the left/right
       
   929                 //   arrows in the menupane produced to paste previously used special
       
   930                 //   chars (this is brought up by pressing the pen button on the phone).
       
   931                 //   This only happens when the cursor is in the first or last position in
       
   932                 //   the goto pane with text in it.
       
   933                 //   Therefore, in this particular scenario, we need to process the EEventKey
       
   934                 //   here since we will not be able to in CBrowserGotoPane::OfferKeyEventL
       
   935                 if (CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsFocused())
       
   936                     {
       
   937                     response = CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType );
       
   938                     }
       
   939                 break;
       
   940                 }
       
   941 
       
   942             case    EKeyBackspace:
       
   943             case    EKeyDelete:
       
   944                 {
       
   945                 if ( iFirstKeyEvent )
       
   946                     {
       
   947                     iFirstKeyEvent = EFalse;
       
   948                     iCoeEnv->SimulateKeyEventL( aKeyEvent, aType );
       
   949                     response = EKeyWasConsumed;
       
   950                     }
       
   951                 break;
       
   952                 }
       
   953 
       
   954             default:
       
   955                 {
       
   956                 if ( iFirstKeyEvent )
       
   957                     {
       
   958                     if ( TChar( aKeyEvent.iCode ).IsPrint() )
       
   959                         {
       
   960                         iFirstKeyEvent = EFalse;
       
   961                         response = EKeyWasConsumed;
       
   962                         iCoeEnv->SimulateKeyEventL( aKeyEvent, aType );
       
   963                         }
       
   964                     }
       
   965                 break;
       
   966                 }
       
   967             }
       
   968 //        CBrowserAppUi::Static()->UpdateCbaL();
       
   969         }
       
   970     return response;
       
   971     }
       
   972 
       
   973 // ----------------------------------------------------------------------------
       
   974 // CBrowserKeyEventHandled::HandleEdwinEventL
       
   975 // ----------------------------------------------------------------------------
       
   976 //
       
   977 void CBrowserKeyEventHandled::HandleEdwinEventL( CEikEdwin* /*aEdwin*/,
       
   978                                                     TEdwinEvent aEventType )
       
   979     {
       
   980     // if text changed in the editor we don't have to handle clear key anymore
       
   981     if ( aEventType == EEventTextUpdate )
       
   982         {
       
   983         iFirstKeyEvent = EFalse;
       
   984         }
       
   985     }
       
   986 
       
   987 // ----------------------------------------------------------------------------
       
   988 // CBrowserKeyEventHandled::EnableL
       
   989 // ----------------------------------------------------------------------------
       
   990 //
       
   991 void CBrowserKeyEventHandled::EnableL( TBool aEnable )
       
   992     {
       
   993     iEnabled = aEnable;
       
   994     }
       
   995 
       
   996 // ----------------------------------------------------------------------------
       
   997 // CBrowserKeyEventHandled::Reset
       
   998 // ----------------------------------------------------------------------------
       
   999 //
       
  1000 void CBrowserKeyEventHandled::Reset()
       
  1001     {
       
  1002     iFirstKeyEvent = ETrue;
       
  1003     }
       
  1004 
       
  1005 // ---------------------------------------------------------------------------
       
  1006 // CBrowserGotoPane::PopupList
       
  1007 // ---------------------------------------------------------------------------
       
  1008 //
       
  1009 CBrowserAdaptiveListPopup* CBrowserGotoPane::PopupList()
       
  1010     {
       
  1011     return iBAdaptiveListPopup;
       
  1012     }
       
  1013 // ---------------------------------------------------------------------------
       
  1014 // CBrowserGotoPane::HandleResourceChange
       
  1015 // ---------------------------------------------------------------------------
       
  1016 //
       
  1017 void CBrowserGotoPane::HandleResourceChange(
       
  1018                 TInt
       
  1019                 aType
       
  1020                 )
       
  1021     {
       
  1022     CCoeControl::HandleResourceChange( aType );
       
  1023 
       
  1024     if ( iBAdaptiveListPopup )
       
  1025         {
       
  1026         iBAdaptiveListPopup->HandleResourceChange( aType );
       
  1027         }
       
  1028     }
       
  1029 
       
  1030 // ---------------------------------------------------------------------------
       
  1031 // CBrowserGotoPane::HandleStartOfTransactionL()
       
  1032 // ---------------------------------------------------------------------------
       
  1033 //
       
  1034 void CBrowserGotoPane::HandleStartOfTransactionL()
       
  1035     {
       
  1036     }
       
  1037 
       
  1038 // ---------------------------------------------------------------------------
       
  1039 // CBrowserGotoPane::HandleCompletionOfTransactionL()
       
  1040 // ---------------------------------------------------------------------------
       
  1041 //
       
  1042 void CBrowserGotoPane::HandleCompletionOfTransactionL()
       
  1043     {
       
  1044     if ( iContentView && iFindKeywordMode && this->IsVisible() &&
       
  1045         !iContentView->MenuBar()->MenuPane()->IsVisible() )
       
  1046         {
       
  1047         if ( GetTextL() )
       
  1048             {
       
  1049             // Find the typed keyword.
       
  1050             if ( iHandleFEPFind && iPrevKeyword->Compare(GetTextL()->Des()) )
       
  1051                 {
       
  1052                 iContentView->FindKeywordL( GetTextL() );
       
  1053                 }
       
  1054             }
       
  1055         }
       
  1056     iHandleFEPFind = ETrue;
       
  1057     }
       
  1058 
       
  1059 // ----------------------------------------------------------------------------
       
  1060 // CBrowserGotoPane::ActivateVKB
       
  1061 // ----------------------------------------------------------------------------
       
  1062 void CBrowserGotoPane::ActivateVKB()
       
  1063     {
       
  1064     if ( ( iEditor && iEditor->TextView() )
       
  1065             || ( iSearchEditor && iSearchEditor->TextView()) )
       
  1066         {
       
  1067         // make sure observer is set
       
  1068         iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus();
       
  1069 
       
  1070            // simulate pointer event to force VKB
       
  1071 
       
  1072            // first get point at cursor location
       
  1073         TInt pos = 0;
       
  1074         CTextView* textView = NULL;
       
  1075         if ( iSearchEditor && iSearchPaneActive )
       
  1076             {
       
  1077             pos = iSearchEditor->CursorPos();
       
  1078             textView = iSearchEditor->TextView();
       
  1079             }
       
  1080         else
       
  1081             {
       
  1082             pos = iEditor->CursorPos();
       
  1083             textView = iEditor->TextView();
       
  1084             }
       
  1085 
       
  1086         TPoint curPos;
       
  1087         textView->DocPosToXyPosL(pos, curPos);
       
  1088 
       
  1089         TPointerEvent pe;
       
  1090         pe.iPosition = curPos;
       
  1091 
       
  1092         pe.iType = TPointerEvent::EButton1Down;
       
  1093 
       
  1094         TInt err(KErrNone);
       
  1095         if ( iSearchEditor && iSearchPaneActive )
       
  1096             {
       
  1097             TRAP(err, iSearchEditor->HandlePointerEventL(pe));
       
  1098             }
       
  1099         else
       
  1100             {
       
  1101             TRAP(err, iEditor->HandlePointerEventL(pe));
       
  1102             }
       
  1103 
       
  1104         if (err != KErrNone)
       
  1105             {
       
  1106             return;
       
  1107             }
       
  1108 
       
  1109         pe.iType = TPointerEvent::EButton1Up;
       
  1110 
       
  1111         // VKB will only activate is nothing selected
       
  1112         if ( iSearchEditor && iSearchPaneActive )
       
  1113             {
       
  1114             iSearchEditor->SetSelectionL(pos,pos);
       
  1115             TRAP_IGNORE(iSearchEditor->HandlePointerEventL(pe));
       
  1116             }
       
  1117         else
       
  1118             {
       
  1119             iEditor->SetSelectionL(pos,pos);
       
  1120             TRAP_IGNORE(iEditor->HandlePointerEventL(pe));
       
  1121             }
       
  1122 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
       
  1123         TRAP_IGNORE(SelectAllL());
       
  1124 #endif
       
  1125         }
       
  1126     }
       
  1127 
       
  1128 // ----------------------------------------------------------------------------
       
  1129 // CBrowserGotoPane::ConstructSearchPaneL
       
  1130 // ----------------------------------------------------------------------------
       
  1131 void CBrowserGotoPane::ConstructSearchPaneL()
       
  1132     {
       
  1133 
       
  1134     TFileName iconFile;
       
  1135     TInt iconId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId );
       
  1136     iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile );
       
  1137 
       
  1138     // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane.
       
  1139     // Comparing Icon File path as well, because it may be possible that two different
       
  1140     // Icon files have same icon id.
       
  1141     if ( iconId != iSearchIconId
       
  1142             || iSearchIconFilePath.Compare( iconFile ) != 0 )
       
  1143         {
       
  1144 
       
  1145         TInt iconMaskId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconMaskId );
       
  1146         // Save IconId
       
  1147         iSearchIconId = iconId;
       
  1148         // Save Icon File
       
  1149         iSearchIconFilePath = iconFile;
       
  1150 
       
  1151         // No Icon file or IconId or IconMaskId set , then it means no search provider is still
       
  1152         // selected and set by search application, in that case we use the default icon for Search.
       
  1153         if ( ! iconFile.Length()
       
  1154                 || iconId == -1
       
  1155                 || iconMaskId == -1 )
       
  1156             {
       
  1157             iconId = EMbmAvkonQgn_indi_find_glass;
       
  1158             iconMaskId = EMbmAvkonQgn_indi_find_glass_mask;
       
  1159             iconFile = KAvkonBitmapFile;
       
  1160             }
       
  1161 
       
  1162 
       
  1163         if ( iSearchEditor )
       
  1164            {
       
  1165            delete iSearchEditor;
       
  1166            iSearchEditor = NULL;
       
  1167            }
       
  1168 
       
  1169         if ( iSearchInputFrame )
       
  1170            {
       
  1171            delete iSearchInputFrame;
       
  1172            iSearchInputFrame = NULL;
       
  1173            }
       
  1174 
       
  1175 
       
  1176         // iSearchEditor != NULL, implies presence of Search Feature, which can be
       
  1177         // used to validate search feature exsistence, avoiding unecessary feature
       
  1178         // check calls and need of separate variable.
       
  1179         iSearchEditor = new (ELeave) CEikGlobalTextEditor;
       
  1180         iSearchInputFrame = CAknInputFrame::NewL(
       
  1181                 iSearchEditor,
       
  1182                 EFalse,
       
  1183                 iconFile,
       
  1184                 iconId,
       
  1185                 iconMaskId,
       
  1186                 CAknInputFrame::EPopupLayout );
       
  1187 
       
  1188         iSearchInputFrame->SetContainerWindowL( *this);
       
  1189         AknEditUtils::ConstructEditingL (   iSearchEditor,
       
  1190                                               KFavouritesMaxUrlGotoPaneDefine,
       
  1191                                               1,
       
  1192                                               EAknEditorCharactersLowerCase,
       
  1193                                               EAknEditorAlignRight,
       
  1194                                               EFalse,
       
  1195                                               ETrue,
       
  1196                                               EFalse );
       
  1197 
       
  1198         iSearchEditor->SetContainerWindowL( *this );
       
  1199         iSearchEditor->SetObserver( this );
       
  1200         iSearchEditor->SetBorder( TGulBorder::ENone );
       
  1201         iSearchEditor->SetAknEditorCase( EAknEditorLowerCase );
       
  1202         iSearchEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
       
  1203 
       
  1204         if (AVKONAPAC)
       
  1205             {
       
  1206             // Disallow chinese input.
       
  1207             iSearchEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
       
  1208                     EAknEditorNumericInputMode );
       
  1209             }
       
  1210 
       
  1211         //Search should use EAknEditorFlagDefault as search allows all types of input
       
  1212         iSearchEditor->SetAknEditorFlags
       
  1213             ( EAknEditorFlagDefault | EAknEditorFlagUseSCTNumericCharmap );
       
  1214 
       
  1215         iSearchEditor->SetAknEditorPermittedCaseModes (   EAknEditorUpperCase |
       
  1216             EAknEditorLowerCase );
       
  1217 
       
  1218         iSearchEditor->SetEdwinObserver( iGotoKeyHandled );
       
  1219         iSearchEditor->SetSkinBackgroundControlContextL(NULL);
       
  1220         iSearchEditor->MakeVisible( ETrue );
       
  1221         iSearchInputFrame->MakeVisible( ETrue );
       
  1222         // Set the default text if not active//
       
  1223         if ( ! iSearchPaneActive )
       
  1224             {
       
  1225             HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength );
       
  1226             TPtr searchProviderPtr = searchProvider->Des();
       
  1227             iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle,
       
  1228                 KMaxTitleLength , searchProviderPtr);
       
  1229             if( searchProvider->Length() == 0 )
       
  1230                 {
       
  1231                  SetSearchTextL( *iDefaultSearchText );
       
  1232                 }
       
  1233             else
       
  1234                 {
       
  1235                 SetSearchTextL( *searchProvider );
       
  1236                 delete iDefaultSearchText;
       
  1237                 iDefaultSearchText = NULL;
       
  1238                 iDefaultSearchText = searchProvider->AllocL();
       
  1239                 }
       
  1240             CleanupStack::PopAndDestroy(searchProvider);
       
  1241             }
       
  1242         iSearchInputFrame->ActivateL();
       
  1243         }
       
  1244 
       
  1245     }
       
  1246 
       
  1247 // ----------------------------------------------------------------------------
       
  1248 // CBrowserGotoPane::SetGotoPaneActive
       
  1249 // ----------------------------------------------------------------------------
       
  1250 void CBrowserGotoPane::SetGotoPaneActiveL()
       
  1251     {
       
  1252 
       
  1253     iGotoPaneActive = ETrue;
       
  1254     iSearchPaneActive = EFalse;
       
  1255 
       
  1256     if ( iSearchEditor )
       
  1257         {
       
  1258 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
  1259         iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB );
       
  1260 #endif
       
  1261         // if searchpane is empty add default text
       
  1262         if ( !SearchTextLength() )
       
  1263             {
       
  1264             HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength );
       
  1265             TPtr searchProviderPtr = searchProvider->Des();
       
  1266             iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle,
       
  1267                 KMaxTitleLength , searchProviderPtr);
       
  1268             if( searchProvider->Length() == 0 )
       
  1269                 {
       
  1270                 SetSearchTextL( *iDefaultSearchText );
       
  1271                 }
       
  1272             else
       
  1273                 {
       
  1274                 SetSearchTextL( *searchProvider );
       
  1275                 }
       
  1276             CleanupStack::PopAndDestroy(searchProvider);
       
  1277             }
       
  1278 
       
  1279         // if gotopane is empty add default text
       
  1280         if ( !TextLength() )
       
  1281             {
       
  1282             SetTextL( KWWWString );
       
  1283             }
       
  1284 
       
  1285         iSearchEditor->SetFocus( EFalse);
       
  1286         }
       
  1287 
       
  1288     iEditor->SetFocus( ETrue );
       
  1289     CBrowserAppUi::Static()->UpdateCbaL();
       
  1290     SetTextModeItalicL();
       
  1291     iEditor->SetCursorPosL(iEditor->TextLength(), EFalse);
       
  1292     DrawDeferred();
       
  1293     }
       
  1294 
       
  1295 // ----------------------------------------------------------------------------
       
  1296 // CBrowserGotoPane::SetSearchPaneActive
       
  1297 // ----------------------------------------------------------------------------
       
  1298 void CBrowserGotoPane::SetSearchPaneActiveL()
       
  1299     {
       
  1300 
       
  1301     if ( iSearchEditor )
       
  1302         {
       
  1303 #if defined(BRDO_SEARCH_INTEGRATION_FF)
       
  1304         iSearchEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB );
       
  1305 #endif
       
  1306         // if gotopane is empty add default text
       
  1307         if ( !TextLength() )
       
  1308             {
       
  1309             SetTextL( KWWWString );
       
  1310             }
       
  1311 
       
  1312         // if searchpane has default text remove it
       
  1313         HBufC* text = iSearchEditor->GetTextInHBufL();
       
  1314         if ( text )
       
  1315             {
       
  1316             CleanupStack::PushL( text );
       
  1317             if ( !text->Compare( iDefaultSearchText->Des() ) )
       
  1318                 {
       
  1319                 SetSearchTextL( KNullDesC );
       
  1320                 }
       
  1321 
       
  1322             CleanupStack::PopAndDestroy( text );
       
  1323             }
       
  1324 
       
  1325         iSearchPaneActive = ETrue;
       
  1326         iGotoPaneActive = EFalse;
       
  1327         iEditor->SetFocus( EFalse );
       
  1328         if ( iBAdaptiveListPopup )
       
  1329             iBAdaptiveListPopup->HidePopupL();
       
  1330         iSearchEditor->SetFocus( ETrue );
       
  1331         iSearchEditor->SetCursorPosL(iSearchEditor->TextLength(), EFalse);
       
  1332         CBrowserAppUi::Static()->UpdateCbaL();
       
  1333 
       
  1334         SetTextModeItalicL();
       
  1335         DrawDeferred();
       
  1336         }
       
  1337     }
       
  1338 
       
  1339 
       
  1340 // ----------------------------------------------------------------------------
       
  1341 // CBrowserBookmarksGotoPane::SetTextModeItalic
       
  1342 // ----------------------------------------------------------------------------
       
  1343 void CBrowserGotoPane::SetTextModeItalicL()
       
  1344     {
       
  1345 
       
  1346     // Editor Control is laid in a scalable way, so we need to get the correct font
       
  1347     // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips,
       
  1348     // as done above in SetTextL() but it does not provide correct fonts for editor.
       
  1349     // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it
       
  1350     // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by
       
  1351     // iInputFrame->SetRect(), which overwrites all the properties for Editor.
       
  1352     if ( iSearchEditor )
       
  1353         {
       
  1354         TAknTextComponentLayout   editorLayout;
       
  1355         TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) );
       
  1356         editorLayout    = AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 );
       
  1357         TAknTextLineLayout lineLayout = editorLayout.LayoutLine();
       
  1358         TInt fontid =  lineLayout.FontId();
       
  1359         const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid  );
       
  1360 
       
  1361         TCharFormat charFormat;
       
  1362         TCharFormatMask charFormatMask;
       
  1363         charFormat.iFontSpec = font->FontSpecInTwips();
       
  1364         charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic );
       
  1365         charFormatMask.SetAttrib(EAttFontTypeface);
       
  1366         charFormatMask.SetAttrib(EAttFontHeight);
       
  1367         charFormatMask.SetAttrib(EAttFontStrokeWeight);
       
  1368         charFormatMask.SetAttrib(EAttFontPosture);
       
  1369 
       
  1370         // Owner ship of charFormatLayer is taken by Editor
       
  1371         CCharFormatLayer* charFormatLayerItalics = NULL;
       
  1372         CCharFormatLayer* charFormatLayerUpright = NULL;
       
  1373         charFormatLayerItalics = CCharFormatLayer::NewL(charFormat,charFormatMask);
       
  1374         charFormat.iFontSpec.iFontStyle.SetPosture( EPostureUpright );
       
  1375         charFormatLayerUpright = CCharFormatLayer::NewL(charFormat,charFormatMask);
       
  1376         if ( iSearchPaneActive   )
       
  1377             {
       
  1378             iSearchEditor->SetCharFormatLayer(charFormatLayerUpright);
       
  1379             iEditor->SetCharFormatLayer(charFormatLayerItalics);
       
  1380             }
       
  1381         else
       
  1382             {
       
  1383             iSearchEditor->SetCharFormatLayer(charFormatLayerItalics);
       
  1384             iEditor->SetCharFormatLayer(charFormatLayerUpright);
       
  1385             }
       
  1386         }
       
  1387    }
       
  1388 
       
  1389 void CBrowserGotoPane::ResetPrevText()
       
  1390     {
       
  1391     iPrevKeyword->Des().SetLength(0);
       
  1392     }
       
  1393 
       
  1394 //  END OF FILE