本文整理汇总了C++中TCalTime::SetTimeUtcL方法的典型用法代码示例。如果您正苦于以下问题:C++ TCalTime::SetTimeUtcL方法的具体用法?C++ TCalTime::SetTimeUtcL怎么用?C++ TCalTime::SetTimeUtcL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCalTime
的用法示例。
在下文中一共展示了TCalTime::SetTimeUtcL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteAllTodosL
void CDummyCalendarApp::DeleteAllTodosL()
{
delete iTestLib;
iTestLib = NULL;
TBuf<60> dtBuf;
iTestLib = CCalTestLibrary::NewL();
TRAPD(err, iTestLib->PIMTestServer().DeleteFileL(KCalendarFile2));
if(err != KErrNotFound || err != KErrPathNotFound)
{
User::LeaveIfError(err);
}
iTestLib->PIMTestServer().CopyFileL(KOriginalDeleteCalendar, _L("c:\\private\\10003A5B\\tcal_delete_calendar_copy"));
iTestLib->RegisterCalFileL(KCalendarFile2);
iTestLib->OpenFileL(KCalendarFile2);
iTestLib->PIMTestServer().SetTimeZoneL(_L8("Europe/Helsinki"));
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
TCalTime maxTime;
maxTime.SetTimeUtcL(TCalTime::MaxTime());
CalCommon::TCalTimeRange timeRange(minTime, maxTime);
CalCommon::TCalViewFilter filter = CalCommon::EIncludeAll;
//DeleteL has to be placed in the end of the function
//because it is a long running operation and it needs
//to wait for callback in order to go to the next step.
iTestLib->SynCGetEntryViewL().DeleteL(timeRange, filter, *this);
}
示例2: ConvertDateFieldToAgnL
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertDateFieldToAgnL
// Converts a PIM date field to native Calendar entry
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertDateFieldToAgnL(const MPIMEventItem& aItem,
CCalEntry& aEntry, const TPIMEventField aField)
{
JELOG2(EPim);
__ASSERT_DEBUG(aField == EPIMEventStart || aField == EPIMEventEnd,
User::Panic(KPIMPanicCategory, EPIMPanicUnsupportedDateField));
TCalTime end;
TCalTime start;
// Get date from the Java item
const MPIMItemData& itemData = aItem.ItemData();
// Get date from index 0 since native entries support only one value
const TPIMFieldData fieldData = itemData.ValueL(aField, 0);
const TPIMDate date = fieldData.DateValue();
// Check that the date is inside the valid range
__ASSERT_ALWAYS(IsDateInValidAgendaRange(date), User::Leave(KErrAbort));
// By default, set both end and start to the same time and check if there
// is the other part of the date field present in the item
start.SetTimeUtcL(date);
end.SetTimeUtcL(date);
if (aField == EPIMEventStart && itemData.CountValues(EPIMEventEnd) > 0
&& itemData.ValueL(EPIMEventEnd, 0).DateValue() >= date)
{
const TPIMFieldData endData = itemData.ValueL(EPIMEventEnd, 0);
const TPIMDate endDate = endData.DateValue();
// Check that the date is inside the valid range
__ASSERT_ALWAYS(IsDateInValidAgendaRange(endDate), User::Leave(
KErrAbort));
// Set end date to the calendar date in UTC since
// PIM API does not support local time format
end.SetTimeUtcL(endDate);
}
else if (aField == EPIMEventEnd && itemData.CountValues(EPIMEventStart) > 0
&& itemData.ValueL(EPIMEventStart, 0).DateValue() <= date)
{
const TPIMFieldData startData = itemData.ValueL(EPIMEventStart, 0);
const TPIMDate startDate = startData.DateValue();
// Check that the date is inside the valid range
__ASSERT_ALWAYS(IsDateInValidAgendaRange(startDate), User::Leave(
KErrAbort));
// Set end date to the calendar date in UTC since
// PIM API does not support local time format
start.SetTimeUtcL(startDate);
}
// Set values to the native calendar entry
aEntry.SetStartAndEndTimeL(start, end);
}
示例3: DeleteAllMemosBeginL
void CDummyCalendarApp::DeleteAllMemosBeginL()
{
test.Printf(_L("Test: DeleteAllMemosBeginL\r\n"));
//Add 1000 entries
test.Printf(_L("Adding 1000 Memos...\r\n"));
const TInt KNumEntriesToAdd(1000);
iTestLib->OpenFileL(KCalendarFile);
for (TInt i(0) ; i < KNumEntriesToAdd ; ++i)
{
HBufC8* guid = NULL;
CCalEntry* entry = iTestLib->CreateCalEntryL(CCalEntry::EReminder, guid);
CleanupStack::PushL(entry);
SetEntryStartAndEndTimeL(entry,
TDateTime(2005, ESeptember, 12, 0, 0, 0, 0),
TDateTime(2005, ESeptember, 12, 1, 0, 0, 0));
RPointerArray<CCalEntry> entryArray;
CleanupClosePushL(entryArray);
entryArray.AppendL(entry);
TInt num;
iTestLib->SynCGetEntryViewL().StoreL(entryArray, num);
CleanupStack::PopAndDestroy(&entryArray);
CleanupStack::PopAndDestroy(entry);
test.Printf(_L("."));
}
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
TCalTime maxTime;
maxTime.SetTimeUtcL(TCalTime::MaxTime());
CalCommon::TCalTimeRange timeRange(minTime, maxTime);
iActive->SetStep(CAppActive::EDeleteAllMemosMiddle);
//Attempt to delete all the entries
test.Printf(_L("Deleting all the entries...\r\n"));
iTestLib->SynCGetEntryViewL().DeleteL(timeRange, CCalEntry::EReminder, *this);
CActiveScheduler::Start();
delete iTestLib;
iTestLib = NULL;
}
示例4: KGUID
void CBadRRule::CreateChild1L()
{
TInt num ;
TCalTime recId;
recId.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 9, 10, 1, 0, 0))); // creating recurrence id
HBufC8* guid1 = KGUID().AllocLC(); // ownership of guid1 gets transferred
CCalEntry *entry1 = CCalEntry::NewL(CCalEntry::EEvent, guid1, CCalEntry::EMethodNone, 0, recId, CalCommon::EThisOnly);
CleanupStack::Pop(guid1);
CleanupStack::PushL(entry1) ;
TCalTime startTime3 ;
TCalTime endTime3 ;
startTime3.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 7, 10, 2, 0, 0))) ;
endTime3.SetTimeUtcL(startTime3.TimeUtcL() + TTimeIntervalHours(1)) ;
entry1->SetStartAndEndTimeL(startTime3, endTime3) ;
RPointerArray<CCalEntry> entryarr1 ;
entryarr1.AppendL(entry1) ;
iCalEntryView->StoreL(entryarr1, num) ;
entryarr1.Close() ;
CleanupStack::PopAndDestroy(entry1) ;
}
示例5: RepeatExceptedEntryFetchInstancesL
void CDummyCalendarApp::RepeatExceptedEntryFetchInstancesL(
RPointerArray<CCalInstance>& aInstances )
{
// Create a time range filter that returns all instances.
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
TCalTime maxTime;
maxTime.SetTimeUtcL(TCalTime::MaxTime());
CalCommon::TCalTimeRange timeRange(minTime, maxTime);
CalCommon::TCalViewFilter filter = CalCommon::EIncludeAll;
CleanupResetAndDestroyPushL(aInstances);
// Get all instances.
AsynCGetInstanceViewL().FindInstanceL(aInstances, filter, timeRange);
test(aInstances.Count() >= 2);
CleanupStack::Pop(&aInstances);
}
示例6: CheckInstancesL
void CBadRRule::CheckInstancesL(RArray<TTime> &insTimes)
{
RPointerArray<CCalInstance> instanceArray ;
TCalTime startTime ;
TCalTime endTime ;
startTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 1, 10, 1, 0, 0))) ;
endTime.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 30, 10, 5, 0, 0))) ;
CalCommon::TCalTimeRange timeRange(startTime, endTime);
CCalInstanceView &insView = iTestLib->SynCGetInstanceViewL();
insView.FindInstanceL(instanceArray, CalCommon::EIncludeAll, timeRange);
TInt count = instanceArray.Count() ;
TInt count1 = insTimes.Count() ;
test(count == count1) ;
TInt i, j ;
for(i = 0; i < count1; i++)
{
for(j = 0; j < count; j++)
{
if (instanceArray[j] == NULL)
{
continue ;
}
TTime t1 = instanceArray[j]->Time().TimeUtcL() ;
TDateTime d1 = t1.DateTime() ;
if (insTimes[i] == t1)
{
delete instanceArray[j] ;
instanceArray[j] = NULL ;
break ;
}
}
test(j < count) ;
}
instanceArray.Close() ;
}
示例7: ConvertDateToAgnL
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ConvertDateToAgnL
// Makes date conversion from framework PIM item data field to To-do item field.
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ConvertDateToAgnL(TPIMToDoField aField, // Date field to be converted
TInt aIndex, // Index of the date field
CCalEntry& aEntry, const MPIMItemData& aItem) // The PIM item to read the field from
{
JELOG2(EPim);
const TPIMFieldData fieldData = aItem.ValueL(aField, aIndex);
const TPIMDate& date = fieldData.DateValue();
switch (aField)
{
case EPIMToDoDue:
{
// Because undated to-dos are possible, the due date can be set
// to a null value.
if (date != Time::NullTTime() && !IsDateInValidAgendaRange(date))
{
User::Leave(KErrAbort);
}
// Java dates cannot be set to native null TTime
else
{
// Convert due date and time to calendar specific due time
// Note that PIM API dates are in UTC time format -> convert
TTime dueDate(date);
ConvertTimeL(dueDate, EPIMDateLocal);
// Set time to native entry. Note that the time is local
TCalTime calDate;
calDate.SetTimeLocalL(StartOfDay(dueDate));
aEntry.SetStartAndEndTimeL(calDate, calDate);
}
break;
}
case EPIMToDoCompletionDate:
{
if (date != Time::NullTTime())
{
__ASSERT_ALWAYS(IsDateInValidAgendaRange(date), User::Leave(
KErrAbort));
TCalTime calDate;
calDate.SetTimeUtcL(date);
aEntry.SetCompletedL(ETrue, calDate);
}
else
{
aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
}
break;
}
default:
{
__ASSERT_DEBUG(EFalse, User::Panic(KPIMPanicCategory,
EPIMPanicUnsupportedField));
}
}
}
示例8: DeleteAllMemosEndL
void CDummyCalendarApp::DeleteAllMemosEndL()
{
test.Printf(_L("Test: DeleteAllMemosEndL\r\n"));
test.Printf(_L("Interrupting the delete...\r\n"));
//Get a time range
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
TCalTime maxTime;
maxTime.SetTimeUtcL(TCalTime::MaxTime());
CalCommon::TCalTimeRange timeRange(minTime, maxTime);
test.Printf(_L("Done!\r\n"));
iTestLib = CCalTestLibrary::NewL(EFalse);
iTestLib->OpenFileL(KCalendarFile);
test.Printf(_L("Deleteing all the entiries again...\r\n"));
iTestLib->SynCGetEntryViewL().DeleteL(timeRange, CCalEntry::EReminder, *this);
}
示例9: DeleteEntryL
void CMultiThreadTestApp::DeleteEntryL(CCalEntryView& aView, CCalEntry::TType aType, TBool aIsSynchronous)
{
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
TCalTime maxTime;
maxTime.SetTimeUtcL(TCalTime::MaxTime());
if(aIsSynchronous)
{
RPointerArray<CCalEntry> entries;
CleanupResetAndDestroyPushL(entries);
FetchEntryL(aView, entries);
TInt count = entries.Count();
for (TInt ii = 0; ii < count; ++ii)
{
CCalEntry* entry = entries[ii];
if(entry->EntryTypeL() == aType)
{
aView.DeleteL(*entry);
}
}
CleanupStack::PopAndDestroy(&entries);
}
else
{
const CalCommon::TCalTimeRange timeRange(minTime, maxTime);
CalCommon::TCalViewFilter filter;
if(aType==CCalEntry::EAppt)
{
filter = CalCommon::EIncludeAppts;
}
else
{
filter = ~ (CalCommon::EIncludeAll & CalCommon::EIncludeAppts);
}
aView.DeleteL(timeRange, filter, *this);
}
}
示例10: ConvertBooleanToAgnL
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ConvertBooleanToAgnL
// Makes boolean conversion from framework PIM item data field to To-do item field
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ConvertBooleanToAgnL(TPIMToDoField aField, // Boolean field to be converted
TInt aIndex, // Index of the date field
CCalEntry& aEntry, // The Agenda model entry typecasted to a Todo item
const MPIMItemData& aItem) // The PIM item to read the field from
{
JELOG2(EPim);
const TPIMFieldData fieldData = aItem.ValueL(aField, aIndex);
TBool booleanField = fieldData.BooleanValue();
if (booleanField) // completed flag is set to value TRUE
{
// Check if the completed date field is present
if (aItem.CountValues(EPIMToDoCompletionDate) == 0)
{
// If completed date is not present, use the current time.
TTime currentTime;
currentTime.HomeTime();
TCalTime calCurrentTime;
// Set time as local time since acquired above as local time
calCurrentTime.SetTimeLocalL(currentTime);
aEntry.SetCompletedL(ETrue, calCurrentTime);
}
else
{
TPIMFieldData completionData = aItem.ValueL(EPIMToDoCompletionDate,
aIndex);
const TPIMDate& date = completionData.DateValue();
if (date != Time::NullTTime())
{
TCalTime calDate;
calDate.SetTimeUtcL(date);
aEntry.SetCompletedL(ETrue, calDate);
}
else
{
// If completed date is set to null time, use the current time.
TTime currentTime;
currentTime.HomeTime();
TCalTime calCurrentTime;
// Set time as local time since acquired above as local time
calCurrentTime.SetTimeLocalL(currentTime);
aEntry.SetCompletedL(ETrue, calCurrentTime);
}
}
}
else // completed flag is set to value FALSE
{
aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
}
}
示例11: SetCalTimeL
/**
* Converts the TTime to TCalTime based on the time mode given
@param aTimeData TTime variable to be set in the specified time mode
@param aCalTimeData time that is set in the specified time mode
@param aTimeMode time mode of the entry
*/
void CTestCalInterimApiSuiteStepBase::SetCalTimeL(const TTime& aTimeData, TCalTime& aCalTimeData, TCalTime::TTimeMode aTimeMode)
{
if(aTimeMode == TCalTime::EFloating)
{
aCalTimeData.SetTimeLocalFloatingL(aTimeData);
}
else if(aTimeMode == TCalTime::EFixedTimeZone)
{
aCalTimeData.SetTimeLocalL(aTimeData);
}
else
{
aCalTimeData.SetTimeUtcL(aTimeData);
}
}
示例12: DeleteEntriesByArrayOfLocalUidsL
/**
* Delete entries by local uids
*/
void CTestCalInterimApiModifier::DeleteEntriesByArrayOfLocalUidsL()
{
RArray<TCalLocalUid> localUids;
CleanupClosePushL(localUids);
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
iEntryView->GetIdsModifiedSinceDateL(minTime, localUids);
TInt numSuccessfulDeleted(0);
TRAPD(err, iEntryView->DeleteL(localUids, numSuccessfulDeleted));
if(err != KErrNone)
{
iTestStep->ERR_PRINTF2(KErrDeleteOperation,err);
iTestStep->SetTestStepResult(EFail);
}
CleanupStack::PopAndDestroy(&localUids); // Close()
}
示例13: FetchEntryL
void CMultiThreadTestApp::FetchEntryL(CCalEntryView& aView, RPointerArray<CCalEntry>& aEntries)
{
RArray<TCalLocalUid> entryIds;
CleanupClosePushL(entryIds);
TCalTime minTime;
minTime.SetTimeUtcL(TCalTime::MinTime());
aView.GetIdsModifiedSinceDateL(minTime, entryIds);
TInt count = entryIds.Count();
for (TInt ii = 0; ii<count; ++ii)
{
CCalEntry* entry = aView.FetchL(entryIds[ii]);
aEntries.AppendL(entry);
}
CleanupStack::PopAndDestroy(&entryIds);
}
示例14: CopyExceptionDatesToAgnL
// -----------------------------------------------------------------------------
// 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
}
示例15: StoreEntryWithAlarmContentLC
CCalAlarm* CCalAlarmAttachTest::StoreEntryWithAlarmContentLC(const TDesC8& aUid)
{
test.Printf(_L("Store an alarmed entry with alarm content\n"));
// Create an attachment to the alarm.
CCalAlarm* alarm = CCalAlarm::NewL();
CleanupStack::PushL(alarm);
alarm->SetTimeOffset(1);
CCalContent* almContent = CCalContent::NewL();
CleanupStack::PushL(almContent);
// Add content and mimetype for the alarm.
HBufC8* content = KContent().AllocLC();
HBufC8* mimetype = KMimeType().AllocLC();
almContent->SetContentL(content, mimetype, CCalContent::EDispositionInline);
CleanupStack::Pop(mimetype);
CleanupStack::Pop(content);
alarm->SetAlarmAction(almContent); // Takes ownership of almContent.
CleanupStack::Pop(almContent);
//Create the entry with the alarm and store it
RPointerArray<CCalEntry> entries;
CleanupResetAndDestroyPushL(entries);
HBufC8* guid = aUid.AllocLC();
CCalEntry* entry = CCalEntry::NewL(CCalEntry::EEvent, guid, CCalEntry::EMethodNone, 0);
CleanupStack::Pop(guid);
CleanupStack::PushL(entry);
entries.AppendL(entry);
CleanupStack::Pop(entry);
TCalTime calTime;
calTime.SetTimeUtcL(TDateTime(2007,EFebruary,15, 13, 30, 0, 0));
entry->SetStartAndEndTimeL(calTime, calTime);
entry->SetSummaryL(KSummary());
entry->SetDescriptionL(KDescription());
entry->SetAlarmL(alarm);
TInt entriesStored = 0;
iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
CleanupStack::PopAndDestroy(&entries);
return alarm;
}