browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 10 4530440261a8
parent 1 57d5b8e231c4
child 11 16a119033e3e
--- a/browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp	Fri Jul 03 15:46:41 2009 +0100
+++ b/browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp	Thu Aug 27 07:42:55 2009 +0300
@@ -493,6 +493,7 @@
         case EWmlCmdGoToAddress: // MSK for Recent Url page
         case EWmlCmdSwitchToGotoActive:
             {
+            iSoftKeyUpdate = EFalse;
             DimToolbarButtons(ETrue);
             TheContainer()->SetGotoActiveL();
             break;
@@ -654,7 +655,7 @@
                 iDomainFolderName = NULL;
 
                 CFavouritesItemList* items =
-                            GetItemsLC( KFavouritesAdaptiveItemsFolderUid );
+                            GetItemsL( KFavouritesAdaptiveItemsFolderUid );
                 TInt indexToHighlight = 0;
 
                 for ( TInt i = 0; i < items->Count(); i++ )
@@ -665,7 +666,7 @@
                         }
                     }
 
-                CleanupStack::PopAndDestroy();  // items
+                delete items;
                 CleanupStack::PopAndDestroy();  // domainFolderNameToHighlight
 
                 HBufC* title;
@@ -820,7 +821,7 @@
     CBrowserBookmarksContainer* theContainer = TheContainer();
 
     // if the container doesn't exist, leave gotoPanePtr at NULL
-    if (theContainer)
+    if (theContainer && !iSoftKeyUpdate)
         {
         gotoPanePtr = theContainer->GotoPane();
         }
@@ -1120,8 +1121,7 @@
     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
             KErrNone )
         {
-        CFavouritesItemList* items = GetItemsLC( KFavouritesRootUid );
-        CleanupStack::PopAndDestroy();
+        iBookmarkitems = GetItemsL( KFavouritesRootUid );
         Model().CommitL();
         }
        
@@ -1129,8 +1129,8 @@
     //thread, its important to refresh when the thread notifies the fresh data.
     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
     //Make it true so that latest FavIcon db info is shown     
-    iRefresh = ETrue;
-
+    //Removed the iRefresh becoming ETrue, move to RefreshL 
+    
     if (iPenEnabled)
         {
         Toolbar()->SetToolbarObserver(this);
@@ -1458,7 +1458,7 @@
         case R_BROWSER_BOOKMARKS_MENU_PANE_OK:
             {
             // Bookmark-specific handling.
-            if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2) )
+            if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2)||iInAdaptiveBookmarksFolder)
                 {
                 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue );
                 }
@@ -1466,6 +1466,12 @@
                 {
                 aMenuPane->SetItemDimmed( EWmlCmdMove, EFalse );
                 }
+               
+            //Disable MoveToFolder option if you are in RecentlyVisitedUrl folder
+            if( iInAdaptiveBookmarksFolder )
+                {
+                aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
+                }
             const CFavouritesItem* item =  TheContainer()->Listbox()->CurrentItem();
             if  ( ( item ) &&
                   ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) ||
@@ -1845,10 +1851,10 @@
     }
 
 // ----------------------------------------------------------------------------
-// CBrowserBookmarksView::GetItemsLC
+// CBrowserBookmarksView::GetItemsL
 // ----------------------------------------------------------------------------
 //
-CFavouritesItemList* CBrowserBookmarksView::GetItemsLC( TInt aFolder )
+CFavouritesItemList* CBrowserBookmarksView::GetItemsL( TInt aFolder )
     {
 PERFLOG_LOCAL_INIT
 PERFLOG_STOPWATCH_START
@@ -1856,7 +1862,6 @@
     if ( iInAdaptiveBookmarksFolder )
         {
         items= new (ELeave) CFavouritesItemList();
-        CleanupStack::PushL(items);//1
         CDesCArrayFlat* aditems = new ( ELeave )
                                 CDesCArrayFlat( KBrowserDesCArrayGranularity );
         aditems->Reset();
@@ -1888,7 +1893,6 @@
     else
         {
         items = new (ELeave) CFavouritesItemList();
-        CleanupStack::PushL( items );
         Model().Database().GetAll( *items, aFolder );
         TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage
         if ( aFolder == KFavouritesRootUid )
@@ -2002,6 +2006,10 @@
         iInAdaptiveBookmarksFolder = ETrue;
         }
 
+    if( iPreviousViewID == KUidBrowserBookmarksViewId )
+       {
+       iSoftKeyUpdate = ETrue;
+       }
     CBrowserFavouritesView::DoActivateL
                             ( aPrevViewId, aCustomMessageId, aCustomMessage );
     ApiProvider().BrCtlInterface().AddLoadEventObserverL( this );
@@ -2050,7 +2058,7 @@
         {
         ExitAdaptiveBookmarks();
         }
-
+    iSoftKeyUpdate = EFalse;
     if ( !ApiProvider().ExitInProgress() )
         {
         ApiProvider().BrCtlInterface().RemoveLoadEventObserver( this );