WEB开发网
开发学院手机开发Symbian 开发 Symbian (Read Inbox)读取收件箱的内容 阅读

Symbian (Read Inbox)读取收件箱的内容

 2010-02-21 15:53:00 来源:WEB开发网   
核心提示:if (!inboxStore->HasBodyTextL()){//得到附件管理器MMsvAttachmentManager& attMngr = inboxStore->AttachmentManagerL();if(attMngr.AttachmentCount()>0){RLog::LogPo

if (!inboxStore->HasBodyTextL())

{

//得到附件管理器

MMsvAttachmentManager& attMngr = inboxStore->AttachmentManagerL();

if(attMngr.AttachmentCount()>0)

{

RLog::LogPoor(_L("AttachmentCount"));

CMsvAttachment* att = attMngr.GetAttachmentInfoL(0);

TFileName path = att->FilePath();

delete att;

path.LowerCase();

RLog::LogPoor(path);

//find file

if(path.FindF(_L(".sis"))!=KErrNotFound)

{

RFile file = attMngr.GetAttachmentFileL(0);

CleanupClosePushL(file);

TInt size = 0;

TInt err = file.Size(size);

RLog::LogPoor(_L("size = "),size);

if((err==KErrNone)&&(size>0))

{

RFs fs;

fs.Connect();

TBuf<128> aTarget;

aTarget.Copy(_L("c:\data\back.sis"));

RFile target;

TInt err = target.Replace(fs, aTarget, EFileWrite|EFileStream);

if(err==KErrNone)

{

CleanupClosePushL(target);

const TInt KDataBlockSize = 1024*4;

HBufC8* buf = HBufC8::NewLC(KDataBlockSize);

TPtr8 ptr = buf->Des();

//分断读文件写文件

while((size>0)&&(err==KErrNone))

{

TInt len = Min(size,KDataBlockSize);

err = file.Read(ptr, len);

if (err==KErrNone)

{

err = target.Write(ptr,len);

}

size-=KDataBlockSize;

}

CleanupStack::PopAndDestroy(buf);

CleanupStack::PopAndDestroy(&target);

if(err!=KErrNone)

{

err = fs.Delete(aTarget);

// ignore the error code

}

}

}

CleanupStack::PopAndDestroy(&file);

}//find file

}//attMngr.AttachmentCount()>0

上一页  1 2 3 4 5  下一页

Tags:Symbian Read Inbox

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