// -----------------------------------------------------------------------------
// CopyExceptionDatesToAgnL
// Copies PIM API exception dates to an Agenda entry.
// Returns: void
// -----------------------------------------------------------------------------
//
void CopyExceptionDatesToAgnL(const MPIMRepeatRuleData& aPimRepeatRuleData,
                              CCalEntry& aAgnEntry)
{
    JELOG2(EPim);
    RArray<TCalTime> agnExceptionDates;
    CleanupClosePushL(agnExceptionDates);
    const CArrayFix<TPIMDate>& pimExceptionDates =
        aPimRepeatRuleData.GetExceptDatesL();
    const TInt numExceptDates = pimExceptionDates.Count();
    TCalTime agnExceptionDate;
    for (TInt i = 0; i < numExceptDates; i++)
    {
        agnExceptionDate.SetTimeUtcL(pimExceptionDates[i]);
        User::LeaveIfError(agnExceptionDates.Append(agnExceptionDate));
    }
    aAgnEntry.SetExceptionDatesL(agnExceptionDates);
    CleanupStack::PopAndDestroy(); // pimExceptionDates close
}
Пример #2
0
void CTestApp::FillEntryL(CCalEntry& aEntry)
	{
	switch (aEntry.EntryTypeL())
		{
		case CCalEntry::EAppt:
			{
			aEntry.SetSummaryL(_L("appt"));

			// the appt spans midnight
			iCalTestLib->SetEntryStartAndEndTimeL(&aEntry, TTime(TDateTime(1995,EJanuary,0,20,15,0,0)), TTime(TDateTime(1995,EJanuary,1,5,15,0,0)) );

			// it repeats every 2 days and has and exception
			TCalRRule rRuleAppt(TCalRRule::EDaily);
			TCalTime dtStartAppt;
			dtStartAppt.SetTimeLocalL(TTime(TDateTime(1995,EJanuary,0,0,0,0,0)));
			TCalTime untilAppt;
			untilAppt.SetTimeLocalL(TTime(TDateTime(1995,EJanuary,9,0,0,0,0)));
			rRuleAppt.SetDtStart(dtStartAppt);
			rRuleAppt.SetUntil(untilAppt);
			rRuleAppt.SetInterval(2);
			aEntry.SetRRuleL(rRuleAppt);
			
			TCalTime exception;
			exception.SetTimeLocalL(TTime(TDateTime(1995,EJanuary,4,0,0,0,0)));
			RArray<TCalTime> exceptions;
			CleanupClosePushL(exceptions);
			exceptions.AppendL(exception);
			aEntry.SetExceptionDatesL(exceptions);
			CleanupStack::PopAndDestroy(&exceptions);
			break;
			}
	case CCalEntry::EEvent:
			{
			aEntry.SetSummaryL(_L("event"));
			iCalTestLib->SetEntryStartAndEndTimeL(&aEntry, TTime(TDateTime(1995,EJanuary,0,0,0,0,0)), TTime(TDateTime(1995,EJanuary,0,0,0,0,0)));
			break;
			}
	case CCalEntry::EAnniv:
			{
			aEntry.SetSummaryL(_L("anniv"));
			iCalTestLib->SetEntryStartAndEndTimeL(&aEntry, TTime(TDateTime(1995,EJanuary,0,0,0,0,0)), TTime(TDateTime(1995,EJanuary,0,0,0,0,0)));  // !!! WHAT'S THIS FOR ???
			
			TCalRRule rRuleAnniv(TCalRRule::EYearly);
			TCalTime dtStartAnniv;
			dtStartAnniv.SetTimeLocalL(TTime(TDateTime(1994,EJanuary,0,0,0,0,0)));
			TCalTime untilAnniv;
			untilAnniv.SetTimeLocalL(TCalTime::MaxTime());
			rRuleAnniv.SetDtStart(dtStartAnniv);
			rRuleAnniv.SetUntil(untilAnniv);
			rRuleAnniv.SetInterval(1);
			aEntry.SetRRuleL(rRuleAnniv);
			break;
			}
	case CCalEntry::ETodo:
			{
			aEntry.SetSummaryL(_L("todo"));
			aEntry.SetPriorityL(1);
			break;
			}
		}
	}