mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp
branchRCL_3
changeset 42 4aca42fa4eb1
parent 28 f56ec6ce2732
child 54 fa0adf088850
equal deleted inserted replaced
34:e257e2b6459d 42:4aca42fa4eb1
    36 #include "mpxcollectionplaylistobserver.h"
    36 #include "mpxcollectionplaylistobserver.h"
    37 #include "mpxcollectionplaylist.h"
    37 #include "mpxcollectionplaylist.h"
    38 
    38 
    39 // CONSTANTS
    39 // CONSTANTS
    40 const TInt KIncrementalFetchSize = 400;
    40 const TInt KIncrementalFetchSize = 400;
    41 const TInt KIncrementalDelay = 2000000;
    41 
       
    42 const TInt KIncrementalDelay = 250000;
    42 
    43 
    43 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    44 // Two-phased constructor.
    45 // Two-phased constructor.
    45 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    46 //
    47 //
  1255         // Deleted
  1256         // Deleted
  1256         if( changeType == EMPXItemDeleted )
  1257         if( changeType == EMPXItemDeleted )
  1257             {
  1258             {
  1258             refresh = ETrue;
  1259             refresh = ETrue;
  1259             MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- current item deleted");
  1260             MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- current item deleted");
  1260             
       
  1261             TBool lastItemDeleted( iItemIndex == 0 && iItemIndexes.Count() == 1 );
       
  1262             
       
  1263             if ( lastItemDeleted ) // playlist is now empty, notify observer immediately
       
  1264                 {
       
  1265                 MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- last playlist item deleted");
       
  1266                 Invalidate();
       
  1267                 if ( iPlObs )
       
  1268                     {
       
  1269                     iPlObs->HandleCollectionPlaylistChange(KErrEof);
       
  1270                     }
       
  1271                 }
       
  1272             }
  1261             }
  1273         // Modified
  1262         // Modified
  1274         else if( changeType == EMPXItemModified )
  1263         else if( changeType == EMPXItemModified )
  1275             {
  1264             {
  1276             MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- modified");
  1265             MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- modified");
  1345                 }
  1334                 }
  1346             }
  1335             }
  1347         }
  1336         }
  1348 
  1337 
  1349     // update playlist immediately when item is deleted in order to detect deletion of the last item in the playlist
  1338     // update playlist immediately when item is deleted in order to detect deletion of the last item in the playlist
  1350     if ( refresh && iItemIndexes.Count() > 0 )
  1339      if (iAutoPlaylist && refresh)
  1351         {
  1340         {
  1352         // For autoplaylist, affected by the event.
  1341         // For autoplaylist, affected by the event.
  1353         // Path clip will never happen for autoplaylist
  1342         // Path clip will never happen for autoplaylist
  1354         if (changeType == EMPXItemDeleted)
  1343 		if ( changeType == EMPXItemDeleted )
  1355             {
  1344             {
  1356             // item deleted in the autoplaylist, update the iPath to remove the item
  1345             // item deleted in the autoplaylist, update the iPath to remove the item
  1357             // auso update iItemIndexes and iItemIndex
  1346             // auso update iItemIndexes and iItemIndex
  1358             iPath->Remove(affectedIndex);
  1347             iPath->Remove(affectedIndex);
  1359             TInt itemIndex = KErrNotFound;
  1348             TInt itemIndex = KErrNotFound;