Series 60第三版上提取消息的附件
来源:互联网 发布:android淘宝源码 编辑:程序博客网 时间:2024/05/10 09:53
S60 3rd上的MTM框架提供了MMsvAttachmentManager(附件管理器)这个接口类管理各种不同消息的附件,它把操作各种附件的实现交给各MTM,使用者只需要简单通过附件管理器提供的方法就可以操作消息的附件。附件管理器基于CMsvAttachment管理各类型的附件,而CMsvAttachment是消息框架中提供的用来表现任何类型附件的对象,通过它不用实际加载或检索附件就可得到附件的许多属性。消息管理器支持下面几种不同类型的附件:
1. 文件附件:被拷贝或创建在消息存储(Message Store)中的文件。
2. 文件链接附件:附件是链接到磁盘中的文件,没有拷贝到消息存储(Message Store)中。
3. 消息条目(Entry):系统中的消息可以注册为别一个消息的附件。
下面的代码演示了如何通过MMsvAttachmentManager提取消息中的附件:
//Extract attachments to specified path
void CMsgEngine::ExtractAttachmentL( const TDesC &aNewPath, CDesCArray &aFileNameArray, TMsvId aEntryId )
{
aFileNameArray.Reset();
CMsvEntry* msvEntry = iSession->GetEntryL( aEntryId );
CleanupStack::PushL( msvEntry );
if( !msvEntry->HasStoreL() )
{
CleanupStack::PopAndDestroy( msvEntry );
return;
}
CMsvStore *store = msvEntry->ReadStoreL();
CleanupStack::PushL( store );
MMsvAttachmentManager& attachManager = store->AttachmentManagerL();
RFs fileSession;
User::LeaveIfError( fileSession.Connect() );
CleanupClosePushL( fileSession );
for( TInt i = 0; i < attachManager.AttachmentCount(); ++i )
{
CMsvAttachment *attachment = attachManager.GetAttachmentInfoL( i );
CleanupStack::PushL( attachment );
TPtrC8 mime = attachment->MimeType();
CMsvAttachment::TMsvAttachmentType type = attachment->Type();
if( type != CMsvAttachment::EMsvMessageEntry )
{
TFileName newPath( aNewPath );
newPath.Append( attachment->AttachmentName() );
aFileNameArray.AppendL( attachment->AttachmentName() );
RFile file = attachManager.GetAttachmentFileL( i );
TInt size(0);
file.Size( size );
HBufC8 *buf = HBufC8::NewLC( size );
TPtr8 ptrBuf( buf->Des() );
file.Read( ptrBuf, size );
RFile newFile;
User::LeaveIfError ( newFile.Replace( fileSession, newPath, EFileWrite ) );
newFile.Write( ptrBuf );
newFile.Close();
CleanupStack::PopAndDestroy( buf );
}
CleanupStack::PopAndDestroy( attachment );
}
CleanupStack::PopAndDestroy( 3, msvEntry );
}
- Series 60第三版上提取消息的附件
- Symbian OS 9.2 Series 60 v3.0 FP1 和Symbian OS 9.1 Series 60 第三版
- Pandas如何将Series的复合索引提取为列?
- 处理带附件的SOAP消息
- 在Series 60设备上进行调试
- 在Series 60设备上进行调试
- 在Series 60设备上进行调试
- 新增supesite提取附件的系统函数功…
- Series 60 3rd上绘图时设置字体的大小
- Series 60 2nd/3rd上处理HTTP通讯中302跳转的方法
- Series 60 2nd/3rd上处理HTTP通讯中302跳转的方法
- [转贴]Series 60 2nd/3rd上处理HTTP通讯中302跳转的方法
- symbian Series 60 3rd上绘图时设置字体的大小
- Series 60 3rd上绘图时设置字体的大小
- blog 上提供的 附件 下载 排行榜
- Android上发送带附件的邮件
- IIS 上傳附件的限制
- 提取网站上的超链接
- ASP和C#.NET实现IIS6添加和删除站点主机头
- symbian的一些tip
- 学用circle画圆形。
- ASP.NET上传图片 客户端验证
- 组件技术
- Series 60第三版上提取消息的附件
- XML网络资源汇集
- ASP.NET上传图片,服务器端验证,宽度,高度,文件类型,尺寸,文件大小,图片上传,图片格式检查
- velocityEngine路径问题
- J2EE安全之Http基本验证
- BSS段、数据段、代码段、堆与栈
- 揭示常见的重构误区
- Item editor examples
- 《贼幸福》