本文整理汇总了C++中CMsvSession::CopyStoreL方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvSession::CopyStoreL方法的具体用法?C++ CMsvSession::CopyStoreL怎么用?C++ CMsvSession::CopyStoreL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvSession
的用法示例。
在下文中一共展示了CMsvSession::CopyStoreL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestStoreExistsL
LOCAL_C void TestStoreExistsL()
{
CMsgsTestUtils::SetDriveL(EDriveC);
//Check that message store exists on the drive at this stage
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 Copy MailStore
active->StartL();
CMsvOperation* operation = NULL;
TDriveUnit unit = EDriveD;
operation = session->CopyStoreL(unit, active->iStatus);
test(operation->Mtm() == KUidMsvServerMtm);
CleanupStack::PushL(operation);
CActiveScheduler::Start();
//Retrieve progress
//Should retrun KErrAlreadyExists
TPckgBuf<TMsvCopyProgress> package;
package.Copy(operation->ProgressL());
test(package().iError == KErrAlreadyExists);
//delete session;
CleanupStack::PopAndDestroy(4, ob);
CMsgsTestUtils::WaitForServerClose();
}
示例2: TestCopyStoreOperationL
/* Test to check the new API
** CopyStoreL(TInt aDrive, TMsvOp aOperationId, TRequestStatus& aStatus)
*/
LOCAL_C void TestCopyStoreOperationL()
{
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);
//Create an entry in the mail
CMsvEntry* entry=session->GetEntryL(KMsvDraftEntryId);
CleanupStack::PushL(entry);
// create entry to work under
TMsvEntry folder;
folder.iType = KUidMsvFolderEntry;
folder.iMtm = KUidMsvLocalServiceMtm;
folder.iServiceId = KMsvLocalServiceIndexEntryId;
_LIT(KTestDescription,"A Description");
_LIT(KTestDetails,"A Details");
folder.iDescription.Set(KTestDescription);
folder.iDetails.Set(KTestDetails);
entry->CreateL(folder);
entry->SetEntryL(folder.Id());
CMsvStore* store=entry->EditStoreL();
CleanupStack::PushL(store);
RMsvWriteStream stream;
stream.AssignLC(*store,TUid::Uid(0x1000));
stream.WriteL(KTestDescription);
stream.CommitL();
store->CommitL();
CleanupStack::PopAndDestroy(3);
CTestActive* active = new(ELeave)CTestActive;
CleanupStack::PushL(active);
// Test Copy MailStore
active->StartL();
CMsvOperation* operation = NULL;
TDriveUnit unit =(EDriveD);
operation = session->CopyStoreL(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);
//delete session;
CleanupStack::PopAndDestroy(4);
//Check that both the source and destination
//MailStore directory structure is same
CMsgsTestUtils::WaitForServerClose();
CDir *srcDir;
CDir *destDir;
_LIT(intro, "Testing the directory structure");
_LIT(KEntryname,"%S");
theUtils->Printf(intro);
TFileName dest = unit.Name();
dest.Append(KMsvDefaultFolder2);
User::LeaveIfError(theUtils->FileSession().GetDir(dest, KEntryAttDir|KEntryAttNormal, ESortByName, destDir));
unit =EDriveC;
TFileName src = unit.Name();
src.Append(KMsvDefaultFolder2);
User::LeaveIfError(theUtils->FileSession().GetDir(src, KEntryAttDir|KEntryAttNormal, ESortByName, srcDir));
TInt counter=0;
TEntry srcEntry;
TEntry destEntry;
while (counter<srcDir->Count())
{
srcEntry = (*srcDir)[counter];
destEntry = (*destDir)[counter];
//Check the sizes
test(srcEntry.iSize == destEntry.iSize);
//Check the names
test(srcEntry.iName == destEntry.iName);
//Print out the names on the log
theUtils->Printf(KEntryname,&(srcEntry.iName));
//.........这里部分代码省略.........