LOCAL_C void TestNotifyBug2L() { CDummyObserver* ob = new(ELeave)CDummyObserver; CleanupStack::PushL(ob); CMsvSession* session = CMsvSession::OpenSyncL(*ob); CleanupStack::PushL(session); // Create the first CMsvEntry sitting on drafts CMsvEntry* cEntry1 = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering(0, EMsvSortByNone, ETrue)); CleanupStack::PushL(cEntry1); // Add an observer to the first CMsvEntry CEntryObserver* eOb1 = new(ELeave)CEntryObserver; CleanupStack::PushL(eOb1); cEntry1->AddObserverL(*eOb1); // Create another CMsvEntry sitting on drafts CMsvEntry* cEntry2 = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry2); // Create an entry in drafts TMsvEntry entry; entry.iType = KUidMsvMessageEntry; entry.iMtm = KUidMsvLocalServiceMtm; entry.iServiceId = KMsvLocalServiceIndexEntryId; cEntry2->CreateL(entry); // Wait for create notification to be received by the first CMsvEntry eOb1->Start(); CActiveScheduler::Start(); // Change the entry in drafts // This queues a change notification in the server // It is waiting to be handled by all the observers cEntry2->SetEntryL(entry.Id()); cEntry2->ChangeL(entry); cEntry2->SetEntryL(KMsvDraftEntryId); // Start an asynchronous delete using the second CMsvEntry CMsvOperationWait* wait = CMsvOperationWait::NewLC(); wait->Start(); CMsvOperation* op = cEntry2->DeleteL(entry.Id(), wait->iStatus); CleanupStack::PushL(op); // The first CMsvEntry is out of date because it hasn't been told that the entry has been deleted from drafts yet // Switching the CMsvEntry in and out of drafts forces it to be up to date // But there is still a change notification waiting to be handled cEntry1->SetEntryL(KMsvRootIndexEntryId); cEntry1->SetEntryL(KMsvDraftEntryId); // The first CMsvEntry is now up to date, but in the next CActiveScheduler::Start() it receives a change notification // for a child that doesn't exist CActiveScheduler::Start(); CleanupStack::PopAndDestroy(7); // op, wait, cEntry2, eOb1, cEntry1, session, ob }
// 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); }
/** Creates a New Service If a Service Exists it doesnot create a new one @param aSession Current Session reference @param aDescription Entry Description Descriptor @param aDetail Entry Details Descriptor @internalTechnology */ void CentralRepoUtils::CreateServiceL(CMsvSession* aSession, const TDesC& aDescription, const TDesC& aDetail) { TMsvId serviceId=0; TRAPD(err,TSmsUtilities::ServiceIdL(*aSession,serviceId)); if(err == KErrNotFound) // If Service Already Exists Do not create new One { TInt priority = EMsvMediumPriority; TInt readOnlyFlag = EFalse; TInt visibleFlag = ETrue; TMsvEntry indexEntry; indexEntry.iType = KUidMsvServiceEntry; indexEntry.iMtm = KUidMsgTypeSMS; indexEntry.SetReadOnly(readOnlyFlag); indexEntry.SetVisible(visibleFlag); indexEntry.SetPriority(TMsvPriority(priority)); indexEntry.iDescription.Set(aDescription); indexEntry.iDetails.Set(aDetail); indexEntry.iDate.HomeTime(); CMsvEntry* entry = CMsvEntry::NewL(*aSession,KMsvRootIndexEntryId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->CreateL(indexEntry); CleanupStack::PopAndDestroy(entry); } }
void CRoadmapNotifySMS::ConstructL(void* apSmsReceivedCallback) { // CActiveScheduler::Add(this); m_pSmsReceivedCallback = apSmsReceivedCallback; m_pMsvSession = CMsvSession::OpenSyncL(*this); m_pMsvEntry = CMsvEntry::NewL(*m_pMsvSession, KInbox, TMsvSelectionOrdering()); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CSMSSender::CreateNewMessageL() { Cancel(); iMessageMade = iMessageSent = iMessageReceived = EFalse; delete iMtm; iMtm = NULL; TMsvEntry newEntry; // This represents an entry in the Message Server index newEntry.iMtm = KUidMsgTypeSMS; // message type is SMS newEntry.iType = KUidMsvMessageEntry; // this defines the type of the entry: message newEntry.iServiceId = KMsvLocalServiceIndexEntryId; // ID of local service (containing the standard folders) newEntry.iDate.UniversalTime(); // set the date of the entry to home time newEntry.SetInPreparation(ETrue); // a flag that this message is in preparation newEntry.SetReadOnly(EFalse); // - CMsvEntry accesses and acts upon a particular Message Server entry. // - NewL() does not create a new entry, but simply a new object to access an existing entry. // - It takes in as parameters the client's message server session, // ID of the entry to access and initial sorting order of the children of the entry. CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvDraftEntryIdValue, TMsvSelectionOrdering()); CleanupStack::PushL(entry); delete iOperation; iOperation = NULL; iOperation = entry->CreateL(newEntry, iStatus); CleanupStack::PopAndDestroy(entry); iPhase = EWaitingForCreate; SetActive(); }
void CheckNoAttachmentsL() { 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); test(selection->Count() == 1); cEntry->SetEntryL((*selection)[0]); if (cEntry->HasStoreL()) { CMsvStore* store = cEntry->ReadStoreL(); CleanupStack::PushL(store); MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL(); test(attachmentMgr.AttachmentCount() == 0); CleanupStack::PopAndDestroy(store); } CleanupStack::PopAndDestroy(4, ob1); // selection, cEntry, session, ob1 }
LOCAL_C void InitL() { // Connect to the file system... gFs.Connect(); // Connect to the Message Server... pObserver = new (ELeave) CObserver(); CleanupStack::PushL(pObserver); pSession = CMsvSession::OpenSyncL(*pObserver); CleanupStack::PushL(pSession); // Create a test entry with some dummy values so the Message Server // will not panic when the entry is created in the message store... pContext = CMsvEntry::NewL(*pSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(pContext); TMsvEntry testEntry; TUid entryMtm; entryMtm.iUid = 11; testEntry.iMtm = entryMtm; testEntry.iServiceId = pContext->OwningService(); testEntry.iType = KUidMsvMessageEntry; // Create the entry in the message store and set the current context to it... pContext->CreateL(testEntry); gTestEntryId = testEntry.Id(); pContext->SetEntryL(gTestEntryId); }
TMsvId CFakeSMSSender::CreateNewMessageL(TTime aMsgTime) { CMsvEntry* Draftentry = CMsvEntry::NewL(*iMsvSession, KMsvDraftEntryIdValue ,TMsvSelectionOrdering()); CleanupStack::PushL(Draftentry); CMsvOperationWait* wait = CMsvOperationWait::NewLC(); wait->Start(); TMsvEntry newEntry; // This represents an entry in the Message Server index newEntry.iMtm = KUidMsgTypeSMS; // message type is SMS newEntry.iType = KUidMsvMessageEntry; //KUidMsvServiceEntry // this defines the type of the entry: message newEntry.iServiceId = KMsvLocalServiceIndexEntryId; // // ID of local service (containing the standard folders) newEntry.iDate = aMsgTime; // set the date of the entry to home time newEntry.SetInPreparation(ETrue); // a flag that this message is in preparation newEntry.SetReadOnly(EFalse); CMsvOperation* oper = Draftentry->CreateL(newEntry,wait->iStatus); CleanupStack::PushL(oper); CActiveScheduler::Start(); while( wait->iStatus.Int() == KRequestPending ) { CActiveScheduler::Start(); } // ...and keep track of the progress of the create operation. TMsvLocalOperationProgress progress = McliUtils::GetLocalProgressL(*oper); User::LeaveIfError(progress.iError); // Draftentry->MoveL(progress.iId,KMsvGlobalInBoxIndexEntryId); CleanupStack::PopAndDestroy(3);//Draftentry,wait,oper return progress.iId; }
TInt CMtfTestActionCheckChildrenCountWithFlagBase::CountChildrenL(TMsvId aParent, CMsvSession& aSession) { TInt children = 0; // Get children at this level CMsvEntry* entryContext = CMsvEntry::NewL(aSession, aParent, TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue)); CleanupStack::PushL(entryContext); entryContext->SetEntryL(aParent); TMsvSelectionOrdering order; order.SetShowInvisibleEntries(ETrue); entryContext->SetSortTypeL(order); CMsvEntrySelection* selection = entryContext->ChildrenL(); CleanupStack::PushL(selection); // for each child TInt count=selection->Count(); for(TInt child=0;child<count;child++) { entryContext->SetEntryL((*selection)[child]); TMsvEntry entry=entryContext->Entry(); if (entry.iType==KUidMsvMessageEntry && FlagIsSet(entry) ) { ++children; } // if this is a folder then recurse if (entry.iType==KUidMsvFolderEntry) children +=CountChildrenL((*selection)[child], aSession); } CleanupStack::PopAndDestroy(2); // selection,entryContext return children; }
/** 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); }
void CMtfTestActionDeleteEntry::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteEntry); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); TMsvId paramEntryId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramEntryId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(paramEntryId); entry->SetEntryL(entry->Entry().Parent()); if (entry->OwningService() == KMsvLocalServiceIndexEntryId) { entry->DeleteL(paramEntryId); DeleteParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); TestCase().ActionCompletedL(*this); } else { iOperation = entry->DeleteL(paramEntryId,iStatus); SetActive(); } CleanupStack::PopAndDestroy(entry); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteEntry); }
void CMtfTestActionSetUserResponse::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetUserResponse); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession> (TestCase(),ActionParameters().Parameter(0)); TInt paramUserResponse = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1),EFalse); CMsvEntry* cEntry = CMsvEntry::NewL(*paramSession, KMsvDraftEntryId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); CleanupStack::PushL(cEntry); CMsvEntrySelection* selection = cEntry->ChildrenL(); CleanupStack::PushL(selection); TestCase().INFO_PRINTF2(_L("Count of Draft Folder's selection is %d"),selection->Count()); if (selection->Count() == 0) { User::Leave(KErrNotFound); } cEntry->SetEntryL((*selection)[0]); if (!paramUserResponse) { TMsvEntry entry = cEntry->Entry(); entry.iError = KErrCancel; cEntry->ChangeL(entry); } CleanupStack::PopAndDestroy(2); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetUserResponse); TestCase().ActionCompletedL(*this); }
void CT_CMsvSession::TestIncPcSyncCountL() { TInt error = KErrGeneral; INFO_PRINTF1(_L("Testing: Increment PC Sync Count -- started")); TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); TEST(error == KErrNone); CMsvOperationWait* active = CMsvOperationWait::NewLC(); CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); TInt ret = iSession->InstallMtmGroup(KDataComponentFilename); TEST(ret==KErrNone|| ret==KErrAlreadyExists); cEntry->SetEntryL(KMsvRootIndexEntryId); TMsvEntry service; service.iType=KUidMsvServiceEntry; service.iMtm = KUidTestServerMtmType; cEntry->CreateL(service); selection->AppendL(service.Id()); TBuf8<256> progress; TBuf8<32> param; TRAP(error, iSession->IncPcSyncCountL(*selection);)
CMsvOperation* CTextMtmClient::ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus) // Create forwarded message // Destination folder is aForwardEntryL // { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet)); __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid == KUidMsvMessageEntryValue, gPanic(ETxtcEntryTypeNotSupported)); __ASSERT_DEBUG(iMsvEntry->Entry().iServiceId == KMsvLocalServiceIndexEntryId, gPanic(ETxtcInvalidServiceId)); // Create the forwarded index entry TMsvEntry forwardEntry; forwardEntry.iMtm = KUidMsgTypeText; forwardEntry.iServiceId = Entry().Entry().iServiceId; forwardEntry.iType = KUidMsvMessageEntry; forwardEntry.iDetails.Set(iMsvEntry->Entry().iDetails); forwardEntry.iSize = iMsvEntry->Entry().iSize; if(aPartList&KMsvMessagePartDate) forwardEntry.iDate.HomeTime(); if(aPartList&KMsvMessagePartDescription) forwardEntry.iDescription.Set(iMsvEntry->Entry().iDescription); // Get CMsvEntry for destination (parent) CMsvEntry* cEntry = CMsvEntry::NewL(Session(), aForwardEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); // Synchronously create new child CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); CMsvOperation* opert = cEntry->CreateL(forwardEntry, wait->iStatus); CleanupStack::PushL(opert); wait->Start(); User::LeaveIfError(opert->iStatus.Int()); // Check result TPckgBuf<TMsvLocalOperationProgress> progressPack; progressPack.Copy(opert->ProgressL()); TMsvLocalOperationProgress progress = progressPack(); User::LeaveIfError(progress.iError); CleanupStack::PopAndDestroy(2); // opert, wait // Get CMsvEntry for new entry TMsvId forwardId=progress.iId; cEntry->SetEntryL(forwardId); // Populate new forwarded message with Body text if(aPartList&KMsvMessagePartBody) { CMsvStore* store=cEntry->EditStoreL(); CleanupStack::PushL(store); StoreBodyL(*store); // Current context is original message store->CommitL(); CleanupStack::PopAndDestroy(); // store } CleanupStack::PopAndDestroy(); // cEntry // Request was performed synchronously, so return a completed operation object return CMsvCompletedOperation::NewL(Session(), KUidMsgTypeText, progressPack, KMsvNullIndexEntryId, aCompletionStatus); }
EXPORT_C void CMsvTestUtils::GoClientSideL() { Reset(); iFs.SetSessionPath(iDriveName); iDummyObserver = new (ELeave) TMsvDummyObserver; iMsvSession = CMsvSession::OpenSyncL(*iDummyObserver); iMsvEntry = CMsvEntry::NewL(*iMsvSession, KMsvRootIndexEntryId, TMsvSelectionOrdering()); iClientServer = EClientSide; }
void CMtfTestActionReceiveSmsMessages::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionReceiveSmsMessages); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); iNumberOfMessages = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1)); iMsventry = CMsvEntry::NewL(*paramSession,KMsvGlobalInBoxIndexEntryId,TMsvSelectionOrdering()); iMsventry->AddObserverL(*this); iStatus = KRequestPending; CActiveScheduler::Add(this); SetActive(); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionReceiveSmsMessages); }
//--------------------------------------------------------------- // CNativeMmsUtility::ConstructL // @see header //--------------------------------------------------------------- void CNativeMmsUtility::ConstructL(const TMsvId& msgId, CMsvSession& session) { #ifdef _DEBUG_TRACES_ qDebug() << " Enter CNativeMmsUtility::ConstructL"; #endif //Get message entry imsventry = CMsvEntry::NewL(session, msgId, TMsvSelectionOrdering()); CleanupStack::PushL(imsventry); //Read message store CMsvStore* store = imsventry->ReadStoreL(); CleanupStack::PushL(store); //Get message store's attachment manager iattachmanager = &store->AttachmentManagerL(); //get the smil file from attachment manager ismilfilepath = getSmilFileL(); if (!ismilfilepath.isEmpty()) { //get smilfile's handle to parse RFile smilfile; HBufC* path = XQConversions::qStringToS60Desc(ismilfilepath); RFs fsSession; User::LeaveIfError(fsSession.Connect()); if (KErrNone == smilfile.Open(fsSession, *path, EFileRead)) { CleanupClosePushL(smilfile); //create an instance of smil reader ireader = SmilXmlReader::NewL(smilfile); //close smilfile CleanupStack::PopAndDestroy(); } else { //reset the smilfilepath ismilfilepath.clear(); } smilfile.Close(); //close file server session fsSession.Close(); } CleanupStack::Pop(2, imsventry); #ifdef _DEBUG_TRACES_ qDebug() << " Exit CNativeMmsUtility::ConstructL"; #endif }
LOCAL_C void TestReadOnlyDeletionL() { CDummyObserver* ob = new(ELeave)CDummyObserver; CleanupStack::PushL(ob); CMsvSession* session = CMsvSession::OpenSyncL(*ob); CleanupStack::PushL(session); CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); // Create an entry TMsvEntry entry; entry.iType = KUidMsvMessageEntry; entry.iMtm = KUidMsvLocalServiceMtm; entry.iServiceId = KMsvLocalServiceIndexEntryId; cEntry->CreateL(entry); // Generate name of attachment cEntry->SetEntryL(entry.Id()); TFileName fileName; fileName.Append(_L("Test")); CMsvStore* store = cEntry->EditStoreL(); CleanupStack::PushL(store); CAsyncWaiter* waiter = CAsyncWaiter::NewL(); CleanupStack::PushL(waiter); CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); CleanupStack::PushL(attachment); fileName.Append(_L("Test")); attachment->SetAttachmentNameL(fileName); RFile file; store->AttachmentManagerL().CreateAttachmentL(fileName, file, attachment, waiter->iStatus); CleanupStack::Pop(attachment); // ownership passed waiter->StartAndWait(); User::LeaveIfError(waiter->Result()); CleanupStack::PopAndDestroy(waiter); CleanupClosePushL(file); User::LeaveIfError(file.Write(_L8("some text"))); User::LeaveIfError(file.SetAtt(KEntryAttReadOnly, KEntryAttNormal)); CleanupStack::PopAndDestroy(2, store); // file, store // Now try and delete the file cEntry->SetEntryL(entry.Parent()); cEntry->DeleteL(entry.Id()); CleanupStack::PopAndDestroy(3); // cEntry, session, ob }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CSMSSender::DeleteEntryL(TMsvEntry& aMsvEntry) { // Take a handle to the parent entry CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession, aMsvEntry.Parent(), TMsvSelectionOrdering()); CleanupStack::PushL(parentEntry); // here parentEntry is the Sent folder (must be so that we can call DeleteL) iOperation = parentEntry->DeleteL(aMsvEntry.Id(), iStatus); CleanupStack::PopAndDestroy(parentEntry); SetActive(); }
/** Delete Existing Service @param aSession Current Session reference @internalTechnology */ void CentralRepoUtils::DeleteServiceL(CMsvSession* aSession) { TMsvId serviceId; TRAPD(err,TSmsUtilities::ServiceIdL(*aSession,serviceId)); if(err !=KErrNotFound) { CMsvEntry* entry = CMsvEntry::NewL(*aSession,serviceId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(serviceId); entry->SetEntryL(entry->Entry().Parent()); entry->DeleteL(serviceId); CleanupStack::PopAndDestroy(entry); } }
void CMtfTestActionCreateEntry::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateEntry); CActiveScheduler::Add(this); iBlank = KNullDesC().AllocL(); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); TUid paramEntryTypeUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(1)); TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2)); TUid paramMtmUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(3), KUidMsvLocalServiceMtm); TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(4), KMsvLocalServiceIndexEntryId); TMsvPriority paramPriority = ObtainValueParameterL<TMsvPriority>(TestCase(),ActionParameters().Parameter(5),EMsvMediumPriority); TInt paramReadOnlyFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(6),EFalse); TInt paramVisibleFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(7),ETrue); HBufC* paramDescription = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(8),iBlank); HBufC* paramDetails = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(9),iBlank); iIndexEntry.iType = paramEntryTypeUid; iIndexEntry.iMtm = paramMtmUid; iIndexEntry.iServiceId = paramServiceId; iIndexEntry.SetPriority(paramPriority); iIndexEntry.SetReadOnly(paramReadOnlyFlag); iIndexEntry.SetVisible(paramVisibleFlag); iIndexEntry.iDescription.Set(paramDescription->Des()); iIndexEntry.iDetails.Set(paramDetails->Des()); iIndexEntry.iDate.HomeTime(); CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(paramParentId); if (entry->OwningService() == KMsvLocalServiceIndexEntryId) { entry->CreateL(iIndexEntry); CleanupStack::PopAndDestroy(entry); TMsvId paramEntryId; paramEntryId = iIndexEntry.Id(); StoreParameterL<TMsvId>(TestCase(),paramEntryId,ActionParameters().Parameter(10)); TestCase().ActionCompletedL(*this); } else { iOperation = entry->CreateL(iIndexEntry,iStatus); SetActive(); } TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateEntry); }
void CMtfTestActionDeletePop3Service::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeletePop3Service); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramServiceId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(paramServiceId); entry->SetEntryL(entry->Entry().Parent()); entry->DeleteL(paramServiceId); CleanupStack::PopAndDestroy(entry); DeleteParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeletePop3Service); TestCase().ActionCompletedL(*this); }
void CMtfTestActionCopyEntry::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCopyEntry); CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); TMsvId paramEntryId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); TMsvId paramTargetId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2)); CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramEntryId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(paramEntryId); entry->SetEntryL(entry->Entry().Parent()); iOperation = entry->CopyL(paramEntryId,paramTargetId,iStatus); CleanupStack::PopAndDestroy(entry); CActiveScheduler::Add(this); SetActive(); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCopyEntry); }
void TestMessageDuringSendingL() { theUtils->Start(_L("Message During Sending Progress")); CleanMailFolder(KMsvDraftEntryId); CleanMailFolder(KMsvSentEntryId); // Create a message. RSendAsMessage message; CleanupClosePushL(message); theUtils->WriteComment(_L("Create a message.")); CreateSendMessageL(message); CTestActive* testActive = new(ELeave) CTestActive; CleanupStack::PushL(testActive); CTestProgressActive* testProgress = new(ELeave) CTestProgressActive(message); CleanupStack::PushL(testProgress); CSentEntryObserver* sentObserver = new(ELeave) CSentEntryObserver(testProgress->iStatus); CleanupStack::PushL(sentObserver); CDummyObserver* ob1 = new(ELeave) CDummyObserver; CleanupStack::PushL(ob1); CMsvSession* session = CMsvSession::OpenSyncL(*ob1); CleanupStack::PushL(session); CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvGlobalOutBoxIndexEntryId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); CleanupStack::PushL(cEntry); cEntry->AddObserverL(*sentObserver); theUtils->WriteComment(_L("Begin sending the created message.")); message.SendMessage(testActive->iStatus); theUtils->WriteComment(_L("Get progress on message.")); testActive->StartL(); testProgress->StartL(); CActiveScheduler::Start(); theUtils->WriteComment(_L("Check progress.")); test(testProgress->iProgress.iState == CMsvSendOperation::ESendStateWaitingToSend); test(testProgress->iProgress.iProgressMax == 0); test(testProgress->iProgress.iError == 0); CleanupStack::PopAndDestroy(7, &message); // cEntry, session, ob1, sendObserver, testProgress, testActive, message theUtils->Complete(); }
EXPORT_C TBool phonehelper::mailbox_defined() { CALLSTACKITEM_N(_CL("phonehelper"), _CL("mailbox_defined")); TBool mailbox_defined = EFalse; dummyhandler * dummy=new (ELeave) dummyhandler; CleanupStack::PushL(dummy); CMsvSession * session = CMsvSession::OpenSyncL(*dummy); CleanupStack::PushL(session); CMsvEntry* entry = CMsvEntry::NewL(*session, KMsvRootIndexEntryId ,TMsvSelectionOrdering()); CleanupStack::PushL(entry); CMsvEntrySelection* imap = entry->ChildrenWithMtmL(KSenduiMtmImap4Uid); CleanupStack::PushL(imap); CMsvEntrySelection* pop = entry->ChildrenWithMtmL(KSenduiMtmPop3Uid); CleanupStack::PushL(pop); if ((imap->Count() >0) || (pop->Count()>0)) mailbox_defined = ETrue; CleanupStack::PopAndDestroy(5); //dummy, session, entry return mailbox_defined; }
void CT_CMsvSession::TestTransferCommandL() { TInt error = KErrGeneral; INFO_PRINTF1(_L("Testing: Transfer Commands -- started")); TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); TEST(error == KErrNone); CMsvOperationWait* active = CMsvOperationWait::NewLC(); CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); TInt ret = iSession->InstallMtmGroup(KDataComponentFilename); TEST(ret==KErrNone|| ret==KErrAlreadyExists); cEntry->SetEntryL(KMsvRootIndexEntryId); TMsvEntry service; service.iType=KUidMsvServiceEntry; service.iMtm = KUidTestServerMtmType; cEntry->CreateL(service); selection->AppendL(service.Id()); TBuf8<256> progress; TBuf8<32> param; CMsvOperation* operation = NULL; active->Start(); operation = iSession->TransferCommandL(*selection, 1, param, active->iStatus); CActiveScheduler::Start(); TEST(operation->iStatus.Int()==KErrNone); cEntry->DeleteL(service.Id()); delete operation; CleanupStack::PopAndDestroy(selection); CleanupStack::PopAndDestroy(cEntry); CleanupStack::PopAndDestroy(active); delete iSession; INFO_PRINTF1(_L("Testing: Transfer Commands -- ended")); }
LOCAL_C void TestSetSendingStateAttributeL() { CDummyObserver* ob = new(ELeave)CDummyObserver; CleanupStack::PushL(ob); CMsvSession* session = CMsvSession::OpenSyncL(*ob); CleanupStack::PushL(session); CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); TMsvEntry entry1; entry1.iType = KUidMsvMessageEntry; entry1.iMtm = KUidMsvLocalServiceMtm; entry1.iServiceId = KMsvLocalServiceIndexEntryId; entry1.SetSendingState(12); cEntry->CreateL(entry1); selection->AppendL(entry1.Id()); TMsvEntry entry2; entry2.iType = KUidMsvMessageEntry; entry2.iMtm = KUidMsvLocalServiceMtm; entry2.iServiceId = KMsvLocalServiceIndexEntryId; entry2.SetSendingState(3); cEntry->CreateL(entry2); selection->AppendL(entry2.Id()); session->ChangeAttributesL(*selection, 6<<KMsvSendingStateShift, 0); cEntry->SetEntryL(entry1.Id()); test(cEntry->Entry().SendingState() == 6); cEntry->SetEntryL(entry2.Id()); test(cEntry->Entry().SendingState() == 6); CleanupStack::PopAndDestroy(4); // selection, cEntry, session, ob }
LOCAL_C void TestHiddenEntryStreamsL() { CDummyObserver ob; CMsvSession* session = CMsvSession::OpenSyncL(ob); CleanupStack::PushL(session); CMsvEntry* cEntry1 = CMsvEntry::NewL(*session, KMsvRootIndexEntryId, TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue)); CleanupStack::PushL(cEntry1); TMsvSelectionOrdering sort(KMsvNoGrouping, EMsvSortByNone, ETrue); cEntry1->SetSortTypeL(sort); // all services CMsvEntrySelection* selection = cEntry1->ChildrenL(); TInt count=selection->Count(); while (count--) TestEntryStream(*cEntry1, selection->At(count), selection->At(count), EFalse); delete selection; // local entries TestEntryStream(*cEntry1, KMsvLocalServiceIndexEntryId, KMsvLocalServiceIndexEntryId, ETrue); CleanupStack::PopAndDestroy(2); // cEntry1,session }
void CMsvIndexContext::DoCreateServiceDirsL() #endif { CMsvEntryFilter* filter = CMsvEntryFilter::NewLC(); filter->SetOrder(TMsvSelectionOrdering(0, EMsvSortByNone, ETrue)); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); TInt err = KErrNone; #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) err = iIndexAdapter->GetChildrenId(MaskTMsvId(aDriveId, KMsvRootIndexEntryId), *filter, *selection); #else err = iIndexAdapter->GetChildrenId(KMsvRootIndexEntryId, *filter, *selection); #endif // make sure the service directories are there if (err == KErrNone) { TInt count = selection->Count(); while (count--) { TFileName filename; filename.Copy(iMessageFolder); TMsvId id = selection->At(count); #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) MsvUtils::ConstructEntryName(UnmaskTMsvId(id), MaskTMsvId(aDriveId, id), filename, MsvUtils::EPath); #else MsvUtils::ConstructEntryName(id, id, filename, MsvUtils::EPath); #endif iServer.FileSession().MkDir(filename); // ignore any error } } CleanupStack::PopAndDestroy(2); // selection, filter }
LOCAL_C void CleanMailFolder(TMsvId aFolderId) { CDummyObserver* ob1 = new(ELeave) CDummyObserver; CleanupStack::PushL(ob1); CMsvSession* session = CMsvSession::OpenSyncL(*ob1); CleanupStack::PushL(session); CMsvEntry* cEntry = CMsvEntry::NewL(*session, aFolderId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); CleanupStack::PushL(cEntry); CMsvEntrySelection* selection = cEntry->ChildrenL(); CleanupStack::PushL(selection); TMsvLocalOperationProgress progress; if (selection->Count() > 0) { cEntry->DeleteL(*selection, progress); } CleanupStack::PopAndDestroy(4); // selection, cEntry, session, ob1 }