Symbian OS通讯录模型
2010-08-11 12:18:00 来源:WEB开发网CleanupStack::PushL(iContactsDb);
CContactItemFieldDef* iFieldDef =
new (ELeave) CContactItemFieldDef();
CleanupStack::PushL(iFieldDef);
iFieldDef->AppendL(KUidContactFieldGivenName);
iFieldDef->AppendL(KUidContactFieldFamilyName);
_LIT(KFindToken, "Bond");
_LIT(KOtherForename, "Wilkinson");
CIdleFinder* iFinder = iContactsDb->FindAsyncL(KFindToken,
iFieldDef, this);
CleanupStack::PushL(iFinder);
if(iFinder->IsComplete())
{
if(iFinder->Error() == KErrNone)
{
CContactIdArray* result = iFinder->TakeContactIds();
CleanupStack::PushL(result);
for (TInt i = 0; i < result->Count(); i++)
{
TContactItemId cardId = (*result)[i];
CContactItem* ownCard = iContactsDb ->OpenContactL(cardId);
CleanupStack::PushL(ownCard);
TInt index = ownCard->CardFields().Find(KUidContactFieldGivenName);
ownCard->CardFields()[index].TextStorage()->SetTextL(KOtherForename);
iContactsDb ->CommitContactL(*ownCard);
CleanupStack::PopAndDestroy(); // ownCard
}
CleanupStack::PopAndDestroy(); //result;
}
}
CleanupStack::PopAndDestroy(3);// iContactsDb、iFieldDef、iFinder
更多精彩
赞助商链接