26 |
26 |
27 |
27 |
28 const TInt KIncrementalDelayNone = 0; |
28 const TInt KIncrementalDelayNone = 0; |
29 const TInt KIncrementalDelayHalfSecond = 1000000; |
29 const TInt KIncrementalDelayHalfSecond = 1000000; |
30 const TInt KIncrementalFetchBlockSize = 20; |
30 const TInt KIncrementalFetchBlockSize = 20; |
31 const TInt KIncrementalNullOffset = 0; |
31 |
32 |
32 |
33 |
33 |
34 /*! |
34 /*! |
35 \class CMpMpxIsolatedCollectionHelper |
35 \class CMpMpxIsolatedCollectionHelper |
36 \brief Helper class to open an isolated collection. |
36 \brief Helper class to open an isolated collection. |
76 |
76 |
77 /*! |
77 /*! |
78 \internal |
78 \internal |
79 Opens an isolated collection with the /a path. |
79 Opens an isolated collection with the /a path. |
80 */ |
80 */ |
81 void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath ) |
81 void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath, TInt aIndex, MpOpenMode aMode ) |
82 { |
82 { |
83 //Using incremental open to open the collection. |
83 //Using incremental open to open the collection. |
84 |
84 iOpenMode = aMode; |
85 // Cancel any reads |
85 // Cancel any reads |
86 iIncrementalOpenUtil->Stop(); |
86 iIncrementalOpenUtil->Stop(); |
87 |
87 |
88 // Start the read |
88 // Start the read |
89 iFirstIncrementalOpen = ETrue; |
89 iFirstIncrementalOpen = ETrue; |
90 RArray<TMPXAttribute> attrs; |
90 RArray<TMPXAttribute> attrs; |
91 CleanupClosePushL( attrs ); |
91 CleanupClosePushL( attrs ); |
92 TArray<TMPXAttribute> ary = attrs.Array(); |
92 TArray<TMPXAttribute> ary = attrs.Array(); |
93 iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone ); |
93 iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone ); |
94 iIncrementalOpenUtil->StartL( aPath, ary, KIncrementalFetchBlockSize, |
94 iIncrementalOpenUtil->StartL( aPath, ary, KIncrementalFetchBlockSize, |
95 KIncrementalNullOffset, CMPXCollectionOpenUtility::EFetchNormal ); |
95 aIndex, CMPXCollectionOpenUtility::EFetchNormal ); |
96 iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond ); |
96 iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond ); |
97 CleanupStack::PopAndDestroy( &attrs ); |
97 CleanupStack::PopAndDestroy( &attrs ); |
98 } |
98 } |
99 |
99 |
100 /*! |
100 /*! |
129 TBool /*aComplete*/, |
129 TBool /*aComplete*/, |
130 TInt aError ) |
130 TInt aError ) |
131 { |
131 { |
132 if ( iFirstIncrementalOpen ) |
132 if ( iFirstIncrementalOpen ) |
133 { |
133 { |
134 iObserver->HandleIsolatedOpenL( aEntries, aError ); |
134 CMPXCollectionPath* cPath = NULL; |
135 iFirstIncrementalOpen = EFalse; |
135 iFirstIncrementalOpen = EFalse; |
|
136 switch( iOpenMode ) { |
|
137 case RestorePathMode: |
|
138 cPath = iIncrementalOpenUtil->PathL(); |
|
139 CleanupStack::PushL( cPath ); |
|
140 iObserver->HandleIsolatedOpenRestorePathL( *cPath, aError ); |
|
141 CleanupStack::PopAndDestroy( cPath ); |
|
142 |
|
143 break; |
|
144 case DefaultMode: |
|
145 default: |
|
146 iObserver->HandleIsolatedOpenL( aEntries, aError ); |
|
147 break; |
|
148 } |
|
149 |
136 } |
150 } |
137 } |
151 } |
138 |
152 |
139 /*! |
153 /*! |
140 \internal |
154 \internal |