本文整理汇总了C++中CMsvSession::FileSession方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvSession::FileSession方法的具体用法?C++ CMsvSession::FileSession怎么用?C++ CMsvSession::FileSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvSession
的用法示例。
在下文中一共展示了CMsvSession::FileSession方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunTestL
void CMtfTestActionAddFileAttachmentByHandle::RunTestL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(2));
HBufC8* paramMimeType = ObtainParameterReferenceL<HBufC8>(TestCase(),ActionParameters().Parameter(3));
iEntry = paramSession->GetEntryL(messageEntry);
iStore = iEntry->EditStoreL();
iAttachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
iAttachment->SetMimeTypeL(*paramMimeType);
RFile fileHandle = OpenFileL(paramSession->FileSession(), *paramFilePath);
CleanupClosePushL(fileHandle);
TFileName fileName;
User::LeaveIfError(fileHandle.Name(fileName));
iAttachment->SetAttachmentNameL(fileName);
TInt fileSize = 0;
User::LeaveIfError(fileHandle.Size(fileSize));
iAttachment->SetSize(fileSize);
MMsvAttachmentManager& manager = iStore->AttachmentManagerL();
CActiveScheduler::Add(this);
SetActive();
manager.AddAttachmentL(fileHandle, iAttachment, iStatus);
iAttachmentId = iAttachment->Id();
iAttachment = NULL; // ownership passed to manager
CleanupStack::Pop(&fileHandle);
}
示例2: RunTestL
void CMtfTestActionSmtpAddLinkedAttachment::RunTestL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(2));
HBufC8* paramMimeType = ObtainParameterReferenceL<HBufC8>(TestCase(),ActionParameters().Parameter(3));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
CleanupStack::PushL(emailMsg);
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile);
CleanupStack::PushL(attachment);
attachment->SetMimeTypeL(*paramMimeType);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(*paramFilePath, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
TEntry fileEntry;
User::LeaveIfError(paramSession->FileSession().Entry( fileNameParser.FullName(), fileEntry));
attachment->SetSize(fileEntry.iSize);
MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
manager.AddLinkedAttachmentL(*paramFilePath, attachment, waiter->iStatus);
CleanupStack::Pop(attachment); // ownership passed to manager
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
attachment = NULL;
TInt attachmentCount = manager.AttachmentCount();
attachment = manager.GetAttachmentInfoL(attachmentCount - 1);
CleanupStack::PushL(attachment);
TMsvAttachmentId attachmentId = attachment->Id();
CleanupStack::PopAndDestroy(attachment);
CleanupStack::PopAndDestroy(2, entry); // emailMsg, entry
StoreParameterL<TMsvAttachmentId>(TestCase(),attachmentId,ActionParameters().Parameter(4));
}