217 if( err == KErrNotFound ) |
217 if( err == KErrNotFound ) |
218 { |
218 { |
219 err = KErrNone; |
219 err = KErrNone; |
220 TRAP( err, iVCalSession->CreateCalFileL( aStoreName )); |
220 TRAP( err, iVCalSession->CreateCalFileL( aStoreName )); |
221 DBG_ARGS(_S("CNSmlAgendaDataStore::DoOpenL: creating the new calfile '%d'"), err ); |
221 DBG_ARGS(_S("CNSmlAgendaDataStore::DoOpenL: creating the new calfile '%d'"), err ); |
|
222 if( err == KErrNone ) |
|
223 { |
|
224 TRAP( err, iVCalSession->OpenL( aStoreName )); |
|
225 } |
222 } |
226 } |
223 if ( err ) |
227 if ( err ) |
224 { |
228 { |
|
229 DBG_ARGS(_S("CNSmlAgendaDataStore::DoOpenL: end with error '%d'"), err ); |
225 User::RequestComplete( iCallerStatus, err ); |
230 User::RequestComplete( iCallerStatus, err ); |
226 return; |
231 return; |
227 } |
232 } |
228 |
233 |
229 // Disable notifications |
234 // Disable notifications |
243 iExporter = CCalenExporter::NewL( *iVCalSession ); |
248 iExporter = CCalenExporter::NewL( *iVCalSession ); |
244 |
249 |
245 // Progress view |
250 // Progress view |
246 iAgendaProgressview = CNSmlAgendaProgressview::NewL(); |
251 iAgendaProgressview = CNSmlAgendaProgressview::NewL(); |
247 |
252 |
|
253 // Entry View |
248 iEntryView = CCalEntryView::NewL( *iVCalSession, *iAgendaProgressview ); |
254 iEntryView = CCalEntryView::NewL( *iVCalSession, *iAgendaProgressview ); |
|
255 |
|
256 // Instance View |
|
257 iInstanceView = CCalInstanceView::NewL(*iVCalSession); |
|
258 |
249 CActiveScheduler::Start(); |
259 CActiveScheduler::Start(); |
250 TInt completedStatus = iAgendaProgressview->GetCompletedStatus(); |
260 TInt completedStatus = iAgendaProgressview->GetCompletedStatus(); |
251 if ( completedStatus != KErrNone ) |
261 if ( completedStatus != KErrNone ) |
252 { |
262 { |
253 User::RequestComplete( iCallerStatus, completedStatus ); |
263 User::RequestComplete( iCallerStatus, completedStatus ); |
1179 CArrayFixSeg<TNSmlSnapshotItem>* snapshot = |
1189 CArrayFixSeg<TNSmlSnapshotItem>* snapshot = |
1180 new ( ELeave ) CArrayFixSeg<TNSmlSnapshotItem>( 64 ); |
1190 new ( ELeave ) CArrayFixSeg<TNSmlSnapshotItem>( 64 ); |
1181 CleanupStack::PushL( snapshot ); |
1191 CleanupStack::PushL( snapshot ); |
1182 |
1192 |
1183 // First find all entries ... |
1193 // First find all entries ... |
1184 RArray<TCalLocalUid> uidArray; |
1194 RPointerArray<CCalInstance> array; |
1185 CleanupClosePushL( uidArray ); |
1195 CleanupRPtrArrayPushL(array); |
1186 TCalTime zeroTime; |
1196 |
1187 zeroTime.SetTimeUtcL( Time::NullTTime() ); |
1197 TCalTime startDate; |
1188 iEntryView->GetIdsModifiedSinceDateL( zeroTime, uidArray ); |
1198 startDate.SetTimeLocalL(TDateTime(1900, EJanuary, 1, 0, 0, 0, 0)); |
1189 |
1199 TCalTime endDate; |
1190 // ... and then create snapshot items |
1200 endDate.SetTimeLocalL(TDateTime(2100, EJanuary, 30, 0, 0, 0, 0)); |
1191 for ( TInt i = 0; i < uidArray.Count(); i++ ) |
1201 CalCommon::TCalTimeRange timeRange(startDate, endDate); |
1192 { |
1202 |
1193 TNSmlSnapshotItem newItem = CreateSnapshotItemL( uidArray[i] ); |
1203 iInstanceView->FindInstanceL(array, |
1194 if ( newItem.ItemId() != 0 ) |
1204 CalCommon::EIncludeAppts| |
1195 { |
1205 CalCommon::EIncludeReminder| |
1196 snapshot->InsertIsqL( newItem, iKey ); |
1206 CalCommon::EIncludeEvents| |
1197 } |
1207 CalCommon::EIncludeAnnivs| |
1198 } |
1208 CalCommon::EIncludeCompletedTodos| |
1199 |
1209 CalCommon::EIncludeIncompletedTodos, |
1200 CleanupStack::PopAndDestroy( &uidArray ); |
1210 timeRange); |
|
1211 TInt i = 0; |
|
1212 |
|
1213 while (i < array.Count()) |
|
1214 { |
|
1215 TNSmlSnapshotItem newItem = CreateSnapshotItemL( array[i]->Entry().LocalUidL() ); |
|
1216 if ( newItem.ItemId() != 0 ) |
|
1217 { |
|
1218 snapshot->InsertIsqL( newItem, iKey ); |
|
1219 } |
|
1220 i++; |
|
1221 } |
|
1222 CleanupStack::PopAndDestroy(&array); |
1201 |
1223 |
1202 iChangeFinder->SetNewSnapshot( snapshot ); |
1224 iChangeFinder->SetNewSnapshot( snapshot ); |
1203 |
1225 |
1204 // iChangeFinder takes ownership of items |
1226 // iChangeFinder takes ownership of items |
1205 CleanupStack::Pop( snapshot ); |
1227 CleanupStack::Pop( snapshot ); |