videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp
branchRCL_3
changeset 18 baf439b22ddd
parent 16 67eb01668b0e
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp	Wed Jun 09 09:44:23 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp	Mon Jun 21 15:43:03 2010 +0300
@@ -292,7 +292,7 @@
 // CVcxMyVideosAlbum::CalculateAttributesL
 // ---------------------------------------------------------------------------
 //
-void CVcxMyVideosAlbum::CalculateAttributesL( TInt aStartIndex )
+TBool CVcxMyVideosAlbum::CalculateAttributesL()
     {
     TInt videoCount = 0;
     TUint32 count = iVideoList.Count();
@@ -303,7 +303,7 @@
     TUint32 flags;
     TInt64 currentItemsCreationDate = 0;
     TInt64 latestCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *iMedia );
-    for ( TInt i = aStartIndex; i < count; i++ )
+    for ( TInt i = 0; i < count; i++ )
         {
         video = iCollection.iCache->FindVideoByMdsIdL( iVideoList[i].iMdsId, pos );
         if ( video )
@@ -322,13 +322,36 @@
                 }
             }
         }
-    iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, videoCount );
-    iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount, newCount );
+    
+    TBool modified = EFalse;
+    
+    TUint32 prevValue = TVcxMyVideosCollectionUtil::CategoryItemCountL( *iMedia );
+    if ( prevValue != videoCount )
+        {
+        iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, videoCount );
+        modified = ETrue;
+        }
+
+    prevValue = TVcxMyVideosCollectionUtil::CategoryNewItemCountL( *iMedia );
+    if ( prevValue != newCount )
+        {
+        iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount, newCount );
+        modified = ETrue;
+        }
+    
     if ( latestNewVideo )
         {
-        iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName,
-                TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
+        TPtrC prevNewVideoName( TVcxMyVideosCollectionUtil::CategoryNewVideoName( *iMedia ) );
+        TPtrC latestNewVideoName( TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
+        if ( prevNewVideoName != latestNewVideoName )
+            {
+            iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName,
+                    TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) );
+            iMedia->SetTObjectValueL<TInt64>( KMPXMediaGeneralDate, latestCreationDate );    
+            modified = ETrue;
+            }
         }
-    iMedia->SetTObjectValueL<TInt64>( KMPXMediaGeneralDate, latestCreationDate );
+    
+    return modified;
     }