Symbian OS 应用开发之玩转通信录
2010-03-24 17:18:00 来源:WEB开发网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.
更多精彩
赞助商链接