browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp
changeset 18 4530440261a8
parent 15 e45c3f40ea5f
child 22 d6f226a5ad2c
--- a/browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp	Fri Jul 03 15:46:41 2009 +0100
+++ b/browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp	Thu Aug 27 07:42:55 2009 +0300
@@ -240,7 +240,7 @@
           iIsActivated( EFalse ),
           iLastSelection( 0 ),
           iUpdatePending( EFalse ),
-          iRefresh( ETrue )
+          iRefresh( EFalse )
     {
     }
 
@@ -258,13 +258,12 @@
     }
 
 // ---------------------------------------------------------
-// CBrowserFavouritesView::GetItemsLC
+// CBrowserFavouritesView::GetItemsL
 // ---------------------------------------------------------
 //
-CFavouritesItemList* CBrowserFavouritesView::GetItemsLC( TInt aFolder )
+CFavouritesItemList* CBrowserFavouritesView::GetItemsL( TInt aFolder )
     {
     CFavouritesItemList* items = new (ELeave) CFavouritesItemList();
-    CleanupStack::PushL( items );
     iModel->Database().GetAll( *items, aFolder );
     iModel->SortL( *items );
     return items;
@@ -412,6 +411,8 @@
     // not activated (and tries to refresh); but this "activated-check" is
     // made here, not in Bookmarks View, because it makes things more safe and
     // "future-proof".)
+    //Making iRefresh ETrue
+    iRefresh = ETrue;
     if ( iIsActivated )
         {
         iUpdatePending = ETrue;
@@ -483,7 +484,6 @@
                 iLastSelection = 0;
                 }
             iContainer->Listbox()->SetCurrentItemIndex( iLastSelection );
-            UpdateGotoPaneL();
             }
 
         iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled );
@@ -772,7 +772,16 @@
 
         if (count ==1)
             {
-            CFavouritesItemList* allItems = GetItemsLC( KFavouritesRootUid );
+            CFavouritesItemList* allItems=NULL;
+            if(iRefresh)
+                {
+                allItems = GetItemsL( KFavouritesRootUid );
+                CleanupStack::PushL(allItems);
+                }
+            else 
+                {
+                allItems = iBookmarkitems;
+                }
             item = items->At(0);
             iPreferredHighlightUid = item->Uid();
             TInt index = allItems->UidToIndex(iPreferredHighlightUid);
@@ -1167,8 +1176,16 @@
     listbox->View()->SetDisableRedraw( ETrue );
 
     // Change the data.
-    CFavouritesItemList* items = GetItemsLC( aFolder );
-
+    CFavouritesItemList* items = NULL; 
+    if (iRefresh)
+        {
+        items = GetItemsL( aFolder );
+        CleanupStack::PushL(items);
+        }
+    else
+        {
+        items = iBookmarkitems;
+        }
     // Next take localized item names for seamless links.
     TInt contextId;
     TInt resId = 0;
@@ -1253,8 +1270,10 @@
         // Set Search item to italics font
         iContainer->Listbox()->ItalicizeRowItemL(0);
         }
-
-    CleanupStack::Pop();    // items: passing ownership to listbox.
+    if(iRefresh)
+        {
+        CleanupStack::Pop();    // items: passing ownership to listbox.
+        }
     iContainer->Listbox()->SetDataL
         ( items, /*ApiProvider().CommsModel(),*/ aKeepState );
     CAknColumnListBoxView *aknview = STATIC_CAST(CAknColumnListBoxView*, iContainer->Listbox()->View() );