browserui/browser/FavouritesSrc/BrowserBookmarksView.cpp
changeset 25 92a061761a7b
parent 24 868cceedabd3
child 26 97c9f46387be
equal deleted inserted replaced
24:868cceedabd3 25:92a061761a7b
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Implementation of CBrowserBookmarksView.
    14 * Description:  Implementation of CBrowserBookmarksView.
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 
    17 
    19 // INCLUDE FILES
    18 // INCLUDE FILES
    20 #include <cdownloadmgruidownloadslist.h>
    19 #include <cdownloadmgruidownloadslist.h>
    21 #include <cdownloadmgruidownloadmenu.h>
    20 #include <cdownloadmgruidownloadmenu.h>
    22 #include <eikmenup.h>
    21 #include <eikmenup.h>
  1588 // ----------------------------------------------------------------------------
  1587 // ----------------------------------------------------------------------------
  1589 // CBrowserBookmarksView::MoveItemsL
  1588 // CBrowserBookmarksView::MoveItemsL
  1590 // ----------------------------------------------------------------------------
  1589 // ----------------------------------------------------------------------------
  1591 void CBrowserBookmarksView::MoveItemsL()
  1590 void CBrowserBookmarksView::MoveItemsL()
  1592     {
  1591     {
       
  1592     
       
  1593     // Get the Uid of currently highlighted bookmark item from listbox.
       
  1594     // NOTE: Listbox indexes is based on "visible" items in list box, our order
       
  1595     // array has visible and invisible items, we have to use Uid to find items.
       
  1596     const CFavouritesItem* toItem = Container()->Listbox()->CurrentItem();
       
  1597     TInt toUid(NULL);
       
  1598     if ( toItem ) {
       
  1599         toUid = toItem->Uid();
       
  1600         if (toUid == (*iItemsToMove)[0])
       
  1601             { // Moving to same location so change nothing, cleanup, & exit
       
  1602             CancelMoveItemsL();
       
  1603             return;
       
  1604             }
       
  1605     }    
       
  1606     
  1593 	// Get a copy of the ordered array, it may contain visible and hidden items.
  1607 	// Get a copy of the ordered array, it may contain visible and hidden items.
  1594     CArrayFixFlat<TInt>* orderArray =
  1608     CArrayFixFlat<TInt>* orderArray =
  1595                             new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh);
  1609                             new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh);
  1596     CleanupStack::PushL( orderArray );
  1610     CleanupStack::PushL( orderArray );
  1597     
  1611     
  1598     orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ),
  1612     orderArray->AppendL( & ( iCurrentOrder->GetBookMarksOrder()[0] ),
  1599                              iCurrentOrder->GetBookMarksOrder().Count() );
  1613                              iCurrentOrder->GetBookMarksOrder().Count() );
       
  1614     
       
  1615     if ( toUid == NULL ) {
       
  1616         toUid = (*orderArray)[orderArray->Count()-1] ;
       
  1617     }
       
  1618 
  1600 
  1619 
  1601 	// Create a sorted "bookmarks to be moved" array
  1620 	// Create a sorted "bookmarks to be moved" array
  1602     CArrayFixFlat<TInt>* sortedItemsToMove =
  1621     CArrayFixFlat<TInt>* sortedItemsToMove =
  1603                             new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh);
  1622                             new (ELeave) CArrayFixFlat<TInt>(KGranularityHigh);
  1604     CleanupStack::PushL( sortedItemsToMove );
  1623     CleanupStack::PushL( sortedItemsToMove );
  1605 
  1624 
  1606     // Get the Uid of currently highlighted bookmark item from listbox.
       
  1607     // NOTE: Listbox indexes is based on "visible" items in list box, our order
       
  1608     // array has visible and invisible items, we have to use Uid to find items.
       
  1609     const CFavouritesItem* toItem = Container()->Listbox()->CurrentItem();
       
  1610     TInt toUid( (*orderArray)[orderArray->Count()-1] );
       
  1611     if ( toItem ) {
       
  1612     	toUid = toItem->Uid();
       
  1613     }
       
  1614 
  1625 
  1615 	// Walk our copy of the ordered bookmark array and
  1626 	// Walk our copy of the ordered bookmark array and
  1616 	// 1. Delete the bookmark items to be moved from the ordered array
  1627 	// 1. Delete the bookmark items to be moved from the ordered array
  1617 	// 2. Sort the bookmark items to be moved to match the visible order of the list
  1628 	// 2. Sort the bookmark items to be moved to match the visible order of the list
  1618     TInt i( 0 );	// index into order bookmark list
  1629     TInt i( 0 );	// index into order bookmark list
  2773                                 || (!state.AnyDeletable());
  2784                                 || (!state.AnyDeletable());
  2774 
  2785 
  2775         Toolbar()->SetItemDimmed( EWmlCmdDelete, needToDimDeleteBtn, ETrue );
  2786         Toolbar()->SetItemDimmed( EWmlCmdDelete, needToDimDeleteBtn, ETrue );
  2776         //set EWmlCmdAddBookmark dim in RecentlyVisitedUrl Folder
  2787         //set EWmlCmdAddBookmark dim in RecentlyVisitedUrl Folder
  2777         Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, iInAdaptiveBookmarksFolder, ETrue);
  2788         Toolbar()->SetItemDimmed( EWmlCmdAddBookmark, iInAdaptiveBookmarksFolder, ETrue);
  2778        
  2789         if(iManualItemMovingGoingOn)
  2779         
  2790             {
       
  2791             DimToolbarButtons(ETrue);
       
  2792             }      
  2780         }
  2793         }
  2781     }
  2794     }
  2782 // End of File
  2795 // End of File