void OrganizerTodoTimeTransform::transformToDetailL(const CCalEntry& entry, QOrganizerItem *item)
{
    if(item->type() == QOrganizerItemType::TypeTodo
        || item->type() == QOrganizerItemType::TypeTodoOccurrence)
    {
        TCalTime startTime = entry.StartTimeL();
        TCalTime endTime = entry.EndTimeL();

        QOrganizerTodoTime range;
        if (startTime.TimeUtcL() != Time::NullTTime())
            range.setStartDateTime(toQDateTimeL(startTime));
        if (endTime.TimeUtcL() != Time::NullTTime())
            range.setDueDateTime(toQDateTimeL(endTime));

        if (!range.isEmpty())
            item->saveDetail(&range);
    }
}
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ReadAlarmFromAgnL
// Reads alarm offset from the native Calendar entry. In case of Anniversary,
// the offset is calculated from the midnight since native Calendar supports
// only dates in these types of entries
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ReadAlarmFromAgnL(MPIMEventItem& aItem,
        CCalEntry& aEntry)
{
    JELOG2(EPim);
    CCalAlarm* calAlarm = aEntry.AlarmL();
    // The previous function call returns NULL if there is no alarm
    // set in the item. The ownership is transferred to the caller
    // if the alarm values has been added to the item.
    if (calAlarm)
    {
        TTimeIntervalMinutes nativeValue = calAlarm->TimeOffset();
        // The alarm is not needed anymore so it can be deleted
        delete calAlarm;
        calAlarm = NULL;
        //            nativeValue.Int() );
        // Convert the alarm value based on the start time of the entry
        CCalEntry::TType entryType = aEntry.EntryTypeL();
        // Events (memos) and anniversaries do not have time in the native
        // side, therefore alarm field in those entries need to be calculated
        // from the end of the day
        if (entryType == CCalEntry::EAnniv)
        {
            TTime start(aEntry.StartTimeL().TimeLocalL());
            // Change the time to the end of the start date
            TTime startOfDayLocal(start);
            startOfDayLocal = StartOfDay(startOfDayLocal);
            // Calculate the difference from end of day and start time including
            // the original alarm offset which was previously read
            TTimeIntervalMinutes temp(0);
            User::LeaveIfError(startOfDayLocal.MinutesFrom(start, temp));
            // Since it is not possible to substract TTimeIntervalMinutes
            // from TTime (probably a Symbian error), the difference has
            // to be calculated using the following way...
            nativeValue = nativeValue.Int() + temp.Int();
        }
        TInt alarmValue = nativeValue.Int() * KPIMSecondsInMinute;
        //            alarmValue );
        // Add alarm value to the item
        TPIMFieldData fieldData(EPIMEventAlarm, EPIMFieldInt, KPIMAttrNone,
                                alarmValue);
        aItem.ItemData().AddValueL(fieldData);
    }
}
Пример #3
0
TInt CDstIntUtils::CheckAgendaEntryL(CCalEntryView& aEntryView, const TCalLocalUid& aId, const TTime& aStart, const TTime& aEnd)
	{
	TInt err = KErrArgument;
	CCalEntry* entry = aEntryView.FetchL(aId);
	CleanupStack::PushL(entry);

	TTime start = entry->StartTimeL().TimeLocalL();
	TTime end   = entry->EndTimeL().TimeLocalL();

#ifdef _DEBUG
	TDateTime startDateTime = start.DateTime();
	TDateTime aStartDateTime = aStart.DateTime();
	TDateTime endDateTime = end.DateTime();
	TDateTime aEndDateTime = aEnd.DateTime();
#endif

	if((aStart == start) && (aEnd == end))
		{
		err = KErrNone;
		}
	
	CleanupStack::PopAndDestroy(entry);
	return err;
	}
Пример #4
0
void CCalOOMTest::CreateEntriesL()
	{
	_LIT8(KGuid1, "Reminder-1");
	_LIT8(KGuid2, "Appt-1");
		
	_LIT(KEntryStartTime, 		"20121119:013000.000000"); // 20-12-2012 01.30
	_LIT(KEntryEndTime, 		"20121119:090000.000000"); // 20-12-2012 09.00
	
	_LIT(KTimeUntil, 			"20131119:013000.000000"); // 20-12-2013 01.30
	
	_LIT(KSummary1, "THIS SUMMARY");
	_LIT(KSummary2, "Appt summary");
	
	
	//entry 1	
	HBufC8* guid8 = HBufC8::NewL(KGuid1().Length());
	guid8->Des().Copy(KGuid1);
	CleanupStack::PushL(guid8);
	CCalEntry* entry = CCalEntry::NewL(CCalEntry::EReminder, guid8, CCalEntry::EMethodAdd, (TUint)0);	
	CleanupStack::Pop(guid8);
	entry->SetSummaryL(KSummary1);
	
	// entry2
	guid8 = HBufC8::NewL(KGuid2().Length());
	guid8->Des().Copy(KGuid2);
	CleanupStack::PushL(guid8);
	CCalEntry* entry2 = CCalEntry::NewL(CCalEntry::EAppt, guid8, CCalEntry::EMethodAdd, (TUint)0);	
	CleanupStack::Pop(guid8);
	entry2->SetSummaryL(KSummary2);
	
	TTime time1(KEntryStartTime());
	TTime time2(KEntryEndTime());
	TCalTime st;
	st.SetTimeUtcL(time1);
	TCalTime end;
	end.SetTimeUtcL(time2);
		
	entry->SetStartAndEndTimeL(st, end); 
	entry2->SetStartAndEndTimeL(st, end);
	
	TCalRRule* rRule=new (ELeave) TCalRRule(TCalRRule::EDaily);
	TCalTime calTime = entry->StartTimeL();
	rRule->SetDtStart(calTime);
	rRule->SetInterval(1);
	TTime until(KTimeUntil());
	TCalTime untilTime;
	untilTime.SetTimeUtcL(until);
	rRule->SetUntil(untilTime); 
	
	entry->SetRRuleL(*rRule);
	entry2->SetRRuleL(*rRule);
	
	TInt						entriesStored(0);
	RPointerArray<CCalEntry>	entriesToStore;
	CleanupResetAndDestroyPushL(entriesToStore);
	entriesToStore.AppendL(entry);
	entriesToStore.AppendL(entry2);
	iTestLib->SynCGetEntryViewL().StoreL(entriesToStore, entriesStored);

	delete rRule;
	CleanupStack::PopAndDestroy(&entriesToStore);
	
	// Find
	_LIT(KFindSt, 		"20131117:013000.000000"); // The event "overlaps" with this search range, hence must be caught. The reminder must not be caught (its end time = start time).
	_LIT(KFindEnd, 		"20131119:093000.000000");

	CalCommon::TCalViewFilter filter = CalCommon::EIncludeAll;
	TestFindInstancesL(KFindSt, KFindEnd, filter); // calling OOM test function
	}