本文整理汇总了C++中CContactDatabase::OpenContactLX方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::OpenContactLX方法的具体用法?C++ CContactDatabase::OpenContactLX怎么用?C++ CContactDatabase::OpenContactLX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::OpenContactLX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FailWriteValidationL
/**
* Unsuccessful edit. Fail the write validation request
* @param aDb Contact database
* @param aId Item Id to edit
*/
void FailWriteValidationL(CContactDatabase& aDb, TContactItemId aId)
{
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::EEdit, KErrNone);
syncChecker->SetValidateWriteResponseL(KErrAccessDenied);
syncChecker->ResetMethodCallCountsL();
CContactItem* item = aDb.OpenContactLX(aId);
CleanupStack::PushL(item);
CContactItemFieldSet& fieldset = item->CardFields();
const TInt pos = fieldset.Find(KUidContactFieldFamilyName);
CContactItemField& field = fieldset[pos];
CContactTextField* textfield = field.TextStorage();
textfield->SetTextL(KGivenEditName);
TRAPD(err, aDb.CommitContactL(*item));
test(syncChecker->ValidateMethodCallCountL() == 4);
test(err==KErrAccessDenied);
CleanupStack::PopAndDestroy(2); //item, lock record
}
示例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;
}