photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp
branchRCL_3
changeset 19 420f6808bf21
parent 18 78ad99c24f08
child 23 b023a8d2866a
equal deleted inserted replaced
18:78ad99c24f08 19:420f6808bf21
    44 #include <glxerrormanager.h>             // For CGlxErrormanager
    44 #include <glxerrormanager.h>             // For CGlxErrormanager
    45 #include <glxthumbnailcontext.h>
    45 #include <glxthumbnailcontext.h>
    46 #include <glxthumbnailattributeinfo.h>
    46 #include <glxthumbnailattributeinfo.h>
    47 #include <glxcollectionpluginall.hrh>
    47 #include <glxcollectionpluginall.hrh>
    48 #include <glxcollectionpluginalbums.hrh>
    48 #include <glxcollectionpluginalbums.hrh>
    49 #include <glxcollectionpluginmonths.hrh>
       
    50 #include <glxcollectionplugintype.hrh>
    49 #include <glxcollectionplugintype.hrh>
    51 #include <glxnavigationalstate.h>
    50 #include <glxnavigationalstate.h>
    52 #include <glxfiltergeneraldefs.h>
    51 #include <glxfiltergeneraldefs.h>
    53 
    52 
    54 #include <akntranseffect.h>  // For transition effects
    53 #include <akntranseffect.h>  // For transition effects
    56 #include "glxgfxtranseffect.h"  // For transition effects
    55 #include "glxgfxtranseffect.h"  // For transition effects
    57 
    56 
    58 const TInt KListDataWindowSize(8); // Visible page
    57 const TInt KListDataWindowSize(8); // Visible page
    59 const TInt KListNonVisibleDataWindowSize(32); // Visible page + 3 pages
    58 const TInt KListNonVisibleDataWindowSize(32); // Visible page + 3 pages
    60 const TInt KNoOfPages(4);
    59 const TInt KNoOfPages(4);
    61 const TInt KGlxCollectionRootLevel = 1;
       
    62 
       
    63 
    60 
    64 // ======== MEMBER FUNCTIONS ========
    61 // ======== MEMBER FUNCTIONS ========
    65 
    62 
    66 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    67 // C++ default constructor can NOT contain any code that might leave.
    64 // C++ default constructor can NOT contain any code that might leave.
   128     CAknToolbar* toolbar = Toolbar();
   125     CAknToolbar* toolbar = Toolbar();
   129     if(toolbar)
   126     if(toolbar)
   130         {
   127         {
   131         toolbar->DisableToolbarL(ETrue);  
   128         toolbar->DisableToolbarL(ETrue);  
   132         }
   129         }
   133     CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   130 
   134     CleanupClosePushL(*uiUtility);
   131     iGridIconSize = iUiUtility->GetGridIconSize();
   135     iGridIconSize = uiUtility->GetGridIconSize();
   132 
   136     CleanupStack::PopAndDestroy(uiUtility);     
       
   137     //Register the view to recieve toolbar events. ViewBase handles the events    
   133     //Register the view to recieve toolbar events. ViewBase handles the events    
   138     SetToolbarObserver(this);
   134     SetToolbarObserver(this);
   139     }
   135     }
   140 
   136 
   141 // ---------------------------------------------------------------------------
   137 // ---------------------------------------------------------------------------
   241 
   237 
   242     iMediaList->AddContextL(iTitleAttributeContext, KMaxTInt);
   238     iMediaList->AddContextL(iTitleAttributeContext, KMaxTInt);
   243     iMediaList->AddContextL(iSubtitleAttributeContext, KGlxFetchContextPriorityNormal);
   239     iMediaList->AddContextL(iSubtitleAttributeContext, KGlxFetchContextPriorityNormal);
   244     if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   240     if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   245         {
   241         {
   246         iOtherAttribsContext = new (ELeave) CGlxAttributeContext(
   242         iNonVisibleThumbnailIterator.SetRangeOffsets(KListDataWindowSize,
   247                 &iThumbnailIterator);
   243                 KListNonVisibleDataWindowSize);
   248         iOtherAttribsContext->AddAttributeL(KMPXMediaGeneralCount);
       
   249 
       
   250         iNonVisibleThumbnailIterator.SetRangeOffsets(0, KListNonVisibleDataWindowSize);
       
   251         iNonVisibleSubtitleAttributeContext
   244         iNonVisibleSubtitleAttributeContext
   252                 = new (ELeave) CGlxAttributeContext(
   245                 = new (ELeave) CGlxAttributeContext(
   253                         &iNonVisibleThumbnailIterator);
   246                         &iNonVisibleThumbnailIterator);
   254         iNonVisibleSubtitleAttributeContext->AddAttributeL(
   247         iNonVisibleSubtitleAttributeContext->AddAttributeL(
   255                 KGlxMediaCollectionPluginSpecificSubTitle);
   248                 KGlxMediaCollectionPluginSpecificSubTitle);
   256         iMediaList->AddContextL(iNonVisibleSubtitleAttributeContext,
   249         iMediaList->AddContextL(iNonVisibleSubtitleAttributeContext,
   257                 KGlxFetchContextPriorityLow);
   250                 KGlxFetchContextPriorityLow);
   258         iNonVisibleOtherAttribsContext = new (ELeave) CGlxAttributeContext(
       
   259                 &iNonVisibleThumbnailIterator);
       
   260         iNonVisibleOtherAttribsContext->AddAttributeL(KMPXMediaGeneralCount);
       
   261 
   251 
   262         CMPXCollectionPath* path = iMediaList->PathLC(
   252         CMPXCollectionPath* path = iMediaList->PathLC(
   263                 NGlxListDefs::EPathParent);
   253                 NGlxListDefs::EPathParent);
   264         if (path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid)
   254         if (path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid)
   265             {
   255             {
       
   256             iOtherAttribsContext = new (ELeave) CGlxAttributeContext(
       
   257                 &iThumbnailIterator);
   266             iOtherAttribsContext->AddAttributeL(KGlxMediaGeneralSystemItem);
   258             iOtherAttribsContext->AddAttributeL(KGlxMediaGeneralSystemItem);
   267             iOtherAttribsContext->AddAttributeL(
   259             iOtherAttribsContext->AddAttributeL(
   268                     KGlxMediaGeneralSlideshowableContent);
   260                     KGlxMediaGeneralSlideshowableContent);
   269 
   261             iMediaList->AddContextL(iOtherAttribsContext,
       
   262                     KGlxFetchContextPriorityNormal);
       
   263 
       
   264             iNonVisibleOtherAttribsContext = new (ELeave) CGlxAttributeContext(
       
   265                 &iNonVisibleThumbnailIterator);
   270             iNonVisibleOtherAttribsContext->AddAttributeL(
   266             iNonVisibleOtherAttribsContext->AddAttributeL(
   271                     KGlxMediaGeneralSystemItem);
   267                     KGlxMediaGeneralSystemItem);
   272             iNonVisibleOtherAttribsContext->AddAttributeL(
   268             iNonVisibleOtherAttribsContext->AddAttributeL(
   273                     KGlxMediaGeneralSlideshowableContent);
   269                     KGlxMediaGeneralSlideshowableContent);
       
   270             iMediaList->AddContextL(iNonVisibleOtherAttribsContext,
       
   271                     KGlxFetchContextPriorityLow);
   274             }
   272             }
   275         CleanupStack::PopAndDestroy(path);
   273         CleanupStack::PopAndDestroy(path);
   276 
   274 
   277         iMediaList->AddContextL(iOtherAttribsContext,
       
   278                 KGlxFetchContextPriorityNormal);
       
   279         iThumbnailContext = new (ELeave) CGlxAttributeContext(
   275         iThumbnailContext = new (ELeave) CGlxAttributeContext(
   280                 &iThumbnailIterator);
   276                 &iThumbnailIterator);
   281         TMPXAttribute tnAttr(KGlxMediaIdThumbnail,
   277         TMPXAttribute tnAttr(KGlxMediaIdThumbnail,
   282                 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
   278                 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
   283                         iGridIconSize.iHeight));
   279                         iGridIconSize.iHeight));
   285                 iGridIconSize.iHeight);
   281                 iGridIconSize.iHeight);
   286         iThumbnailContext->AddAttributeL(tnAttr);
   282         iThumbnailContext->AddAttributeL(tnAttr);
   287         iMediaList->AddContextL(iThumbnailContext,
   283         iMediaList->AddContextL(iThumbnailContext,
   288                 KGlxFetchContextPriorityNormal);
   284                 KGlxFetchContextPriorityNormal);
   289 
   285 
   290         iMediaList->AddContextL(iNonVisibleOtherAttribsContext,
       
   291                 KGlxFetchContextPriorityLow);
       
   292         iNonVisibleThumbnailContext = new (ELeave) CGlxAttributeContext(
   286         iNonVisibleThumbnailContext = new (ELeave) CGlxAttributeContext(
   293                 &iNonVisibleThumbnailIterator);
   287                 &iNonVisibleThumbnailIterator);
   294         iNonVisibleThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth,
   288         iNonVisibleThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth,
   295                 iGridIconSize.iHeight);
   289                 iGridIconSize.iHeight);
   296         iNonVisibleThumbnailContext->AddAttributeL(tnAttr);
   290         iNonVisibleThumbnailContext->AddAttributeL(tnAttr);
   308     GLX_LOG_INFO1("CGlxListViewImp::DoMLViewActivateL() - "
   302     GLX_LOG_INFO1("CGlxListViewImp::DoMLViewActivateL() - "
   309             "iBackwardNavigation(%d)", iBackwardNavigation);
   303             "iBackwardNavigation(%d)", iBackwardNavigation);
   310 
   304 
   311     iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this);
   305     iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this);
   312     CreateListL();
   306     CreateListL();
   313     if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot && iPreviewTNBinding
       
   314 			&& iBackwardNavigation && iMediaList->FocusIndex() == 0)
       
   315 		{
       
   316 		GLX_LOG_INFO("CGlxListViewImp::DoMLViewActivateL() - HandleItemChangedL()");
       
   317 		iPopulateListTNs = ETrue;
       
   318 		CMPXCollectionPath* path = iMediaList->PathLC(
       
   319 				NGlxListDefs::EPathFocusOrSelection);
       
   320 		iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs,
       
   321 				iIsRefreshNeeded, iBackwardNavigation);
       
   322 		CleanupStack::PopAndDestroy(path);
       
   323 		}
       
   324     iProgressIndicator = CGlxProgressIndicator::NewL(*this);
   307     iProgressIndicator = CGlxProgressIndicator::NewL(*this);
   325     iProgressIndicator->ShowProgressbarL();
       
   326     iMMCNotifier = CGlxMMCNotifier::NewL(*this);
   308     iMMCNotifier = CGlxMMCNotifier::NewL(*this);
   327     }
   309     }
   328 
   310 
   329 // ---------------------------------------------------------------------------
   311 // ---------------------------------------------------------------------------
   330 // From CAknView
   312 // From CAknView
   545     for (TInt i=aRequestStart; i<= aRequestEnd; i++)
   527     for (TInt i=aRequestStart; i<= aRequestEnd; i++)
   546         {
   528         {
   547         const TGlxMedia& item = iMediaList->Item(i);
   529         const TGlxMedia& item = iMediaList->Item(i);
   548         iList->ItemL(i).SetTitleL(item.Title());
   530         iList->ItemL(i).SetTitleL(item.Title());
   549         iList->ItemL(i).SetTextL(item.SubTitle());
   531         iList->ItemL(i).SetTextL(item.SubTitle());
   550         UpdatePreviewL(i);
   532         if(iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   551         }
   533             {
   552     
   534             UpdatePreviewL(i);
   553     if(iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot)
   535             }
   554         {
   536         }
   555         if ( visIndex != iLastFocusedIndex && !iPopulateListTNs)
   537     
   556             {
   538     if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot && iBackwardNavigation)
   557             GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()"
   539         {
   558                     " iPopulateListTNs(%d)", iPopulateListTNs);      
   540         iMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);
   559             GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()"
   541         CMPXCollectionPath* path = iMediaList->PathLC(
   560                     " visIndex(%d)", visIndex);
   542                 NGlxListDefs::EPathFocusOrSelection);
   561             iPopulateListTNs = ETrue;
   543         GLX_LOG_INFO("CGlxListViewImp::RequestL() - HandleItemChangedL()");
   562             iStartIndex = KErrNotFound;
   544         iPreviewTNBinding->HandleItemChangedL(*path, iIsRefreshNeeded,
   563             iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex);
   545                 iBackwardNavigation);
   564             }
   546         CleanupStack::PopAndDestroy(path);
   565         }
   547         }
   566     else
   548     else
   567         {
   549         {
   568         iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex);
   550         iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex);
   569         }
   551         }
   570     }
   552     }
   571 
   553 
   572 
       
   573 void CGlxListViewImp::Release(TInt /*aBufferStart*/, TInt /*aBufferEnd*/)
   554 void CGlxListViewImp::Release(TInt /*aBufferStart*/, TInt /*aBufferEnd*/)
   574     {
   555     {
   575     TRACER("CGlxListViewImp::Release");
   556     TRACER("CGlxListViewImp::Release");
   576     }
   557     }
   577 
   558 
   578 void CGlxListViewImp::HandleSelectL( TInt aIndex )
   559 void CGlxListViewImp::HandleSelectL(TInt aIndex)
   579     {
   560     {
   580     TRACER("CGlxListViewImp::HandleSelectL");
   561     TRACER("CGlxListViewImp::HandleSelectL");
   581     if(0 <= aIndex && aIndex < iMediaList->Count())
   562     if (0 <= aIndex && aIndex < iMediaList->Count())
   582     	{
   563         {
   583     	iPopulateListTNs = EFalse;
   564         iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex);
   584     	iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex);			
   565         }
   585     	}
       
   586     }
   566     }
   587 
   567 
   588 void CGlxListViewImp::HandleOpenL( TInt aIndex )
   568 void CGlxListViewImp::HandleOpenL( TInt aIndex )
   589     {
   569     {
   590     TRACER("CGlxListViewImp::HandleOpenL");
   570     TRACER("CGlxListViewImp::HandleOpenL");
   591     
   571     
   592 #ifndef __WINSCW__ 
       
   593     GLX_LOG_INFO1("CGlxListViewImp RProperty::Get leftVariable %d",(iUiUtility->GetItemsLeftCount()));
   572     GLX_LOG_INFO1("CGlxListViewImp RProperty::Get leftVariable %d",(iUiUtility->GetItemsLeftCount()));
   594 
   573 
   595     if (iUiUtility->GetItemsLeftCount())
   574     if (iUiUtility->GetItemsLeftCount())
   596         {
   575         {
   597         if(!iProgressIndicator)
   576         if(!iProgressIndicator)
   605             iSchedulerWait = NULL;
   584             iSchedulerWait = NULL;
   606             }
   585             }
   607         iSchedulerWait = new (ELeave) CActiveSchedulerWait();
   586         iSchedulerWait = new (ELeave) CActiveSchedulerWait();
   608         iSchedulerWait->Start();
   587         iSchedulerWait->Start();
   609         }
   588         }
   610 #endif
   589 
   611     if (iNextViewActivationEnabled && (aIndex >= 0 && aIndex
   590     if (iNextViewActivationEnabled && (aIndex >= 0 && aIndex
   612             < iMediaList->Count()) && (iUiUtility->GetItemsLeftCount() == 0))
   591             < iMediaList->Count()) && (iUiUtility->GetItemsLeftCount() == 0))
   613         {
   592         {
   614         iMediaList->CancelPreviousRequests();
   593         iMediaList->CancelPreviousRequests();
   615         //Delete the PreviewTNMBinding as in forward navigation
   594         //Delete the PreviewTNMBinding as in forward navigation
   644 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* 
   623 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* 
   645         /*aMask*/)
   624         /*aMask*/)
   646     {
   625     {
   647     TRACER("CGlxListViewImp::PreviewTNReadyL");
   626     TRACER("CGlxListViewImp::PreviewTNReadyL");
   648 
   627 
   649     if (!iPopulateListTNs)
   628     iPreviewTNBinding->StopTimer();
       
   629 
       
   630     if (iMediaList->FocusIndex() != EGlxListItemAll || iMediaList->IdSpaceId(
       
   631             0) != KGlxIdSpaceIdRoot)
   650         {
   632         {
   651         GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL()- Ignore!");
   633         GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL()- Ignore!");
   652         return;
   634         return;
   653         }
   635         }
   654     iPreviewTNBinding->StopTimer();
   636 
   655 
       
   656 	TInt focusIndex = iMediaList->FocusIndex();
       
   657     TInt mediaCount = iMediaList->Count();
       
   658     GLX_LOG_INFO1("CGlxListViewImp::PreviewTNReadyL() focusIndex(%d)",
       
   659             focusIndex);      
       
   660     
       
   661     TGlxIdSpaceId id = iMediaList->IdSpaceId(0);        
       
   662     if (aBitmap)
   637     if (aBitmap)
   663 	    {
   638         {
   664         iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(aBitmap));
   639         iList->ItemL(EGlxListItemAll).SetIcon(CGulIcon::NewL(aBitmap));
   665         if (id == KGlxIdSpaceIdRoot && focusIndex == EGlxListItemAll)
       
   666             {
       
   667             CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
       
   668             bitmap->Duplicate(aBitmap->Handle());
       
   669             iList->ItemL(EGlxListItemMonth).SetIcon(CGulIcon::NewL(bitmap));
       
   670             }
       
   671         else if (iBackwardNavigation && id == KGlxIdSpaceIdRoot && focusIndex
       
   672                 == EGlxListItemMonth)
       
   673             {
       
   674             CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
       
   675             bitmap->Duplicate(aBitmap->Handle());
       
   676             iList->ItemL(EGlxListItemAll).SetIcon(CGulIcon::NewL(bitmap));
       
   677             }
       
   678         }
   640         }
   679     else
   641     else
   680     	{
   642         {
   681 	    // In main list view, default thumbnails will be set according 
   643         // In main list view, default thumbnails will be set according 
   682 	    // to the list items.
   644         // to the list items.
   683     	//Displays default thumbnail if aBitmap is NULL 
   645         //Displays default thumbnail if aBitmap is NULL 
   684         SetDefaultThumbnailL(focusIndex);
   646         SetDefaultThumbnailL(EGlxListItemAll);
   685         if(id == KGlxIdSpaceIdRoot && focusIndex == EGlxListItemAll)
   647         }
   686             {
   648 
   687             SetDefaultThumbnailL(EGlxListItemMonth);
   649     iList->RefreshScreen(EGlxListItemAll);
   688             }
       
   689     	}
       
   690     
       
   691     GLX_DEBUG2("CGlxListViewImp::PreviewTNReadyL()"
       
   692             " RefreshList(%d)", focusIndex);
       
   693     RefreshList(focusIndex);
       
   694 	
       
   695 	if (iPopulateListTNs)
       
   696 		{
       
   697 		if(iStartIndex == KErrNotFound)
       
   698 			{
       
   699 			iStartIndex = focusIndex;
       
   700 			}
       
   701 		
       
   702 		TInt count = iMediaList->Count();
       
   703 		if(count)
       
   704 		    {
       
   705             TInt focus = (focusIndex + 1) % count;
       
   706             if (!iBackwardNavigation && id == KGlxIdSpaceIdRoot && focus
       
   707                     == EGlxListItemMonth)
       
   708                 {
       
   709                 focus += 1;
       
   710                 }
       
   711             if (focus != iStartIndex)
       
   712                 {
       
   713                 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, focus);
       
   714                 }
       
   715             else
       
   716                 {
       
   717                 iPopulateListTNs = EFalse;	
       
   718                 iIsRefreshNeeded = EFalse;
       
   719                 
       
   720                 // iStartIndex holds the focus index of the item.
       
   721                 // If the focus is not on 0th index and if USB is Connected/Disconnected
       
   722                 // or some files are deleted from file manager, 
       
   723                 // Once the updation of all items is done, the focus should be set to
       
   724                 // previous focus index(not to 0th index). 
       
   725                                
       
   726                 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, 
       
   727                 		iStartIndex);
       
   728                 iList->SetSelectedIndex(iStartIndex);
       
   729                 iList->RefreshScreen(iStartIndex);
       
   730                 
       
   731                 iStartIndex = KErrNotFound;
       
   732                 
       
   733                 /* The medialist doesn't give the callback for focuschanged if the count is one.
       
   734                  * So we have to explicitly start the timer of 2 seconds after populating the list 
       
   735                  * TN's ie., after gettting the first thumbnail.
       
   736                  * The callback is not given because the setfocus index is same as the focused index
       
   737                  * in medialist. 
       
   738                  */
       
   739                 if(count==1 )
       
   740                     {       
       
   741                     if(id == KGlxIdSpaceIdRoot )
       
   742                     	{
       
   743                         CMPXCollectionPath* path = iMediaList->PathLC( 
       
   744                                 NGlxListDefs::EPathFocusOrSelection );
       
   745                         GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL() - HandleItemChangedL()");                    
       
   746                         iPreviewTNBinding->HandleItemChangedL(*path, 
       
   747                                 iPopulateListTNs, iIsRefreshNeeded, iBackwardNavigation);
       
   748                         CleanupStack::PopAndDestroy( path );
       
   749                     	}
       
   750                     }
       
   751                 }
       
   752 			}
       
   753 		}
       
   754     }
   650     }
   755     
   651     
   756 // ----------------------------------------------------------------------------
   652 // ----------------------------------------------------------------------------
   757 // CreateListL
   653 // CreateListL
   758 // ----------------------------------------------------------------------------
   654 // ----------------------------------------------------------------------------
   759 // 
   655 // 
   760 void CGlxListViewImp::CreateListL()
   656 void CGlxListViewImp::CreateListL()
   761     {
   657     {
   762     TRACER("CGlxListViewImp::CreateListL");
   658     TRACER("CGlxListViewImp::CreateListL");
   763     
   659     
   764 	iStartIndex = KErrNotFound;
       
   765 	TInt mediaCount = iMediaList->Count();
   660 	TInt mediaCount = iMediaList->Count();
   766     GLX_DEBUG2("CGlxListViewImp::CreateListL() mediaCount=%d", mediaCount);
   661     GLX_DEBUG2("CGlxListViewImp::CreateListL() mediaCount=%d", mediaCount);
   767 	
   662 	
   768 	if (!iList)
   663 	if (!iList)
   769 		{
   664 		{
   778                 NGlxListDefs::EPathParent);
   673                 NGlxListDefs::EPathParent);
   779         if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid)
   674         if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid)
   780             {           
   675             {           
   781             bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
   676             bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
   782             maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask;
   677             maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask;
   783             }
       
   784         else if (path->Id() == KGlxCollectionPluginMonthsImplementationUid)
       
   785             {
       
   786             bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large;
       
   787             maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask;
       
   788             }
   678             }
   789         else
   679         else
   790             {
   680             {
   791             bitmapId = EMbmGlxiconsQgn_prop_image_notcreated;
   681             bitmapId = EMbmGlxiconsQgn_prop_image_notcreated;
   792             maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask;
   682             maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask;
   891             }            
   781             }            
   892         
   782         
   893         if(aStartIndex == aEndIndex )
   783         if(aStartIndex == aEndIndex )
   894             {
   784             {
   895             iLastFocusedIndex = aStartIndex;
   785             iLastFocusedIndex = aStartIndex;
   896             iPopulateListTNs = EFalse;
       
   897             iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex);			
   786             iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex);			
   898             iList->SetSelectedIndex(iLastFocusedIndex); 
   787             iList->SetSelectedIndex(iLastFocusedIndex); 
   899             iList->RefreshScreen(iLastFocusedIndex);
   788             iList->RefreshScreen(iLastFocusedIndex);
   900             }
   789             }
   901         }
   790         }
   928 // ----------------------------------------------------------------------------
   817 // ----------------------------------------------------------------------------
   929 // HandleAttributesAvailableL
   818 // HandleAttributesAvailableL
   930 // ----------------------------------------------------------------------------
   819 // ----------------------------------------------------------------------------
   931 //	
   820 //	
   932 void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, 
   821 void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, 
   933 	const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList)
   822 	const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/)
   934 	{
   823 	{
   935 	TRACER("CGlxListViewImp::HandleAttributesAvailableL");
   824 	TRACER("CGlxListViewImp::HandleAttributesAvailableL");
   936 
   825 
   937 	TMPXAttribute titleAttrib(KMPXMediaGeneralTitle);
   826 	TMPXAttribute titleAttrib(KMPXMediaGeneralTitle);
   938 	TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle);
   827 	TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle);
   962             iList->RefreshScreen(aItemIndex);
   851             iList->RefreshScreen(aItemIndex);
   963             }
   852             }
   964 		
   853 		
   965 		// If there is some modified in grid/fullscreen view,
   854 		// If there is some modified in grid/fullscreen view,
   966 		// HandleAttributesAvailableL will get called. Here we are setting
   855 		// HandleAttributesAvailableL will get called. Here we are setting
   967 		// iIsRefreshNeeded flag to ETrue		
   856 		// iIsRefreshNeeded flag to ETrue to cleanup once!		
   968 		if (!iIsRefreshNeeded && iBackwardNavigation)
   857 		if (!iIsRefreshNeeded && iBackwardNavigation)
   969 			{
   858 			{
   970 			iIsRefreshNeeded = ETrue;
   859             if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   971 			if(iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   860                 {
   972 				{
   861                 iIsRefreshNeeded = ETrue;
   973 				CleanUpL();
   862                 CleanUpL();
   974 				}
   863                 }
   975 			}
   864             }
   976 		// Set iPopulateListTNs to ETrue and refresh all the items in
   865 		// Refresh thumbnail, if subtitle is updated for the All collection
   977 		// list view if subtitle is updated
   866 		if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot &&
   978 		else if (iPreviewTNBinding && ((!iPopulateListTNs && aItemIndex
   867 		        iPreviewTNBinding && aItemIndex == 0)
   979                 == aList->Count() - 1) || (iIsRefreshNeeded)))
   868             {
   980             {
   869             if (iBackwardNavigation)
   981 			iPopulateListTNs = ETrue;
   870                 {
   982 			iStartIndex = KErrNotFound;
   871                 iIsRefreshNeeded = ETrue;
       
   872                 }
       
   873             iMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);
   983 			CMPXCollectionPath* path = iMediaList->PathLC(
   874 			CMPXCollectionPath* path = iMediaList->PathLC(
   984 					NGlxListDefs::EPathFocusOrSelection);
   875 					NGlxListDefs::EPathFocusOrSelection);
   985 			GLX_LOG_INFO("CGlxListViewImp::HandleAttributesAvailableL() - HandleItemChangedL()");		
   876 			GLX_LOG_INFO("CGlxListViewImp::HandleAttributesAvailableL() - HandleItemChangedL()");
   986 			iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs,
   877 			iPreviewTNBinding->HandleItemChangedL(*path, iIsRefreshNeeded,
   987 					iIsRefreshNeeded, iBackwardNavigation);
   878                     iBackwardNavigation);
   988 			CleanupStack::PopAndDestroy(path);		            	
   879 			CleanupStack::PopAndDestroy(path);		            	
   989 			}
   880 			}
   990 		}
   881 		}
   991 
   882 
   992 	if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   883 	if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot)
   993 		{
   884 		{
   994 		TMPXAttribute countAttrib(KMPXMediaGeneralCount);
   885         TMPXAttribute countAttrib(KMPXMediaGeneralCount);
   995 		TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail,
   886         TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail,
   996 				GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
   887                 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
   997 						iGridIconSize.iHeight));
   888                         iGridIconSize.iHeight));
   998 		if ((KErrNotFound != aAttributes.Find(thumbnailAttribute, match))
   889         if (iIsRefreshNeeded && KErrNotFound != aAttributes.Find(
   999 				|| (KErrNotFound != aAttributes.Find(countAttrib, match)))
   890                 thumbnailAttribute, match))
  1000 			{
   891             {
  1001 			iIsRefreshNeeded = EFalse;
   892             iIsRefreshNeeded = EFalse;
  1002 			UpdatePreviewL(aItemIndex);
   893             }
  1003 			}
   894 
  1004 		}
   895         if ((KErrNotFound != aAttributes.Find(thumbnailAttribute, match))
       
   896                 || (KErrNotFound != aAttributes.Find(countAttrib, match)))
       
   897             {
       
   898             UpdatePreviewL(aItemIndex);
       
   899             }
       
   900         }
  1005 	}
   901 	}
  1006 	
   902 	
  1007 // ----------------------------------------------------------------------------
   903 // ----------------------------------------------------------------------------
  1008 // HandleFocusChangedL
   904 // HandleFocusChangedL
  1009 // ----------------------------------------------------------------------------
   905 // ----------------------------------------------------------------------------
  1010 //	
   906 //	
  1011 void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs::
   907 void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs::
  1012 	TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/,
   908 	TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/,
  1013 	MGlxMediaList* /*aList*/ )
   909 	MGlxMediaList* /*aList*/ )
  1014 	{
   910 	{
  1015 	TRACER( "CGlxListViewImp::HandleFocusChangedL");	 
       
  1016 	if (iPreviewTNBinding && iPopulateListTNs)
       
  1017 		{
       
  1018 		if(iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot)
       
  1019 			{
       
  1020 	        CMPXCollectionPath* path = iMediaList->PathLC(
       
  1021 	                NGlxListDefs::EPathFocusOrSelection);
       
  1022 	        if (!iBackwardNavigation && path->Levels() == KGlxCollectionRootLevel
       
  1023 	                && path->Id(0) == KGlxCollectionPluginMonthsImplementationUid)
       
  1024 	            {
       
  1025 	            CleanupStack::PopAndDestroy(path);
       
  1026 	            return;
       
  1027 	            }
       
  1028 	        GLX_LOG_INFO("CGlxListViewImp::HandleFocusChangedL() - HandleItemChangedL()");        
       
  1029 	        iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs,
       
  1030 	                iIsRefreshNeeded, iBackwardNavigation);	                
       
  1031 	        CleanupStack::PopAndDestroy(path);			
       
  1032 			}
       
  1033         }
       
  1034 	}
   911 	}
  1035 
   912 
  1036 // ----------------------------------------------------------------------------
   913 // ----------------------------------------------------------------------------
  1037 // HandleItemSelected
   914 // HandleItemSelected
  1038 // ----------------------------------------------------------------------------
   915 // ----------------------------------------------------------------------------
  1162             {
  1039             {
  1163             case EGlxListItemAll:
  1040             case EGlxListItemAll:
  1164                 {
  1041                 {
  1165                 bitmapId = EMbmGlxiconsQgn_prop_photo_all_large;
  1042                 bitmapId = EMbmGlxiconsQgn_prop_photo_all_large;
  1166                 maskId = EMbmGlxiconsQgn_prop_photo_all_large_mask;
  1043                 maskId = EMbmGlxiconsQgn_prop_photo_all_large_mask;
  1167                 }
       
  1168                 break;
       
  1169             case EGlxListItemMonth:
       
  1170                 {
       
  1171                 bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large;
       
  1172                 maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask;
       
  1173                 }
  1044                 }
  1174                 break;
  1045                 break;
  1175             case EGlxListItemAlbum:
  1046             case EGlxListItemAlbum:
  1176                 {
  1047                 {
  1177                 bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
  1048                 bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
  1197         if(path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid)
  1068         if(path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid)
  1198             {
  1069             {
  1199             bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
  1070             bitmapId = EMbmGlxiconsQgn_prop_photo_album_large;
  1200             maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask;
  1071             maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask;
  1201             }
  1072             }
  1202         else if(path->Id(0) == KGlxCollectionPluginMonthsImplementationUid)
       
  1203             {
       
  1204             bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large;
       
  1205             maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask;
       
  1206             }
       
  1207         else
  1073         else
  1208             {
  1074             {
  1209             bitmapId = EMbmGlxiconsQgn_prop_image_notcreated;
  1075             bitmapId = EMbmGlxiconsQgn_prop_image_notcreated;
  1210             maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask;
  1076             maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask;
  1211             }
  1077             }
  1251 void CGlxListViewImp::HandleMMCInsertionL()
  1117 void CGlxListViewImp::HandleMMCInsertionL()
  1252     {
  1118     {
  1253     TRACER("CGlxListViewImp::HandleMMCInsertionL()");
  1119     TRACER("CGlxListViewImp::HandleMMCInsertionL()");
  1254     iMMCState = ETrue;
  1120     iMMCState = ETrue;
  1255     NavigateToMainListL();
  1121     NavigateToMainListL();
  1256     
       
  1257     }
  1122     }
  1258 
  1123 
  1259 // ---------------------------------------------------------------------------
  1124 // ---------------------------------------------------------------------------
  1260 // HandleMMCRemovalL
  1125 // HandleMMCRemovalL
  1261 // 
  1126 // 
  1280     if(iMMCState)
  1145     if(iMMCState)
  1281         {
  1146         {
  1282         iMMCState = EFalse;
  1147         iMMCState = EFalse;
  1283         NavigateToMainListL();
  1148         NavigateToMainListL();
  1284         }
  1149         }
       
  1150 
       
  1151     if (iProgressIndicator)
       
  1152         {
       
  1153         iProgressIndicator->ControlTNDaemon(aForeground);
       
  1154         if (aForeground)
       
  1155             {
       
  1156             iProgressIndicator->ShowProgressbarL();
       
  1157             }
       
  1158         else
       
  1159             {
       
  1160             iProgressIndicator->DismissProgressDialog();
       
  1161             }
       
  1162         }
  1285     }
  1163     }
  1286 
  1164 
  1287 // ---------------------------------------------------------------------------
  1165 // ---------------------------------------------------------------------------
  1288 // NavigateToMainListL
  1166 // NavigateToMainListL
  1289 // 
  1167 // 
  1291 void CGlxListViewImp::NavigateToMainListL()
  1169 void CGlxListViewImp::NavigateToMainListL()
  1292     {
  1170     {
  1293     TRACER("CGlxListViewImp::NavigateToMainListL()");
  1171     TRACER("CGlxListViewImp::NavigateToMainListL()");
  1294     ProcessCommandL(EAknSoftkeyClose);
  1172     ProcessCommandL(EAknSoftkeyClose);
  1295     }
  1173     }
       
  1174 
  1296 // ----------------------------------------------------------------------------
  1175 // ----------------------------------------------------------------------------
  1297 // CleanUpL
  1176 // CleanUpL
  1298 // ----------------------------------------------------------------------------
  1177 // ----------------------------------------------------------------------------
  1299 //	
  1178 //	
  1300 void CGlxListViewImp::CleanUpL()
  1179 void CGlxListViewImp::CleanUpL()