本文整理汇总了C++中CContactItem::Guid方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactItem::Guid方法的具体用法?C++ CContactItem::Guid怎么用?C++ CContactItem::Guid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactItem
的用法示例。
在下文中一共展示了CContactItem::Guid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestUpdateContactL
LOCAL_C void TestUpdateContactL()
{
test.Next(_L("TestUpdateContactL"));
SETUP;
CContactItem* contact = CContactItem::NewLC(KUidContactCard);
TContactItemId id = cntClient.CreateContactL(*contact);
CleanupStack::PopAndDestroy(contact);
// View definition to read image field
CContactItemViewDef* imageViewDef = CContactItemViewDef::NewLC(CContactItemViewDef::EIncludeFields, CContactItemViewDef::EMaskHiddenFields);
imageViewDef->AddL(KUidContactFieldMatchAll);
contact = cntClient.OpenContactLX(imageViewDef ,id);
CleanupStack::PushL(contact);
CContactItemField* newField = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldCodImage);
newField->SetMapping(KUidContactFieldVCardMapUnknown);
newField->TextStorage()->SetTextL(KSrcImage());
contact->AddFieldL(*newField); // Takes ownership
CleanupStack::Pop(newField);
cntClient.CommitContactL(*contact, EFalse);
CleanupStack::PopAndDestroy(2); // contact, imageViewDef
// View definition to read image field
imageViewDef = CContactItemViewDef::NewLC(CContactItemViewDef::EIncludeFields, CContactItemViewDef::EMaskHiddenFields);
imageViewDef->AddL(KUidContactFieldCodImage);
contact = cntClient.ReadContactL(imageViewDef ,id);
TInt index = contact->CardFields().Find(KUidContactFieldCodImage, KUidContactFieldVCardMapUnknown);
// Test image field found
test(index != KErrNotFound);
CContactItemField& field = contact->CardFields()[index];
TPtrC imagePtr = field.TextStorage()->Text();
// Image should exist
test(BaflUtils::FileExists(fs, imagePtr));
// Test for GUID
TPtrC guid = contact->Guid();
test(imagePtr.Find(guid));
cntClient.CloseContact(id);
CleanupStack::PopAndDestroy(2); // contact, imageViewDef
TEAR_DOWN;
}
示例2: CreateL
/**
Add the given contact item to the database. Forward the call to CPplTableBase
based classes representing the tables in the contact database.
@param aItem The contact item to be added to the database.
@param aSessionId The ID of the session that issued the request. Used to
prevent Phonebook Synchroniser deadlock.
@return Contact item ID of the contact added to the database.
*/
TContactItemId CPplContactItemManager::CreateL(CContactItem& aItem, TUint aSessionId)
{
TBool controlTransaction = !(iTransactionManager.IsTransactionActive());
TBool compressedGuid=EFalse;
// If needed generate a gui for the current contact item
if (aItem.Guid() == TPtrC(KNullDesC))
{
iPreferencePersistor->SetGuidL(aItem, compressedGuid);
}
if (compressedGuid)
{
aItem.SetHasCompressedGuid(compressedGuid);
}
if (aItem.Type() == KUidContactICCEntry)
{
const TInt ret = iContactProperties.ContactSynchroniserL(aSessionId).ValidateWriteContact(static_cast<CContactICCEntry&>(aItem));
User::LeaveIfError(ret);
}
if(controlTransaction)
{
StartTransactionL(aSessionId);
}
iContactTable->CreateInDbL(aItem);
iGroupTable->CreateInDbL(aItem);
iCommAddrTable->CreateInDbL(aItem);
TContactItemId groupId = iIccContactStore.CreateInDbL(aItem, aSessionId);
if(groupId != KNullContactId)
{
//Every ICC entry is added to a special group, created by the Phonebook
//Synchroniser server during the initial synchronisation with the Contacts Model.
CContactItemViewDef* itemDef = CContactItemViewDef::NewLC(CContactItemViewDef::EIncludeFields,CContactItemViewDef::EMaskHiddenFields);
itemDef->AddL(KUidContactFieldMatchAll);
// Add ICC entry to the group.
CContactGroup* grp = static_cast<CContactGroup*>(ReadLC(groupId, *itemDef, EPlAllInfo, aSessionId));
grp->AddContactL(aItem.Id());
UpdateL(*grp, aSessionId);
CleanupStack::PopAndDestroy(2, itemDef); // grp
}
if(controlTransaction)
{
CommitTransactionL();
}
// Assuming success if no leaves at this point, so update
// the metadata search store for this entry
//CCntMetadataOperation* op = CCntMetadataOperation::NewLC(iColSession);
//TRAP_IGNORE(op->SaveContactLD(aItem));
//CleanupStack::Pop(op); // Do not destroy - called LD function
return aItem.Id();
}