browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 31 868cceedabd3
parent 22 d6f226a5ad2c
child 32 92a061761a7b
equal deleted inserted replaced
27:b57c5fc53578 31:868cceedabd3
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <CDownloadMgrUiDownloadsList.h>
    20 #include <cdownloadmgruidownloadslist.h>
    21 #include <CDownloadMgrUiDownloadMenu.h>
    21 #include <cdownloadmgruidownloadmenu.h>
    22 #include <eikmenup.h>
    22 #include <eikmenup.h>
    23 #include <aknsfld.h>
    23 #include <aknsfld.h>
    24 #include <smut.h>
    24 #include <smut.h>
    25 #include <IrcMTM.h>
    25 #include <IrcMTM.h>
    26 
    26 
    27 #ifndef AVERELL2_BLUETOOTH_MISSING
    27 #ifndef AVERELL2_BLUETOOTH_MISSING
    28     #include <btmsgtypeuid.h>
    28     #include <btmsgtypeuid.h>
    29 #endif
    29 #endif
    30 
    30 
    31 #include <irmsgtypeuid.h>
    31 #include <irmsgtypeuid.h>
    32 #include <FavouritesDb.h>
    32 #include <favouritesdb.h>
    33 
    33 
    34 #include <BrowserNG.rsg>
    34 #include <BrowserNG.rsg>
    35 
    35 
    36 #include <FavouritesItem.h>
    36 #include <favouritesitem.h>
    37 #include <FavouritesItemList.h>
    37 #include <favouritesitemlist.h>
    38 #include <ApEngineConsts.h>
    38 #include <ApEngineConsts.h>
    39 #include <ApListItem.h>
    39 #include <ApListItem.h>
    40 #include <ApListItemList.h>
    40 #include <ApListItemList.h>
    41 #include <StringLoader.h>
    41 #include <StringLoader.h>
    42 #include <FeatMgr.h>
    42 #include <FeatMgr.h>
    59 #include "BrowserAppUi.h"
    59 #include "BrowserAppUi.h"
    60 #include "Browser.hrh"
    60 #include "Browser.hrh"
    61 #include "CommandVisibility.h"
    61 #include "CommandVisibility.h"
    62 #include "BrowserBmOTABinSender.h"
    62 #include "BrowserBmOTABinSender.h"
    63 #include "CommsModel.h"
    63 #include "CommsModel.h"
    64 #include <MConnection.h>
    64 #include <mconnection.h>
    65 #include "BrowserUiVariant.hrh"
    65 #include "BrowserUiVariant.hrh"
    66 #include "BrowserWindowManager.h"
    66 #include "BrowserWindowManager.h"
    67 #include "BrowserWindow.h"
    67 #include "BrowserWindow.h"
    68 #include "BrowserDownloadUtil.h"
    68 #include "BrowserDownloadUtil.h"
    69 #include "Display.h"
    69 #include "Display.h"
   654                 domainFolderNameToHighlight->Des().Append( *iDomainFolderName );
   654                 domainFolderNameToHighlight->Des().Append( *iDomainFolderName );
   655                 delete iDomainFolderName;
   655                 delete iDomainFolderName;
   656                 iDomainFolderName = NULL;
   656                 iDomainFolderName = NULL;
   657 
   657 
   658                 CFavouritesItemList* items =
   658                 CFavouritesItemList* items =
   659                             GetItemsL( KFavouritesAdaptiveItemsFolderUid );
   659                             GetItemsLC( KFavouritesAdaptiveItemsFolderUid );
   660                 TInt indexToHighlight = 0;
   660                 TInt indexToHighlight = 0;
   661 
   661 
   662                 for ( TInt i = 0; i < items->Count(); i++ )
   662                 for ( TInt i = 0; i < items->Count(); i++ )
   663                     {
   663                     {
   664                     if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) )
   664                     if ( (*items)[i]->Name() == (*domainFolderNameToHighlight) )
   665                         {
   665                         {
   666                         indexToHighlight = i;
   666                         indexToHighlight = i;
   667                         }
   667                         }
   668                     }
   668                     }
   669 
   669 
   670                 delete items;
   670                 CleanupStack::PopAndDestroy();  // items
   671                 CleanupStack::PopAndDestroy();  // domainFolderNameToHighlight
   671                 CleanupStack::PopAndDestroy();  // domainFolderNameToHighlight
   672 
   672 
   673                 HBufC* title;
   673                 HBufC* title;
   674                 title=iCoeEnv->AllocReadResourceLC(
   674                 title=iCoeEnv->AllocReadResourceLC(
   675                                         R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE );
   675                                         R_BROWSER_ADAPTIVE_BOOKMARKS_TITLE );
  1120     iSaveBMOrder = ETrue;
  1120     iSaveBMOrder = ETrue;
  1121 
  1121 
  1122     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
  1122     if ( Model().BeginL( /*aWrite=*/ETrue, /*aDbErrorNote*/ EFalse ) ==
  1123             KErrNone )
  1123             KErrNone )
  1124         {
  1124         {
  1125         iBookmarkitems = GetItemsL( KFavouritesRootUid );
  1125         CFavouritesItemList* items = GetItemsLC( KFavouritesRootUid );
       
  1126         CleanupStack::PopAndDestroy();
  1126         Model().CommitL();
  1127         Model().CommitL();
  1127         }
  1128         }
  1128        
  1129        
  1129     //Since the webcore will be reading the bookmark information in background
  1130     //Since the webcore will be reading the bookmark information in background
  1130     //thread, its important to refresh when the thread notifies the fresh data.
  1131     //thread, its important to refresh when the thread notifies the fresh data.
  1131     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1132     //Call to GetItemsLC above, which inturn calls ManualBMSortL will set iRefresh to false
  1132     //Make it true so that latest FavIcon db info is shown     
  1133     //Make it true so that latest FavIcon db info is shown     
  1133     //Removed the iRefresh becoming ETrue, move to RefreshL 
  1134     iRefresh = ETrue;
  1134     
  1135 
  1135     if (iPenEnabled)
  1136     if (iPenEnabled)
  1136         {
  1137         {
  1137         Toolbar()->SetToolbarObserver(this);
  1138         Toolbar()->SetToolbarObserver(this);
  1138         }
  1139         }
  1139     if ( ApiProvider().Preferences().SearchFeature() )
  1140     if ( ApiProvider().Preferences().SearchFeature() )
  1879 
  1880 
  1880 // ----------------------------------------------------------------------------
  1881 // ----------------------------------------------------------------------------
  1881 // CBrowserBookmarksView::GetItemsL
  1882 // CBrowserBookmarksView::GetItemsL
  1882 // ----------------------------------------------------------------------------
  1883 // ----------------------------------------------------------------------------
  1883 //
  1884 //
  1884 CFavouritesItemList* CBrowserBookmarksView::GetItemsL( TInt aFolder )
  1885 CFavouritesItemList* CBrowserBookmarksView::GetItemsLC( TInt aFolder )
  1885     {
  1886     {
  1886 PERFLOG_LOCAL_INIT
  1887 PERFLOG_LOCAL_INIT
  1887 PERFLOG_STOPWATCH_START
  1888 PERFLOG_STOPWATCH_START
  1888     CFavouritesItemList* items;
  1889     CFavouritesItemList* items;
  1889     if ( iInAdaptiveBookmarksFolder )
  1890     if ( iInAdaptiveBookmarksFolder )
  1890         {
  1891         {
  1891         items= new (ELeave) CFavouritesItemList();
  1892         items= new (ELeave) CFavouritesItemList();
       
  1893         CleanupStack::PushL(items);//1
  1892         CDesCArrayFlat* aditems = new ( ELeave )
  1894         CDesCArrayFlat* aditems = new ( ELeave )
  1893                                 CDesCArrayFlat( KBrowserDesCArrayGranularity );
  1895                                 CDesCArrayFlat( KBrowserDesCArrayGranularity );
  1894         aditems->Reset();
  1896         aditems->Reset();
  1895         CleanupStack::PushL(aditems);//2
  1897         CleanupStack::PushL(aditems);//2
  1896 
  1898 
  1918         CleanupStack::PopAndDestroy( 2 );// aditems, adnames
  1920         CleanupStack::PopAndDestroy( 2 );// aditems, adnames
  1919         }
  1921         }
  1920     else
  1922     else
  1921         {
  1923         {
  1922         items = new (ELeave) CFavouritesItemList();
  1924         items = new (ELeave) CFavouritesItemList();
       
  1925         CleanupStack::PushL( items );
  1923         Model().Database().GetAll( *items, aFolder );
  1926         Model().Database().GetAll( *items, aFolder );
  1924         TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage
  1927         TInt aBMPosition = KAdaptiveBookmarksFirstPositionInBMView; // Adaptive BM folder is first if there is no startpage
  1925         if ( aFolder == KFavouritesRootUid )
  1928         if ( aFolder == KFavouritesRootUid )
  1926             {
  1929             {
  1927             // Create Start Page item to be displayed in root folder (if exist).
  1930             // Create Start Page item to be displayed in root folder (if exist).