photosgallery/viewframework/medialists/src/glxmedialist.cpp
branchRCL_3
changeset 32 78ad99c24f08
parent 18 bcb43dc84c44
child 35 420f6808bf21
equal deleted inserted replaced
30:a60acebbbd9d 32:78ad99c24f08
    36 #include "glxmedialistarray.h"
    36 #include "glxmedialistarray.h"
    37 #include "glxnavigablelist.h"
    37 #include "glxnavigablelist.h"
    38 #include "mglxfetchcontext.h"
    38 #include "mglxfetchcontext.h"
    39 #include "mglxmedialistobserver.h"
    39 #include "mglxmedialistobserver.h"
    40 #include "glxmediastaticitemdefs.h"
    40 #include "glxmediastaticitemdefs.h"
       
    41 
       
    42 /**
       
    43  * Min & Max wait interval for a modify event, in microseconds
       
    44  * This is to allow thumbnail manager to procees the event first.
       
    45  */
       
    46 const TInt KModifyEventMinWaitInterval = 2000000;
       
    47 const TInt KModifyEventMaxWaitInterval = 3000000;
       
    48 /**
       
    49  * Maximum items count for minimum wait interval.
       
    50  */
       
    51 const TInt KMaxItemsCount = 500;
    41 
    52 
    42 namespace NGlxMediaList
    53 namespace NGlxMediaList
    43     {
    54     {
    44     /**
    55     /**
    45      * Interface to notify observers. Allows different notifications to use
    56      * Interface to notify observers. Allows different notifications to use
  1286     iManager = CGlxCacheManager::InstanceL();
  1297     iManager = CGlxCacheManager::InstanceL();
  1287     iErrorPoster = CGlxErrorPoster::InstanceL();
  1298     iErrorPoster = CGlxErrorPoster::InstanceL();
  1288     iMediaListArray = CGlxMediaListArray::InstanceL();
  1299     iMediaListArray = CGlxMediaListArray::InstanceL();
  1289     iCountAttributes.AppendL(KGlxMediaCollectionPluginSpecificSubTitle);
  1300     iCountAttributes.AppendL(KGlxMediaCollectionPluginSpecificSubTitle);
  1290     iCountAttributes.AppendL(KGlxMediaGeneralSlideshowableContent);
  1301     iCountAttributes.AppendL(KGlxMediaGeneralSlideshowableContent);
       
  1302     iCountAttributes.AppendL(KMPXMediaGeneralCount);
  1291     }
  1303     }
  1292 
  1304 
  1293 // -----------------------------------------------------------------------------
  1305 // -----------------------------------------------------------------------------
  1294 // Initialize the media list
  1306 // Initialize the media list
  1295 // -----------------------------------------------------------------------------
  1307 // -----------------------------------------------------------------------------
  1508             MGlxMediaListObserver* obs = iItemListObservers[obsIdx];
  1520             MGlxMediaListObserver* obs = iItemListObservers[obsIdx];
  1509             obs->HandleItemModifiedL(itemIndices, this);
  1521             obs->HandleItemModifiedL(itemIndices, this);
  1510             }
  1522             }
  1511 
  1523 
  1512         CleanupStack::PopAndDestroy(&itemIndices);
  1524         CleanupStack::PopAndDestroy(&itemIndices);
       
  1525 		
       
  1526         RPointerArray<CGlxMediaList>& mediaLists = iMediaListArray->Array();
       
  1527         TInt listCount = mediaLists.Count();
       
  1528         GLX_DEBUG2("ML:HandleItemModifiedL listCount=%d", listCount);
       
  1529         if (listCount > 0)
       
  1530             {
       
  1531             CGlxMediaList* mediaList = mediaLists[listCount-1];
       
  1532             // Force a delay to allow TNM to process the modified event
       
  1533             if (mediaList == this)
       
  1534                 {
       
  1535                 GLX_DEBUG3("ML:HandleItemModifiedL(wait) listCount=%d, Id=%d",
       
  1536                                                   listCount, id.Value());
       
  1537                 TTimeIntervalMicroSeconds32 timeout;
       
  1538                 timeout = (mediaList->Count() > KMaxItemsCount ?
       
  1539                   KModifyEventMaxWaitInterval : KModifyEventMinWaitInterval );
       
  1540                 RTimer timer;
       
  1541                 CleanupClosePushL(timer);
       
  1542                 TRequestStatus status;
       
  1543                 timer.CreateLocal();
       
  1544                 timer.After(status, timeout);
       
  1545 			 	// User::WaitForRequest() will add codescanner warning but is necessary 
       
  1546 			 	// as User::WaitForAnyRequest() cannot be used in this case
       
  1547                 User::WaitForRequest(status);
       
  1548                 CleanupStack::PopAndDestroy(&timer);
       
  1549                 }
       
  1550             }
  1513         }
  1551         }
  1514     }
  1552     }
  1515 
  1553 
  1516 // -----------------------------------------------------------------------------
  1554 // -----------------------------------------------------------------------------
  1517 // NotifyObserversOfMediaL
  1555 // NotifyObserversOfMediaL
  1845 // Cancels the pending attribute/thumbnail requests 
  1883 // Cancels the pending attribute/thumbnail requests 
  1846 // -----------------------------------------------------------------------------
  1884 // -----------------------------------------------------------------------------
  1847 
  1885 
  1848 void CGlxMediaList::CancelPreviousRequests()
  1886 void CGlxMediaList::CancelPreviousRequests()
  1849 	{
  1887 	{
  1850 	TRACER("CGlxMediaList::CancelPreviousRequests");	
  1888     TRACER("CGlxMediaList::CancelPreviousRequests");
  1851 	
  1889     // Cancel the previous pending request.
  1852 	TInt focusIndex = FocusIndex();
  1890     // Place a new request for the item in focus, to fetch the media attributes
  1853 	
  1891     iManager->CancelPreviousRequest();
  1854 	if(focusIndex >= KErrNone)
  1892     }
  1855 		{	
       
  1856 		if(!Item(focusIndex).Properties())
       
  1857 			{
       
  1858 			// If media is NULL, cancel the previous pending request.
       
  1859 			// Place a new request for the item in focus, to fetch the media attributes
       
  1860 			iManager->CancelPreviousRequest();		
       
  1861 			}
       
  1862 		}
       
  1863 	}