本文整理汇总了C++中CCalEntry类的典型用法代码示例。如果您正苦于以下问题:C++ CCalEntry类的具体用法?C++ CCalEntry怎么用?C++ CCalEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCalEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JELOG2
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ReadRepeatFromAgnL
// Reads entry's repeat details and converts them into PIM repeat rule.
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ReadRepeatFromAgnL(MPIMEventItem& aItem,
CCalEntry& aEntry)
{
JELOG2(EPim);
MPIMRepeatRuleData* repeatRuleData = aItem.GetRepeat();
TCalRRule agnRRule;
if (aEntry.GetRRuleL(agnRRule))
{
repeatRuleData->clear();
PIMRepeatRuleConverter::ConvertSupportedRepeatToPIML(*repeatRuleData,
agnRRule);
CopyExceptionDatesToPimL(aEntry, *repeatRuleData);
// Anniv does not need to have an end date, so clear that field to be sure
if (aEntry.EntryTypeL() == CCalEntry::EAnniv)
{
repeatRuleData->ClearFieldL(EPIMRepeatRuleEnd);
}
aItem.SetRepeating(ETrue);
}
else
{
repeatRuleData->clear();
aItem.SetRepeating(EFalse);
}
}
示例2: QLatin1String
void OrganizerItemTypeTransform::transformToDetailL(const CCalEntry& entry, QOrganizerItem *item)
{
CCalEntry::TType entryType = entry.EntryTypeL();
QString itemType;
if (entryType == CCalEntry::ETodo) {
// Assume this is an occurrence if the recurrence id is set
if (entry.RecurrenceIdL().TimeUtcL() != Time::NullTTime())
itemType = QLatin1String(QOrganizerItemType::TypeTodoOccurrence);
else
itemType = QLatin1String(QOrganizerItemType::TypeTodo);
}
else if (entryType == CCalEntry::EEvent || entryType == CCalEntry::EAppt) {
// Assume this is an occurrence if the recurrence id is set
if (entry.RecurrenceIdL().TimeUtcL() != Time::NullTTime())
itemType = QLatin1String(QOrganizerItemType::TypeEventOccurrence);
else
itemType = QLatin1String(QOrganizerItemType::TypeEvent);
}
else if (entryType == CCalEntry::EAnniv)
itemType = QLatin1String(QOrganizerItemType::TypeEvent);
#ifdef AGENDA_EXT_SUPPORT
else if (CCalEntry::ENote == entryType) {
itemType = QLatin1String(QOrganizerItemType::TypeNote);
}
#endif
else
User::Leave(KErrUnknown); // unknown type
item->setType(itemType);
}
示例3: transformToDetailL
void OrganizerItemTimeStampTransform::transformToDetailL(const CCalEntry& entry, QOrganizerItem *item)
{
QOrganizerItemTimestamp timeStamp = item->detail<QOrganizerItemTimestamp>();
timeStamp.setCreated(toQDateTimeL(entry.DTStampL()));
timeStamp.setLastModified(toQDateTimeL(entry.LastModifiedDateL()));
item->saveDetail(&timeStamp);
}
示例4: ConvertStringToAgnL
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ConvertStringToAgnL
// Makes string conversion from framework PIM item data field to To-do item field
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ConvertStringToAgnL(TPIMToDoField aField, // String field to be converted
TInt aIndex, // Index of the date field
CCalEntry& aEntry, // The Agenda Model entry
const MPIMItemData& aItem) // The PIM item to read the field from
{
JELOG2(EPim);
const TPIMFieldData fieldData = aItem.ValueL(aField, aIndex);
const TDesC& string = fieldData.StringValue();
// Check that string is not too long
__ASSERT_ALWAYS(string.Length() <= KPIMToDoStringValueMaxLength,
User::Leave(KErrTooBig));
switch (aField)
{
case EPIMToDoSummary:
{
aEntry.SetSummaryL(string);
break;
}
case EPIMToDoNote:
{
aEntry.SetDescriptionL(string);
break;
}
default:
{
// Should not happen
}
}
}
示例5: _LIT8
void CCalAlarmAttachTest::TestFetchEntryAlarmContentL()
{
test.Printf(_L("Test fetching entry twice and check it alarm conten\n"));
_LIT8(KEntryUidFetchEntry, "FetchEntryUid");
CCalAlarm* alarm = StoreEntryWithAlarmContentLC(KEntryUidFetchEntry());
RPointerArray<CCalEntry> entries;
CleanupResetAndDestroyPushL(entries);
//Fetch the entry and test the alarm content
iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
TInt entriesStored = 0;
iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
entries.ResetAndDestroy();
iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
CCalEntry* entry = entries[0];
test( KSummary() == entry->SummaryL() );
test( KDescription() == entry->DescriptionL());
TestAlarmL(entry, KContent(), KMimeType());
entries.ResetAndDestroy();
//Close the serve and fetch the entry again
iTestLib->CloseAgendaServer();
iTestLib->OpenFileL(KCalName());
iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
TestAlarmL(entries[0], KContent(), KMimeType());
CleanupStack::PopAndDestroy(&entries);
CleanupStack::PopAndDestroy(alarm);
}
示例6: GetIterL
TBool CDummyCalendarApp::CheckEntryNumL(TEntryType aType, TInt aNumEntry)
{
CCalIter& iter = GetIterL();
TPtrC8 Uid(iter.FirstL());
TInt ii=0;
while (Uid!=KNullDesC8())
{
++ii;
RPointerArray<CCalEntry> entryList;
CleanupResetAndDestroyPushL(entryList);
iLocalEntryView->FetchL(Uid, entryList);
CCalEntry* entry = entryList[0];
if(aType==EApp)
{
test(entry->EntryTypeL()==CCalEntry::EAppt);
}
else if (aType==ETodo)
{
test(entry->EntryTypeL()==CCalEntry::ETodo);
}
else if(aType == EReminder)
{
test(entry->EntryTypeL()==CCalEntry::EReminder);
}
CleanupStack::PopAndDestroy(&entryList);
Uid.Set(iter.NextL());
}
return (ii==aNumEntry);
}
示例7: JELOG2
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::AddDefaultValuesToEntryL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::AddDefaultValuesToEntryL(const MPIMItemData& aData,
CCalEntry& aEntry) const
{
JELOG2(EPim);
// Calendar creates medium priority ToDos by default
if (!aData.CountValues(EPIMToDoPriority))
{
aEntry.SetPriorityL(EPIMToDoNativePriorityMedium);
}
// Calendar uses private synchronization by default
if (!aData.CountValues(EPIMToDoClass))
{
aEntry.SetReplicationStatusL(CCalEntry::EPrivate);
}
// Calendar does not support timed ToDo so the time is set to 00:00 o'clock
if (!aData.CountValues(EPIMToDoDue))
{
TTime thisTime;
thisTime.HomeTime();
// Set time to calendar specific due time. Currently this is the start
// of the date. Note that No conversion needed since time is local
TCalTime calThisTime;
// Set time as local time since acquired above as local time
calThisTime.SetTimeLocalL(StartOfDay(thisTime));
aEntry.SetStartAndEndTimeL(calThisTime, calThisTime);
}
if (!aData.CountValues(EPIMToDoCompletionDate) && !aData.CountValues(
EPIMToDoCompleted))
{
aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
}
}
示例8: ExportItemL
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ExportItemL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ExportItemL(const MPIMToDoItem& aItem,
CCalEntry& aEntry, TBool aResetEntry)
{
JELOG2(EPim);
if (aResetEntry)
{
// Reset native entry for exporting new data
aEntry.SetSummaryL(KNullDesC());
aEntry.SetDescriptionL(KNullDesC());
aEntry.SetPriorityL(0);
aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
}
// Export item data to the native ToDo calendar entry
const MPIMItemData& itemData = aItem.ItemData();
CArrayFix<TPIMField>* fields = itemData.FieldsLC();
// Add default values to the calendar entry
AddDefaultValuesToEntryL(itemData, aEntry);
// Convert each field to the native ToDo calendar entry
TInt count = fields->Count();
for (TInt i = 0; i < count; i++)
{
TPIMToDoField field = static_cast<TPIMToDoField>(fields->At(i));
ConvertToAgnL(field, aEntry, itemData);
}
CleanupStack::PopAndDestroy(fields);
}
示例9: ReadDateFieldsL
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ReadDateFieldsL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ReadDateFieldsL(MPIMItemData& aData, CCalEntry& aEntry)
{
JELOG2(EPim);
TTime nullTime = Time::NullTTime();
// The Agenda todo entry end field is the due date
TTime due(aEntry.EndTimeL().TimeLocalL());
if (due != nullTime)
{
// Set due to the PIM API specific due date, in this case, the start of date
// Note that PIM API uses times as UTC times so the due date must be in
// correct format. Previously requested as local time -> do not change
TPIMDate pimDueDate(StartOfDay(due));
// Date must be converted UTC time because acquired as local above
ConvertTimeL(pimDueDate, EPIMDateUTC);
TPIMFieldData dueFieldData(EPIMToDoDue, KPIMAttrNone, pimDueDate);
aData.AddValueL(dueFieldData);
// Get alarm. Ownership is transferred to the caller. Alarm cannot be set
// if the due date is not set because the calculation is done as an offset
// from the ToDo due date.
CCalAlarm* calAlarm = aEntry.AlarmL();
if (calAlarm)
{
TTimeIntervalMinutes nativeValue = calAlarm->TimeOffset();
// The alarm is not needed anymore so it can be deleted
delete calAlarm;
calAlarm = NULL;
// Change the time to the start of the due date
TTime startOfDayLocal(StartOfDay(due));
// Calculate the difference from the start of due date and start time including
// the original alarm offset which was previously read
TTimeIntervalMinutes temp(0);
User::LeaveIfError(startOfDayLocal.MinutesFrom(due, 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...
TInt alarm = (nativeValue.Int() + temp.Int()) * KPIMSecondsInMinute;
// Add alarm value to the item
TPIMFieldData fieldData(EPIMToDoExtAlarm, EPIMFieldInt,
KPIMAttrNone, alarm);
// Add value to the PIM item data
aData.AddValueL(fieldData);
}
}
// Completion date. If the item has a completion date, the item is then completed
// and completed flag is set to true in PIM API. Null time if not crossed out.
TTime completed = aEntry.CompletedTimeL().TimeUtcL();
if (completed != nullTime)
{
TPIMFieldData dateData(EPIMToDoCompletionDate, KPIMAttrNone, completed);
aData.AddValueL(dateData);
// Note that boolean and integer fields must be identified in the constructor
TPIMFieldData flag(EPIMToDoCompleted, EPIMFieldBoolean, KPIMAttrNone,
ETrue);
aData.AddValueL(flag);
}
}
示例10: ConvertAlarmToAgnL
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertAlarmToAgnL
// Converts alarm from PIM item to a native entry. The alarm is calculated
// from the start date of the event and if it is not present, the alarm field
// is ignored because there is no possibility to calculate it
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertAlarmToAgnL(const MPIMEventItem& aItem,
CCalEntry& aEntry)
{
JELOG2(EPim);
const MPIMItemData& itemData = aItem.ItemData();
// Note that start time must be set before alarm can be calculated
// Add start to the item so alarm can be properly converted. The
// native entry does not accept alarm value if start is not present
if (itemData.CountValues(EPIMEventStart) == 0)
{
User::Leave(KErrArgument);
}
else
{
ConvertDateFieldToAgnL(aItem, aEntry, EPIMEventStart);
}
__ASSERT_DEBUG(aEntry.StartTimeL().TimeUtcL() != Time::NullTTime(),
User::Panic(KPIMPanicCategory, EPIMPanicInvalidState));
// Get alarm value from the Java item. There should be only one alarm
// value supported by the PIM API because native entries do not support
// multiple alarm values.
const TPIMFieldData alarmData = itemData.ValueL(EPIMEventAlarm, 0);
TInt value = alarmData.IntegerValue();
// Count the alarm value from the start date of the event
TTime entryStart = aEntry.StartTimeL().TimeLocalL();
const TPIMFieldData startData = itemData.ValueL(EPIMEventStart, 0);
TPIMDate startTime = startData.DateValue();
ConvertTimeL(startTime, EPIMDateLocal);
TTimeIntervalSeconds temp(0);
User::LeaveIfError(entryStart.SecondsFrom(startTime, temp));
// Add difference between PIM API start and start which has been
// converted to the item (in case if the date has been changed, it is
// reflected here)
value += temp.Int();
// Check that if the alarm has passed to the following day. In this case,
// the alarm is transferred back to 12 o'clock of the current start date
TTime alarmTime(entryStart - TTimeIntervalSeconds(value));
// Temporary date. This date is used when calculating if the alarm
// value has passed to the following date.
TTime startOfNextDay(StartOfDay(startTime + TTimeIntervalDays(1)));
if (alarmTime >= startOfNextDay)
{
alarmTime = StartOfDay(entryStart);
alarmTime += TTimeIntervalSeconds(KPIMDefaultAlarmInterval);
User::LeaveIfError(entryStart.SecondsFrom(alarmTime, temp));
value = temp.Int();
}
// Convert the alarm value to the native entry
SetAlarmToEntryL(aEntry, value);
}
示例11: JELOG2
void CPIMAgnListAdapter::DoExternalItemModificationsByEntryTypeL(
CCalEntry::TType aEntryType)
{
JELOG2(EPim);
EnsureOpenSessionL();
if (!iChangesRead)
{
if (!iItemChangeArray)
{
iItemChangeArray
= new(ELeave) RPointerArray<CPIMItemStateChange> (10);
}
// Read all the entries in the agenda file
RPointerArray<CCalEntry> entryArray;
CCalIter* iterator = CCalIter::NewL(*iCalSession);
CleanupStack::PushL(iterator);
const TDesC8* entryId = &(iterator->FirstL());
while ((*entryId) != KNullDesC8())
{
iCalEntryView->FetchL(*entryId, entryArray);
CleanupResetAndDestroyPushL(entryArray);
// There should be at least one entry in the array. Other instances
// will be ignored since child entries are currently not supported
if (entryArray.Count() > 0)
{
// Get only the parent item from the array. Other items are
// simply ignored since PIM API does not support them
CCalEntry* entry = entryArray[0];
// Check that the entry type is correct and add the item
// to the change list
if (entry->EntryTypeL() == aEntryType)
{
HBufC8* changeId = entryId->AllocLC();
CPIMItemStateChange
* change =
new(ELeave) CPIMItemStateChange(changeId, EPIMExternalChangeNew);
CleanupStack::Pop(changeId);
CleanupStack::PushL(change);
iItemChangeArray->AppendL(change);
CleanupStack::Pop(change);
}
}
CleanupStack::PopAndDestroy(&entryArray);
// Get next calendar entry from the iterator
entryId = &(iterator->NextL());
}
CleanupStack::PopAndDestroy(iterator);
iChangesRead = ETrue;
}
}
示例12: 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));
}
}
}
示例13: test
void CMultiThreadTestApp::AddEntryL(CCalEntryView& aView, const TInt aNumToAdd)
{
// Add Entries for Test
RTest test(KTestName);
test.Next(_L("Adding entries"));
TBuf<50> summary;
TBuf<50> location;
TBuf<50> description;
RPointerArray<CCalEntry> entriesToStore;
CleanupResetAndDestroyPushL(entriesToStore);
for (TInt index = 0; index < aNumToAdd; ++index)
{
CCalEntry* entry;
HBufC8* guid = HBufC8::NewL(255);
TPtr8 uidP = guid->Des();
RandomText8(uidP);
if( (index %2) == 0 )
{
entry = CreateCalEntryL(CCalEntry::ETodo, guid);
}
else
{
entry = CreateCalEntryL(CCalEntry::EAppt, guid);
}
TInt err = entriesToStore.Append(entry);
test(err == KErrNone);
SetEntryStartAndEndTimeL(entry);
RandomText(summary);
entry->SetSummaryL(summary);
RandomText(location);
entry->SetLocationL(location);
RandomText(description);
entry->SetDescriptionL(description);
}
TInt entriesStored(0);
aView.StoreL(entriesToStore, entriesStored); //temp
test(entriesStored == aNumToAdd);
test.Close();
CleanupStack::PopAndDestroy(&entriesToStore);
}
示例14: FetchAndCheckDataL
/** Fetch the entry and check the properties that are set.
@param aGuid Data for fetching the entry.
@param aEntryProperties Structure containing the entry properties
*/
void CTestCalInterimApiFetchEntryAndCheckData::FetchAndCheckDataL(const TPtrC& aGuid, const TInt& aExpectedCount,
const TEntryProperties& aEntryProperties, const TPtrC& aTimeMode)
{
RPointerArray<CCalEntry> entriesFetched;
CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &entriesFetched));
HBufC8* entryId = HBufC8::NewLC(aGuid.Length());
entryId->Des().Copy(aGuid);
iCalEntryView->FetchL(entryId->Des(), entriesFetched);
CleanupStack::PopAndDestroy(entryId);
TBool matchInRecurrenceId = EFalse;
if ( entriesFetched.Count() == aExpectedCount )
{
for ( TInt i = 0; i < entriesFetched.Count(); i++ )
{
CCalEntry* calEntry = entriesFetched[i];
if ( aEntryProperties.iRecurrenceId == KNullDesC16() ) // Parent Entry
{
if ( calEntry->RecurrenceIdL().TimeUtcL() == Time::NullTTime() )
{
// Checks the data for the parent entry
CheckDataL(calEntry, aEntryProperties);
}
}
else // Child Entry
{
TTime recurrenceIdValue;
recurrenceIdValue.Set(aEntryProperties.iRecurrenceId);
TCalTime recurrenceId;
// Sets the time mode to floating or Utc based on the time mode given
SetCalTimeL(recurrenceIdValue, iRecurrenceId, SetTimeMode(aTimeMode));
if (iRecurrenceId.TimeUtcL() == (calEntry->RecurrenceIdL().TimeUtcL()) )
{
matchInRecurrenceId = ETrue;
// Checks the data for the child entry
CheckDataL(calEntry, aEntryProperties);
}
}
}
INFO_PRINTF3(KInfoEntryFetched, entriesFetched.Count(), aExpectedCount) ;
}
else
{
ERR_PRINTF3(KErrExpectedCount, entriesFetched.Count(), aExpectedCount);
SetTestStepResult(EFail);
}
/* If the recurrence Id doesn't match with the recurrenceId of the child entry
then, print a warning message */
if (aEntryProperties.iRecurrenceId != KNullDesC16() && matchInRecurrenceId == 0)
{
WARN_PRINTF1(KWarnNoMatchInRecurrenceId);
}
CleanupStack::PopAndDestroy(&entriesFetched);
}
示例15: 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);
}
}
}