browserui/browser/BrowserAppSrc/BrowserGotoPane.cpp
changeset 10 57d5b8e231c4
parent 0 84ad3b177aa3
child 15 e45c3f40ea5f
equal deleted inserted replaced
0:84ad3b177aa3 10:57d5b8e231c4
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description:
    15 *
    15 *
    16 *
    16 *
    17 *
    17 *
    18 */
    18 */
    19 
    19 
    33 #include <AknsListBoxBackgroundControlContext.h>
    33 #include <AknsListBoxBackgroundControlContext.h>
    34 #include <BrowserNG.rsg>
    34 #include <BrowserNG.rsg>
    35 #include <Featmgr.h>
    35 #include <Featmgr.h>
    36 #include <fepbase.h>
    36 #include <fepbase.h>
    37 #include <aknutils.h>
    37 #include <aknutils.h>
    38 
    38 #include <BrowserUiSDKCRKeys.h>
    39 #include <centralrepository.h> 
    39 
       
    40 #include <centralrepository.h>
       
    41 #include <AknLayout2ScalableDef.h>
    40 #include <AknFepInternalCRKeys.h>
    42 #include <AknFepInternalCRKeys.h>
       
    43 #include <aknlayoutfont.h>
    41 #include <PtiDefs.h>
    44 #include <PtiDefs.h>
       
    45 #include <aknlayoutscalable_avkon.cdl.h>
    42 
    46 
    43 #include "CommonConstants.h"
    47 #include "CommonConstants.h"
    44 #include "BrowserGotoPane.h"
    48 #include "BrowserGotoPane.h"
    45 #include "BrowserAppUi.h"
    49 #include "BrowserAppUi.h"
    46 #include "BrowserUtil.h"
    50 #include "BrowserUtil.h"
    49 #include "BrowserAdaptiveListPopup.h"
    53 #include "BrowserAdaptiveListPopup.h"
    50 #include "BrowserContentView.h"
    54 #include "BrowserContentView.h"
    51 
    55 
    52 #include "eikon.hrh"
    56 #include "eikon.hrh"
    53 
    57 
       
    58 #include <StringLoader.h>
       
    59 
    54 
    60 
    55 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    56 // CBrowserGotoPane::NewL
    62 // CBrowserGotoPane::NewL
    57 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    58 //
    64 //
    78 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    79 //
    85 //
    80 void CBrowserGotoPane::MakeVisibleL( TBool aVisible )
    86 void CBrowserGotoPane::MakeVisibleL( TBool aVisible )
    81     {
    87     {
    82     if ( aVisible )
    88     if ( aVisible )
    83     {
    89         {
       
    90         if ( iSearchEditor )
       
    91             {
       
    92             ConstructSearchPaneL();
       
    93             }
    84         HandleFindSizeChanged();
    94         HandleFindSizeChanged();
    85         if ( AUTOCOMP ) //ask the feature manager
    95         if ( AUTOCOMP ) //ask the feature manager
    86         {
    96         {
    87         //2.1 does not put http:// there
    97         //2.1 does not put http:// there
    88             SetTextL( KNullDesC );
    98             SetTextL( KNullDesC );
    89         }
    99         }
    90         else
   100         else
    91         {
   101         {
    92         //2.0 does put the http:// there
   102         //2.0 does put the http:// there
    93             SetTextL( KHttpString );
   103             SetTextL( KHttpString );
    94         }
   104             }
    95     }
   105         }
    96     if (AknLayoutUtils::PenEnabled())
   106     else
       
   107         {
       
   108         // Clear the search text if goto is cancelled ( hidden ).
       
   109         if ( iSearchEditor )
       
   110             {
       
   111             SetSearchTextL( KNullDesC );
       
   112             }
       
   113         }
       
   114 
       
   115     if (AknLayoutUtils::PenEnabled() &&  ( !iSearchEditor )  )
    97         {
   116         {
    98         SetPointerCapture(aVisible);
   117         SetPointerCapture(aVisible);
    99         if (aVisible)
   118         if (aVisible)
   100             {
   119             {
   101             ActivateVKB();
   120             ActivateVKB();
   104 
   123 
   105     CCoeControl::MakeVisible( aVisible );
   124     CCoeControl::MakeVisible( aVisible );
   106 
   125 
   107     iGotoKeyHandled->Reset();
   126     iGotoKeyHandled->Reset();
   108     iGotoKeyHandled->EnableL( aVisible );
   127     iGotoKeyHandled->EnableL( aVisible );
       
   128 
       
   129 
       
   130     if ( iSearchEditor )
       
   131         {
       
   132         SetTextModeItalicL();
       
   133         }
       
   134     // To avoid Flickring Effect when SearchInputFrame is
       
   135     // re-created with new search provider icon.
       
   136     DrawNow( );
       
   137 
   109     }
   138     }
   110 
   139 
   111 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   112 // CBrowserGotoPane::MakeVisible
   141 // CBrowserGotoPane::MakeVisible
   113 // ---------------------------------------------------------------------------
   142 // ---------------------------------------------------------------------------
   125     {
   154     {
   126     if (iAvkonAppUi!=NULL)
   155     if (iAvkonAppUi!=NULL)
   127         {
   156         {
   128         iAvkonAppUi->RemoveFromStack( iGotoKeyHandled );
   157         iAvkonAppUi->RemoveFromStack( iGotoKeyHandled );
   129         }
   158         }
       
   159     delete iSearchEditor;
       
   160     delete iSearchInputFrame;
       
   161 
   130     delete iGotoKeyHandled;
   162     delete iGotoKeyHandled;
   131     delete iEditor;
   163     delete iEditor;
   132     delete iInputFrame;
   164     delete iInputFrame;
   133     delete iPrevKeyword;
   165     delete iPrevKeyword;
   134     delete iBAdaptiveListPopup;
   166     delete iBAdaptiveListPopup;
       
   167     delete iDefaultSearchText;
   135     iContentView = NULL;
   168     iContentView = NULL;
   136     CCoeEnv::Static()->RemoveFepObserver(static_cast<MCoeFepObserver &>(*this));
   169     CCoeEnv::Static()->RemoveFepObserver(static_cast<MCoeFepObserver &>(*this));
   137     }
   170     }
   138 
   171 
   139 // ---------------------------------------------------------------------------
   172 // ---------------------------------------------------------------------------
   141 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   142 //
   175 //
   143 CBrowserGotoPane::CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode )
   176 CBrowserGotoPane::CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode )
   144 :   iContentView( aContentView),
   177 :   iContentView( aContentView),
   145     iFindKeywordMode( aFindKeywordMode ),
   178     iFindKeywordMode( aFindKeywordMode ),
   146     iHandleFEPFind( ETrue )
   179     iHandleFEPFind( ETrue ),
   147     ,iBAdaptiveListPopup( NULL )
   180     iBAdaptiveListPopup( NULL ),
       
   181     iGotoPaneActive( ETrue ),
       
   182     iSearchPaneActive( EFalse),
       
   183     iSearchIconId( 0 )
   148     {
   184     {
   149     }
   185     }
   150 
   186 
   151 // ---------------------------------------------------------------------------
   187 // ---------------------------------------------------------------------------
   152 // CBrowserGotoPane::ConstructL
   188 // CBrowserGotoPane::ConstructL
   195         iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
   231         iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
   196                                             EAknEditorNumericInputMode );
   232                                             EAknEditorNumericInputMode );
   197         }
   233         }
   198     TInt editorFlags =  ((iFindKeywordMode) ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) |EAknEditorFlagUseSCTNumericCharmap;
   234     TInt editorFlags =  ((iFindKeywordMode) ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) |EAknEditorFlagUseSCTNumericCharmap;
   199 #ifdef RD_INTELLIGENT_TEXT_INPUT
   235 #ifdef RD_INTELLIGENT_TEXT_INPUT
   200     TInt physicalKeyboards = 0; 
   236     TInt physicalKeyboards = 0;
   201     CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
   237     CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
   202 	User::LeaveIfNull( aknFepRepository );
   238     User::LeaveIfNull( aknFepRepository );
   203 
   239 
   204     aknFepRepository->Get( KAknFepPhysicalKeyboards,  physicalKeyboards );
   240     aknFepRepository->Get( KAknFepPhysicalKeyboards,  physicalKeyboards );
   205     delete aknFepRepository; 
   241     delete aknFepRepository;
   206         
   242 
   207 	if ( physicalKeyboards &&   EPtiKeyboardQwerty3x11 ) {
   243     if ( physicalKeyboards &&   EPtiKeyboardQwerty3x11 ) {
   208         editorFlags = (editorFlags | EAknEditorFlagNoT9);
   244         editorFlags = (editorFlags | EAknEditorFlagNoT9);
   209 	}
   245     }
   210 #endif 
   246 #endif
   211     iEditor->SetAknEditorFlags( editorFlags ); 
   247     iEditor->SetAknEditorFlags( editorFlags );
   212 
   248 
   213     iEditor->SetAknEditorPermittedCaseModes (   EAknEditorUpperCase |
   249     iEditor->SetAknEditorPermittedCaseModes (   EAknEditorUpperCase |
   214                                                 EAknEditorLowerCase );
   250                                                 EAknEditorLowerCase );
   215 
   251 
   216     iGotoKeyHandled = new (ELeave) CBrowserKeyEventHandled( *this );
   252     iGotoKeyHandled = new (ELeave) CBrowserKeyEventHandled( *this );
   218                                 ECoeStackPriorityFep + 1,
   254                                 ECoeStackPriorityFep + 1,
   219                                 ECoeStackFlagRefusesFocus );
   255                                 ECoeStackFlagRefusesFocus );
   220     iEditor->SetEdwinObserver( iGotoKeyHandled );
   256     iEditor->SetEdwinObserver( iGotoKeyHandled );
   221     iEditor->SetSkinBackgroundControlContextL(NULL);
   257     iEditor->SetSkinBackgroundControlContextL(NULL);
   222 
   258 
   223     //adaptive popuplist
   259     TBool searchFeature = iContentView->ApiProvider().Preferences().SearchFeature();
       
   260     if (  searchFeature && !iFindKeywordMode )
       
   261         {
       
   262         iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH );
       
   263         ConstructSearchPaneL();
       
   264         }
       
   265 
       
   266       //adaptive popuplist
   224     if ( aPopupListStatus && AUTOCOMP )
   267     if ( aPopupListStatus && AUTOCOMP )
   225         {
   268         {
   226         iBAdaptiveListPopup =
   269         iBAdaptiveListPopup =
   227             new (ELeave) CBrowserAdaptiveListPopup( iEditor, this, EGotoPane );
   270             new (ELeave) CBrowserAdaptiveListPopup( iEditor, this, EGotoPane, searchFeature );
   228         iBAdaptiveListPopup->ConstructL();
   271         iBAdaptiveListPopup->ConstructL();
   229         iEditor->SetObserver( iBAdaptiveListPopup );
   272         iEditor->SetObserver( iBAdaptiveListPopup );
   230         if (iContentView)
   273         if (iContentView)
   231             {
   274             {
   232             iBAdaptiveListPopup->SetUrlSuffixList(iContentView->ApiProvider().Preferences().URLSuffixList());
   275             iBAdaptiveListPopup->SetUrlSuffixList(iContentView->ApiProvider().Preferences().URLSuffixList());
   255 // CBrowserGotoPane::HandleFindSizeChanged
   298 // CBrowserGotoPane::HandleFindSizeChanged
   256 // ---------------------------------------------------------------------------
   299 // ---------------------------------------------------------------------------
   257 //
   300 //
   258 void CBrowserGotoPane::HandleFindSizeChanged()
   301 void CBrowserGotoPane::HandleFindSizeChanged()
   259     {
   302     {
   260 
       
   261     if ( !AknLayoutUtils::PenEnabled() )
   303     if ( !AknLayoutUtils::PenEnabled() )
   262         {
   304         {
   263         TRect parentrect = iAvkonAppUi->ApplicationRect();
   305         if ( iSearchEditor && !iFindKeywordMode)
   264 
   306             {
   265         TAknLayoutRect lrect;
   307             TRect clientRect = CBrowserAppUi::Static()->ClientRect();
   266         lrect.LayoutRect( parentrect,
   308             TAknWindowLineLayout findWindow = AknLayout::popup_find_window();
       
   309 
       
   310             TRect findWindowRect = AknLayoutUtils::RectFromCoords( clientRect,findWindow.il, findWindow.it,
       
   311                     findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH);
       
   312 
       
   313             // Now Increase the height of rect to make room for two editors (Goto + search)//
       
   314             findWindowRect.iTl.iY -= ( findWindow.iH  );
       
   315             SetRect( findWindowRect );
       
   316             }
       
   317         else
       
   318             {
       
   319             TRect parentrect = iAvkonAppUi->ApplicationRect();
       
   320 
       
   321             TAknLayoutRect lrect;
       
   322             lrect.LayoutRect( parentrect,
   267                         AknLayout::main_pane( CBrowserAppUi::Static()->ApplicationRect(), 0, 1, 1 )
   323                         AknLayout::main_pane( CBrowserAppUi::Static()->ApplicationRect(), 0, 1, 1 )
   268                         );
   324                         );
   269         AknLayoutUtils::LayoutControl ( this,
   325             AknLayoutUtils::LayoutControl ( this,
   270                                         lrect.Rect(),
   326                                         lrect.Rect(),
   271                                         AknLayout::popup_find_window() );
   327                                         AknLayout::popup_find_window() );
       
   328             }
   272         }
   329         }
   273     else
   330     else
   274         {
   331         {
   275         // The ClientRect() will be the application rectangle minus any
   332         // The ClientRect() will be the application rectangle minus any
   276         // toolbars/menu bars etc.
   333         // toolbars/menu bars etc.
   348 // ----------------------------------------------------------------------------
   405 // ----------------------------------------------------------------------------
   349 //
   406 //
   350 TKeyResponse CBrowserGotoPane::OfferKeyEventL
   407 TKeyResponse CBrowserGotoPane::OfferKeyEventL
   351 ( const TKeyEvent& aKeyEvent, TEventCode aType )
   408 ( const TKeyEvent& aKeyEvent, TEventCode aType )
   352     {
   409     {
   353     TKeyResponse resp;
   410     TKeyResponse resp = EKeyWasNotConsumed;
   354 
   411 
   355     if ( AknLayoutUtils::PenEnabled() &&
   412     if (    AknLayoutUtils::PenEnabled()
   356          PopupList() &&
   413          && PopupList()
   357          PopupList()->DrawableWindow()->OrdinalPosition() > 0)
   414          && PopupList()->DrawableWindow()->OrdinalPosition() > 0 )
   358         {
   415         {
   359         PopupList()->SetOrdinalPosition(0);
   416         PopupList()->SetOrdinalPosition(0);
   360         }
   417         }
   361 
   418 
   362     // Escape key event handling
   419     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )  // Escape key event handling
   363     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
       
   364         {
   420         {
   365         CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
   421         CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
   366         if ( PopupList() )
   422         if ( PopupList() )
   367             {
   423             {
   368             PopupList()->SetDirectoryModeL( ETrue );
   424             PopupList()->SetDirectoryModeL( ETrue );
   369             PopupList()->HidePopupL();
   425             PopupList()->HidePopupL();
   370             }
   426             }
   371 
   427         MakeVisible( EFalse );                                  // Hide Goto pane
   372         // Hide Goto pane
       
   373         MakeVisible( EFalse );
       
   374         SetFocus( EFalse );
   428         SetFocus( EFalse );
   375         // should set the focus of container to ETrue...how?
   429         resp = EKeyWasConsumed;                                 // should set the focus of container to ETrue...how?
   376         resp = EKeyWasConsumed;
       
   377         }
   430         }
   378 
   431 
   379     if ( iFindKeywordMode )
   432     if ( iFindKeywordMode )
   380         {
   433         {
   381         if ( iContentView->MenuBar()->MenuPane()->IsVisible() )
   434         if ( iContentView->MenuBar()->MenuPane()->IsVisible() )
   382             {
   435             {
   383             return iContentView->MenuBar()->MenuPane()->OfferKeyEventL(  aKeyEvent, aType );
   436             return iContentView->MenuBar()->MenuPane()->OfferKeyEventL(  aKeyEvent, aType );
   384             }
   437             }
   385         else
   438         else
   386             {
   439             {
   387             // Handle up and down arow keys to search for
   440             if ( aType == EEventKey )                           // Handle up and down arow keys to search for
   388             // next and previous keywords.
   441                 {                                               //   next and previous keywords.
   389             if ( aType == EEventKey )
   442 
   390                 {
       
   391                 if (    aKeyEvent.iCode == EKeyLeftUpArrow      // Northwest
   443                 if (    aKeyEvent.iCode == EKeyLeftUpArrow      // Northwest
   392                      || aKeyEvent.iCode == EStdKeyDevice10      //   : Extra KeyEvent supports diagonal event simulator wedge
   444                      || aKeyEvent.iCode == EStdKeyDevice10      //   : Extra KeyEvent supports diagonal event simulator wedge
   393                      || aKeyEvent.iCode == EKeyUpArrow          // North
   445                      || aKeyEvent.iCode == EKeyUpArrow          // North
   394                      || aKeyEvent.iCode == EKeyRightUpArrow     // Northeast
   446                      || aKeyEvent.iCode == EKeyRightUpArrow     // Northeast
   395                      || aKeyEvent.iCode == EStdKeyDevice11 )    //   : Extra KeyEvent supports diagonal event simulator wedge
   447                      || aKeyEvent.iCode == EStdKeyDevice11 )    //   : Extra KeyEvent supports diagonal event simulator wedge
   396                     {
   448                     {                                           // Any of those? If so, then...
   397                     // Find previous keyword
   449                     iContentView->FindKeywordL( NULL, EFalse ); // Find previous keyword
   398                     iContentView->FindKeywordL( NULL, EFalse );
   450                     iHandleFEPFind = EFalse;                    //   :
   399                     iHandleFEPFind = EFalse;
   451                     return EKeyWasConsumed;                     // And that consumes the key
   400                     return EKeyWasConsumed;
   452                     }
   401                     }
   453 
   402                 if (    aKeyEvent.iCode == EKeyLeftDownArrow    // Southwest
   454                 if (    aKeyEvent.iCode == EKeyLeftDownArrow    // Southwest
   403                      || aKeyEvent.iCode == EStdKeyDevice13      //   : Extra KeyEvent supports diagonal event simulator wedge
   455                      || aKeyEvent.iCode == EStdKeyDevice13      //   : Extra KeyEvent supports diagonal event simulator wedge
   404                      || aKeyEvent.iCode == EKeyDownArrow        // South
   456                      || aKeyEvent.iCode == EKeyDownArrow        // South
   405                      || aKeyEvent.iCode == EKeyRightDownArrow   // Southeast
   457                      || aKeyEvent.iCode == EKeyRightDownArrow   // Southeast
   406                      || aKeyEvent.iCode == EStdKeyDevice12 )    //   : Extra KeyEvent supports diagonal event simulator wedge
   458                      || aKeyEvent.iCode == EStdKeyDevice12 )    //   : Extra KeyEvent supports diagonal event simulator wedge
   407                     {
   459                     {                                           // Any of those? If so, then...
   408                     // Find next keyword
   460                     iContentView->FindKeywordL( NULL, ETrue );  // Find next keyword
   409                     iContentView->FindKeywordL( NULL, ETrue );
   461                     iHandleFEPFind = EFalse;                    //   :
   410                     iHandleFEPFind = EFalse;
   462                     return EKeyWasConsumed;                     // And that consumes the key
   411                     return EKeyWasConsumed;
   463                     }
   412                     }
   464 
   413                 if ( aKeyEvent.iCode == EKeyDevice3 )
   465                 if ( aKeyEvent.iCode == EKeyDevice3 )           // Select key?
   414                     {
   466                     {                                           // If so, then...
   415                     // ignore select key
   467                     return EKeyWasConsumed;                     // Ignore select key
   416                     return EKeyWasConsumed;
   468                     }
   417                     }
   469 
   418                 }
   470                 }
   419             return iEditor->OfferKeyEventL( aKeyEvent, aType );
   471             return iEditor->OfferKeyEventL( aKeyEvent, aType );  // Otherwise, just pass the key on to the editor
   420             }
   472             }
   421         }
   473         }
   422     else
   474 
   423         {
   475     else                                                        // *NOT* iFindKeywordMode
       
   476         {
       
   477 
       
   478         if (    aKeyEvent.iCode == EKeyRightUpArrow             // Northeast
       
   479              || aKeyEvent.iCode == EStdKeyDevice11              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   480              || aKeyEvent.iCode == EKeyRightDownArrow           // Southeast
       
   481              || aKeyEvent.iCode == EStdKeyDevice12              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   482              || aKeyEvent.iCode == EKeyLeftDownArrow            // Southwest
       
   483              || aKeyEvent.iCode == EStdKeyDevice13              //   : Extra KeyEvent supports diagonal event simulator wedge
       
   484              || aKeyEvent.iCode == EKeyLeftUpArrow              // Northwest
       
   485              || aKeyEvent.iCode == EStdKeyDevice10 )            //   : Extra KeyEvent supports diagonal event simulator wedge
       
   486             {                                                   // Any of those? If so, then...
       
   487             return EKeyWasConsumed;                             // Ignore diagonal navigation events here
       
   488             }
       
   489 
   424         if ( (aKeyEvent.iCode == EKeyOK ) && iGPObserver && IsFocused() )
   490         if ( (aKeyEvent.iCode == EKeyOK ) && iGPObserver && IsFocused() )
   425             {
   491             {
   426             if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() )
   492             if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() )
   427                 {
   493                 {
   428                 return CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType );
   494                 return CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType );
   429                 }
   495                 }
   430             else
   496             else
   431                 {
   497                 {
   432                 // If there is an observer and we have the focus, enter key is
       
   433                 // consumed and observer is notified.
       
   434                 iGPObserver->HandleGotoPaneEventL
   498                 iGPObserver->HandleGotoPaneEventL
   435                                 ( this, MGotoPaneObserver::EEventEnterKeyPressed );
   499                                 ( this, MGotoPaneObserver::EEventEnterKeyPressed );
   436                 return EKeyWasConsumed;
   500                 return EKeyWasConsumed;                         // If there is an observer and we have the focus,
   437                 }
   501 		}                                               //   enter key is consumed and observer is notified.
   438             }
   502             }
   439         // For touch UI, handle enter key from VKB as a "GOTO"
   503 
   440         else if (AknLayoutUtils::PenEnabled() && aKeyEvent.iCode == EKeyEnter)
   504         else if (AknLayoutUtils::PenEnabled() && aKeyEvent.iCode == EKeyEnter)
   441             {
   505             {                                                   // For touch UI, handle enter key from VKB as a "GOTO"
   442             CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo);
   506             CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo);
   443             return EKeyWasConsumed;
   507             return EKeyWasConsumed;
   444             }
   508             }
   445 
   509 
   446         resp = iEditor->OfferKeyEventL( aKeyEvent, aType );
   510         if ( iSearchEditor && iSearchPaneActive )
       
   511             {
       
   512             resp = iSearchEditor->OfferKeyEventL( aKeyEvent, aType );
       
   513             }
       
   514         else
       
   515             {
       
   516             resp = iEditor->OfferKeyEventL( aKeyEvent, aType );
       
   517             }
   447 
   518 
   448         if ((iBAdaptiveListPopup ) && (resp != EKeyWasConsumed))
   519         if ((iBAdaptiveListPopup ) && (resp != EKeyWasConsumed))
   449             {
   520           {
   450             resp = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType );
   521           resp = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType );
   451             }
   522           }
   452         return resp;
   523 
   453         }
   524 
       
   525         if ( iSearchEditor )
       
   526             {
       
   527             if (    ( iGotoPaneActive || iSearchPaneActive)
       
   528                  && (resp != EKeyWasConsumed) )
       
   529                 {
       
   530 
       
   531                 if (  aKeyEvent.iCode == EKeyUpArrow )
       
   532                     {
       
   533                     resp = EKeyWasConsumed;
       
   534                     if ( iSearchPaneActive )
       
   535                         {
       
   536                         SetGotoPaneActiveL();
       
   537                         iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB );
       
   538                         }
       
   539                     }
       
   540                 if ( aKeyEvent.iCode == EKeyDownArrow )
       
   541                     {
       
   542                     resp = EKeyWasConsumed;
       
   543                     if ( iGotoPaneActive )
       
   544                         {
       
   545                         SetSearchPaneActiveL();
       
   546                         iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB );
       
   547                         }
       
   548                     }
       
   549                 }
       
   550             }
       
   551         }
       
   552 
       
   553     return resp;
       
   554 
   454     }
   555     }
   455 
   556 
   456 // ----------------------------------------------------------------------------
   557 // ----------------------------------------------------------------------------
   457 // CBrowserGotoPane::HandlePointerEventL
   558 // CBrowserGotoPane::HandlePointerEventL
   458 // ----------------------------------------------------------------------------
   559 // ----------------------------------------------------------------------------
   466 
   567 
   467     // ponter is in goto pane
   568     // ponter is in goto pane
   468     if (Rect().Contains(aPointerEvent.iPosition))
   569     if (Rect().Contains(aPointerEvent.iPosition))
   469         {
   570         {
   470         iGotoKeyHandled->EnableL(ETrue);
   571         iGotoKeyHandled->EnableL(ETrue);
   471         iEditor->HandlePointerEventL(aPointerEvent);
   572         // If search feature exists, check and route to appropriate editor //
       
   573         if ( iSearchEditor  )
       
   574             {
       
   575             if ( iSearchInputFrame->Rect().Contains(aPointerEvent.iPosition))
       
   576                 {
       
   577                 if ( iSearchPaneActive )
       
   578                     {
       
   579                     iSearchEditor->HandlePointerEventL(aPointerEvent);
       
   580                     }
       
   581                 else
       
   582                     {
       
   583                     SetSearchPaneActiveL();
       
   584                     }
       
   585                 iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB);
       
   586                 }
       
   587             else
       
   588                 {
       
   589                 if ( iGotoPaneActive )
       
   590                     {
       
   591                     iEditor->HandlePointerEventL(aPointerEvent);
       
   592                     }
       
   593                 else
       
   594                     {
       
   595                     SetGotoPaneActiveL();
       
   596                     }
       
   597                 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB);
       
   598                 }
       
   599             }
       
   600         else
       
   601             {
       
   602             iEditor->HandlePointerEventL(aPointerEvent);
       
   603             }
   472         iGotoKeyHandled->SetFirstKeyEvent(EFalse);
   604         iGotoKeyHandled->SetFirstKeyEvent(EFalse);
   473         }
   605         }
   474     else
   606     else
   475         {
   607         {
   476         // pointer outside of control
   608         // pointer outside of control
   482 // CBrowserGotoPane::CountComponentControls
   614 // CBrowserGotoPane::CountComponentControls
   483 // ----------------------------------------------------------------------------
   615 // ----------------------------------------------------------------------------
   484 //
   616 //
   485 TInt CBrowserGotoPane::CountComponentControls() const
   617 TInt CBrowserGotoPane::CountComponentControls() const
   486     {
   618     {
       
   619     if ( iSearchEditor && !iFindKeywordMode )
       
   620         {
       
   621         return 4; // iEditor, input frame, SearchEditor and Searchinput frame.
       
   622         }
   487     return 2;   // iEditor and input frame
   623     return 2;   // iEditor and input frame
   488     }
   624     }
   489 
   625 
   490 // ----------------------------------------------------------------------------
   626 // ----------------------------------------------------------------------------
   491 // CBrowserGotoPane::ComponentControl
   627 // CBrowserGotoPane::ComponentControl
   501             }
   637             }
   502         case 1:
   638         case 1:
   503             {
   639             {
   504             return iEditor;
   640             return iEditor;
   505             }
   641             }
       
   642         case 2:
       
   643             {
       
   644             return iSearchInputFrame;
       
   645             }
       
   646         case 3:
       
   647             {
       
   648             return iSearchEditor;
       
   649             }
       
   650 
   506         default:
   651         default:
   507             return NULL;
   652             return NULL;
   508         }
   653         }
   509     }
   654     }
   510 
   655 
   512 // CBrowserGotoPane::SizeChanged
   657 // CBrowserGotoPane::SizeChanged
   513 // ----------------------------------------------------------------------------
   658 // ----------------------------------------------------------------------------
   514 //
   659 //
   515 void CBrowserGotoPane::SizeChanged()
   660 void CBrowserGotoPane::SizeChanged()
   516     {
   661     {
   517     iInputFrame->SetRect( Rect() );
   662     if (iSearchEditor && !iFindKeywordMode )
       
   663         {
       
   664         // We need height and width of FindWindow
       
   665         TAknWindowLineLayout findWindow = AknLayout::popup_find_window();
       
   666         TRect findWindowRect = AknLayoutUtils::RectFromCoords( Rect(), findWindow.il,
       
   667                 findWindow.it, findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH);
       
   668 
       
   669         TSize gotoSize( findWindowRect.Size() );
       
   670         TRect gotoRect( TPoint( 0,0 ), gotoSize );
       
   671         iInputFrame->SetRect( gotoRect );
       
   672 
       
   673         // Now set SearchPane right below GoTo pane //
       
   674         TRect searchRect( TPoint( 0, gotoRect.iBr.iY ), gotoSize );
       
   675         iSearchInputFrame->SetRect( searchRect );
       
   676         }
       
   677     else
       
   678         {
       
   679         iInputFrame->SetRect( Rect() );
       
   680         }
   518     }
   681     }
   519 
   682 
   520 // ----------------------------------------------------------------------------
   683 // ----------------------------------------------------------------------------
   521 // CBrowserGotoPane::FocusChanged
   684 // CBrowserGotoPane::FocusChanged
   522 // ----------------------------------------------------------------------------
   685 // ----------------------------------------------------------------------------
   524 void CBrowserGotoPane::FocusChanged( TDrawNow aDrawNow )
   687 void CBrowserGotoPane::FocusChanged( TDrawNow aDrawNow )
   525     {
   688     {
   526     // this is a workaround
   689     // this is a workaround
   527     TRAP_IGNORE( iGotoKeyHandled->EnableL( IsFocused() ) );
   690     TRAP_IGNORE( iGotoKeyHandled->EnableL( IsFocused() ) );
   528     CCoeControl::FocusChanged( aDrawNow );
   691     CCoeControl::FocusChanged( aDrawNow );
   529     iEditor->SetFocus( IsFocused() );
   692     if ( iGotoPaneActive )
   530     }
   693         {
       
   694         iEditor->SetFocus( IsFocused() );
       
   695         }
       
   696     else if ( iSearchEditor && !iFindKeywordMode && iSearchPaneActive )
       
   697         {
       
   698         iSearchEditor->SetFocus( IsFocused() );
       
   699         }
       
   700     }
       
   701 
       
   702 
   531 
   703 
   532 // ----------------------------------------------------------------------------
   704 // ----------------------------------------------------------------------------
   533 // CBrowserGotoPane::TextLength
   705 // CBrowserGotoPane::TextLength
   534 // ----------------------------------------------------------------------------
   706 // ----------------------------------------------------------------------------
   535 //
   707 //
       
   708 TInt CBrowserGotoPane::SearchTextLength() const
       
   709     {
       
   710     TInt len = 0;
       
   711     if ( iSearchEditor )
       
   712         {
       
   713         len = iSearchEditor->TextLength();
       
   714         }
       
   715     return len;
       
   716     }
       
   717 
       
   718 // ----------------------------------------------------------------------------
       
   719 // CBrowserGotoPane::TextLength
       
   720 // ----------------------------------------------------------------------------
       
   721 //
   536 TInt CBrowserGotoPane::TextLength() const
   722 TInt CBrowserGotoPane::TextLength() const
   537     {
   723     {
   538     return iEditor->TextLength();
   724     return iEditor->TextLength();
   539     }
   725     }
   540 
   726 
   544 //
   730 //
   545 HBufC* CBrowserGotoPane::GetTextL() const
   731 HBufC* CBrowserGotoPane::GetTextL() const
   546     {
   732     {
   547     HBufC *retVal = NULL;
   733     HBufC *retVal = NULL;
   548 
   734 
   549     if ( TextLength() || iFindKeywordMode)
   735     if ( TextLength()
   550         {
   736             || SearchTextLength()
   551         retVal = HBufC::NewL( TextLength() + 1 );
   737             || iFindKeywordMode)
       
   738         {
       
   739         if ( iSearchEditor && iSearchPaneActive )
       
   740             {
       
   741             retVal = HBufC::NewL( SearchTextLength() + 1 );
       
   742             }
       
   743         else
       
   744             {
       
   745             retVal = HBufC::NewL( TextLength() + 1 );
       
   746             }
   552         TPtr ptr = retVal->Des();
   747         TPtr ptr = retVal->Des();
   553         iEditor->GetText( ptr );
   748         if ( iSearchEditor && iSearchPaneActive )
       
   749             {
       
   750             iSearchEditor->GetText( ptr );
       
   751             }
       
   752         else
       
   753             {
       
   754             iEditor->GetText( ptr );
       
   755             }
   554         ptr.ZeroTerminate();
   756         ptr.ZeroTerminate();
   555         if (!iFindKeywordMode)
   757         if ( !iFindKeywordMode && !iSearchPaneActive )
   556            Util::EncodeSpaces(retVal);
   758             {
   557 
   759             Util::EncodeSpaces(retVal);
       
   760             }
   558         }
   761         }
   559 
   762 
   560     return retVal;
   763     return retVal;
       
   764     }
       
   765 
       
   766 
       
   767 // ----------------------------------------------------------------------------
       
   768 // CBrowserGotoPane::SetSearchTextL
       
   769 // ----------------------------------------------------------------------------
       
   770 //
       
   771 void CBrowserGotoPane::SetSearchTextL( const TDesC& aTxt )
       
   772     {
       
   773     // for search pane, no default text
       
   774     if ( aTxt == KHttpString || aTxt == KWWWString)
       
   775         {
       
   776         iSearchEditor->SetTextL( &KNullDesC );
       
   777         }
       
   778     else
       
   779         {
       
   780         iSearchEditor->SetTextL( &aTxt );
       
   781         }
       
   782     TInt curPos = SearchTextLength();
       
   783     // Cursor to end, no selection.
       
   784     iSearchEditor->SetSelectionL( curPos, curPos );
       
   785     iSearchEditor->DrawNow();
   561     }
   786     }
   562 
   787 
   563 // ----------------------------------------------------------------------------
   788 // ----------------------------------------------------------------------------
   564 // CBrowserGotoPane::SetTextL
   789 // CBrowserGotoPane::SetTextL
   565 // ----------------------------------------------------------------------------
   790 // ----------------------------------------------------------------------------
   577 // CBrowserGotoPane::SelectAllL
   802 // CBrowserGotoPane::SelectAllL
   578 // ----------------------------------------------------------------------------
   803 // ----------------------------------------------------------------------------
   579 //
   804 //
   580 void CBrowserGotoPane::SelectAllL()
   805 void CBrowserGotoPane::SelectAllL()
   581     {
   806     {
   582     iEditor->SelectAllL();
   807     if ( iSearchEditor && iSearchPaneActive )
       
   808         {
       
   809         iSearchEditor->SelectAllL();
       
   810         }
       
   811     else
       
   812         {
       
   813         iEditor->SelectAllL();
       
   814         }
   583     }
   815     }
   584 
   816 
   585 // ----------------------------------------------------------------------------
   817 // ----------------------------------------------------------------------------
   586 // CBrowserGotoPane::SetInfoTextL
   818 // CBrowserGotoPane::SetInfoTextL
   587 // ----------------------------------------------------------------------------
   819 // ----------------------------------------------------------------------------
   797 // ----------------------------------------------------------------------------
  1029 // ----------------------------------------------------------------------------
   798 // CBrowserGotoPane::ActivateVKB
  1030 // CBrowserGotoPane::ActivateVKB
   799 // ----------------------------------------------------------------------------
  1031 // ----------------------------------------------------------------------------
   800 void CBrowserGotoPane::ActivateVKB()
  1032 void CBrowserGotoPane::ActivateVKB()
   801     {
  1033     {
   802     if (iEditor && iEditor->TextView())
  1034     if ( ( iEditor && iEditor->TextView() )
       
  1035             || ( iSearchEditor && iSearchEditor->TextView()) )
   803         {
  1036         {
   804         // make sure observer is set
  1037         // make sure observer is set
   805         iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus();
  1038         iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus();
   806 
  1039 
   807         // simulate pointer event to force VKB
  1040            // simulate pointer event to force VKB
   808 
  1041 
   809         // first get point at cursor location
  1042            // first get point at cursor location
   810         TInt pos = iEditor->CursorPos();
  1043         TInt pos = 0;
   811         CTextView* textView = iEditor->TextView();
  1044         CTextView* textView = NULL;
       
  1045         if ( iSearchEditor && iSearchPaneActive )
       
  1046             {
       
  1047             pos = iSearchEditor->CursorPos();
       
  1048             textView = iSearchEditor->TextView();
       
  1049             }
       
  1050         else
       
  1051             {
       
  1052             pos = iEditor->CursorPos();
       
  1053             textView = iEditor->TextView();
       
  1054             }
       
  1055 
   812         TPoint curPos;
  1056         TPoint curPos;
   813         textView->DocPosToXyPosL(pos, curPos);
  1057         textView->DocPosToXyPosL(pos, curPos);
   814 
  1058 
   815         TPointerEvent pe;
  1059         TPointerEvent pe;
   816         pe.iPosition = curPos;
  1060         pe.iPosition = curPos;
   817 
  1061 
   818         pe.iType = TPointerEvent::EButton1Down;
  1062         pe.iType = TPointerEvent::EButton1Down;
       
  1063 
   819         TInt err(KErrNone);
  1064         TInt err(KErrNone);
   820         TRAP(err, iEditor->HandlePointerEventL(pe));
  1065         if ( iSearchEditor && iSearchPaneActive )
       
  1066             {
       
  1067             TRAP(err, iSearchEditor->HandlePointerEventL(pe));
       
  1068             }
       
  1069         else
       
  1070             {
       
  1071             TRAP(err, iEditor->HandlePointerEventL(pe));
       
  1072             }
       
  1073 
   821         if (err != KErrNone)
  1074         if (err != KErrNone)
   822             {
  1075             {
   823             return;
  1076             return;
   824             }
  1077             }
   825 
  1078 
       
  1079         pe.iType = TPointerEvent::EButton1Up;
       
  1080 
   826         // VKB will only activate is nothing selected
  1081         // VKB will only activate is nothing selected
   827         iEditor->SetSelectionL(pos,pos);
  1082         if ( iSearchEditor && iSearchPaneActive )
   828 
  1083             {
   829         pe.iType = TPointerEvent::EButton1Up;
  1084             iSearchEditor->SetSelectionL(pos,pos);
   830         if (KErrNone == err)
  1085             TRAP_IGNORE(iSearchEditor->HandlePointerEventL(pe));
       
  1086             }
       
  1087         else
       
  1088             {
       
  1089             iEditor->SetSelectionL(pos,pos);
       
  1090             TRAP_IGNORE(iEditor->HandlePointerEventL(pe));
       
  1091             }
       
  1092         }
       
  1093     }
       
  1094 
       
  1095 // ----------------------------------------------------------------------------
       
  1096 // CBrowserGotoPane::ConstructSearchPaneL
       
  1097 // ----------------------------------------------------------------------------
       
  1098 void CBrowserGotoPane::ConstructSearchPaneL()
       
  1099     {
       
  1100 
       
  1101     TFileName iconFile;
       
  1102     TInt iconId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId );
       
  1103     iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile );
       
  1104 
       
  1105     // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane.
       
  1106     // Comparing Icon File path as well, because it may be possible that two different
       
  1107     // Icon files have same icon id.
       
  1108     if ( iconId != iSearchIconId
       
  1109             || iSearchIconFilePath.Compare( iconFile ) != 0 )
       
  1110         {
       
  1111 
       
  1112         TInt iconMaskId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconMaskId );
       
  1113         // Save IconId
       
  1114         iSearchIconId = iconId;
       
  1115         // Save Icon File
       
  1116         iSearchIconFilePath = iconFile;
       
  1117 
       
  1118         // No Icon file or IconId or IconMaskId set , then it means no search provider is still
       
  1119         // selected and set by search application, in that case we use the default icon for Search.
       
  1120         if ( ! iconFile.Length()
       
  1121                 || iconId == -1
       
  1122                 || iconMaskId == -1 )
       
  1123             {
       
  1124             iconId = EMbmAvkonQgn_indi_find_glass;
       
  1125             iconMaskId = EMbmAvkonQgn_indi_find_glass_mask;
       
  1126             iconFile = KAvkonBitmapFile;
       
  1127             }
       
  1128 
       
  1129 
       
  1130         if ( iSearchEditor )
   831            {
  1131            {
   832            TRAP_IGNORE(iEditor->HandlePointerEventL(pe));
  1132            delete iSearchEditor;
       
  1133            iSearchEditor = NULL;
   833            }
  1134            }
   834         }
  1135 
   835     }
  1136         if ( iSearchInputFrame )
       
  1137            {
       
  1138            delete iSearchInputFrame;
       
  1139            iSearchInputFrame = NULL;
       
  1140            }
       
  1141 
       
  1142 
       
  1143         // iSearchEditor != NULL, implies presence of Search Feature, which can be
       
  1144         // used to validate search feature exsistence, avoiding unecessary feature
       
  1145         // check calls and need of separate variable.
       
  1146         iSearchEditor = new (ELeave) CEikGlobalTextEditor;
       
  1147         iSearchInputFrame = CAknInputFrame::NewL(
       
  1148                 iSearchEditor,
       
  1149                 EFalse,
       
  1150                 iconFile,
       
  1151                 iconId,
       
  1152                 iconMaskId,
       
  1153                 CAknInputFrame::EPopupLayout );
       
  1154 
       
  1155         iSearchInputFrame->SetContainerWindowL( *this);
       
  1156         AknEditUtils::ConstructEditingL (   iSearchEditor,
       
  1157                                               KFavouritesMaxUrlGotoPaneDefine,
       
  1158                                               1,
       
  1159                                               EAknEditorCharactersLowerCase,
       
  1160                                               EAknEditorAlignRight,
       
  1161                                               EFalse,
       
  1162                                               ETrue,
       
  1163                                               EFalse );
       
  1164 
       
  1165         iSearchEditor->SetContainerWindowL( *this );
       
  1166         iSearchEditor->SetObserver( this );
       
  1167         iSearchEditor->SetBorder( TGulBorder::ENone );
       
  1168         iSearchEditor->SetAknEditorCase( EAknEditorLowerCase );
       
  1169         iSearchEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
       
  1170 
       
  1171         if (AVKONAPAC)
       
  1172             {
       
  1173             // Disallow chinese input.
       
  1174             iSearchEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
       
  1175                     EAknEditorNumericInputMode );
       
  1176             }
       
  1177 
       
  1178         //Search should use EAknEditorFlagDefault as search allows all types of input
       
  1179         iSearchEditor->SetAknEditorFlags
       
  1180             ( EAknEditorFlagDefault | EAknEditorFlagUseSCTNumericCharmap );
       
  1181 
       
  1182         iSearchEditor->SetAknEditorPermittedCaseModes (   EAknEditorUpperCase |
       
  1183             EAknEditorLowerCase );
       
  1184 
       
  1185         iSearchEditor->SetEdwinObserver( iGotoKeyHandled );
       
  1186         iSearchEditor->SetSkinBackgroundControlContextL(NULL);
       
  1187         iSearchEditor->MakeVisible( ETrue );
       
  1188         iSearchInputFrame->MakeVisible( ETrue );
       
  1189         // Set the default text if not active//
       
  1190         if ( ! iSearchPaneActive )
       
  1191             {
       
  1192             SetSearchTextL( *iDefaultSearchText );
       
  1193             }
       
  1194         iSearchInputFrame->ActivateL();
       
  1195         }
       
  1196 
       
  1197     }
       
  1198 
       
  1199 // ----------------------------------------------------------------------------
       
  1200 // CBrowserGotoPane::SetGotoPaneActive
       
  1201 // ----------------------------------------------------------------------------
       
  1202 void CBrowserGotoPane::SetGotoPaneActiveL()
       
  1203     {
       
  1204 
       
  1205     iGotoPaneActive = ETrue;
       
  1206     iSearchPaneActive = EFalse;
       
  1207 
       
  1208     if ( iSearchEditor )
       
  1209         {
       
  1210         iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB );
       
  1211         // if searchpane is empty add default text
       
  1212         if ( !SearchTextLength() )
       
  1213             {
       
  1214             SetSearchTextL( *iDefaultSearchText );
       
  1215             }
       
  1216 
       
  1217         // if gotopane is empty add default text
       
  1218         if ( !TextLength() )
       
  1219             {
       
  1220             SetTextL( KWWWString );
       
  1221             }
       
  1222 
       
  1223         iSearchEditor->SetFocus( EFalse);
       
  1224         }
       
  1225 
       
  1226     iEditor->SetFocus( ETrue );
       
  1227     CBrowserAppUi::Static()->UpdateCbaL();
       
  1228     SetTextModeItalicL();
       
  1229     iEditor->SetCursorPosL(iEditor->TextLength(), EFalse);
       
  1230     DrawDeferred();
       
  1231     }
       
  1232 
       
  1233 // ----------------------------------------------------------------------------
       
  1234 // CBrowserGotoPane::SetSearchPaneActive
       
  1235 // ----------------------------------------------------------------------------
       
  1236 void CBrowserGotoPane::SetSearchPaneActiveL()
       
  1237     {
       
  1238 
       
  1239     if ( iSearchEditor )
       
  1240         {
       
  1241         iSearchEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB );
       
  1242         // if gotopane is empty add default text
       
  1243         if ( !TextLength() )
       
  1244             {
       
  1245             SetTextL( KWWWString );
       
  1246             }
       
  1247 
       
  1248         // if searchpane has default text remove it
       
  1249         HBufC* text = iSearchEditor->GetTextInHBufL();
       
  1250         if ( text )
       
  1251             {
       
  1252             CleanupStack::PushL( text );
       
  1253             if ( !text->Compare( iDefaultSearchText->Des() ) )
       
  1254                 {
       
  1255                 SetSearchTextL( KNullDesC );
       
  1256                 }
       
  1257 
       
  1258             CleanupStack::PopAndDestroy( text );
       
  1259             }
       
  1260 
       
  1261         iSearchPaneActive = ETrue;
       
  1262         iGotoPaneActive = EFalse;
       
  1263         iEditor->SetFocus( EFalse );
       
  1264         if ( iBAdaptiveListPopup )
       
  1265             iBAdaptiveListPopup->HidePopupL();
       
  1266         iSearchEditor->SetFocus( ETrue );
       
  1267         iSearchEditor->SetCursorPosL(iSearchEditor->TextLength(), EFalse);
       
  1268         CBrowserAppUi::Static()->UpdateCbaL();
       
  1269 
       
  1270         SetTextModeItalicL();
       
  1271         DrawDeferred();
       
  1272         }
       
  1273     }
       
  1274 
       
  1275 
       
  1276 // ----------------------------------------------------------------------------
       
  1277 // CBrowserBookmarksGotoPane::SetTextModeItalic
       
  1278 // ----------------------------------------------------------------------------
       
  1279 void CBrowserGotoPane::SetTextModeItalicL()
       
  1280     {
       
  1281 
       
  1282     // Editor Control is laid in a scalable way, so we need to get the correct font
       
  1283     // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips,
       
  1284     // as done above in SetTextL() but it does not provide correct fonts for editor.
       
  1285     // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it
       
  1286     // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by
       
  1287     // iInputFrame->SetRect(), which overwrites all the properties for Editor.
       
  1288     if ( iSearchEditor )
       
  1289         {
       
  1290         TAknTextComponentLayout   editorLayout;
       
  1291         TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) );
       
  1292         editorLayout    = AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 );
       
  1293         TAknTextLineLayout lineLayout = editorLayout.LayoutLine();
       
  1294         TInt fontid =  lineLayout.FontId();
       
  1295         const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid  );
       
  1296 
       
  1297         TCharFormat charFormat;
       
  1298         TCharFormatMask charFormatMask;
       
  1299         charFormat.iFontSpec = font->FontSpecInTwips();
       
  1300         charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic );
       
  1301         charFormatMask.SetAttrib(EAttFontTypeface);
       
  1302         charFormatMask.SetAttrib(EAttFontHeight);
       
  1303         charFormatMask.SetAttrib(EAttFontStrokeWeight);
       
  1304         charFormatMask.SetAttrib(EAttFontPosture);
       
  1305 
       
  1306         // Owner ship of charFormatLayer is taken by Editor
       
  1307         CCharFormatLayer* charFormatLayerItalics = NULL;
       
  1308         CCharFormatLayer* charFormatLayerUpright = NULL;
       
  1309         charFormatLayerItalics = CCharFormatLayer::NewL(charFormat,charFormatMask);
       
  1310         charFormat.iFontSpec.iFontStyle.SetPosture( EPostureUpright );
       
  1311         charFormatLayerUpright = CCharFormatLayer::NewL(charFormat,charFormatMask);
       
  1312         if ( iSearchPaneActive   )
       
  1313             {
       
  1314             iSearchEditor->SetCharFormatLayer(charFormatLayerUpright);
       
  1315             iEditor->SetCharFormatLayer(charFormatLayerItalics);
       
  1316             }
       
  1317         else
       
  1318             {
       
  1319             iSearchEditor->SetCharFormatLayer(charFormatLayerItalics);
       
  1320             iEditor->SetCharFormatLayer(charFormatLayerUpright);
       
  1321             }
       
  1322         }
       
  1323    }
       
  1324 
   836 
  1325 
   837 //  END OF FILE
  1326 //  END OF FILE