videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp
changeset 40 13331705e488
parent 38 ff53afa8ad05
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp	Fri May 28 09:45:19 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp	Fri Jun 11 09:44:20 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;
     }