photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp
branchRCL_3
changeset 9 6b87b143d312
parent 3 9a9c174934f5
child 13 71da52165949
equal deleted inserted replaced
5:f7f0874bfe7d 9:6b87b143d312
    24 #include "glxpreviewthumbnailbinding.h"
    24 #include "glxpreviewthumbnailbinding.h"
    25 
    25 
    26 #include <mpxcollectionutility.h>
    26 #include <mpxcollectionutility.h>
    27 #include <mpxcollectionpath.h>
    27 #include <mpxcollectionpath.h>
    28 #include <glxcollectiongeneraldefs.h>
    28 #include <glxcollectiongeneraldefs.h>
    29 #include <ganes/HgDoubleGraphicList.h>
    29 #include <ganes/HgDoubleGraphicListFlat.h>
    30 #include <ganes/HgGrid.h>
       
    31 #include <ganes/HgItem.h>
    30 #include <ganes/HgItem.h>
    32 #include <data_caging_path_literals.hrh>
    31 #include <data_caging_path_literals.hrh>
    33 #include <glxuistd.h>
    32 #include <glxuistd.h>
    34 #include <glxicons.mbg>
    33 #include <glxicons.mbg>
    35 #include <gulicon.h>
    34 #include <gulicon.h>
    46 #include <glxcollectionpluginalbums.hrh>
    45 #include <glxcollectionpluginalbums.hrh>
    47 
    46 
    48 const TInt KListDataWindowSize(25);
    47 const TInt KListDataWindowSize(25);
    49 const TInt KNoOfPages(2);
    48 const TInt KNoOfPages(2);
    50 const TInt KBufferTresholdSize(6);
    49 const TInt KBufferTresholdSize(6);
    51 const TInt KRecreateListSize(5);
    50 
    52 
    51 
    53 // ======== MEMBER FUNCTIONS ========
    52 // ======== MEMBER FUNCTIONS ========
    54 
    53 
    55 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    56 // C++ default constructor can NOT contain any code that might leave.
    55 // C++ default constructor can NOT contain any code that might leave.
   454     	TFileName resFile(KDC_APP_BITMAP_DIR);
   453     	TFileName resFile(KDC_APP_BITMAP_DIR);
   455 		resFile.Append(KGlxIconsFilename);
   454 		resFile.Append(KGlxIconsFilename);
   456 		CFbsBitmap* defaultBitmap = AknIconUtils::CreateIconL(resFile,
   455 		CFbsBitmap* defaultBitmap = AknIconUtils::CreateIconL(resFile,
   457 						 EMbmGlxiconsQgn_prop_image_notcreated);
   456 						 EMbmGlxiconsQgn_prop_image_notcreated);
   458 		AknIconUtils::SetSize(defaultBitmap, 
   457 		AknIconUtils::SetSize(defaultBitmap, 
   459 				CHgDoubleGraphicList::PreferredImageSize());
   458 				CHgDoubleGraphicListFlat::PreferredImageSize());
   460 		
   459 		
   461     	iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(defaultBitmap));
   460     	iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(defaultBitmap));
   462     	}
   461     	}
   463     
   462     
   464     TInt firstIndex = iList->FirstIndexOnScreen();
   463     TInt firstIndex = iList->FirstIndexOnScreen();
   545 	    TFileName resFile(KDC_APP_BITMAP_DIR);
   544 	    TFileName resFile(KDC_APP_BITMAP_DIR);
   546 		resFile.Append(KGlxIconsFilename);
   545 		resFile.Append(KGlxIconsFilename);
   547     	CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile,
   546     	CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile,
   548    						 EMbmGlxiconsQgn_prop_image_notcreated);
   547    						 EMbmGlxiconsQgn_prop_image_notcreated);
   549 		AknIconUtils::SetSize(bitmap, 
   548 		AknIconUtils::SetSize(bitmap, 
   550 		        CHgDoubleGraphicList::PreferredImageSize());
   549 				CHgDoubleGraphicListFlat::PreferredImageSize());
   551 
   550 
   552 	    iList = CHgDoubleGraphicList::NewL(
   551 	    iList = CHgDoubleGraphicListFlat::NewL(
   553 	            ClientRect(), 
   552 	            ClientRect(), 
   554 	            mediaCount, 
   553 	            mediaCount, 
   555 	            CGulIcon::NewL(bitmap) );
   554 	            CGulIcon::NewL(bitmap) );
   556 
   555 
   557 	    iList->SetMopParent(this);
   556 	    iList->SetMopParent(this);
   566             {
   565             {
   567             GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()");			
   566             GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()");			
   568             //set the text to be shown if the list is empty.
   567             //set the text to be shown if the list is empty.
   569             HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); 
   568             HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); 
   570             iList->SetEmptyTextL(*emptyText);
   569             iList->SetEmptyTextL(*emptyText);
   571             CleanupStack::PopAndDestroy(emptyText);            
   570             CleanupStack::PopAndDestroy(emptyText);
   572             iLastFocusedIndex = iList->FirstIndexOnScreen();            
       
   573             }		
   571             }		
   574         
   572         
   575 		//Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view
   573 		//Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view
   576 		iList->ClearFlags(CHgScroller::EHgScrollerSearchWithQWERTY ); 
   574 		iList->ClearFlags(CHgScroller::EHgScrollerSearchWithQWERTY ); 
   577 		
   575 		
   606 // ----------------------------------------------------------------------------
   604 // ----------------------------------------------------------------------------
   607 // 
   605 // 
   608 void CGlxListViewImp::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, 
   606 void CGlxListViewImp::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, 
   609      MGlxMediaList* aList )
   607      MGlxMediaList* aList )
   610     {
   608     {
   611     TRACER("CGlxListViewImp::HandleItemAddedL");
   609     TRACER("CGlxListViewImp::HandleItemAddedL");    
   612     if (iList)
   610     
   613         {
   611     if (iList && aList)
   614         if ((aEndIndex - aStartIndex) >= KRecreateListSize)
   612         {            
       
   613         iList->ResizeL(aList->Count());            
       
   614         for (TInt i = aStartIndex; i<= aEndIndex; i++)
   615             {
   615             {
   616             iList->ResizeL(aList->Count());
   616             const TGlxMedia& item = iMediaList->Item(i);                
       
   617             iList->ItemL(i).SetTitleL(item.Title());
       
   618             iList->ItemL(i).SetTextL(item.SubTitle());
       
   619             }            
       
   620         
       
   621         if(aStartIndex == aEndIndex )
       
   622             {
       
   623             iLastFocusedIndex = aStartIndex;
       
   624             iPopulateListTNs = EFalse;
       
   625             iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex);			
   617             }
   626             }
   618         else
   627         
   619             {
   628         iList->SetSelectedIndex(iLastFocusedIndex);	
   620             for (TInt i = aStartIndex; i<= aEndIndex; i++)
   629         iList->RefreshScreen(iLastFocusedIndex);
   621                 {
       
   622                 const TGlxMedia& item = iMediaList->Item(i);
       
   623                 iList->InsertItem(CHgItem::NewL(CHgItem::EHgItemFlagsNone,
       
   624                         NULL, item.Title(), item.SubTitle()), i);
       
   625                 }
       
   626 
       
   627             if(aStartIndex == aEndIndex )
       
   628                 {
       
   629                 iLastFocusedIndex = aStartIndex;
       
   630                 iPopulateListTNs = EFalse;
       
   631                 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex);			
       
   632                 }
       
   633 
       
   634             iList->SetSelectedIndex(iLastFocusedIndex);	
       
   635             iList->RefreshScreen(iLastFocusedIndex);
       
   636             }
       
   637         }
   630         }
   638     }
   631     }
   639 
   632 
   640 // ----------------------------------------------------------------------------
   633 // ----------------------------------------------------------------------------
   641 // HandleItemRemoved
   634 // HandleItemRemoved