browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp
changeset 10 4530440261a8
parent 5 e45c3f40ea5f
child 15 d6f226a5ad2c
equal deleted inserted replaced
5:e45c3f40ea5f 10:4530440261a8
   238           iShowOkOptions( EFalse ),
   238           iShowOkOptions( EFalse ),
   239           iCurrentFolder( aInitialFolderId ),
   239           iCurrentFolder( aInitialFolderId ),
   240           iIsActivated( EFalse ),
   240           iIsActivated( EFalse ),
   241           iLastSelection( 0 ),
   241           iLastSelection( 0 ),
   242           iUpdatePending( EFalse ),
   242           iUpdatePending( EFalse ),
   243           iRefresh( ETrue )
   243           iRefresh( EFalse )
   244     {
   244     {
   245     }
   245     }
   246 
   246 
   247 // ---------------------------------------------------------
   247 // ---------------------------------------------------------
   248 // CBrowserFavouritesView::ConstructL
   248 // CBrowserFavouritesView::ConstructL
   256     // Ap model cannot be created without opening it; so that's not done here.
   256     // Ap model cannot be created without opening it; so that's not done here.
   257     // DoActivateL / DoDecativateL does that.
   257     // DoActivateL / DoDecativateL does that.
   258     }
   258     }
   259 
   259 
   260 // ---------------------------------------------------------
   260 // ---------------------------------------------------------
   261 // CBrowserFavouritesView::GetItemsLC
   261 // CBrowserFavouritesView::GetItemsL
   262 // ---------------------------------------------------------
   262 // ---------------------------------------------------------
   263 //
   263 //
   264 CFavouritesItemList* CBrowserFavouritesView::GetItemsLC( TInt aFolder )
   264 CFavouritesItemList* CBrowserFavouritesView::GetItemsL( TInt aFolder )
   265     {
   265     {
   266     CFavouritesItemList* items = new (ELeave) CFavouritesItemList();
   266     CFavouritesItemList* items = new (ELeave) CFavouritesItemList();
   267     CleanupStack::PushL( items );
       
   268     iModel->Database().GetAll( *items, aFolder );
   267     iModel->Database().GetAll( *items, aFolder );
   269     iModel->SortL( *items );
   268     iModel->SortL( *items );
   270     return items;
   269     return items;
   271     }
   270     }
   272 
   271 
   410     // (This is a sanity-check like functionality, but is really used.
   409     // (This is a sanity-check like functionality, but is really used.
   411     // Bookmarks View observes changes in active and default AP-s, even if
   410     // Bookmarks View observes changes in active and default AP-s, even if
   412     // not activated (and tries to refresh); but this "activated-check" is
   411     // not activated (and tries to refresh); but this "activated-check" is
   413     // made here, not in Bookmarks View, because it makes things more safe and
   412     // made here, not in Bookmarks View, because it makes things more safe and
   414     // "future-proof".)
   413     // "future-proof".)
       
   414     //Making iRefresh ETrue
       
   415     iRefresh = ETrue;
   415     if ( iIsActivated )
   416     if ( iIsActivated )
   416         {
   417         {
   417         iUpdatePending = ETrue;
   418         iUpdatePending = ETrue;
   418         if ( !iIncrementalOp )
   419         if ( !iIncrementalOp )
   419             {
   420             {
   481             if ( iLastSelection > iContainer->Listbox()->BottomItemIndex() )
   482             if ( iLastSelection > iContainer->Listbox()->BottomItemIndex() )
   482                 {
   483                 {
   483                 iLastSelection = 0;
   484                 iLastSelection = 0;
   484                 }
   485                 }
   485             iContainer->Listbox()->SetCurrentItemIndex( iLastSelection );
   486             iContainer->Listbox()->SetCurrentItemIndex( iLastSelection );
   486             UpdateGotoPaneL();
       
   487             }
   487             }
   488 
   488 
   489         iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled );
   489         iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled );
   490         iContainer->Listbox()->DrawNow();
   490         iContainer->Listbox()->DrawNow();
   491         }
   491         }
   770     if ( ConfirmDeleteL( *uids, *folderUids ) )
   770     if ( ConfirmDeleteL( *uids, *folderUids ) )
   771         {
   771         {
   772 
   772 
   773         if (count ==1)
   773         if (count ==1)
   774             {
   774             {
   775             CFavouritesItemList* allItems = GetItemsLC( KFavouritesRootUid );
   775             CFavouritesItemList* allItems=NULL;
       
   776             if(iRefresh)
       
   777                 {
       
   778                 allItems = GetItemsL( KFavouritesRootUid );
       
   779                 CleanupStack::PushL(allItems);
       
   780                 }
       
   781             else 
       
   782                 {
       
   783                 allItems = iBookmarkitems;
       
   784                 }
   776             item = items->At(0);
   785             item = items->At(0);
   777             iPreferredHighlightUid = item->Uid();
   786             iPreferredHighlightUid = item->Uid();
   778             TInt index = allItems->UidToIndex(iPreferredHighlightUid);
   787             TInt index = allItems->UidToIndex(iPreferredHighlightUid);
   779             index++;
   788             index++;
   780             if (allItems->IndexToUid(index) != NULL)
   789             if (allItems->IndexToUid(index) != NULL)
  1165     // Disable redraw to avoid flickering.
  1174     // Disable redraw to avoid flickering.
  1166     TBool redrawDisabled = listbox->View()->RedrawDisabled();
  1175     TBool redrawDisabled = listbox->View()->RedrawDisabled();
  1167     listbox->View()->SetDisableRedraw( ETrue );
  1176     listbox->View()->SetDisableRedraw( ETrue );
  1168 
  1177 
  1169     // Change the data.
  1178     // Change the data.
  1170     CFavouritesItemList* items = GetItemsLC( aFolder );
  1179     CFavouritesItemList* items = NULL; 
  1171 
  1180     if (iRefresh)
       
  1181         {
       
  1182         items = GetItemsL( aFolder );
       
  1183         CleanupStack::PushL(items);
       
  1184         }
       
  1185     else
       
  1186         {
       
  1187         items = iBookmarkitems;
       
  1188         }
  1172     // Next take localized item names for seamless links.
  1189     // Next take localized item names for seamless links.
  1173     TInt contextId;
  1190     TInt contextId;
  1174     TInt resId = 0;
  1191     TInt resId = 0;
  1175     HBufC* name;
  1192     HBufC* name;
  1176  
  1193  
  1251         CleanupStack::PopAndDestroy( repository );
  1268         CleanupStack::PopAndDestroy( repository );
  1252         
  1269         
  1253         // Set Search item to italics font
  1270         // Set Search item to italics font
  1254         iContainer->Listbox()->ItalicizeRowItemL(0);
  1271         iContainer->Listbox()->ItalicizeRowItemL(0);
  1255         }
  1272         }
  1256 
  1273     if(iRefresh)
  1257     CleanupStack::Pop();    // items: passing ownership to listbox.
  1274         {
       
  1275         CleanupStack::Pop();    // items: passing ownership to listbox.
       
  1276         }
  1258     iContainer->Listbox()->SetDataL
  1277     iContainer->Listbox()->SetDataL
  1259         ( items, /*ApiProvider().CommsModel(),*/ aKeepState );
  1278         ( items, /*ApiProvider().CommsModel(),*/ aKeepState );
  1260     CAknColumnListBoxView *aknview = STATIC_CAST(CAknColumnListBoxView*, iContainer->Listbox()->View() );
  1279     CAknColumnListBoxView *aknview = STATIC_CAST(CAknColumnListBoxView*, iContainer->Listbox()->View() );
  1261 
  1280 
  1262     if ( !items->Count() )
  1281     if ( !items->Count() )