WEB开发网
开发学院手机开发Symbian 开发 于Symbian OS的通讯录操作总结 阅读

于Symbian OS的通讯录操作总结

 2010-05-31 20:12:00 来源:WEB开发网   
核心提示:TInt index =ownCard->CardFields().Find(KUidContactFieldGivenName);ownCard->CardFields()[index].TextStorage()->SetTextL(KOtherForename);contactsDb->C

TInt index =

ownCard->CardFields().Find(KUidContactFieldGivenName);

ownCard->CardFields()[index].TextStorage()

->SetTextL(KOtherForename);

contactsDb->CommitContactL(*ownCard);//提交所做的修改

CleanupStack::PopAndDestroy(2);

4、遍历数据库中的所有记录

CContactDatabase* contactsDb = CContactDatabase::OpenL();

CleanupStack::PushL(contactsDb);

TContactIter iter(*contactsDb);//建立遍历对象

TContactItemId cardId;

while( ( cardId = iter.NextL() ) != KNullContactId )

{

CContactItem* card = contactsDb->ReadContactL(cardId);

CleanupStack::PushL(card);

TInt nField =

card->CardFields().Find(KUidContactFieldGivenName);

TInt fField =

card->CardFields().Find(KUidContactFieldFamilyName);

if( nField!=KErrNotFound && fField!=KErrNotFound )

{ //读出数据

TPtrC name =

card->CardFields()[nField].TextStorage()->Text();

TPtrC fName =

card->CardFields()[fField].TextStorage()->Text();

iEikonEnv->InfoWinL(name, fName);

}

contactsDb->CloseContactL(card->Id());

CleanupStack::PopAndDestroy(); // card

}

CleanupStack::PopAndDestroy(); // contactsDb

5、过滤数据库中的记录

CContactDatabase* contactsDb = CContactDatabase::OpenL();

CleanupStack::PushL(contactsDb);

CCntFilter *filter = CCntFilter::NewLC();//建立过滤对象

filter->SetContactFilterTypeALL(EFalse);

filter->SetContactFilterTypeCard(ETrue);

_LIT(KFilterDate,"20040101:");

filter->SetFilterDateTime( TTime(KFilterDate) );

filter->SetIncludeModifiedContacts(ETrue);

contactsDb->FilterDatabaseL(*filter);

上一页  1 2 3 4  下一页

Tags:Symbian OS 通讯录

编辑录入:coldstar [复制链接] [打 印]
赞助商链接