mpengine/src/mpmpxisolatedcollectionhelper.cpp
changeset 42 79c49924ae23
parent 22 ecf06a08d4d9
child 51 560ce2306a17
--- a/mpengine/src/mpmpxisolatedcollectionhelper.cpp	Wed Jun 23 18:10:13 2010 +0300
+++ b/mpengine/src/mpmpxisolatedcollectionhelper.cpp	Tue Jul 06 14:13:36 2010 +0300
@@ -28,7 +28,7 @@
 const TInt KIncrementalDelayNone = 0;
 const TInt KIncrementalDelayHalfSecond = 1000000;
 const TInt KIncrementalFetchBlockSize = 20;
-const TInt KIncrementalNullOffset = 0;
+
 
 
 /*!
@@ -78,10 +78,10 @@
  \internal
  Opens an isolated collection with the /a path.
  */
-void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath )
+void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath, TInt aIndex, MpOpenMode aMode )
     {
     //Using incremental open to open the collection.
-    
+    iOpenMode = aMode;
     // Cancel any reads
     iIncrementalOpenUtil->Stop();
 
@@ -92,7 +92,7 @@
     TArray<TMPXAttribute> ary = attrs.Array();
     iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone );
     iIncrementalOpenUtil->StartL( aPath, ary, KIncrementalFetchBlockSize,
-                                  KIncrementalNullOffset, CMPXCollectionOpenUtility::EFetchNormal );
+                                  aIndex, CMPXCollectionOpenUtility::EFetchNormal );
     iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond );
     CleanupStack::PopAndDestroy( &attrs );
     }
@@ -131,8 +131,22 @@
     {
     if ( iFirstIncrementalOpen )
         {
-        iObserver->HandleIsolatedOpenL( aEntries, aError );
+        CMPXCollectionPath* cPath = NULL;
         iFirstIncrementalOpen = EFalse;
+        switch( iOpenMode ) {
+        case RestorePathMode:
+            cPath = iIncrementalOpenUtil->PathL();
+            CleanupStack::PushL( cPath );
+            iObserver->HandleIsolatedOpenRestorePathL( *cPath, aError );
+            CleanupStack::PopAndDestroy( cPath );
+
+            break;
+        case DefaultMode:
+        default:
+            iObserver->HandleIsolatedOpenL( aEntries, aError );
+            break;
+        }
+        
         }
     }