videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp
branchRCL_3
changeset 18 baf439b22ddd
parent 16 67eb01668b0e
equal deleted inserted replaced
16:67eb01668b0e 18:baf439b22ddd
   290 
   290 
   291 // ---------------------------------------------------------------------------
   291 // ---------------------------------------------------------------------------
   292 // CVcxMyVideosAlbum::CalculateAttributesL
   292 // CVcxMyVideosAlbum::CalculateAttributesL
   293 // ---------------------------------------------------------------------------
   293 // ---------------------------------------------------------------------------
   294 //
   294 //
   295 void CVcxMyVideosAlbum::CalculateAttributesL( TInt aStartIndex )
   295 TBool CVcxMyVideosAlbum::CalculateAttributesL()
   296     {
   296     {
   297     TInt videoCount = 0;
   297     TInt videoCount = 0;
   298     TUint32 count = iVideoList.Count();
   298     TUint32 count = iVideoList.Count();
   299     TInt newCount = 0;
   299     TInt newCount = 0;
   300     CMPXMedia* video;
   300     CMPXMedia* video;
   301     CMPXMedia* latestNewVideo = NULL;
   301     CMPXMedia* latestNewVideo = NULL;
   302     TInt pos;
   302     TInt pos;
   303     TUint32 flags;
   303     TUint32 flags;
   304     TInt64 currentItemsCreationDate = 0;
   304     TInt64 currentItemsCreationDate = 0;
   305     TInt64 latestCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *iMedia );
   305     TInt64 latestCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *iMedia );
   306     for ( TInt i = aStartIndex; i < count; i++ )
   306     for ( TInt i = 0; i < count; i++ )
   307         {
   307         {
   308         video = iCollection.iCache->FindVideoByMdsIdL( iVideoList[i].iMdsId, pos );
   308         video = iCollection.iCache->FindVideoByMdsIdL( iVideoList[i].iMdsId, pos );
   309         if ( video )
   309         if ( video )
   310             {
   310             {
   311             videoCount++;
   311             videoCount++;
   320                     latestNewVideo     = video;
   320                     latestNewVideo     = video;
   321                     }
   321                     }
   322                 }
   322                 }
   323             }
   323             }
   324         }
   324         }
   325     iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, videoCount );
   325     
   326     iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount, newCount );
   326     TBool modified = EFalse;
       
   327     
       
   328     TUint32 prevValue = TVcxMyVideosCollectionUtil::CategoryItemCountL( *iMedia );
       
   329     if ( prevValue != videoCount )
       
   330         {
       
   331         iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, videoCount );
       
   332         modified = ETrue;
       
   333         }
       
   334 
       
   335     prevValue = TVcxMyVideosCollectionUtil::CategoryNewItemCountL( *iMedia );
       
   336     if ( prevValue != newCount )
       
   337         {
       
   338         iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount, newCount );
       
   339         modified = ETrue;
       
   340         }
       
   341     
   327     if ( latestNewVideo )
   342     if ( latestNewVideo )
   328         {
   343         {
   329         iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName,
   344         TPtrC prevNewVideoName( TVcxMyVideosCollectionUtil::CategoryNewVideoName( *iMedia ) );
   330                 TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
   345         TPtrC latestNewVideoName( TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
   331         }
   346         if ( prevNewVideoName != latestNewVideoName )
   332     iMedia->SetTObjectValueL<TInt64>( KMPXMediaGeneralDate, latestCreationDate );
   347             {
   333     }
   348             iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName,
   334 
   349                     TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
       
   350             iMedia->SetTObjectValueL<TInt64>( KMPXMediaGeneralDate, latestCreationDate );    
       
   351             modified = ETrue;
       
   352             }
       
   353         }
       
   354     
       
   355     return modified;
       
   356     }
       
   357