本文整理汇总了C++中CContactItem::RemoveField方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactItem::RemoveField方法的具体用法?C++ CContactItem::RemoveField怎么用?C++ CContactItem::RemoveField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactItem
的用法示例。
在下文中一共展示了CContactItem::RemoveField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePhonebookTemplateL
/**
* Create a new template and add it to the database
* @param aDb Contact database
* @param aTemplateName Name for the template
* @param aFieldSet Array of fields which should are added to the template
* @return TContactItemId Id of the newly created template
*/
TContactItemId CreatePhonebookTemplateL(CContactDatabase& aDb, const TDesC& aTemplateName, RArray<TFieldEntry>& aFieldSet)
{
CContactItem* temp = aDb.CreateContactCardTemplateLC(aTemplateName);
TContactItemId templateId = temp->Id();
CleanupStack::PopAndDestroy(temp);
temp=NULL;
//Remove all the unnecessary fields
temp = aDb.OpenContactLX(templateId);
CleanupStack::PushL(temp);
const TInt fieldCount = temp->CardFields().Count();
for(TInt i=fieldCount-1;i>=0;i--)
temp->RemoveField(i);
// Add each of the required fields to the template
for (TInt j=0; j<aFieldSet.Count(); ++j)
{
TFieldEntry fieldEntry=aFieldSet[j];
CContactItemField* field = CContactItemField::NewLC(KStorageTypeText,fieldEntry.iField);
if (fieldEntry.iFieldType!=KNullUid)
field->AddFieldTypeL(fieldEntry.iFieldType);
temp->AddFieldL(*field);
CleanupStack::Pop(field);
}
aDb.CommitContactL(*temp);
CleanupStack::PopAndDestroy(2); // temp, close template
return templateId;
}
示例2: CreateICCTemplateL
/**
* Create template card for ICC contact items
* @param aDb Contact database
*/
TContactItemId CreateICCTemplateL(CContactDatabase& aDb)
{
CContactItem* temp = aDb.CreateContactCardTemplateLC(KTemplateName);
TContactItemId templateId = temp->Id();
CleanupStack::PopAndDestroy(temp);
temp=NULL;
//Remove all the unnecessary fields
temp = aDb.OpenContactLX(templateId);
CleanupStack::PushL(temp);
const TInt fieldCount = temp->CardFields().Count();
for(TInt i=fieldCount-1;i>=0;i--)
temp->RemoveField(i);
CContactItemField* name = CContactItemField::NewLC(KStorageTypeText,KUidContactFieldFamilyName);
name->SetMapping(KUidContactFieldVCardMapUnusedN);
temp->AddFieldL(*name);
CleanupStack::Pop(name);
CContactItemField* number = CContactItemField::NewLC(KStorageTypeText,KUidContactFieldPhoneNumber);
number->SetMapping(KUidContactFieldVCardMapTEL);
temp->AddFieldL(*number);
CleanupStack::Pop(number);
CContactItemField* slotnum = CContactItemField::NewLC(KStorageTypeText,KUidContactFieldICCSlot);
temp->AddFieldL(*slotnum);
CleanupStack::Pop(slotnum);
CContactItemField* phonebook = CContactItemField::NewLC(KStorageTypeText,KUidContactFieldICCPhonebook);
temp->AddFieldL(*phonebook);
CleanupStack::Pop(phonebook);
aDb.CommitContactL(*temp);
CleanupStack::PopAndDestroy(2); // temp, close template
return templateId;
}