本文整理汇总了C++中CMsvSession类的典型用法代码示例。如果您正苦于以下问题:C++ CMsvSession类的具体用法?C++ CMsvSession怎么用?C++ CMsvSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMsvSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestSessionWithPriorityL
LOCAL_C void TestSessionWithPriorityL()
{
CDummyObserver ob;
CMsvSession* session = CMsvSession::OpenSyncL(ob,CMsvSession::EPriorityStandard);
if (session->Priority() == session->EPriorityStandard)
{
CMsgsTestUtils::Next(_L("Dfault priority is EPriorityStandard "));
}
delete session;
session= NULL;
session = CMsvSession::OpenAsyncL(ob,CMsvSession::EPriorityLow);
if (session->Priority() == session->EPriorityLow)
{
CMsgsTestUtils::Next(_L("Dfault priority is EPriorityLow "));
}
delete session;
session= NULL;
RFs rfs;
User::LeaveIfError(rfs.Connect());
CleanupClosePushL(rfs);
session = CMsvSession::OpenAsyncL(ob,rfs,CMsvSession::EPriorityHigh);
if (session->Priority() == session->EPriorityHigh)
{
CMsgsTestUtils::Next(_L("Dfault priority is EPriorityHigh "));
}
delete session;
session= NULL;
CleanupStack::PopAndDestroy(&rfs);
}
示例2: new
// methods from CSendAsEditUtils
void CSendAsTestEditUtils::LaunchEditorL(TMsvId /*aId*/, TRequestStatus& aStatus)
{
CDummyObserver* ob1 = new(ELeave) CDummyObserver;
CleanupStack::PushL(ob1);
CMsvSession* session = CMsvSession::OpenSyncL(*ob1);
CleanupStack::PushL(session);
CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId,
TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
CleanupStack::PushL(cEntry);
CMsvEntrySelection* selection = cEntry->ChildrenL();
CleanupStack::PushL(selection);
CMsvEntry* cEntry2 = session->GetEntryL(selection->At(0));
CleanupStack::PushL(cEntry2);
TMsvEntry entry = cEntry2->Entry();
entry.SetMtmData3(234567890); // Show we've been called by touching the TMsvEntry.
cEntry2->ChangeL(entry);
CleanupStack::PopAndDestroy(5, ob1); // cEntry2, selection, cEntry, session, ob1
iUserStatus = &aStatus;
aStatus = KRequestPending;
// wait a few seconds before completing
iEditTimer->After(KSendAsTestEditWaitTime);
}
示例3: 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);
}
示例4: RunTestActionL
void CMtfTestActionGetAttachmentFileFromIndex::RunTestActionL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TInt attachIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
HBufC* dataFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
RFile fileAttachment = manager.GetAttachmentFileL(attachIndex);
CleanupClosePushL(fileAttachment);
if( dataFilePath != NULL )
{
// check of contents of attachment file is requested
CompareFileL(fileAttachment, *dataFilePath);
}
CleanupStack::PopAndDestroy(3, entry); // fileAttachment, store, entry
}
示例5: RunTestActionL
void CMtfTestActionSmtpGetAttachmentFileFromId::RunTestActionL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
HBufC* dataFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
CleanupStack::PushL(emailMsg);
MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
RFile fileAttachment = manager.GetAttachmentFileL(attachId);
CleanupClosePushL(fileAttachment);
if( dataFilePath != NULL )
{
// check of contents of attachment file is requested
CompareFileL(fileAttachment, *dataFilePath);
}
CleanupStack::PopAndDestroy(3, entry); // fileAttachment, emailMsg, entry
}
示例6: TestCase
/**
Function : ExecuteActionL
Description : Issues command to Pigeon Server MTM to schedule/reschedule the messages
@internalTechnology
@param : none
@return : void
@pre
@post none
*/
void CMtfTestActionSchedulePigeonMessage::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSchedulePigeonMessage);
// Obtain input parameters
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),
ActionParameters().Parameter(0));
TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),
ActionParameters().Parameter(1));
TInt paramCommand = ObtainValueParameterL<TInt>(TestCase(),
ActionParameters().Parameter(2));
//Error Handling Just in case one of the above inputs fail.
if(TestCase().TestStepResult() == EPass)
{
CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering());
// Get the selection of Pigeon Messages
iSelection = entry->ChildrenWithMtmL(KUidMsgTypePigeon);
// Initiate asynchronous operation, passing the schedule/reschedule the message in the selection
// Dummy aParameter value passed as Pigeon MTM does not make use of it.
iOperation = paramSession->TransferCommandL(*iSelection,paramCommand, _L8("aaaa"), iStatus);
CActiveScheduler::Add(this);
SetActive();
}
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSchedulePigeonMessage);
}
示例7: TestCase
void CMtfTestActionCompareAttachment::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareAttachment);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
HBufC* dataFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
RFile fileAttachment = manager.GetAttachmentFileL(attachId);
CleanupClosePushL(fileAttachment);
CompareFileL(fileAttachment, *dataFilePath);
CleanupStack::PopAndDestroy(&fileAttachment);
CleanupStack::PopAndDestroy(2, entry); // store, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareAttachment);
TestCase().ActionCompletedL(*this);
}
示例8: TestDeleteStoreOperationL
LOCAL_C void TestDeleteStoreOperationL()
{
CMsgsTestUtils::SetDriveL(EDriveC);
CSessionObserver* ob = new(ELeave)CSessionObserver;
CleanupStack::PushL(ob);
// Set session in observer
CMsvSession* session = CMsvSession::OpenAsyncL(*ob);
ob->iSession = session;
CleanupStack::PushL(session);
CActiveScheduler::Start();
test(ob->iType==MMsvSessionObserver::EMsvServerReady);
CTestActive* active = new(ELeave)CTestActive;
CleanupStack::PushL(active);
// Test Delete MailStore
active->StartL();
CMsvOperation* operation = NULL;
TDriveUnit unit =(EDriveD);
operation = session->DeleteStoreL(unit, active->iStatus);
test(operation->Mtm() == KUidMsvServerMtm);
CleanupStack::PushL(operation);
CActiveScheduler::Start();
//Retrieve progress
TPckgBuf<TMsvCopyProgress> package;
package.Copy(operation->ProgressL());
test((package().iError == KErrNone) || (package().iError == KErrPathNotFound)) ;
CleanupStack::PopAndDestroy(4);
}
示例9: CloseServerL
LOCAL_C void CloseServerL()
{
CDummyObserver ob;
CMsvSession* session = CMsvSession::OpenSyncL(ob);
session->CloseMessageServer();
delete session;
User::After(1000000);
}
示例10: TestCase
void CMtfTestActionSmtpModifyAttachmentInfo::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSmtpModifyAttachmentInfo);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachmentId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
CleanupStack::PushL(emailMsg);
MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL(mimeHeaders);
mimeHeaders->SetContentDescriptionL(KTxtContentDescription());
mimeHeaders->SetContentBaseL(KTxtContentBase());
mimeHeaders->SetContentLocationL(KTxtContentLocation());
mimeHeaders->SetContentIdL(KTxtContentId());
mimeHeaders->SetContentTypeL(KTxtContentType());
mimeHeaders->SetContentSubTypeL(KTxtContentSubType());
mimeHeaders->SetContentDispositionL(KTxtContentDisposition());
mimeHeaders->ContentTypeParams().AppendL(KTxtParam1());
mimeHeaders->ContentTypeParams().AppendL(KTxtParam2());
mimeHeaders->ContentTypeParams().AppendL(KTxtParam3());
mimeHeaders->ContentDispositionParams().AppendL(KTxtParam4());
mimeHeaders->ContentDispositionParams().AppendL(KTxtParam5());
mimeHeaders->ContentDispositionParams().AppendL(KTxtParam6());
mimeHeaders->XTypeParams().AppendL(KTxtParam7());
mimeHeaders->XTypeParams().AppendL(KTxtParam8());
mimeHeaders->XTypeParams().AppendL(KTxtParam9());
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = manager.GetAttachmentInfoL(attachmentId);
CleanupStack::PushL(attachment);
mimeHeaders->StoreL(*attachment);
manager.ModifyAttachmentInfoL(attachment, waiter->iStatus);
CleanupStack::Pop(attachment);
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(2, mimeHeaders); // waiter, mimeHeaders
CompareMimeHeadersL(*emailMsg, attachmentId);
CleanupStack::PopAndDestroy(2, entry);//emailMsg, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSmtpModifyAttachmentInfo);
TestCase().ActionCompletedL(*this);
}
示例11: 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));
}
示例12: TestCase
void CMtfTestActionRemoveAllAttachments::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionRemoveAllAttachments);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TInt attachIdFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2), 0);
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->EditStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
TInt attachmentCount = manager.AttachmentCount();
for ( ; attachmentCount > 0 ; attachmentCount-- )
{
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
if( attachIdFlag == 1 )
{
CMsvAttachment* attachInfo = manager.GetAttachmentInfoL(0);
CleanupStack::PushL(attachInfo);
manager.RemoveAttachmentL(attachInfo->Id(), waiter->iStatus);
CleanupStack::PopAndDestroy(attachInfo);
}
else
{
manager.RemoveAttachmentL(0, waiter->iStatus);
}
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
}
store->CommitL();
CleanupStack::PopAndDestroy(2, entry); // store, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionRemoveAllAttachments);
TestCase().ActionCompletedL(*this);
}
示例13: RunTestL
void CMtfTestActionSmtpRemoveEntryAttachmentById::RunTestL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
CleanupStack::PushL(emailMsg);
MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
CMsvAttachment* attachInfo = manager.GetAttachmentInfoL(attachId);
CleanupStack::PushL(attachInfo);
// First ensure that the attachment is a file attachment
if( attachInfo->Type() != CMsvAttachment::EMsvMessageEntry )
{
User::Leave(KErrGeneral);
}
// Get the linked file
TMsvId msgId = attachInfo->EntryAttachmentId();
CleanupStack::PopAndDestroy(attachInfo);
// Remove the attachment
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
manager.RemoveAttachmentL(attachId, waiter->iStatus);
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
CleanupStack::PopAndDestroy(2, entry); // email msg, entry
// Ensure that the message entry still exists
CMsvEntry* checkEntry = paramSession->GetEntryL(msgId);
delete checkEntry;
checkEntry = NULL;
}
示例14: new
// Get the TMsvEntry of the message whose TMsvId is passed from the client..
void CDummyServerSession::GetTMsvEntryL(const RMessage2& aMessage)
{
CDummyObserver* ob = new(ELeave) CDummyObserver;
CleanupStack::PushL(ob);
TPckgBuf<TMsvId> idBuf;
idBuf = aMessage.Int0();
CMsvSession* session = CMsvSession::OpenSyncL(*ob);
CleanupStack::PushL(session);
TMsvId entryId = idBuf();
CMsvEntry* cEntry = session->GetEntryL(entryId);
CleanupStack::PushL(cEntry);
TPckgBuf<TMsvEntry> pckg = cEntry->Entry();
aMessage.WriteL(1,pckg);
CleanupStack::PopAndDestroy(3,ob);//cEntry,session,ob
}
示例15: TestCase
void CMtfTestActionGetEntry::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionAddGetEntry);
if(TestCase().TestStepResult() == EPass)
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
entry->SetEntryL(messageEntry);
StoreParameterL<CMsvEntry>(TestCase(),*entry,ActionParameters().Parameter(2));
CleanupStack::Pop(entry);
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionAddGetEntry);
}
TestCase().ActionCompletedL(*this);
}