photosgallery/viewframework/medialists/src/glxmedialist.cpp
branchRCL_3
changeset 23 b023a8d2866a
parent 21 f9e827349359
equal deleted inserted replaced
21:f9e827349359 23:b023a8d2866a
    47 const TInt KModifyEventMaxWaitInterval = 3000000;
    47 const TInt KModifyEventMaxWaitInterval = 3000000;
    48 /**
    48 /**
    49  * Maximum items count for minimum wait interval.
    49  * Maximum items count for minimum wait interval.
    50  */
    50  */
    51 const TInt KMaxItemsCount = 500;
    51 const TInt KMaxItemsCount = 500;
    52 /**
       
    53  * Time between Callbacks to determine a batch delete operation.
       
    54  */
       
    55 const TInt KCallbackInterval = 200000;
       
    56 
    52 
    57 namespace NGlxMediaList
    53 namespace NGlxMediaList
    58     {
    54     {
    59     /**
    55     /**
    60      * Interface to notify observers. Allows different notifications to use
    56      * Interface to notify observers. Allows different notifications to use
  1107 	      			//Side Effect: Does not reorder album list in case of renaming album (To be handled later).
  1103 	      			//Side Effect: Does not reorder album list in case of renaming album (To be handled later).
  1108 	      			break;
  1104 	      			break;
  1109 
  1105 
  1110                     // Drop through to perform sync, in case the order has changed
  1106                     // Drop through to perform sync, in case the order has changed
  1111                     }
  1107                     }
       
  1108                 case EMPXItemInserted:
  1112                 case EMPXItemDeleted:
  1109                 case EMPXItemDeleted:
  1113                 	{
       
  1114                 	GLX_LOG_INFO("CGlxMediaList::HandleCollectionMessageL() EMPXItemDeleted");
       
  1115                 	if(iBatchOperationMonitorTimer && !iCommandPending)
       
  1116                 		{
       
  1117 						if(iBatchOperationMonitorTimer->IsActive())
       
  1118 							{
       
  1119 							iBatchOperationMonitorTimer->Cancel();
       
  1120 							}
       
  1121 						iBatchOperationMonitorTimer->Start(KCallbackInterval,KCallbackInterval,TCallBack( TimeOut,this ));
       
  1122 						}
       
  1123                 	break;
       
  1124                 	}
       
  1125                 case EMPXItemInserted:
       
  1126                 default:
  1110                 default:
  1127                     // Items have changed, determine whether to sync now
  1111                     // Items have changed, determine whether to sync now
  1128                     // or resync later if a sync is already pending after opening
  1112                     // or resync later if a sync is already pending after opening
  1129                     if ( iSyncStatus == KNonePending )
  1113                     if ( iSyncStatus == KNonePending )
  1130                         {
  1114                         {
  1296     // objects.. item list destructor manipulates those objects so need to do it in this order
  1280     // objects.. item list destructor manipulates those objects so need to do it in this order
  1297 	if(iManager)
  1281 	if(iManager)
  1298 		{
  1282 		{
  1299 		iManager->HandleListDeleted( this );
  1283 		iManager->HandleListDeleted( this );
  1300 		iManager->Close();
  1284 		iManager->Close();
  1301 		}
  1285 		}    
  1302 	if(iBatchOperationMonitorTimer)
       
  1303 		{
       
  1304 		if(iBatchOperationMonitorTimer->IsActive())
       
  1305 			{
       
  1306 			iBatchOperationMonitorTimer->Cancel();			
       
  1307 			}
       
  1308 		delete iBatchOperationMonitorTimer;
       
  1309 		}
       
  1310     }
  1286     }
  1311 
  1287 
  1312 // -----------------------------------------------------------------------------
  1288 // -----------------------------------------------------------------------------
  1313 // ConstructL
  1289 // ConstructL
  1314 // -----------------------------------------------------------------------------
  1290 // -----------------------------------------------------------------------------
  1322     iErrorPoster = CGlxErrorPoster::InstanceL();
  1298     iErrorPoster = CGlxErrorPoster::InstanceL();
  1323     iMediaListArray = CGlxMediaListArray::InstanceL();
  1299     iMediaListArray = CGlxMediaListArray::InstanceL();
  1324     iCountAttributes.AppendL(KGlxMediaCollectionPluginSpecificSubTitle);
  1300     iCountAttributes.AppendL(KGlxMediaCollectionPluginSpecificSubTitle);
  1325     iCountAttributes.AppendL(KGlxMediaGeneralSlideshowableContent);
  1301     iCountAttributes.AppendL(KGlxMediaGeneralSlideshowableContent);
  1326     iCountAttributes.AppendL(KMPXMediaGeneralCount);
  1302     iCountAttributes.AppendL(KMPXMediaGeneralCount);
  1327     iBatchOperationMonitorTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
  1328     }
  1303     }
  1329 
  1304 
  1330 // -----------------------------------------------------------------------------
  1305 // -----------------------------------------------------------------------------
  1331 // Initialize the media list
  1306 // Initialize the media list
  1332 // -----------------------------------------------------------------------------
  1307 // -----------------------------------------------------------------------------
  1913     TRACER("CGlxMediaList::CancelPreviousRequests");
  1888     TRACER("CGlxMediaList::CancelPreviousRequests");
  1914     // Cancel the previous pending request.
  1889     // Cancel the previous pending request.
  1915     // Place a new request for the item in focus, to fetch the media attributes
  1890     // Place a new request for the item in focus, to fetch the media attributes
  1916     iManager->CancelPreviousRequest();
  1891     iManager->CancelPreviousRequest();
  1917     }
  1892     }
  1918 
       
  1919 // ---------------------------------------------------------------------------
       
  1920 // TimeOut
       
  1921 // ---------------------------------------------------------------------------
       
  1922 //  
       
  1923 TInt CGlxMediaList::TimeOut(TAny* aSelf)
       
  1924     {
       
  1925     TRACER("CGlxMediaList::TimeOut");    
       
  1926     if(aSelf)
       
  1927         {
       
  1928 		CGlxMediaList* self = static_cast <CGlxMediaList*> (aSelf);
       
  1929         if (self)
       
  1930             {
       
  1931 			self->iBatchOperationMonitorTimer->Cancel();
       
  1932 			// Items have changed, determine whether to sync now
       
  1933 			// or resync later if a sync is already pending after opening
       
  1934 			if (self->iSyncStatus == KNonePending)
       
  1935 				{
       
  1936 				self->ReOpenL(); // force re-opens
       
  1937 				self->iSyncStatus = KSyncPending;
       
  1938 				}
       
  1939 			else
       
  1940 				{
       
  1941 				self->iSyncStatus = KResyncPending;
       
  1942 				}
       
  1943 			}
       
  1944         }
       
  1945     return KErrNone;
       
  1946     }
       
  1947 
       
  1948 
       
  1949 // END OF FILE