browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 10 4530440261a8
parent 1 57d5b8e231c4
child 11 16a119033e3e
equal deleted inserted replaced
5:e45c3f40ea5f 10:4530440261a8
   491 
   491 
   492         case EWmlCmdGoToAddressAndSearch:    
   492         case EWmlCmdGoToAddressAndSearch:    
   493         case EWmlCmdGoToAddress: // MSK for Recent Url page
   493         case EWmlCmdGoToAddress: // MSK for Recent Url page
   494         case EWmlCmdSwitchToGotoActive:
   494         case EWmlCmdSwitchToGotoActive:
   495             {
   495             {
       
   496             iSoftKeyUpdate = EFalse;
   496             DimToolbarButtons(ETrue);
   497             DimToolbarButtons(ETrue);
   497             TheContainer()->SetGotoActiveL();
   498             TheContainer()->SetGotoActiveL();
   498             break;
   499             break;
   499             }
   500             }
   500 
   501 
   652                 domainFolderNameToHighlight->Des().Append( *iDomainFolderName );
   653                 domainFolderNameToHighlight->Des().Append( *iDomainFolderName );
   653                 delete iDomainFolderName;
   654                 delete iDomainFolderName;
   654                 iDomainFolderName = NULL;
   655                 iDomainFolderName = NULL;
   655 
   656 
   656                 CFavouritesItemList* items =
   657                 CFavouritesItemList* items =
   657                             GetItemsLC( KFavouritesAdaptiveItemsFolderUid );
   658                             GetItemsL( KFavouritesAdaptiveItemsFolderUid );
   658                 TInt indexToHighlight = 0;
   659                 TInt indexToHighlight = 0;
   659 
   660 
   660                 for ( TInt i = 0; i < items->Count(); i++ )
   661                 for ( TInt i = 0; i < items->Count(); i++ )
   661                     {
   662                     {
   662                     if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) )
   663                     if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) )
   663                         {
   664                         {
   664                         indexToHighlight = i;
   665                         indexToHighlight = i;
   665                         }
   666                         }
   666                     }
   667                     }
   667 
   668 
   668                 CleanupStack::PopAndDestroy();  // items
   669                 delete items;
   669                 CleanupStack::PopAndDestroy();  // domainFolderNameToHighlight
   670                 CleanupStack::PopAndDestroy();  // domainFolderNameToHighlight
   670 
   671 
   671                 HBufC* title;
   672                 HBufC* title;
   672                 title=iCoeEnv->AllocReadResourceLC(
   673                 title=iCoeEnv->AllocReadResourceLC(
   673                                         R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE );
   674                                         R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE );
   818     //
   819     //
   819     CBrowserBookmarksGotoPane* gotoPanePtr = NULL;
   820     CBrowserBookmarksGotoPane* gotoPanePtr = NULL;
   820     CBrowserBookmarksContainer* theContainer = TheContainer();
   821     CBrowserBookmarksContainer* theContainer = TheContainer();
   821 
   822 
   822     // if the container doesn't exist, leave gotoPanePtr at NULL
   823     // if the container doesn't exist, leave gotoPanePtr at NULL
   823     if (theContainer)
   824     if (theContainer && !iSoftKeyUpdate)
   824         {
   825         {
   825         gotoPanePtr = theContainer->GotoPane();
   826         gotoPanePtr = theContainer->GotoPane();
   826         }
   827         }
   827 
   828 
   828     // set LSK, RSK, MSK respectively
   829     // set LSK, RSK, MSK respectively
  1118     iSaveBMOrder = ETrue;
  1119     iSaveBMOrder = ETrue;
  1119 
  1120 
  1120     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
  1121     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
  1121             KErrNone )
  1122             KErrNone )
  1122         {
  1123         {
  1123         CFavouritesItemList* items = GetItemsLC( KFavouritesRootUid );
  1124         iBookmarkitems = GetItemsL( KFavouritesRootUid );
  1124         CleanupStack::PopAndDestroy();
       
  1125         Model().CommitL();
  1125         Model().CommitL();
  1126         }
  1126         }
  1127        
  1127        
  1128     //Since the webcore will be reading the bookmark information in background
  1128     //Since the webcore will be reading the bookmark information in background
  1129     //thread, its important to refresh when the thread notifies the fresh data.
  1129     //thread, its important to refresh when the thread notifies the fresh data.
  1130     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1130     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1131     //Make it true so that latest FavIcon db info is shown     
  1131     //Make it true so that latest FavIcon db info is shown     
  1132     iRefresh = ETrue;
  1132     //Removed the iRefresh becoming ETrue, move to RefreshL 
  1133 
  1133     
  1134     if (iPenEnabled)
  1134     if (iPenEnabled)
  1135         {
  1135         {
  1136         Toolbar()->SetToolbarObserver(this);
  1136         Toolbar()->SetToolbarObserver(this);
  1137         }
  1137         }
  1138     if ( ApiProvider().Preferences().SearchFeature() )
  1138     if ( ApiProvider().Preferences().SearchFeature() )
  1456             break;
  1456             break;
  1457             }
  1457             }
  1458         case R_BROWSER_BOOKMARKS_MENU_PANE_OK:
  1458         case R_BROWSER_BOOKMARKS_MENU_PANE_OK:
  1459             {
  1459             {
  1460             // Bookmark-specific handling.
  1460             // Bookmark-specific handling.
  1461             if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2) )
  1461             if ( aState.IsEmpty() || (TheContainer()->Listbox()->UnfilteredNumberOfItems() < 2)||iInAdaptiveBookmarksFolder)
  1462                 {
  1462                 {
  1463                 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue );
  1463                 aMenuPane->SetItemDimmed( EWmlCmdMove, ETrue );
  1464                 }
  1464                 }
  1465             else
  1465             else
  1466                 {
  1466                 {
  1467                 aMenuPane->SetItemDimmed( EWmlCmdMove, EFalse );
  1467                 aMenuPane->SetItemDimmed( EWmlCmdMove, EFalse );
       
  1468                 }
       
  1469                
       
  1470             //Disable MoveToFolder option if you are in RecentlyVisitedUrl folder
       
  1471             if( iInAdaptiveBookmarksFolder )
       
  1472                 {
       
  1473                 aMenuPane->SetItemDimmed( EWmlCmdMoveToFolder, ETrue );
  1468                 }
  1474                 }
  1469             const CFavouritesItem* item =  TheContainer()->Listbox()->CurrentItem();
  1475             const CFavouritesItem* item =  TheContainer()->Listbox()->CurrentItem();
  1470             if  ( ( item ) &&
  1476             if  ( ( item ) &&
  1471                   ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) ||
  1477                   ( ( item->Uid() == KFavouritesAdaptiveItemsFolderUid ) ||
  1472                     ( item->ContextId() != NULL ) )
  1478                     ( item->ContextId() != NULL ) )
  1843     }
  1849     }
  1844     return ETrue;
  1850     return ETrue;
  1845     }
  1851     }
  1846 
  1852 
  1847 // ----------------------------------------------------------------------------
  1853 // ----------------------------------------------------------------------------
  1848 // CBrowserBookmarksView::GetItemsLC
  1854 // CBrowserBookmarksView::GetItemsL
  1849 // ----------------------------------------------------------------------------
  1855 // ----------------------------------------------------------------------------
  1850 //
  1856 //
  1851 CFavouritesItemList* CBrowserBookmarksView::GetItemsLC( TInt aFolder )
  1857 CFavouritesItemList* CBrowserBookmarksView::GetItemsL( TInt aFolder )
  1852     {
  1858     {
  1853 PERFLOG_LOCAL_INIT
  1859 PERFLOG_LOCAL_INIT
  1854 PERFLOG_STOPWATCH_START
  1860 PERFLOG_STOPWATCH_START
  1855     CFavouritesItemList* items;
  1861     CFavouritesItemList* items;
  1856     if ( iInAdaptiveBookmarksFolder )
  1862     if ( iInAdaptiveBookmarksFolder )
  1857         {
  1863         {
  1858         items= new (ELeave) CFavouritesItemList();
  1864         items= new (ELeave) CFavouritesItemList();
  1859         CleanupStack::PushL(items);//1
       
  1860         CDesCArrayFlat* aditems = new ( ELeave )
  1865         CDesCArrayFlat* aditems = new ( ELeave )
  1861                                 CDesCArrayFlat( KBrowserDesCArrayGranularity );
  1866                                 CDesCArrayFlat( KBrowserDesCArrayGranularity );
  1862         aditems->Reset();
  1867         aditems->Reset();
  1863         CleanupStack::PushL(aditems);//2
  1868         CleanupStack::PushL(aditems);//2
  1864 
  1869 
  1886         CleanupStack::PopAndDestroy( 2 );// aditems, adnames
  1891         CleanupStack::PopAndDestroy( 2 );// aditems, adnames
  1887         }
  1892         }
  1888     else
  1893     else
  1889         {
  1894         {
  1890         items = new (ELeave) CFavouritesItemList();
  1895         items = new (ELeave) CFavouritesItemList();
  1891         CleanupStack::PushL( items );
       
  1892         Model().Database().GetAll( *items, aFolder );
  1896         Model().Database().GetAll( *items, aFolder );
  1893         TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage
  1897         TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage
  1894         if ( aFolder == KFavouritesRootUid )
  1898         if ( aFolder == KFavouritesRootUid )
  1895             {
  1899             {
  1896             // Create Start Page item to be displayed in root folder (if exist).
  1900             // Create Start Page item to be displayed in root folder (if exist).
  2000     if ( iOpenAdaptiveBookmarksWhenActivated )
  2004     if ( iOpenAdaptiveBookmarksWhenActivated )
  2001         {
  2005         {
  2002         iInAdaptiveBookmarksFolder = ETrue;
  2006         iInAdaptiveBookmarksFolder = ETrue;
  2003         }
  2007         }
  2004 
  2008 
       
  2009     if( iPreviousViewID == KUidBrowserBookmarksViewId )
       
  2010        {
       
  2011        iSoftKeyUpdate = ETrue;
       
  2012        }
  2005     CBrowserFavouritesView::DoActivateL
  2013     CBrowserFavouritesView::DoActivateL
  2006                             ( aPrevViewId, aCustomMessageId, aCustomMessage );
  2014                             ( aPrevViewId, aCustomMessageId, aCustomMessage );
  2007     ApiProvider().BrCtlInterface().AddLoadEventObserverL( this );
  2015     ApiProvider().BrCtlInterface().AddLoadEventObserverL( this );
  2008 
  2016 
  2009     if ( iPreferencesChanged )
  2017     if ( iPreferencesChanged )
  2048     {
  2056     {
  2049     if ( !iSaveStateOnDeactivate )
  2057     if ( !iSaveStateOnDeactivate )
  2050         {
  2058         {
  2051         ExitAdaptiveBookmarks();
  2059         ExitAdaptiveBookmarks();
  2052         }
  2060         }
  2053 
  2061     iSoftKeyUpdate = EFalse;
  2054     if ( !ApiProvider().ExitInProgress() )
  2062     if ( !ApiProvider().ExitInProgress() )
  2055         {
  2063         {
  2056         ApiProvider().BrCtlInterface().RemoveLoadEventObserver( this );
  2064         ApiProvider().BrCtlInterface().RemoveLoadEventObserver( this );
  2057         }
  2065         }
  2058     CBrowserFavouritesView::DoDeactivate();
  2066     CBrowserFavouritesView::DoDeactivate();