WEB开发网
开发学院手机开发Symbian 开发 Symbian OS 应用开发之玩转通信录 阅读

Symbian OS 应用开发之玩转通信录

 2010-03-24 17:18:00 来源:WEB开发网   
核心提示:CleanupStack::PushL(contactsDb);TContactIter iter(*contactsDb); //类似游标TContactItemId cardId;while( ( cardId = iter.NextL() ) != KNullContactId ) //循环遍历{CContact
CleanupStack::PushL(contactsDb);

TContactIter iter(*contactsDb); //类似游标

TContactItemId cardId;

while( ( cardId = iter.NextL() ) != KNullContactId ) //循环遍历

{

CContactItem* card = contactsDb->ReadContactL(cardId); //读取相应项

CleanupStack::PushL(card);

//添加自己功能代码

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

CleanupStack::PopAndDestroy(); // card

}

CleanupStack::PopAndDestroy(); // contactsDb

-------------------------------------------

导出所有通信项到文件

主要使用类CContactDatabase中ExportSelectedContactsL函数。s60 2.1help中定义如下:

-------------------------------------------

void ExportSelectedContactsL(const TUid& aFormat,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOption,TBool aExportPrivateFields=ETrue);

void ExportSelectedContactsL(const TUid& aFormat,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOption,const CVersitParser::TVersitCharSet aCharSet, TBool aExportPrivateFields=ETrue);

Supported from 6.0

Description:

Exports an array of contact items to a write stream — overloaded function. The items are converted into vCards before being written to the stream.

Parameters:

const TUid& aFormat:Indicates the format for imported and exported contacts. Must have a value of KVersitEntityUidVCard.

const CContactIdArray& aSelectedContactIds:Array of contact IDs to export.

RWriteStream& aWriteStream:The stream to write to.

TInt aOption:Indicates the options for import and export. See the TOptions enum.

const CVersitParser::TVersitCharSet aCharSet:The character format. If not specified, defaults to CVersitParser::EUTF8CharSet.

上一页  1 2 3 4 5 6 7  下一页

Tags:Symbian OS 应用开发

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