browserui/browser/FavouritesSrc/BrowserAdaptiveListPopup.cpp
changeset 0 84ad3b177aa3
child 1 57d5b8e231c4
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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 *       Implementation of CBrowserPopupList and CBrowserAdaptiveListPopup
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include  <e32std.h>
       
    24 #include <AknPopup.h>
       
    25 #include <AknListQueryDialog.h>
       
    26 #include <AknIconArray.h>
       
    27 #include "RecentUrlStore.h"
       
    28 #include <AknsUtils.h>
       
    29 #include <AknsListBoxBackgroundControlContext.h>
       
    30 #include <AppApacLayout.cdl.h>
       
    31 #include <AppLayout.cdl.h>
       
    32 #include <AknLayout.cdl.h>
       
    33 #include <SkinLayout.cdl.h>
       
    34 #include <AknLayout2ScalableDef.h>
       
    35 #include <AknLayoutScalable_Avkon.cdl.h>
       
    36 #include <AknLayoutScalable_Apps.cdl.h>
       
    37 #include <LayoutMetaData.cdl.h>
       
    38 #include <AknEnv.h>
       
    39 #include <aknsdrawutils.h>
       
    40 #include <browser.mbg>
       
    41 #include "BrowserContentView.h"
       
    42 #include "BrowserAdaptiveListPopup.h"
       
    43 #include "BrowserAppUi.h"
       
    44 #include "CommonConstants.h"
       
    45 #include "BrowserAppViewBase.h"
       
    46 #include <data_caging_path_literals.hrh>
       
    47 
       
    48 #include "eikon.hrh"
       
    49 
       
    50 
       
    51 // CONSTANTS
       
    52 const TInt KMaxIcons = 2;
       
    53 const TInt KListLengthToShow = 64;//the length of the string in the list
       
    54 _LIT( KItemTab, "1\t");//prefix for items
       
    55 _LIT( KDirTab, "0\t");//prefix for directories
       
    56 const TInt KArrayGranularity = 10;
       
    57 _LIT( KProtocolIdentifier,"://" );
       
    58 const TUint KSlash('/');
       
    59 const TUint KPeriod('.');
       
    60 
       
    61 static void TextPos(TPoint *aResultArray, const TAknTextLineLayout
       
    62 &aLayout, TSize aItemSize)
       
    63     {
       
    64     TRect itemRect(TPoint(0,0), aItemSize);
       
    65     TAknLayoutText textLayout;
       
    66     textLayout.LayoutText(itemRect, aLayout);
       
    67     aResultArray[0] = textLayout.TextRect().iTl;
       
    68     aResultArray[1] = textLayout.TextRect().iTl +
       
    69 textLayout.TextRect().Size();
       
    70     }
       
    71 
       
    72 static void GfxPos(TPoint *aResultArray, const TAknWindowLineLayout
       
    73 &aLayout, TSize aItemSize)
       
    74     {
       
    75     TRect itemRect(TPoint(0,0), aItemSize);
       
    76     TAknLayoutRect layout;
       
    77     layout.LayoutRect(itemRect, aLayout);
       
    78     aResultArray[0] = layout.Rect().iTl;
       
    79     aResultArray[1] = layout.Rect().iTl + layout.Rect().Size();
       
    80     }
       
    81 
       
    82 TSize ListBoxItemSize(CEikListBox &aListBox, CFormattedCellListBoxItemDrawer *aItemDrawer)
       
    83     {
       
    84     TSize size = TSize( aItemDrawer->LafItemSize().iWidth, aListBox.View()->ItemSize().iHeight );
       
    85     return size;
       
    86     }
       
    87 
       
    88 // ================= MEMBER FUNCTIONS =======================
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CBrowserPopupList::CBrowserPopupList()
       
    92 //
       
    93 // ---------------------------------------------------------
       
    94 //
       
    95 CBrowserPopupList::CBrowserPopupList(TParentType aParentType):CAknSingleGraphicPopupMenuStyleListBox()
       
    96     {
       
    97     iParentType = aParentType;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CBrowserPopupList::~CBrowserPopupList()
       
   102 //
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 CBrowserPopupList::~CBrowserPopupList()
       
   106     {
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------
       
   110 // CBrowserPopupList::ConstructL
       
   111 //
       
   112 // ---------------------------------------------------------
       
   113 //
       
   114 void CBrowserPopupList::ConstructL(const CCoeControl* aParent, TInt aFlags)
       
   115     {
       
   116     CAknSingleGraphicPopupMenuStyleListBox::ConstructL( aParent, aFlags);
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------
       
   120 // CBrowserPopupList::SetHighLight
       
   121 // Sets the highlight of the list
       
   122 // ---------------------------------------------------------
       
   123 //
       
   124 void CBrowserPopupList::SetHighLight(TBool aHighLight)
       
   125     {
       
   126     iListBoxFlags = ( aHighLight ?  iListBoxFlags &~ CEikListBox::EDisableHighlight : iListBoxFlags | CEikListBox::EDisableHighlight );
       
   127     if ( aHighLight )
       
   128         {
       
   129         iItemDrawer->ClearFlags( CListItemDrawer::EDisableHighlight );
       
   130         }
       
   131     else
       
   132         {
       
   133         iItemDrawer->SetFlags( CListItemDrawer::EDisableHighlight );
       
   134         }
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------
       
   138 // CBrowserPopupList::HighLightEnabled()
       
   139 // Enables the highlight in the list
       
   140 // ---------------------------------------------------------
       
   141 //
       
   142 TBool CBrowserPopupList::HighLightEnabled()
       
   143     {
       
   144     return !( iItemDrawer->Flags() & CListItemDrawer::EDisableHighlight );
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------
       
   148 // CBrowserPopupList::SizeChanged()
       
   149 // sets the inner layout
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 void CBrowserPopupList::SizeChanged()
       
   153     {
       
   154     CAknSingleGraphicPopupMenuStyleListBox::SizeChanged();
       
   155     TAknWindowLineLayout windowLineLayout;
       
   156     TAknWindowLineLayout windowLineLayoutTmp;
       
   157     TAknWindowLineLayout windowLineLayoutTmp2;
       
   158     TAknLayoutRect layoutRect;
       
   159     TPoint area[2] ;
       
   160     TRgb color;
       
   161     CEikFormattedCellListBox &aListBox = *this;
       
   162     CFormattedCellListBoxItemDrawer *itemDrawer = aListBox.ItemDrawer();
       
   163     AknListBoxLayouts::SetupStandardListBox(aListBox);
       
   164 
       
   165     AknListBoxLayouts::SetupListboxPos( aListBox, AppLayout::list_single_graphic_popup_wml_pane( 0 ));
       
   166 
       
   167     GfxPos(area,
       
   168     AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_g1(),
       
   169     ListBoxItemSize(*this, ItemDrawer()) );
       
   170 
       
   171     AknListBoxLayouts::SetupFormGfxCell(aListBox,
       
   172                                         itemDrawer,
       
   173                                         0,
       
   174                                         AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_g2(),
       
   175                                         area[0],
       
   176                                         area[1]);
       
   177 
       
   178     //sets the rectangle of the text
       
   179     TextPos(area,
       
   180     AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_t1( ),
       
   181     ListBoxItemSize(*this, ItemDrawer()) );
       
   182     AknListBoxLayouts::SetupFormAntiFlickerTextCell(aListBox,
       
   183                                                     itemDrawer,
       
   184                                                     1,
       
   185                                                     AknLayoutScalable_Apps::list_single_graphic_popup_wml_pane_t1( ),
       
   186                                                     area[0],
       
   187                                                     area[1]);
       
   188     }
       
   189 
       
   190 // ---------------------------------------------------------
       
   191 // CBrowserPopupList::Draw()
       
   192 // ---------------------------------------------------------
       
   193 //
       
   194 void CBrowserPopupList::Draw(const TRect& /*aRect*/) const
       
   195     {
       
   196     TRect windowRect = this->Rect();
       
   197     CEikFormattedCellListBox::Draw( windowRect );
       
   198     return;
       
   199     }
       
   200 
       
   201 
       
   202 // ================= CBrowserAdaptiveListPopup =======================
       
   203 
       
   204 
       
   205 // ---------------------------------------------------------
       
   206 // CBrowserAdaptiveListPopup::CBrowserAdaptiveListPopup()
       
   207 // ---------------------------------------------------------
       
   208 //
       
   209 CBrowserAdaptiveListPopup::CBrowserAdaptiveListPopup( CEikEdwin* aGotoPaneEdit, CCoeControl* aParent, TParentType aParentType):
       
   210     iEditor( aGotoPaneEdit ), iParent( aParent ), iParentType( aParentType )
       
   211     {
       
   212     iTouchSupported = AknLayoutUtils::PenEnabled();
       
   213     }
       
   214 
       
   215 // ---------------------------------------------------------
       
   216 // CBrowserAdaptiveListPopup::ConstructL(const TRect& aRect)
       
   217 // EPOC two-phased constructor
       
   218 // ---------------------------------------------------------
       
   219 void CBrowserAdaptiveListPopup::ConstructL( )
       
   220     {
       
   221     CreateWindowL();
       
   222 //-------- list ------
       
   223     iList = new(ELeave) CBrowserPopupList( iParentType );
       
   224     iList->ConstructL( this , CEikListBox::ELeftDownInViewRect );
       
   225     iList->SetContainerWindowL( *this );
       
   226     if (iTouchSupported)
       
   227         {
       
   228         iList->SetListBoxObserver( this );
       
   229         }
       
   230     iList->CreateScrollBarFrameL( ETrue );
       
   231     iList->SetMopParent(iParent);
       
   232     iList->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   233                                 CEikScrollBarFrame::EOff,
       
   234                                 CEikScrollBarFrame::EAuto);
       
   235     iList->ScrollBarFrame()->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
       
   236     iList->UpdateScrollBarsL();
       
   237     iList->SetBorder(TGulBorder::ESingleBlack);
       
   238     iList->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
       
   239 //---------- items storing arrays ---------
       
   240     iItems = new(ELeave) CDesCArrayFlat(KArrayGranularity);
       
   241     iItemNames = new(ELeave) CDesCArrayFlat(KArrayGranularity);
       
   242     iItemNamesToShow = new(ELeave) CDesCArrayFlat(KArrayGranularity);
       
   243 //---------- model ----------
       
   244     CTextListBoxModel* model = iList->Model();
       
   245     model->SetItemTextArray( iItemNamesToShow );
       
   246     model->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   247 //---------- icons -----------
       
   248     SetIconsL();
       
   249 //--------- other --------
       
   250     iFirstGotoContent = KNullDesC().AllocL();
       
   251     iPrevGotoContent = KNullDesC().AllocL();
       
   252     iPoppedUp = EFalse;
       
   253     iDirectoryMode = ETrue;
       
   254     iOpenCBA=EFalse;
       
   255     iItemDrawer = iList->ItemDrawer();
       
   256     iPrevItem = -2;
       
   257     iUrlCompletionMode = EFalse;
       
   258     iRecentUrlStore = CBrowserAppUi::Static()->RecentUrlStore();
       
   259     if (!iRecentUrlStore)
       
   260         {
       
   261         User::Leave(KErrCouldNotConnect);
       
   262         }
       
   263 
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------
       
   267 // CBrowserAdaptiveListPopup::~CBrowserAdaptiveListPopup()
       
   268 // Destructor
       
   269 // ---------------------------------------------------------
       
   270 CBrowserAdaptiveListPopup::~CBrowserAdaptiveListPopup()
       
   271     {
       
   272     delete iList;
       
   273     delete iItems;
       
   274     delete iItemNames;
       
   275     delete iItemNamesToShow;
       
   276     delete iPrevGotoContent;
       
   277     delete iFirstGotoContent;
       
   278 }
       
   279 
       
   280 // ---------------------------------------------------------
       
   281 // CBrowserAdaptiveListPopup::SetOrdinalPosition
       
   282 // ---------------------------------------------------------
       
   283 //
       
   284 void CBrowserAdaptiveListPopup::SetOrdinalPosition( TInt aPos )
       
   285     {
       
   286     Window().SetOrdinalPosition( aPos );
       
   287     }
       
   288 
       
   289 void CBrowserAdaptiveListPopup::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   290     {
       
   291     if (iList && iTouchSupported)
       
   292         {
       
   293         TInt idx = iList->CurrentItemIndex();
       
   294 
       
   295         //the first time
       
   296         if ( !iList->HighLightEnabled() )
       
   297             {
       
   298             iList->SetHighLight( ETrue );
       
   299 
       
   300             //save the original content
       
   301             if ( iFirstGotoContent != NULL )
       
   302                 {
       
   303                 delete iFirstGotoContent;
       
   304                 iFirstGotoContent = NULL;
       
   305                 }
       
   306             iFirstGotoContent = iEditor->GetTextInHBufL();
       
   307             if ( iFirstGotoContent == NULL )
       
   308                 {
       
   309                 iFirstGotoContent = KNullDesC().AllocL();
       
   310                 }
       
   311             }
       
   312 
       
   313         //using ComponentControl(0) instead of iList because need access to a
       
   314         //protected function
       
   315         ComponentControl(0)->HandlePointerEventL( aPointerEvent );
       
   316         TInt idx2 = iList->CurrentItemIndex();
       
   317         if ((idx2 != idx) || (idx == 0)) // 0 is pre-selected
       
   318             {
       
   319             idx2 = iItems->Count() - idx2 - 1;
       
   320             TPtrC16 item;
       
   321             TPtrC rightSide;
       
   322             item.Set( (*iItems)[ idx2 ] );
       
   323             //cut the slash from the end if needed
       
   324             //permanent sollution until AHLE does not
       
   325             //solve this problem related to ID: TMCN-5TTRXV error
       
   326             if ( item[item.Length() - 1] != KSlash )
       
   327                 {
       
   328                 rightSide.Set( item.Left( item.Length() ) );
       
   329                 }
       
   330             else
       
   331                 {
       
   332                 rightSide.Set( item.Left( item.Length() - 1 ) );
       
   333                 }
       
   334 
       
   335             //if true then append the suffix(rightSide), to the
       
   336             //user-typed data
       
   337             //else just use the recent URLs text(rightSide) only
       
   338             if ( iUrlCompletionMode )
       
   339                 {
       
   340                 HBufC* currentCompletion = HBufC::NewLC(
       
   341                     iFirstGotoContent->Des().Length() + rightSide.Length() + 1 );
       
   342                 TPtr currentCompletionPtr = currentCompletion->Des();
       
   343 
       
   344                 currentCompletionPtr.Copy( iFirstGotoContent->Des() );
       
   345                 currentCompletionPtr.Append( rightSide );
       
   346                 currentCompletionPtr.ZeroTerminate();
       
   347                 iEditor->SetTextL( currentCompletion );
       
   348                 iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse );
       
   349                 CleanupStack::PopAndDestroy( currentCompletion );
       
   350                 }
       
   351             else
       
   352                 {
       
   353                 iEditor->SetTextL( &rightSide );
       
   354                 iEditor->SetCursorPosL( rightSide.Length(), EFalse );
       
   355                 }
       
   356             iEditor->HandleTextChangedL();
       
   357 
       
   358             delete iPrevGotoContent;
       
   359             iPrevGotoContent = NULL;
       
   360             iPrevGotoContent = item.AllocL();
       
   361             iEditor->DrawNow();
       
   362             //change the CBA depending on whether the highlight is
       
   363             //on url or domain
       
   364             CBrowserAppUi::Static()->UpdateCbaL();
       
   365             }
       
   366         }
       
   367     }
       
   368 
       
   369 void CBrowserAdaptiveListPopup::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType)
       
   370     {
       
   371     if (iList && aListBox == iList && iTouchSupported)
       
   372         {
       
   373         switch (aEventType)
       
   374             {
       
   375             case MEikListBoxObserver::EEventItemDoubleClicked:
       
   376                 {
       
   377                 TKeyEvent keyEvent;
       
   378                 keyEvent.iModifiers = 0;
       
   379                 keyEvent.iRepeats = 0;
       
   380                 keyEvent.iCode = EKeyDevice3;
       
   381                 keyEvent.iScanCode = EStdKeyDevice3;
       
   382                 if ( iParentType == EBookmarksGotoPane )
       
   383                     {
       
   384                     CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyDown );
       
   385                     }
       
   386                 CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKey );
       
   387                 if ( iParentType == EBookmarksGotoPane )
       
   388                     {
       
   389                     CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyUp );
       
   390                     }
       
   391                 }
       
   392                 break;
       
   393             default:
       
   394                 break;
       
   395             }
       
   396         }
       
   397     }
       
   398 
       
   399 //------------------------------------------------------------------
       
   400 // CBrowserAdaptiveListPopup::ShowSingleItemPopupListWithGraphicsL(TBool aShowTitle)
       
   401 // shows "List pane for single item with graphic"
       
   402 //------------------------------------------------------------------
       
   403 void CBrowserAdaptiveListPopup::ShowPopupListL(TBool aRelayout)
       
   404     {
       
   405     TAknWindowLineLayout windowLineLayout;
       
   406     TAknWindowLineLayout windowLineLayoutTmp;
       
   407     TAknWindowLineLayout windowLineLayoutMain;
       
   408     TAknWindowLineLayout windowLineLayoutMainTmp;
       
   409     TAknWindowLineLayout windowLineLayoutLW;
       
   410     TAknWindowLineLayout windowLineLayoutLWTmp;
       
   411     TAknWindowLineLayout windowLineLayoutSLW;
       
   412     TAknWindowLineLayout windowLineLayoutSLWTmp;
       
   413     TAknLayoutRect layoutRect;
       
   414     TAknLayoutRect layoutMainRect;
       
   415     TAknLayoutRect layoutLWRect;
       
   416     TAknLayoutRect layoutSLWRect;
       
   417 
       
   418     //turn of the highlight
       
   419     iList->SetHighLight( EFalse );
       
   420     //clear arrays
       
   421     iItems->Reset();
       
   422     iItemNames->Reset();
       
   423     iItemNamesToShow->Reset();
       
   424 
       
   425     TInt offset;
       
   426     HBufC* newText;
       
   427     //get create and get the string from the edit field
       
   428     if ( iEditor->TextLength() > 0 )
       
   429         {
       
   430         newText = iEditor->GetTextInHBufL();
       
   431         CleanupStack::PushL( newText );
       
   432         //cut the protokolidentifier from the string
       
   433         offset = newText->Find( KProtocolIdentifier );
       
   434         if ( offset == KErrNotFound )
       
   435             {
       
   436             offset = newText->Length();
       
   437             }
       
   438         else
       
   439             {
       
   440             offset = newText->Length() - offset - 3;
       
   441             }
       
   442         }
       
   443     else
       
   444         {
       
   445              offset = 0;
       
   446              newText = KNullDesC().AllocLC();
       
   447         }
       
   448     TPtrC trimmedContent( newText->Right( offset ) );
       
   449     TBuf<KListLengthToShow> buf;
       
   450 
       
   451     //find out if the user typed a ".", if so, bring up the url completion list
       
   452     TInt periodPos = trimmedContent.LocateReverse( TChar(KPeriod) );
       
   453     if ((periodPos != KErrNotFound) && ((periodPos + 1) == trimmedContent.Length()))
       
   454         {
       
   455         //add the url completion entries to the popup list
       
   456         iUrlCompletionMode = ETrue;
       
   457         CreateURLCompletionListL();
       
   458         }
       
   459     else
       
   460         {
       
   461         iUrlCompletionMode = EFalse;
       
   462         //only include recent URLs if not including the url completion items
       
   463         iRecentUrlStore->GetData( *iItems, *iItemNames, trimmedContent );
       
   464         }
       
   465     iDirectoryMode = EFalse;
       
   466     CleanupStack::PopAndDestroy();//newText
       
   467     TInt k;
       
   468     k = iItems->Count();
       
   469     iItemNo = k;
       
   470     TInt length = KListLengthToShow - 2;
       
   471     if ( k > 0 )
       
   472         {
       
   473         TInt j;
       
   474         TPtrC textToShow;
       
   475         TPtrC itemJ;
       
   476         //changeing the order
       
   477         for (j=k-1; j>-1; j--)
       
   478             {
       
   479             itemJ.Set( (*iItems)[j] );
       
   480             textToShow.Set( itemJ.Left( length ) );
       
   481             if ( iDirectoryMode )
       
   482                 {
       
   483             //directories and items
       
   484                 if ( itemJ[ itemJ.Length() - 1 ] == KSlash )
       
   485                     {
       
   486                 //item
       
   487                     buf.Format( _L( "%S%S" ), &KItemTab, &textToShow );
       
   488                     }
       
   489                 else
       
   490                     {
       
   491                     //directory
       
   492                     buf.Format( _L( "%S%S" ), &KDirTab, &textToShow );
       
   493                     }
       
   494                 }
       
   495             else
       
   496                 {
       
   497             //items only
       
   498                 buf.Format( _L( "%S%S" ), &KItemTab, &textToShow );
       
   499                 }
       
   500             iItemNamesToShow->AppendL( buf );
       
   501             }
       
   502         //set how many item will be shown
       
   503         TInt itemstoshow;
       
   504 
       
   505         if ( k >  iMaxRecentUrlsToShow)
       
   506             {
       
   507             itemstoshow = iMaxRecentUrlsToShow;
       
   508             }
       
   509         else
       
   510             {
       
   511             itemstoshow = k;
       
   512             }
       
   513 
       
   514         //set the main rect of the window
       
   515         // fixing bug RFON-7E2PPV, don't use ApplicationRect()
       
   516         TRect  rect;
       
   517         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
       
   518         windowLineLayoutMain = AknLayout::main_pane( rect, 0, 2, 1 );
       
   519         windowLineLayoutMainTmp = windowLineLayoutMain;
       
   520         layoutMainRect.LayoutRect( rect, windowLineLayoutMainTmp );
       
   521 
       
   522         if ( iParentType == EBookmarksGotoPane )
       
   523         {
       
   524             windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow );
       
   525         }
       
   526         else
       
   527         {
       
   528             windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow );
       
   529         }
       
   530         windowLineLayoutLWTmp = windowLineLayoutLW;
       
   531         layoutLWRect.LayoutRect( layoutMainRect.Rect(), windowLineLayoutLWTmp );
       
   532         windowLineLayoutSLW = AknLayoutScalable_Apps::listscroll_popup_wml_pane();
       
   533         windowLineLayoutSLWTmp = windowLineLayoutSLW;
       
   534         layoutSLWRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutSLWTmp );
       
   535         windowLineLayout = AppLayout::list_wml_pane( itemstoshow - 1 );
       
   536         windowLineLayoutTmp = windowLineLayout;
       
   537         layoutRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutTmp );
       
   538 
       
   539         TRect rectTemp(layoutSLWRect.Rect());
       
   540         // force listbox on top of goto pane
       
   541         rectTemp.iBr.iY = iParent->PositionRelativeToScreen().iY;
       
   542         rectTemp.iTl.iX = iParent->PositionRelativeToScreen().iX;
       
   543         // shrink list box to size of list
       
   544         rectTemp.iTl.iY =  rectTemp.iBr.iY - (AppLayout::list_single_graphic_popup_wml_pane( 0 ).iH * itemstoshow);
       
   545         // set bottom right x axis to full width
       
   546         rectTemp.iBr.iX = rect.iBr.iX;
       
   547         
       
   548         // we only want to call SetRect() when we have a relayout, otherwise just
       
   549         // scroll the list to the correct position. Doing this will reduce the amount
       
   550         // of flicker seen while typing into the gotopane
       
   551         if ((rectTemp.Size() != Rect().Size()) || aRelayout)
       
   552             {
       
   553             //set the window rect
       
   554             SetRect( rectTemp );
       
   555             }
       
   556         rectTemp = TRect( 0, 0, Rect().Width(), Rect().Height() );
       
   557         if ( rectTemp!=iList->Rect() )
       
   558             {
       
   559             //set the rect of the list
       
   560             iList->SetRect( rectTemp );
       
   561             }
       
   562         else
       
   563             {
       
   564             // this scrolls list to the correct position, probably still does too much work
       
   565             AknListBoxLayouts::SetupListboxPos( *iList, AppLayout::list_single_graphic_popup_wml_pane( 0 ));
       
   566             }
       
   567         //the last item is visible
       
   568         iList->ScrollToMakeItemVisible( iList->Model()->NumberOfItems()-1 );
       
   569         MakeVisible( ETrue );
       
   570         iPoppedUp = ETrue;
       
   571         DrawNow();
       
   572         iList->Draw(rectTemp);
       
   573         }
       
   574     else
       
   575         {
       
   576         MakeVisible( EFalse );
       
   577         iPoppedUp = EFalse;
       
   578         CBrowserAppUi::Static()->UpdateCbaL();
       
   579         }
       
   580     if (!IsActivated())
       
   581         {
       
   582         ActivateL();
       
   583         }
       
   584     iPrevItem = -2;
       
   585     }
       
   586 
       
   587 // ---------------------------------------------------------
       
   588 // CBrowserAdaptiveListPopup::CreateURLCompletionListL
       
   589 // ---------------------------------------------------------
       
   590 //
       
   591 void CBrowserAdaptiveListPopup::CreateURLCompletionListL()
       
   592     {
       
   593     _LIT(KSeparator, ",");
       
   594 
       
   595     if (iUrlSuffixBuf)
       
   596         {
       
   597         TPtrC urlSuffix(iUrlSuffixBuf->Des());
       
   598         TInt index(urlSuffix.FindF(KSeparator));
       
   599         TInt offset = 0;
       
   600 
       
   601         while (index != KErrNotFound)
       
   602             {
       
   603             // Omit empty string
       
   604             if (index > 0)
       
   605                 {
       
   606                 iItems->AppendL( urlSuffix.Mid(offset,index) );
       
   607                 }
       
   608 
       
   609             offset += (index + 1);
       
   610             TPtrC remainder(urlSuffix.Mid(offset));
       
   611             index = remainder.FindF(KSeparator);
       
   612             }
       
   613 
       
   614         // Cover the cases where we only have one suffix in the list and/or
       
   615         // the last suffix in the list does not have a comma
       
   616         if (offset < urlSuffix.Length())
       
   617             {
       
   618             TPtrC remainderB(urlSuffix.Mid(offset, urlSuffix.Length() - offset));
       
   619             iItems->AppendL( remainderB );
       
   620             }
       
   621         }
       
   622     }
       
   623 
       
   624 // ---------------------------------------------------------
       
   625 // CBrowserAdaptiveListPopup::HandleControlEventL
       
   626 // if the content of the edit box changes
       
   627 // ---------------------------------------------------------
       
   628 //
       
   629 void CBrowserAdaptiveListPopup::HandleControlEventL(CCoeControl* aControl,enum MCoeControlObserver::TCoeEvent aEventType)
       
   630     {
       
   631     CEikEdwin* edwin = ( CEikEdwin* )aControl;
       
   632     // the content of the edit box changes
       
   633     if ( MCoeControlObserver::EEventStateChanged == aEventType )
       
   634         {
       
   635         HBufC* newText = edwin->GetTextInHBufL();
       
   636         if (!newText)
       
   637             {
       
   638             newText = KNullDesC().AllocL();
       
   639             }
       
   640         CleanupStack::PushL( newText );
       
   641         //check whether the last content is different to the one in the editbox
       
   642         if ( !iPrevGotoContent || iPrevGotoContent->Compare( *newText ) )
       
   643             {
       
   644             ShowPopupListL();
       
   645             delete iPrevGotoContent;
       
   646             iPrevGotoContent = NULL;
       
   647             iPrevGotoContent = newText;
       
   648             CleanupStack::Pop( newText );//ownership is taken
       
   649             }
       
   650         else
       
   651             {
       
   652             if ( !iPrevGotoContent )
       
   653                 {
       
   654                 CleanupStack::PopAndDestroy( newText );
       
   655                 }
       
   656             else
       
   657                 {
       
   658                 ShowPopupListL();
       
   659                 delete iPrevGotoContent;
       
   660                 iPrevGotoContent = NULL;
       
   661                 iPrevGotoContent = newText;
       
   662                 CleanupStack::Pop( newText );//ownership is taken
       
   663                 }
       
   664             }
       
   665         //change the CBA
       
   666         if ( iOpenCBA )
       
   667             {
       
   668             iOpenCBA = EFalse;
       
   669             CBrowserAppUi::Static()->UpdateCbaL();
       
   670             }
       
   671         }
       
   672     }
       
   673 
       
   674 // ---------------------------------------------------------
       
   675 // CBrowserAdaptiveListPopup::CountComponentControls
       
   676 //
       
   677 // ---------------------------------------------------------
       
   678 //
       
   679 TInt CBrowserAdaptiveListPopup::CountComponentControls() const
       
   680     {
       
   681     if ( iList == NULL )
       
   682         {
       
   683         return 0;
       
   684         }
       
   685     return 1;
       
   686     }
       
   687 
       
   688 // ---------------------------------------------------------
       
   689 // CBrowserAdaptiveListPopup::ComponentControl
       
   690 //
       
   691 // ---------------------------------------------------------
       
   692 //
       
   693 CCoeControl* CBrowserAdaptiveListPopup::ComponentControl(TInt aIndex) const
       
   694     {
       
   695     if (aIndex==0)
       
   696         {
       
   697         return iList;
       
   698         }
       
   699     else
       
   700         {
       
   701         return NULL;
       
   702         }
       
   703     }
       
   704 
       
   705 // ---------------------------------------------------------
       
   706 // CBrowserAdaptiveListPopup::OfferKeyEventL
       
   707 // Handles key events
       
   708 // ---------------------------------------------------------
       
   709 //
       
   710 TKeyResponse CBrowserAdaptiveListPopup::OfferKeyEventL
       
   711 ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   712     {
       
   713     TKeyResponse resp = EKeyWasNotConsumed;
       
   714     if (( iPoppedUp &&
       
   715     !CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() &&
       
   716     (CBrowserAppUi::Static()->LastActiveViewId() == KUidBrowserContentViewId) ) || (( iPoppedUp ) &&
       
   717     (CBrowserAppUi::Static()->LastActiveViewId() != KUidBrowserContentViewId)))
       
   718         {
       
   719         TInt currIndex = iItems->Count() - iList->CurrentItemIndex() - 1;
       
   720 
       
   721         //the joystick is pressed
       
   722         if ( aKeyEvent.iCode == EKeyOK )
       
   723             {
       
   724             if ( ( iList->HighLightEnabled() )
       
   725               && ( iDirectoryMode )
       
   726               && ( (*iItems)[ currIndex ][(*iItems)[ currIndex ].Length() - 1] != KSlash ) )
       
   727                 {
       
   728                 SetDirectoryModeL( EFalse );
       
   729                 resp = EKeyWasConsumed;
       
   730                 }
       
   731             else
       
   732                 {
       
   733                 if (iEditor->TextLength()!=0)
       
   734                     {
       
   735                     HidePopupL();
       
   736                     }
       
   737                 }
       
   738             }
       
   739 
       
   740         //the joystick is pressed up
       
   741         else if (    aKeyEvent.iCode == EKeyLeftUpArrow      // Northwest
       
   742                   || aKeyEvent.iCode == EStdKeyDevice10      //   : Extra KeyEvent supports diagonal event simulator wedge
       
   743                   || aKeyEvent.iCode == EKeyUpArrow          // North
       
   744                   || aKeyEvent.iCode == EKeyRightUpArrow     // Northeast
       
   745                   || aKeyEvent.iCode == EStdKeyDevice11 )    //   : Extra KeyEvent supports diagonal event simulator wedge
       
   746             {
       
   747             resp = EKeyWasConsumed;
       
   748             //the first time
       
   749             if ( !iList->HighLightEnabled() )
       
   750                 {
       
   751                 iList->SetHighLight( ETrue );
       
   752                 currIndex = iList->Model()->NumberOfItems()-1;
       
   753                 iList->ScrollToMakeItemVisible( currIndex );
       
   754                 iList->SetCurrentItemIndex( currIndex );
       
   755                 DrawNow();
       
   756                 //save the original content
       
   757                 if ( iFirstGotoContent != NULL )
       
   758                     {
       
   759                     delete iFirstGotoContent;
       
   760                     iFirstGotoContent = NULL;
       
   761                     }
       
   762                 iFirstGotoContent = iEditor->GetTextInHBufL();
       
   763                 if (iFirstGotoContent == NULL)
       
   764                     {
       
   765                     iFirstGotoContent = KNullDesC().AllocL();
       
   766                     }
       
   767                 }
       
   768             else
       
   769                 {
       
   770                 resp=iList->OfferKeyEventL( aKeyEvent, aType );
       
   771                 }
       
   772             if ( currIndex > -1 )
       
   773                 {
       
   774                 //copy the selected item to edit field
       
   775                 TPtrC16 item;
       
   776                 TPtrC rightSide;
       
   777                 TInt newIndex;
       
   778                 newIndex = iItems->Count() - iList->CurrentItemIndex() - 1;
       
   779                 item.Set( (*iItems)[ newIndex ] );
       
   780                 //cut the slash from the end if needed
       
   781                 //permanent sollution until AHLE does not
       
   782                 //solve this problem related to ID: TMCN-5TTRXV error
       
   783 
       
   784                 //if URL completion, then we want to append the item to the item in the edit field
       
   785                 if (iUrlCompletionMode)
       
   786                     {
       
   787                     TPtr16 ptr = iFirstGotoContent->Des();
       
   788 
       
   789                     HBufC* buf = HBufC::NewLC(ptr.Length() + item.Length() + 1);
       
   790 
       
   791                     buf->Des().Copy(ptr);
       
   792                     buf->Des().Append(item);
       
   793                     buf->Des().ZeroTerminate();
       
   794 
       
   795 
       
   796                     rightSide.Set(buf->Des());
       
   797 
       
   798                     iEditor->SetTextL( &rightSide );
       
   799                     iEditor->SetCursorPosL( rightSide.Length(), EFalse );
       
   800 
       
   801                     CleanupStack::PopAndDestroy(); //buf
       
   802                     }
       
   803                 else
       
   804                     {
       
   805                     if ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash )
       
   806                         {
       
   807                         rightSide.Set( item.Left( item.Length() ) );
       
   808                         }
       
   809                     else
       
   810                         {
       
   811                         rightSide.Set( item.Left( item.Length() - 1 ) );
       
   812                         }
       
   813                     iEditor->SetTextL( &rightSide );
       
   814                     iEditor->SetCursorPosL( rightSide.Length(), EFalse );
       
   815                     }
       
   816                 delete iPrevGotoContent;
       
   817                 iPrevGotoContent = NULL;
       
   818                 iPrevGotoContent = item.AllocL();
       
   819                 iEditor->DrawNow();
       
   820                 //change the CBA depending on whether the highlight is
       
   821                 //on url or domain
       
   822                 if ( ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) && iDirectoryMode )
       
   823                     {
       
   824                     iOpenCBA = ETrue;
       
   825                     }
       
   826                 else
       
   827                     {
       
   828                     iOpenCBA = EFalse;
       
   829                     }
       
   830                 CBrowserAppUi::Static()->UpdateCbaL();
       
   831                 }
       
   832             }
       
   833 
       
   834         //the joystisk is pressed down
       
   835         else if (    aKeyEvent.iCode == EKeyLeftDownArrow    // Southwest
       
   836                   || aKeyEvent.iCode == EStdKeyDevice13      //   : Extra KeyEvent supports diagonal event simulator wedge
       
   837                   || aKeyEvent.iCode == EKeyDownArrow        // South
       
   838                   || aKeyEvent.iCode == EKeyRightDownArrow   // Southeast
       
   839                   || aKeyEvent.iCode == EStdKeyDevice12 )    //   : Extra KeyEvent supports diagonal event simulator wedge
       
   840             {
       
   841             resp = EKeyWasConsumed;
       
   842             //it was the last item
       
   843             if ( iPrevItem == 0 )
       
   844                 {
       
   845                 //write back the original string
       
   846                 iList->SetHighLight( EFalse );
       
   847                 iEditor->SetTextL( iFirstGotoContent );
       
   848                 iEditor->HandleTextChangedL();
       
   849                 iEditor->SetCursorPosL( iFirstGotoContent->Length(), EFalse );
       
   850                 delete iPrevGotoContent;
       
   851                 iPrevGotoContent = NULL;
       
   852                 iPrevGotoContent = iFirstGotoContent->AllocL();
       
   853                 iEditor->DrawNow();
       
   854                 DrawNow();
       
   855                 //change the CBA
       
   856                 if ( iOpenCBA )
       
   857                     {
       
   858                     iOpenCBA = EFalse;
       
   859                     CBrowserAppUi::Static()->UpdateCbaL();
       
   860                     }
       
   861                 return resp;
       
   862                 }
       
   863             else if ( ( currIndex > -1 ) && iList->HighLightEnabled() )
       
   864                 {
       
   865                 //write the selected items string to the editor
       
   866                 TPtrC16 item;
       
   867                 TPtrC rightSide;
       
   868                 TInt newIndex;
       
   869                 resp = iList->OfferKeyEventL( aKeyEvent, aType );
       
   870                 newIndex = iItems->Count() - iList->CurrentItemIndex() - 1;
       
   871                 item.Set( (*iItems)[ newIndex ] );
       
   872                 //cut the slash from the end if needed
       
   873                 //permanent sollution until AHLE does not
       
   874                 //solve this problem related to ID: TMCN-5TTRXV error
       
   875                 if ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash )
       
   876                     {
       
   877                     rightSide.Set( item.Left( item.Length() ) );
       
   878                     }
       
   879                 else
       
   880                     {
       
   881                     rightSide.Set( item.Left( item.Length() - 1 ) );
       
   882                     }
       
   883 
       
   884                 //if true then append the suffix (rightSide), to the
       
   885                 //user-typed data
       
   886                 //else just use the recent URLs text(rightSide) only
       
   887                 if ( iUrlCompletionMode )
       
   888                     {
       
   889                     HBufC* currentCompletion = HBufC::NewLC(
       
   890                         iFirstGotoContent->Des().Length() + rightSide.Length() + 1 );
       
   891                     TPtr currentCompletionPtr = currentCompletion->Des();
       
   892 
       
   893                     currentCompletionPtr.Copy( iFirstGotoContent->Des() );
       
   894                     currentCompletionPtr.Append( rightSide );
       
   895                     currentCompletionPtr.ZeroTerminate();
       
   896                     iEditor->SetTextL( currentCompletion );
       
   897                     iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse );
       
   898                     CleanupStack::PopAndDestroy( currentCompletion );
       
   899                     }
       
   900                 else
       
   901                     {
       
   902                     iEditor->SetTextL( &rightSide );
       
   903                     iEditor->SetCursorPosL( rightSide.Length(), EFalse );
       
   904                     }
       
   905                 iEditor->HandleTextChangedL();
       
   906 
       
   907                 if ( iPrevGotoContent != NULL )
       
   908                     {
       
   909                     delete iPrevGotoContent;
       
   910                     iPrevGotoContent = NULL;
       
   911                     }
       
   912                 iPrevGotoContent = item.AllocL();
       
   913                 iEditor->DrawNow();
       
   914                 //change the CBA depending on whether the highlight is
       
   915                 //on url or domain
       
   916                 if ( ( (*iItems)[ newIndex ][(*iItems)[ newIndex ].Length() - 1] != KSlash ) && iDirectoryMode )
       
   917                     {
       
   918                     iOpenCBA = ETrue;
       
   919                     }
       
   920                 else
       
   921                     {
       
   922                     iOpenCBA = EFalse;
       
   923                     }
       
   924                 CBrowserAppUi::Static()->UpdateCbaL();
       
   925                 }
       
   926             }
       
   927 
       
   928         if ( iList->HighLightEnabled() )
       
   929             {
       
   930             iPrevItem = currIndex;
       
   931             }
       
   932         }
       
   933     return resp;
       
   934     }
       
   935 
       
   936 
       
   937 // ---------------------------------------------------------
       
   938 // CBrowserAdaptiveListPopup::HidePopupL
       
   939 // Hides the popup list
       
   940 // ---------------------------------------------------------
       
   941 //
       
   942 void CBrowserAdaptiveListPopup::HidePopupL()
       
   943     {
       
   944     //clear the lists
       
   945     if ( iPoppedUp )
       
   946         {
       
   947         HBufC* newText = HBufC::NewLC( iEditor->TextLength() );
       
   948         TPtr newTextDes = newText->Des();
       
   949         iEditor->GetText( newTextDes );
       
   950         iEditor->ClearSelectionL();
       
   951         iEditor->SetTextL( newText );
       
   952         iEditor->SetCursorPosL( iEditor->TextLength(), EFalse );
       
   953         CleanupStack::PopAndDestroy( newText );
       
   954         iItemNames->Reset();
       
   955         iList->Reset();
       
   956         if (!IsActivated())
       
   957             {
       
   958             ActivateL();
       
   959             }
       
   960         MakeVisible(EFalse);
       
   961         DrawNow();
       
   962         iPrevItem = -2;
       
   963         iPoppedUp = EFalse;
       
   964         // highlight a directory, cancel goto pane
       
   965         // activate goto pane again -> softkey problem
       
   966         iOpenCBA = EFalse;
       
   967         CBrowserAppUi::Static()->UpdateCbaL();
       
   968         }
       
   969     }
       
   970 
       
   971 // ---------------------------------------------------------
       
   972 // CBrowserAdaptiveListPopup::IsInDirectoryMode
       
   973 // gives back the directory mode
       
   974 // ---------------------------------------------------------
       
   975 //
       
   976 TBool CBrowserAdaptiveListPopup::IsInDirectoryMode()
       
   977     {
       
   978     return iDirectoryMode;
       
   979     }
       
   980 
       
   981 // ---------------------------------------------------------
       
   982 // CBrowserAdaptiveListPopup::SetDirectoryMode
       
   983 // Sets the directory mode
       
   984 // ---------------------------------------------------------
       
   985 //
       
   986 void CBrowserAdaptiveListPopup::SetDirectoryModeL(TBool aDirMode)
       
   987     {
       
   988     iDirectoryMode = aDirMode;
       
   989     if ( aDirMode == EFalse )
       
   990         {
       
   991         //put the slash to the back of the editor fileds string
       
   992         //it will show the directory mode
       
   993         TInt length;
       
   994         length = iEditor->TextLength() + 1;
       
   995         HBufC* newText = HBufC::NewLC( length );
       
   996         TPtr newTextDes = newText->Des();
       
   997         iEditor->GetText( newTextDes );
       
   998         newTextDes.Append( TChar(KSlash) );
       
   999         iEditor->SetTextL( newText );
       
  1000         iEditor->SetCursorPosL( length, EFalse );
       
  1001         CleanupStack::PopAndDestroy( newText );
       
  1002         iEditor->DrawNow();
       
  1003         ShowPopupListL();
       
  1004         //change the CBA
       
  1005         if ( iOpenCBA )
       
  1006             {
       
  1007             iOpenCBA = EFalse;
       
  1008             CBrowserAppUi::Static()->UpdateCbaL();
       
  1009             }
       
  1010         }
       
  1011     return;
       
  1012     }
       
  1013 
       
  1014 // ---------------------------------------------------------
       
  1015 // CBrowserAdaptiveListPopup::IsOpenDirToShow
       
  1016 // Show which CBA is about to show
       
  1017 // ---------------------------------------------------------
       
  1018 //
       
  1019 TBool CBrowserAdaptiveListPopup::IsOpenDirToShow()
       
  1020 {
       
  1021     return iOpenCBA;
       
  1022 }
       
  1023 
       
  1024 // ---------------------------------------------------------
       
  1025 // CBrowserAdaptiveListPopup::IsPoppedUp
       
  1026 // Show whether the list is popped up or not
       
  1027 // ---------------------------------------------------------
       
  1028 //
       
  1029 TBool CBrowserAdaptiveListPopup::IsPoppedUp()
       
  1030 {
       
  1031     return iPoppedUp;
       
  1032 }
       
  1033 
       
  1034 
       
  1035 // ---------------------------------------------------------
       
  1036 // CBrowserAdaptiveListPopup::HandleResourceChange
       
  1037 // If new skin is set the icons will be reloaded
       
  1038 // ---------------------------------------------------------
       
  1039 //
       
  1040 void CBrowserAdaptiveListPopup::HandleResourceChange( TInt aType )
       
  1041     {
       
  1042     TRAP_IGNORE( HandleResourceChangeL( aType ) );
       
  1043     }
       
  1044 
       
  1045 // ---------------------------------------------------------
       
  1046 // CBrowserAdaptiveListPopup::HandleResourceChangeL
       
  1047 // If new skin is set the icons will be reloaded
       
  1048 // ---------------------------------------------------------
       
  1049 //
       
  1050 void CBrowserAdaptiveListPopup::HandleResourceChangeL( TInt aType )
       
  1051     {
       
  1052     if (( aType == KAknsMessageSkinChange )||
       
  1053        ( aType == KEikDynamicLayoutVariantSwitch ) )
       
  1054         {
       
  1055         CArrayPtr<CGulIcon>* array =
       
  1056                             iList->ItemDrawer()->ColumnData()->IconArray();
       
  1057 
       
  1058         array->ResetAndDestroy();
       
  1059         delete array;
       
  1060         SetIconsL();
       
  1061         }
       
  1062 
       
  1063     CCoeControl::HandleResourceChange(aType);
       
  1064     if (aType == KEikDynamicLayoutVariantSwitch)
       
  1065         {
       
  1066         TRect  rect;
       
  1067         if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect))
       
  1068             {
       
  1069             SetRect(rect);
       
  1070             }
       
  1071         }
       
  1072 
       
  1073     if ( ( aType == KEikDynamicLayoutVariantSwitch ) && ( iPoppedUp ) )
       
  1074         {
       
  1075 
       
  1076         if ( AknLayoutUtils::PenEnabled() )
       
  1077             {
       
  1078             SetOrdinalPosition( 0 );
       
  1079             }
       
  1080 
       
  1081         TInt selectionIndex = -1;
       
  1082         HBufC* originalText = NULL;
       
  1083         TInt popitem( 0 );
       
  1084         if ( iList->HighLightEnabled() )
       
  1085             {
       
  1086             selectionIndex = iList->CurrentItemIndex();
       
  1087             //save the editors content
       
  1088             originalText = iEditor->GetTextInHBufL();
       
  1089             if (originalText == NULL)
       
  1090                 {
       
  1091                 originalText = KNullDesC().AllocL();
       
  1092                 }
       
  1093             CleanupStack::PushL( originalText );
       
  1094             ++popitem;
       
  1095             //write back the first string
       
  1096             iEditor->SetTextL( iFirstGotoContent );
       
  1097             iEditor->HandleTextChangedL();
       
  1098             }
       
  1099         ShowPopupListL(ETrue);
       
  1100         if ( selectionIndex > -1)
       
  1101             {
       
  1102             iEditor->SetTextL( originalText );
       
  1103             iEditor->SetCursorPosL( originalText->Length(), EFalse );
       
  1104             iEditor->HandleTextChangedL();
       
  1105             iList->SetHighLight( ETrue );
       
  1106             iList->ScrollToMakeItemVisible( selectionIndex );
       
  1107             iList->SetCurrentItemIndex( selectionIndex );
       
  1108             DrawNow();
       
  1109             iEditor->DrawNow();
       
  1110             }
       
  1111         if ( popitem )
       
  1112             {
       
  1113             CleanupStack::PopAndDestroy( popitem );  // originalText
       
  1114             }
       
  1115         }
       
  1116     }
       
  1117 
       
  1118 // ---------------------------------------------------------
       
  1119 // CBrowserAdaptiveListPopup::SetIconsL()
       
  1120 // ---------------------------------------------------------
       
  1121 //
       
  1122 void CBrowserAdaptiveListPopup::SetIconsL()
       
  1123 {
       
  1124     CArrayPtr<CGulIcon>* icons =
       
  1125     new(ELeave) CAknIconArray( KMaxIcons );
       
  1126     CleanupStack::PushL(icons); // PUSH Icon
       
  1127     CGulIcon* newIcon;
       
  1128     CFbsBitmap *newIconBmp;
       
  1129     CFbsBitmap *newIconMaskBmp;
       
  1130 
       
  1131     TParse* fp = new(ELeave) TParse();
       
  1132     CleanupStack::PushL(fp);
       
  1133     TInt err = fp->Set(KBrowserDirAndFile, &KDC_APP_BITMAP_DIR, NULL);
       
  1134     if (err != KErrNone)
       
  1135         {
       
  1136         User::Leave(err);
       
  1137         }
       
  1138     TBuf<KMaxFileName> iconFile= fp->FullName();
       
  1139     CleanupStack::PopAndDestroy(fp);
       
  1140 
       
  1141     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1142     AknsUtils::CreateIconL( skinInstance,
       
  1143                                            KAknsIIDQgnPropWmlFolderAdap,
       
  1144                                            newIconBmp,
       
  1145                                            newIconMaskBmp,
       
  1146                                            iconFile,
       
  1147                                            EMbmBrowserQgn_prop_wml_folder_adap,
       
  1148                                            EMbmBrowserQgn_prop_wml_folder_adap_mask);
       
  1149     newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp);
       
  1150     CleanupStack::PushL(newIcon);
       
  1151     icons->AppendL( newIcon );
       
  1152     CleanupStack::Pop(newIcon);
       
  1153     AknsUtils::CreateIconL( skinInstance,
       
  1154                                            KAknsIIDQgnPropWmlBmAdap,
       
  1155                                            newIconBmp,
       
  1156                                            newIconMaskBmp,
       
  1157                                            iconFile,
       
  1158                                            EMbmBrowserQgn_prop_wml_bm_adap,
       
  1159                                            EMbmBrowserQgn_prop_wml_bm_adap_mask);
       
  1160     newIcon = CGulIcon::NewL( newIconBmp, newIconMaskBmp);
       
  1161     CleanupStack::PushL(newIcon);
       
  1162     icons->AppendL( newIcon );
       
  1163     CleanupStack::Pop(newIcon);
       
  1164     iList->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
       
  1165     CleanupStack::Pop();    // POP Icon
       
  1166 }
       
  1167 
       
  1168 // ---------------------------------------------------------
       
  1169 // CBrowserAdaptiveListPopup::SetUrlSuffixList()
       
  1170 // ---------------------------------------------------------
       
  1171 //
       
  1172 void CBrowserAdaptiveListPopup::SetUrlSuffixList(HBufC* urlSuffixList)
       
  1173     {
       
  1174     iUrlSuffixBuf = urlSuffixList;
       
  1175     }
       
  1176 
       
  1177 // ---------------------------------------------------------
       
  1178 // CBrowserAdaptiveListPopup::SetMaxRecentUrls()
       
  1179 // ---------------------------------------------------------
       
  1180 //
       
  1181 void CBrowserAdaptiveListPopup::SetMaxRecentUrls (TInt maxRecentUrls)
       
  1182     {
       
  1183     iMaxRecentUrlsToShow = maxRecentUrls;
       
  1184     }
       
  1185 
       
  1186 
       
  1187 // End of File