void CPopsTestHarness::DoLocalCopyTestL() // Test copying a message locally. ie create a message in the Drafts folder // and copy it to a local sub folder { // Create the Message in the Drafts Folder iTestUtils->CreateMessageL(KTestMsgPath, KMsvDraftEntryId, KMsvDraftEntryId); CMsvServerEntry* serverEntry = iTestUtils->iServerEntry; serverEntry->SetEntry(KMsvDraftEntryId); CMsvEntrySelection* newMessageList = new (ELeave)CMsvEntrySelection(); CleanupStack::PushL(newMessageList); serverEntry->GetChildren(*newMessageList); TMsvId newMessageId = (*newMessageList)[0]; // Create a local folder under the Drafts folder TMsvEntry parentEntry = serverEntry->Entry(); TMsvEntry newFolder; newFolder.SetStandardFolder(ETrue); newFolder.iDetails.Set(KSubFolder); newFolder.iType.iUid=KUidMsvFolderEntryValue; newFolder.iMtm=parentEntry.iMtm; newFolder.iServiceId = parentEntry.iServiceId; serverEntry->CreateEntry(newFolder); // Fill the Disk Space and attempt to do the Copy FillDiskL(); // Copy the message into the new LOCAL Sub-Folder CTestActive* active = new(ELeave) CTestActive; CleanupStack::PushL(active); serverEntry->CopyEntryL(newMessageId, newFolder.Id(), active->iStatus); active->StartL(); CActiveScheduler::Start(); CleanupStack::PopAndDestroy(2); // newMessageList, active }
// ----------------------------------------------------------------------------- // CMmsAdapterMsvApi::AddUserFolderL // Creates new user folder // ----------------------------------------------------------------------------- TInt CMmsAdapterMsvApi::AddUserFolderL( TMsvId& aFolder, const TDesC& aName ) { TRACE_FUNC_ENTRY; LOGGER_WRITE_1( "aName: %S", &aName ); // Make sure that we are not going to add same folder twise TBool found( EFalse ); found = FindUserFolderL( aName, aFolder ); if ( found ) { LOGGER_WRITE( "Folder already exists" ); LOGGER_LEAVEFN( "CMmsAdapterMsvApi::AddUserFolderL" ); return KErrNone; } CMsvEntry* entry = iSession.GetEntryL(KMsvMyFoldersEntryIdValue); CleanupStack::PushL( entry ); TTime date; date.UniversalTime(); TMsvEntry folderEntry; folderEntry.iType = KUidMsvFolderEntry; folderEntry.iMtm = KUidMsvLocalServiceMtm; folderEntry.iDetails.Set( aName ); folderEntry.iServiceId = KMsvLocalServiceIndexEntryIdValue; folderEntry.iSize = sizeof( folderEntry ); folderEntry.iDate = date; folderEntry.SetStandardFolder( EFalse ); folderEntry.SetVisible( ETrue ); folderEntry.SetComplete( ETrue ); folderEntry.SetInPreparation( EFalse ); folderEntry.SetReadOnly( EFalse ); entry->CreateL( folderEntry ); CleanupStack::PopAndDestroy( entry ); aFolder = folderEntry.Id(); TRACE_FUNC_EXIT; return KErrNone; }