41 //recognition string for ical |
41 //recognition string for ical |
42 _LIT8(KVersionICal, "VERSION:2.0"); |
42 _LIT8(KVersionICal, "VERSION:2.0"); |
43 //recognition string for vcal |
43 //recognition string for vcal |
44 _LIT8(KVersionVCal, "VERSION:1.0"); |
44 _LIT8(KVersionVCal, "VERSION:1.0"); |
45 const TInt KReadDataAmount = 256; |
45 const TInt KReadDataAmount = 256; |
46 const TInt KGuidLength = 30; |
|
47 const TInt KNoOfDaysInWeek = 7; |
46 const TInt KNoOfDaysInWeek = 7; |
48 static const int startDateArray[2] = { 1900, 1}; |
47 static const int startDateArray[2] = { 1900, 1}; |
49 static const int endDateArray[2] = { 2100, 1}; |
48 static const int endDateArray[2] = { 2100, 1}; |
50 |
49 |
51 AgendaUtilPrivate::AgendaUtilPrivate(AgendaUtil* parent) |
50 AgendaUtilPrivate::AgendaUtilPrivate(AgendaUtil* parent) |
205 if (!mInstanceViewCreated) { |
204 if (!mInstanceViewCreated) { |
206 // Something went wrong |
205 // Something went wrong |
207 return localUid; |
206 return localUid; |
208 } |
207 } |
209 |
208 |
|
209 // Get the global uid. |
|
210 CCalenInterimUtils2* calenInterimUtils2 = CCalenInterimUtils2::NewL(); |
|
211 HBufC8* globalUid = calenInterimUtils2->GlobalUidL(); |
210 if (AgendaEntry::TypeNote == entry.type()) { |
212 if (AgendaEntry::TypeNote == entry.type()) { |
211 TRAP( |
213 TRAP( |
212 iError, |
214 iError, |
213 |
215 |
214 RPointerArray<CCalEntry> entryArray; |
216 RPointerArray<CCalEntry> entryArray; |
215 CleanupResetAndDestroyPushL(entryArray); |
217 CleanupResetAndDestroyPushL(entryArray); |
216 |
|
217 // Get the global uid. |
|
218 CCalenInterimUtils2* calenInterimUtils2 = CCalenInterimUtils2::NewL(); |
|
219 HBufC8* globalUid = calenInterimUtils2->GlobalUidL(); |
|
220 CleanupStack::PushL(globalUid); |
218 CleanupStack::PushL(globalUid); |
221 delete calenInterimUtils2; |
|
222 |
219 |
223 // Construct a CCalEntry object and start filling the details. |
220 // Construct a CCalEntry object and start filling the details. |
224 CCalEntry* newEntry = 0; |
221 CCalEntry* newEntry = 0; |
225 newEntry = CCalEntry::NewL( |
222 newEntry = CCalEntry::NewL( |
226 static_cast<CCalEntry::TType>(entry.type()), |
223 static_cast<CCalEntry::TType>(entry.type()), |
274 TRAP( |
271 TRAP( |
275 iError, |
272 iError, |
276 |
273 |
277 RPointerArray<CCalEntry> entryArray; |
274 RPointerArray<CCalEntry> entryArray; |
278 CleanupResetAndDestroyPushL(entryArray); |
275 CleanupResetAndDestroyPushL(entryArray); |
279 |
276 CleanupStack::PushL(globalUid); |
280 // Get the global uid. |
|
281 TTime homeTime; |
|
282 homeTime.HomeTime(); |
|
283 TInt64 seed = homeTime.Int64(); |
|
284 TInt randumNumber = Math::Rand(seed); |
|
285 HBufC8* globalUid = HBufC8::NewLC(KGuidLength); |
|
286 globalUid->Des().Num(randumNumber); |
|
287 |
|
288 // Construct a CCalEntry object and start filling the details. |
277 // Construct a CCalEntry object and start filling the details. |
289 CCalEntry* newEntry = 0; |
278 CCalEntry* newEntry = 0; |
290 newEntry = CCalEntry::NewL( |
279 newEntry = CCalEntry::NewL( |
291 static_cast<CCalEntry::TType>(entry.type()), |
280 static_cast<CCalEntry::TType>(entry.type()), |
292 globalUid, |
281 globalUid, |
443 } |
435 } |
444 |
436 |
445 // Now save the GUID of the saved entry. |
437 // Now save the GUID of the saved entry. |
446 TRAP( |
438 TRAP( |
447 iError, |
439 iError, |
448 |
440 globalUid = originalEntry->UidL().AllocL(); |
449 globalUid = HBufC8::NewL(KGuidLength); |
|
450 *globalUid = originalEntry->UidL(); |
|
451 ) |
441 ) |
452 |
442 |
453 delete originalEntry; |
443 delete originalEntry; |
454 |
444 |
455 // Now start cloning and create a new entry. |
445 // Now start cloning and create a new entry. |
456 if (AgendaEntry::TypeNote == type) { |
446 if (AgendaEntry::TypeNote == type) { |
457 TRAP( |
447 TRAP( |
458 iError, |
448 iError, |
459 |
449 |
460 RPointerArray<CCalEntry> entryArray; |
450 RPointerArray<CCalEntry> entryArray; |
461 CleanupResetAndDestroyPushL(entryArray); |
451 CleanupClosePushL(entryArray); |
462 |
452 |
463 // Construct a CCalEntry object and start filling the details. |
453 // Construct a CCalEntry object and start filling the details. |
464 CCalEntry* newEntry = 0; |
454 CCalEntry* newEntry = 0; |
465 newEntry = CCalEntry::NewL( |
455 newEntry = CCalEntry::NewL( |
466 static_cast<CCalEntry::TType>(type), |
456 static_cast<CCalEntry::TType>(type), |
487 } else { |
477 } else { |
488 TRAP( |
478 TRAP( |
489 iError, |
479 iError, |
490 |
480 |
491 RPointerArray<CCalEntry> entryArray; |
481 RPointerArray<CCalEntry> entryArray; |
492 CleanupResetAndDestroyPushL(entryArray); |
482 CleanupClosePushL(entryArray); |
493 |
483 |
494 // Construct a CCalEntry object and start filling the details. |
484 // Construct a CCalEntry object and start filling the details. |
495 CCalEntry* newEntry = 0; |
485 CCalEntry* newEntry = 0; |
496 newEntry = CCalEntry::NewL( |
486 newEntry = CCalEntry::NewL( |
497 static_cast<CCalEntry::TType>(type), |
487 static_cast<CCalEntry::TType>(type), |
648 */ |
638 */ |
649 void AgendaUtilPrivate::deleteRepeatedEntry( |
639 void AgendaUtilPrivate::deleteRepeatedEntry( |
650 AgendaEntry& entry, |
640 AgendaEntry& entry, |
651 AgendaUtil::RecurrenceRange range) |
641 AgendaUtil::RecurrenceRange range) |
652 { |
642 { |
653 qDebug("AgendaUtilPrivate::deleteRepeatedEntry"); |
|
654 |
643 |
655 // First prepare the session with agenda server. |
644 // First prepare the session with agenda server. |
656 if (!mInstanceViewCreated) { |
645 if (!mInstanceViewCreated) { |
657 // Something went wrong. |
646 // Something went wrong. |
658 return; |
647 return; |