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

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

 2010-03-24 17:18:00 来源:WEB开发网   
核心提示:TBool aExportPrivateFields=ETrue:ETrue exports fields marked as private. EFalse does not export fields marked as private. See CContactItemField::SetPrivate().Le

TBool aExportPrivateFields=ETrue:ETrue exports fields marked as private. EFalse does not export fields marked as private. See CContactItemField::SetPrivate().

Leave codes:

KErrNotSupported aFormat.iUid is not KVersitEntityUidVCard.

KErrNotFound One or more of the contact items does not exist in the database.

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

例程如下:

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

RFs fileSession;

User::LeaveIfError(fileSession.Connect());//连接文件服务器

CleanupClosePushL(fileSession);

CContactDatabase* contactDb = CContactDatabase::OpenL();//打开默认数据库

CleanupStack::PushL(contactDb);

CContactIdArray* exportContact = CContactIdArray::NewL();//记录数据项数组

CleanupStack::PushL(exportContact);

RFile file;

file.Replace(fileSession,aFileName,EFileWrite);// 新建文件,aFileName是文件名字

CleanupClosePushL(file);

RFileWriteStream outputStream(file);//声明文件流

CleanupClosePushL(outputStream);

exportContact = iContacts;//iContacts是已初始化了相应导出属性的数组,需用类CCntFilter

//如:

//CCntFilter* filter = CCntFilter::NewLC();

//filter->SetContactFilterTypeALL(EFalse);

//filter->SetContactFilterTypeCard(ETrue);//按vCard格式导出

//contactDb->FilterDatabaseL(*filter); //按照该filter属性取出满足条件的相应项

TUid id;

id.iUid = KVersitEntityUidVCard;

contactDb->ExportSelectedContactsL(id,*exportContact, //导出到文件

aWriteStream,

CContactDatabase::EExcludeUid);

CleanupStack::PopAndDestroy(5);

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

删除一个指定通信录项

这里可以使用类CPbkContactEngine,这个类可以很方便的完成各种操作,它相当于操作手机通信录的一个快速引擎

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

Tags:Symbian OS 应用开发

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