本文整理汇总了C++中TCalTime::TimeUtcL方法的典型用法代码示例。如果您正苦于以下问题:C++ TCalTime::TimeUtcL方法的具体用法?C++ TCalTime::TimeUtcL怎么用?C++ TCalTime::TimeUtcL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCalTime
的用法示例。
在下文中一共展示了TCalTime::TimeUtcL方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transformToDetailL
void OrganizerTodoTimeTransform::transformToDetailL(const CCalInstance& instance, QOrganizerItem *itemOccurrence)
{
if (itemOccurrence->type() == QOrganizerItemType::TypeTodo
|| itemOccurrence->type() == QOrganizerItemType::TypeTodoOccurrence)
{
TCalTime startTime = instance.StartTimeL();
TCalTime endTime = instance.EndTimeL();
QOrganizerTodoTime range;
if (startTime.TimeUtcL() != Time::NullTTime())
range.setStartDateTime(toQDateTimeL(startTime));
if (endTime.TimeUtcL() != Time::NullTTime())
range.setDueDateTime(toQDateTimeL(endTime));
if (!range.isEmpty())
itemOccurrence->saveDetail(&range);
}
}
示例2: transformToDetailL
void OrganizerJournalTimeTransform::transformToDetailL(const CCalEntry& entry, QOrganizerItem *item)
{
if (item->type() == QOrganizerItemType::TypeJournal)
{
TCalTime dtstamp = entry.DTStampL(); // TODO: is DTStamp correct?
if (dtstamp.TimeUtcL() != Time::NullTTime()) {
QOrganizerJournalTime range;
range.setEntryDateTime(toQDateTimeL(entry.DTStampL()));
item->saveDetail(&range);
}
}
}
示例3: SetUntil
/** Sets the repeat's end date.
Only one of the until or count parameters may be set. Setting the until date will reset the count parameter.
If the until date is set to TCalTime::MaxTime() the rule will repeat forever.
@param aEndDate The end date, as a TCalTime so it may be accessed in utc or system local time.
@publishedAll
@released
@capability None
*/
EXPORT_C void TCalRRule::SetUntil(const TCalTime& aEndDate)
{
//"-1" means only until time has been set
iCount = -1;
if (aEndDate.TimeUtcL() == TCalTime::MaxTime() || aEndDate.TimeLocalL() == TCalTime::MaxTime())
{
iCount = 0;
}
iUntil = aEndDate;
}
示例4: CopyExceptionDatesToPimL
// -----------------------------------------------------------------------------
// CopyExceptionDatesToPimL
// Copies Agenda exception dates to a PIM API repeat rule.
// Returns: void
// -----------------------------------------------------------------------------
//
void CopyExceptionDatesToPimL(const CCalEntry& aAgnEntry,
MPIMRepeatRuleData& aPimRepeatRuleData)
{
JELOG2(EPim);
RArray<TCalTime> agnExceptionDates;
aAgnEntry.GetExceptionDatesL(agnExceptionDates);
CleanupClosePushL(agnExceptionDates);
const TInt numExceptions = agnExceptionDates.Count();
for (TInt i = 0; i < numExceptions; i++)
{
TCalTime agnExceptionDate = agnExceptionDates[i];
TTime pimExceptionDate = agnExceptionDate.TimeUtcL();
aPimRepeatRuleData.AddExceptDateL(pimExceptionDate);
}
CleanupStack::PopAndDestroy(); // agnExceptionDates close
}
示例5: UpdateEntriesL
/**
* Update entries
* Care is taken to ensure that updateL is not performed on the Child Entries
*/
void CTestCalInterimApiModifier::UpdateEntriesL()
{
RPointerArray<CCalEntry> updatedEntries;
CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &updatedEntries));
const TInt KUidCount(iModifier->iEntryArray.Count());
for (TInt j(0) ; j < KUidCount ; ++j)
{
RPointerArray<CCalEntry> calEntries;
CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &calEntries));
TCalTime recurrenceId = iModifier->iEntryArray[j]->RecurrenceIdL();
TTime recurrenceIdInTTime = recurrenceId.TimeUtcL();
TTime recurNullTime = Time::NullTTime();
if(recurrenceIdInTTime != recurNullTime)
{
continue;
}
TPtrC8 desiredGuid(iModifier->iEntryArray[j]->UidL());
iEntryView->FetchL(desiredGuid, calEntries);
// update of entries can be performed only on the parent entry
calEntries[0]->SetLastModifiedDateL();
updatedEntries.Append(calEntries[0]);
calEntries.Reset();
CleanupStack::Pop(&calEntries);
}
TInt numSuccessful(0);
iTestStep->INFO_PRINTF1(KModifyOperation);
TRAPD(err, iEntryView->UpdateL(updatedEntries, numSuccessful));
TESTL( numSuccessful == updatedEntries.Count() );
if(err != KErrNone)
{
iTestStep->ERR_PRINTF2(KErrUpdateOperation,err);
iTestStep->SetTestStepResult(EFail);
}
CleanupStack::PopAndDestroy(); //UpdateEntries
}
示例6: FinalizeParsingL
/**
Finalize the parsing
@param aRule recurrence rules
@param aStartTime The DTSTART of the parent component.
@return True if finalized parsing successfully
*/
TBool CAgnParseRRuleWeekly::FinalizeParsingL( TCalRRule& aRule, const TCalTime& aStartTime )
{
TRACE_ENTRY_POINT;
//Call the parent, to set some common values
TBool finalized = CAgnParseRRule::FinalizeParsingL( aRule, aStartTime );
// If we are yearly or weekly we can only handle ByDay, and need to handle it
// differently for each.
if ( !( iSetSegs & ESegFlagByDay ) )
{
RArray<TDay> days;
CleanupClosePushL(days);
User::LeaveIfError(days.Append(aStartTime.TimeUtcL().DayNoInWeek()));
aRule.SetByDay(days);
CleanupStack::PopAndDestroy(&days);
}
TRACE_EXIT_POINT;
return finalized;
}
示例7: CreateToDoEntryL
void CBadRRule::CreateToDoEntryL()
{
RPointerArray<CCalEntry> entryarr ;
CleanupResetAndDestroyPushL(entryarr);
TInt num ;
HBufC8* guid = KGUID1().AllocLC(); // ownership of guid gets transferred
CCalEntry *entry = CCalEntry::NewL(CCalEntry::ETodo, guid, CCalEntry::EMethodNone, 0) ;
CleanupStack::Pop(guid);
CleanupStack::PushL(entry) ;
TCalTime startTime ;
TCalTime endTime ;
startTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 8, 10, 30, 0, 0))) ;
endTime.SetTimeUtcL(startTime.TimeUtcL() + TTimeIntervalDays(1)) ;
entry->SetStartAndEndTimeL(startTime, endTime) ;
TCalTime endTime1 ;
endTime1.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 23, 10, 5, 0, 0))) ;
TCalRRule rrule(TCalRRule::EWeekly) ;
rrule.SetDtStart(startTime);
rrule.SetUntil(endTime1);
rrule.SetInterval(1);
RArray<TDay> days;
CleanupClosePushL(days);
days.AppendL(ETuesday);
rrule.SetByDay(days);
CleanupStack::PopAndDestroy(&days);
entry->SetRRuleL(rrule) ;
// both entry and rrule start time should be aligned to the first instance
TCalRRule setRRule ;
entry->GetRRuleL(setRRule) ;
test(setRRule.DtStart().TimeUtcL() == rrule.DtStart().TimeUtcL()) ;
entryarr.AppendL(entry) ;
CleanupStack::Pop(entry);
iCalEntryView->StoreL(entryarr, num) ;
entryarr.ResetAndDestroy();
TCalTime recId;
recId.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 9, 10, 30, 0, 0))); // creating recurrence id
guid = KGUID1().AllocLC(); // ownership of guid gets transferred
entry = CCalEntry::NewL(CCalEntry::ETodo, guid, CCalEntry::EMethodNone, 0, recId, CalCommon::EThisOnly);
CleanupStack::Pop(guid);
CleanupStack::PushL(entry) ;
TCalTime startTime3 ;
TCalTime endTime3 ;
startTime3.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 7, 10, 2, 0, 0))) ;
endTime3.SetTimeUtcL(startTime3.TimeUtcL() + TTimeIntervalHours(1)) ;
entry->SetStartAndEndTimeL(startTime3, endTime3) ;
entryarr.AppendL(entry) ;
CleanupStack::Pop(entry) ;
iCalEntryView->StoreL(entryarr, num) ;
CleanupStack::PopAndDestroy(&entryarr);
RArray<TTime> insTimes ;
insTimes.Append(TTime(TDateTime(2006, EJanuary, 7, 11, 2, 0, 0))) ;
insTimes.Append(TTime(TDateTime(2006, EJanuary, 16, 10, 30, 0, 0))) ;
CleanupClosePushL(insTimes) ;
CheckInstancesL(insTimes) ;
CleanupStack::PopAndDestroy(&insTimes) ;
// time portion of repeat's end eliminates the third instance
}
示例8: CreateParentL
void CBadRRule::CreateParentL()
{
RPointerArray<CCalEntry> entryarr ;
CleanupResetAndDestroyPushL(entryarr);
TInt num ;
HBufC8* guid = KGUID().AllocLC(); // ownership of guid gets transferred
CCalEntry *entry = CCalEntry::NewL(CCalEntry::EEvent, guid, CCalEntry::EMethodNone, 0) ;
CleanupStack::Pop(guid);
CleanupStack::PushL(entry) ;
TCalTime startTime ;
TCalTime endTime ;
startTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 7, 10, 1, 0, 0))) ;
endTime.SetTimeUtcL(startTime.TimeUtcL() + TTimeIntervalHours(1)) ;
entry->SetStartAndEndTimeL(startTime, endTime) ;
TCalTime endTime1;
endTime1.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 23, 10, 5, 0, 0))) ;
TCalRRule rrule(TCalRRule::EWeekly) ;
rrule.SetDtStart(startTime);
rrule.SetUntil(endTime1);
rrule.SetInterval(1);
RArray<TDay> days;
CleanupClosePushL(days);
days.AppendL(ETuesday);
rrule.SetByDay(days);
CleanupStack::PopAndDestroy(&days);
entry->SetRRuleL(rrule) ;
TCalRRule setRRule ;
entry->GetRRuleL(setRRule) ;
test(setRRule.DtStart().TimeUtcL() == rrule.DtStart().TimeUtcL()) ;
entryarr.AppendL(entry) ;
CleanupStack::Pop(entry);
iCalEntryView->StoreL(entryarr, num) ;
entryarr.ResetAndDestroy() ;
iCalEntryView->FetchL(KGUID(), entryarr);
TCalRRule savedRRule ;
entryarr[0]->GetRRuleL(savedRRule) ;
TCalTime matchTime ; /* Jan 10, 2006 is the first Tuesday */
matchTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 9, 10, 1, 0, 0))) ;
//When the entry is stored, the repeat start time is adjusted so that it fits the rule (10th January is Tuesday
test(savedRRule.DtStart().TimeUtcL() == matchTime.TimeUtcL()) ;
test(entryarr[0]->StartTimeL().TimeUtcL() == (matchTime.TimeUtcL())) ;
CleanupStack::PopAndDestroy(&entryarr) ;
RArray<TTime> insTimes ;
insTimes.Append(TTime(TDateTime(2006, EJanuary, 9, 10, 1, 0, 0))) ;
insTimes.Append(TTime(TDateTime(2006, EJanuary, 16, 10, 1, 0, 0))) ;
insTimes.Append(TTime(TDateTime(2006, EJanuary, 23, 10, 1, 0, 0))) ;
CleanupClosePushL(insTimes) ;
CheckInstancesL(insTimes) ;
CleanupStack::PopAndDestroy(&insTimes) ;
}
示例9: PreviousL
/** Returns the previous instance
Loops through all the entries in the cached entry list and finds
the latest instance that appears before the current index instance time.
@return The previous instance
@internalComponent
*/
CCalInstance* CCalInstanceIteratorUid::PreviousL()
{
CCalInstance* retInstance = NULL;
TInt numOfsameTimeInstance = iEntryWithSameTime.Count();
if(numOfsameTimeInstance > 0 && iCurrentIndex >= 1)
{
// we should return the last instance in the array to make it consistent with NextL which returns the first entry's instance.
return iInstanceViewImpl.CreateInstanceL(*iCalLiteEntries[iEntryWithSameTime[--iCurrentIndex]], iCurrentIndexTime);
}
TCalTime bestSoFar;
bestSoFar.SetTimeUtcL(TCalTime::MinTime());
TInt thisAgnSimpleEntryIndex(KErrNotFound);
const TInt KEntryCount(iCalLiteEntries.Count());
TInt i(0);
for (; i < KEntryCount ; ++i)
{
TCalTime entryPreviousTime;
entryPreviousTime.SetTimeUtcL(TCalTime::MinTime());
CAgnRptDef* thisEntryRptDef = iCalLiteEntries[i]->LiteEntry().RptDef();
if (thisEntryRptDef)
{
TTime entryPreviousTimeUtc(iCurrentIndexTime.TimeUtcL());
TBool instancefound(EFalse);
TTime fromTimeUtc;
do
{
fromTimeUtc = entryPreviousTimeUtc - TTimeIntervalMicroSeconds(1);
// keep calling until an unexcepted instance is found or there are no more instances
instancefound = thisEntryRptDef->NudgePreviousInstanceUtcL(fromTimeUtc, entryPreviousTimeUtc);
}
while (instancefound && !thisEntryRptDef->IsAnUnexceptedInstanceL(AgnDateTime::ConvertToLocalTimeL(entryPreviousTimeUtc) ) );
if (instancefound)
{
entryPreviousTime.SetTimeUtcL(entryPreviousTimeUtc);
}
}
else
{
// The entry does not have a repeat rule so it is just a single instance
TCalTime entryInstanceTime = NonRptEntryInstanceTimeL(iCalLiteEntries[i]->LiteEntry());
if (entryInstanceTime.TimeUtcL() < iCurrentIndexTime.TimeUtcL())
{
// The entry's instance time is before the current index time
// so it is a valid possible next instance
entryPreviousTime = entryInstanceTime;
}
}
if (entryPreviousTime.TimeUtcL() > bestSoFar.TimeUtcL())
{
// This time is better than best time so far so update the best so far
bestSoFar = entryPreviousTime;
thisAgnSimpleEntryIndex = i;
iEntryWithSameTime.Reset();
iCurrentIndex = -1;
}
else if (entryPreviousTime.TimeUtcL() == bestSoFar.TimeUtcL() && entryPreviousTime.TimeUtcL()!= TCalTime::MinTime())
{
iEntryWithSameTime.AppendL(thisAgnSimpleEntryIndex);
thisAgnSimpleEntryIndex = i;
}
}
if (bestSoFar.TimeUtcL() != TCalTime::MinTime())
{
retInstance = iInstanceViewImpl.CreateInstanceL(*iCalLiteEntries[thisAgnSimpleEntryIndex], bestSoFar);
iCurrentIndexTime = bestSoFar;
numOfsameTimeInstance = iEntryWithSameTime.Count();
if(numOfsameTimeInstance>0)
{
iCurrentIndex = numOfsameTimeInstance;
}
}
return retInstance;
}
示例10: NextL
/** Returns the next instance
Loops through all the entries in the cached entry list and finds
the earliest instance that appears after the current index instance time.
@return The next instance
@internalComponent
*/
CCalInstance* CCalInstanceIteratorUid::NextL()
{
CCalInstance* retInstance = NULL;
TInt numSameTimeEntry = iEntryWithSameTime.Count();
if(numSameTimeEntry >0 && iCurrentIndex < numSameTimeEntry - 1)
{
//If there are entries in iEntryWithSameTime, their instance time is same as the iCurrentIndexTime, we should return this instance.
return iInstanceViewImpl.CreateInstanceL(*iCalLiteEntries[iEntryWithSameTime[++iCurrentIndex]], iCurrentIndexTime);
}
TCalTime bestSoFar;
bestSoFar.SetTimeUtcL(TCalTime::MaxTime());
TInt thisAgnSimpleEntryIndex(KErrNotFound);
const TInt KEntryCount(iCalLiteEntries.Count());
TInt i(0);
for (; i < KEntryCount ; ++i)
{
TCalTime entryNextTime;
entryNextTime.SetTimeUtcL(TCalTime::MaxTime());
CAgnRptDef* thisEntryRptDef = iCalLiteEntries[i]->LiteEntry().RptDef();
if (thisEntryRptDef)
{
TTime entryNextTimeUtc;
TBool instanceFound(EFalse);
TTime fromTimeUtc(iCurrentIndexTime.TimeUtcL() + TTimeIntervalMicroSeconds(1));
do
{
// keep looping until we find an unexcepted instance or there are no more instances
instanceFound = thisEntryRptDef->NudgeNextInstanceUtcL(fromTimeUtc, entryNextTimeUtc);
fromTimeUtc = entryNextTimeUtc + TTimeIntervalMicroSeconds(1);
}
while (instanceFound && !thisEntryRptDef->IsAnUnexceptedInstanceL(AgnDateTime::ConvertToLocalTimeL(entryNextTimeUtc) ) );
if (instanceFound)
{
entryNextTime.SetTimeUtcL(entryNextTimeUtc);
}
}
else
{
TCalTime entryInstanceTime = NonRptEntryInstanceTimeL(iCalLiteEntries[i]->LiteEntry());
if (entryInstanceTime.TimeUtcL() > iCurrentIndexTime.TimeUtcL())
{
// The entry's instance time is after the current index time
// so it is a valid possible next instance
entryNextTime = entryInstanceTime;
}
}
if (entryNextTime.TimeUtcL() < bestSoFar.TimeUtcL())
{
// This time is better than best time so far so update the best so far
bestSoFar = entryNextTime;
thisAgnSimpleEntryIndex = i;
iEntryWithSameTime.Reset();
iCurrentIndex = -1;
}
else if (entryNextTime.TimeUtcL() == bestSoFar.TimeUtcL() && entryNextTime.TimeUtcL()!= TCalTime::MaxTime())
{
//Store the index of the entry which has the instance time as the "bestSoFar" time
iEntryWithSameTime.AppendL(i);
}
}
if (bestSoFar.TimeUtcL() != TCalTime::MaxTime())
{
retInstance = iInstanceViewImpl.CreateInstanceL(*iCalLiteEntries[thisAgnSimpleEntryIndex], bestSoFar);
iCurrentIndexTime = bestSoFar;
}
return retInstance;
}