LOCAL_C void SendSmtpMessageL() { CTestActive* testActive = new (ELeave) CTestActive(); CleanupStack::PushL(testActive); testUtils->iMsvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); testUtils->InstantiateSmtpClientMtmL(); CMsvEntrySelection* sendSel = testUtils->iMsvEntry->ChildrenL(); CleanupStack::PushL(sendSel); TInt count = sendSel->Count(); test(count >= 1); testUtils->Printf(KMsgSend, count); testUtils->iSmtpClientMtm->SetCurrentEntryL(testUtils->iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId)); CMsvOperation* msvOperation = testUtils->iSmtpClientMtm->Entry().CopyL(*sendSel, smtpService, testActive->iStatus); CleanupStack::PushL(msvOperation); testActive->StartL(); CActiveScheduler::Start(); //check progress testUtils->Printf(KMsgCompleted, testActive->iStatus.Int()); CMsvEntrySelection* sendSelc = testUtils->iMsvEntry->ChildrenL(); TInt noOfMessages = sendSelc->Count(); // Check Whether the mails in Outbox is Zero (i.e. mails has been sent..). test(noOfMessages == 0); delete sendSelc; TImSmtpProgress temp; TPckgC<TImSmtpProgress> paramPack(temp); const TDesC8& progBuf = msvOperation->ProgressL(); paramPack.Set(progBuf); TImSmtpProgress progress = paramPack(); testUtils->Printf(KProgressError, progress.Error()); test(progress.Error()==0); CleanupStack::PopAndDestroy(3,testActive); //msvOperation,sendsel,testActive }
/** Reset subscription flags for all children, and recurse into folders @param aFolder Folder from which to start the flags resetting */ void CImapOpSyncSubs::ResetSubscriptionFlagsL(const TMsvId aFolder) { // Do this one SetEntryL(aFolder); TMsvEmailEntry entry = iServerEntry.Entry(); // A folder or service? If not, return if (entry.iType!=KUidMsvServiceEntry && entry.iType!=KUidMsvFolderEntry) { return; } // Reset flag if needed if (entry.Subscribed()) { // Reset flag and save entry.SetSubscribed(EFalse); ChangeEntryL(entry); } // Any children? CMsvEntrySelection *children = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(children); GetChildrenL(*children); if (children->Count()) { // Do each in turn for(TInt child = 0; child<children->Count(); ++child) { ResetSubscriptionFlagsL((*children)[child]); } } CleanupStack::PopAndDestroy(); }
// ---------------------------------------------------------------------------- // CIpsPlgNewChildPartFromFileOperation::PrepareMsvEntryL // ---------------------------------------------------------------------------- // void CIpsPlgNewChildPartFromFileOperation::PrepareMsvEntryL() { // Dig out the entry ID of the new attachment iMessage->GetAttachmentsListL( iEntry->Entry().Id( ), CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly ); TKeyArrayFix key( 0, ECmpTInt32 ); CMsvEntrySelection* attachmentIds = iMessage->Selection().CopyLC(); attachmentIds->Sort( key ); if ( !attachmentIds->Count() ) { User::Leave( KErrGeneral ); } iNewAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ]; CleanupStack::PopAndDestroy( attachmentIds ); CMsvEntry* cAtta = iMsvSession.GetEntryL( iNewAttachmentId ); CleanupStack::PushL( cAtta ); // Set filename to iDetails TMsvEntry tEntry = cAtta->Entry(); tEntry.iDetails.Set(iFilePath->Des()); // Do async iOperation = cAtta->ChangeL( tEntry, iStatus ); CleanupStack::PopAndDestroy( cAtta ); iStep = EPrepareStore; // Next step SetActive(); }
/* ----------------------------------------------------------------------------- ---------------------------------------------------------------------------- */ void CMailBoxContainer::AddEmailFoldersL(CMsvSession* aSession) { if(aSession) { CMsvEntry *localServiceEntry = aSession->GetEntryL(KMsvRootIndexEntryId);//KMsvLocalServiceIndexEntryId); CleanupStack::PushL(localServiceEntry); CMsvEntrySelection *folders = localServiceEntry->ChildrenL(); CleanupStack::PushL(folders); if(folders->Count() > 1) // first is local folder { for (TInt i = 1;i < folders->Count();i++) { TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]); CMailFldItem* NewIttem = new(ELeave)CMailFldItem(); CleanupStack::PushL(NewIttem); NewIttem->iTitle = ExtraFolder.iDetails.AllocL(); NewIttem->iMscId = ExtraFolder.Id(); CleanupStack::Pop();//NewIttem iFolderArray.Append(NewIttem); } } CleanupStack::PopAndDestroy(2); // localServiceEntry, folders } }
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 CMsvServerEntry::DoMoveEntriesL(CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection*& aMoved) { __ASSERT_DEBUG(!aMoved, PanicServer(EMsvMoveSelectionNotNull)); __ASSERT_DEBUG(aSelection.Count() > 0, PanicServer(EMsvMovingEmptySelection)); aMoved = new(ELeave)CMsvEntrySelection; aMoved->SetReserveL(aSelection.Count()); CMsvMove* move = CMsvMove::NewL(iServer); CleanupStack::PushL(move); TInt error = KErrNone; TInt count = aSelection.Count(); while(count--) { TMsvId id = aSelection.At(count); if (!IsAChild(id)) error = KErrNotFound; else { move->StartL(id, aDestination); aSelection.Delete(count); aMoved->AppendL(id); } } User::LeaveIfError(error); CleanupStack::PopAndDestroy(); // move }
LOCAL_C void TestInitialStructureL(CMsvServer& aServer) { TInt services=1; TInt localFolders=5; CMsvServerEntry* sEntry = CMsvServerEntry::NewL(aServer, KMsvRootIndexEntryId); CleanupStack::PushL(sEntry); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); TMsvSelectionOrdering sort(KMsvNoGrouping, EMsvSortByNone, ETrue); sEntry->SetSort(sort); // root REPORT_IF_ERROR(sEntry->SetEntry(KMsvRootIndexEntryId)); test(sEntry->Entry().iDetails==KNullDesC); test(sEntry->Entry().iDescription==KNullDesC); REPORT_IF_ERROR(sEntry->GetChildren(*selection)); test(selection->Count()==services); // local service REPORT_IF_ERROR(sEntry->SetEntry(KMsvLocalServiceIndexEntryId)); test(sEntry->Entry().iDetails==_L("Local")); REPORT_IF_ERROR(sEntry->GetChildren(*selection)); test(selection->Count()==localFolders); // standard folders REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalInBoxIndexEntryId)); test(sEntry->Entry().iDetails==_L("Inbox")); REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalOutBoxIndexEntryId)); test(sEntry->Entry().iDetails==_L("Outbox")); REPORT_IF_ERROR(sEntry->SetEntry(KMsvDraftEntryId)); test(sEntry->Entry().iDetails==_L("Drafts")); REPORT_IF_ERROR(sEntry->SetEntry(KMsvSentEntryId)); test(sEntry->Entry().iDetails==_L("Sent")); REPORT_IF_ERROR(sEntry->SetEntry(KMsvDeletedEntryFolderEntryId)); test(sEntry->Entry().iDetails==_L("Deleted")); // check that only the index file and the local services dir are present CDir* dir; const TUidType type(KMsvEntryFile, KMsvEntryFile, KNullUid); REPORT_IF_ERROR(theUtils->FileSession().GetDir(KTestFolder,type , ESortNone, dir)); TInt count=dir->Count(); test(count==0) ; delete dir; // check that the local services dir is empty TFileName filename; filename.Append(KTestLocalService); filename.Append(_L("\\")); REPORT_IF_ERROR(theUtils->FileSession().GetDir(filename,type , ESortNone, dir)); count=dir->Count(); test(count==0) ; delete dir; CleanupStack::PopAndDestroy(2); // sEntry,selection }
void CEntryObserver::HandleEntryEventL(TMsvEntryEvent aEvent, TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/) { if (aEvent == EMsvNewChildren && iCurrentMessageNum > -1) { CMsvEntrySelection* msgs = (CMsvEntrySelection*)aArg1; TInt count = msgs->Count(); TInt msgRecv = 0; while (count--) { TMsvId id = (*msgs)[count]; CSmsHeader* header = iSmsTest.GetHeaderLC(id); if (header->Type() == CSmsPDU::ESmsDeliver) { iReceived->AppendL(id); msgRecv++; } CleanupStack::PopAndDestroy(header); } if (msgRecv) iSmsTest.Printf(_L("%d Messages Received in inbox\n"), msgRecv); } }
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; }
/** confirm the message has been stored. Writes the number of stored messages found to the log file - if present. @param void @return TBool returns ETrue if messages found returns EFalse if no messages found */ TBool CWapPushSIMessageTest::ConfirmMessagesSavedL() { CSISLPushMsgUtils* wapPushUtils = CSISLPushMsgUtils::NewL(); CleanupStack::PushL(wapPushUtils); TMsvId localFolderId; wapPushUtils->GetPushMsgFolderIdL(localFolderId); const TDesC& siId16 = _L("http://www.xyz.com/ppaid/123/abc.wml"); CMsvEntrySelection* matchingIdList = wapPushUtils->FindSiIdLC(siId16); // check there are any entries - zero indicates no matches TInt foundCount; if (matchingIdList) foundCount = matchingIdList->Count(); else foundCount = 0; TBuf<KPushLogBuffer> buf; _LIT(KLogSICount,"SI messages stored:\t%d"); buf.Format(KLogSICount,foundCount); WPLPrintf(buf); CleanupStack::PopAndDestroy(2); // wapPushUtils, matchingIdList return foundCount; }
/** Schedules messages on the task scheduler. Messages that are successfully scheduled have their sending state set to KMsvSendStateScheduled. @param aSelection Array of message IDs that need to be scheduled. This array cannot be empty. All the messages identified in the selection must belong to the same MTM; be scheduled for the same time; have the same setting for their OffPeak() flag; have the scheduled time stored in the iDate member of their corresponding TMsvEntry. @param aPackage Scheduling options @leave Any error code but KErrLocked and KErrNotFound The method overloading CMsvScheduledEntry::GetMessageL() left with an error, i.e. the scheduling info of one of the messages from the selection could not be retrieved from the message server. @leave Any error code Unable to reset the previous scheduling info for a message. @panic ScheduleSend-DLL 0 The array of message IDs is empty. Debug build only. @panic ScheduleSend-DLL 1 At least one of the selected messages is scheduled for a different time as the others. Debug build only. @panic ScheduleSend-DLL 2 At least one of the selected messages does not belong to the same MTM. Debug build only. @panic ScheduleSend-DLL 3 At least one of the selected messages does not have the same off-peak settings as the others. Debug build only. */ EXPORT_C void CMsvScheduleSend::ScheduleL(const CMsvEntrySelection& aSelection, const TMsvSchedulePackage& aPackage) { __ASSERT_DEBUG(aSelection.Count() > 0, gPanic(EMessageSelectionEmpty)); iPackage = aPackage; GetMessagesL(aSelection); //Leaves with KErrNotFound if there //are no messages returned in schEntries TInt entryCount = iSchEntries->Count(); SCHSENDLOG(FLog(_L8("Asked to schedule %d msgs"), entryCount)); if (entryCount) { TTime startTime; #if defined(_DEBUG) CMsvScheduledEntry* firstEntry = (*iSchEntries)[0]; #endif while (entryCount--) { CMsvScheduledEntry* message = iSchEntries->At(entryCount); __ASSERT_DEBUG(firstEntry->ScheduleDate() == message->ScheduleDate(), gPanic(EMessagesNotSameTime)); startTime = message->ScheduleDate(); // Reset previous scheduling info DeleteScheduleForEntryL(*message); ResetScheduleInfoForEntryL(*message, EFalse); } //Schedule the messages DoScheduleL(*iSchEntries, KMsvSendStateScheduled, startTime, EFalse); } }
TMsvId CTestImapSyncManager::FindFolderL(const TDesC& aName, TBool aCaseSensitive) { TMsvId remoteId = KErrNotFound; iEntry->SetEntry(iServiceId); CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection; iEntry->GetChildren(*msvEntrySelection); TPtrC iEntryName = aName; TInt count = msvEntrySelection->Count(); for (TInt i=0; i<count; i++) { iEntry->SetEntry((*msvEntrySelection)[i]); if (aCaseSensitive) { if (iEntryName.Compare(iEntry->Entry().iDetails ) == 0) { remoteId = (*msvEntrySelection)[i]; break; } } else if ((iEntryName.CompareF(iEntry->Entry().iDetails) == 0)) { remoteId = (*msvEntrySelection)[i]; break; } } delete msvEntrySelection; return remoteId; }
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 }
/* ----------------------------------------------------------------------------- ---------------------------------------------------------------------------- */ void CMailBoxContainer::GetFoldersL(void) { iFolderArray.ResetAndDestroy(); if(iSession) { CMsvEntry *localServiceEntry = iSession->GetEntryL(KMsvLocalServiceIndexEntryId); CleanupStack::PushL(localServiceEntry); CMsvEntrySelection *folders = localServiceEntry->ChildrenWithTypeL(KUidMsvFolderEntry); CleanupStack::PushL(folders); for (TInt i = 0;i < folders->Count();i++) { TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]); CMailFldItem* NewIttem = new(ELeave)CMailFldItem(); CleanupStack::PushL(NewIttem); NewIttem->iTitle = ExtraFolder.iDetails.AllocL(); NewIttem->iMscId = ExtraFolder.Id(); CleanupStack::Pop();//NewIttem iFolderArray.Append(NewIttem); } CleanupStack::PopAndDestroy(2); // localServiceEntry, folders AddEmailFoldersL(iSession); } }
TInt CPartialDownloadStep::GetEntryCountL() { TImapAccount imapAccount=iImapClient->GetImapAccount(); TMsvSelectionOrdering ordering; //open the imap service entry CMsvEntry* imapService = CMsvEntry::NewL(*iSession,imapAccount.iImapService,ordering); CleanupStack::PushL(imapService); //get its children CMsvEntrySelection* msvEntrySelection; msvEntrySelection=imapService->ChildrenL(); //open its child inbox entry CMsvEntry* inboxEntry = CMsvEntry::NewL(*iSession, (*msvEntrySelection)[0],ordering); CleanupStack::PushL(inboxEntry); //get the childeren of the inbox delete msvEntrySelection; msvEntrySelection=NULL; msvEntrySelection=inboxEntry->ChildrenL(); //the count should be 2 TInt count=msvEntrySelection->Count(); delete msvEntrySelection; msvEntrySelection=NULL; CleanupStack::PopAndDestroy(2,imapService); return count; }
void CMsvServerEntry::DoCopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus) // // // { __ASSERT_DEBUG(iEntry.Id()!=KMsvNullIndexEntryId, PanicServer(EMsvEntryWithNoContext10)); __ASSERT_ALWAYS(aDestination!=iEntry.Id(), PanicServer(EMsvCopyingToSameParent)); __ASSERT_ALWAYS(iEntryState == EMsvIdle, PanicServer(EMsvServerEntryNotIdle)); __ASSERT_ALWAYS(aSelection.Count() > 0, PanicServer(EMsvEmptySelection)); __ASSERT_DEBUG(iCopyMove==NULL, PanicServer(EMsvCopyNotCompleted)); // only copy children if (!AreChildren(aSelection)) User::Leave(KErrNotFound); CMsvCopyEntries* copy = CMsvCopyEntries::NewL(iServer); CleanupStack::PushL(copy); copy->StartL(aSelection, aDestination, iStatus); CleanupStack::Pop(); // copy iCopyMove=copy; iEntryState = EMsvCopying; iObserverStatus = &aObserverStatus; *iObserverStatus = KRequestPending; SetActive(); }
// ----------------------------------------------------------------------------- // CMmsAdapterMsvApi::FindUserFolderL // ----------------------------------------------------------------------------- // TBool CMmsAdapterMsvApi::FindUserFolderL( const TDesC& aName, TMsvId& aFolder ) { CMsvEntry* entry = iSession.GetEntryL( KMsvMyFoldersEntryIdValue ); CleanupStack::PushL( entry ); CMsvEntrySelection* selection = entry->ChildrenL(); CleanupStack::PushL( selection ); TBool found( EFalse ); TMsvId serviceId; TMsvEntry entryT; for ( TInt i = 0; i < selection->Count(); i++ ) { User::LeaveIfError( iSession.GetEntry( selection->At( i ), serviceId, entryT ) ); if ( !entryT.Deleted() && entryT.iType == KUidMsvFolderEntry && aName.Compare(entryT.iDescription) == 0 ) { found = ETrue; aFolder = entryT.Id(); break; } } CleanupStack::PopAndDestroy( selection ); CleanupStack::PopAndDestroy( entry ); return found; }
// ----------------------------------------------------------------------------- // CMmsAdapterMsvApi::FindUserFolderL // ----------------------------------------------------------------------------- // TBool CMmsAdapterMsvApi::FindUserFolderL( TMsvId aFolder, TPtrC& aName, TTime& aDate ) { TBool found( EFalse ); CMsvEntry* entry = iSession.GetEntryL( KMsvMyFoldersEntryIdValue ); CleanupStack::PushL( entry ); CMsvEntrySelection* selection = entry->ChildrenL(); CleanupStack::PushL( selection ); TMsvId serviceId; TMsvEntry entryT; for ( TInt i = 0; i < selection->Count(); i++ ) { User::LeaveIfError( iSession.GetEntry( selection->At( i ), serviceId, entryT ) ); if ( !entryT.Deleted() && entryT.iType == KUidMsvFolderEntry && entryT.Id() == aFolder ) { found = ETrue; aDate = entryT.iDate; aName.Set( entryT.iDetails ); break; } } CleanupStack::PopAndDestroy( selection ); CleanupStack::PopAndDestroy( entry ); return found; }
void CBulkCommitServerMtm::ConstructL() { // Get the entry id for the bulkcommit service entry. User::LeaveIfError(iServerEntry->SetEntry(KMsvRootIndexEntryId)); CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); User::LeaveIfError(iServerEntry->GetChildrenWithMtm(KUidBulkCommitTestMtm, *sel)); TInt count = sel->Count(); if( count > 1 ) // should only be one service entry { User::Leave(KErrCorrupt); } if( count == 0 ) { // Create the settings TMsvEntry serviceEntry; serviceEntry.iType= KUidMsvServiceEntry; serviceEntry.iMtm = KUidBulkCommitTestMtm; User::LeaveIfError(iServerEntry->CreateEntry(serviceEntry)); iServiceId = serviceEntry.Id(); } else { iServiceId = sel->At(0); } CleanupStack::PopAndDestroy(sel); }
EXPORT_C void CMsvTestUtils::DeleteServiceL(TUid aMtm) { CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); TMsvId firstId = 0; TRAPD(err, ServiceIdL(aMtm, firstId, sel)); if (!err) { TInt count = sel->Count(); while (count--) { TMsvId del = sel->At(count); TRAP(err, SetEntryL(del)); if (!err) { TRAP(err, SetEntryL(Entry().Parent())); if (!err) { TRAP(err, DeleteEntryL(del)); } } if (err) { Printf(_L("Error deleting service entry\n")); } } } CleanupStack::PopAndDestroy(); //sel }
void CMsgImOutboxSend::DisconnectUnsentMessagesL() { // Pos errors TInt err = KErrNone; // Temp entry selection... CMsvEntrySelection* unsentSelection = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(unsentSelection); // Append unsent messages into the temp array.. for(TInt i=0; i<iEntrySelection.Count(); i++) { err = iServerEntry.SetEntry((iEntrySelection)[i]); // If not found carry on along the array... if(err != KErrNone) continue; if(iServerEntry.Entry().Parent() == KMsvGlobalOutBoxIndexEntryIdValue) { unsentSelection->AppendL((iEntrySelection)[i]); } } // Reset the iConnected flag on the lot. User::LeaveIfError(iServerEntry.SetEntry(KMsvGlobalOutBoxIndexEntryIdValue)); if(unsentSelection->Count() > 0) { User::LeaveIfError(iServerEntry.ChangeAttributes(*unsentSelection, 0, KMsvConnectedAttribute)); } iServerEntry.SetEntry(KMsvNullIndexEntryId); CleanupStack::PopAndDestroy(); // unsentSelection.. }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- void CIpsPlgImap4PopulateOp::ConstructL( const CMsvEntrySelection& aSel, TBool aDoFilterSelection ) { FUNC_LOG; BaseConstructL( KUidMsgTypeIMAP4 ); // <qmail> instantiation moved here iSelection = new ( ELeave ) CMsvEntrySelection(); iTempSelection = new ( ELeave ) CMsvEntrySelection(); if ( aDoFilterSelection ) { FilterSelectionL( aSel ); } else // no filtering; populate all { // first entry in selection is serviceId for ( TInt i = 1; i < aSel.Count(); i++ ) { if ( aSel[i] != iService ) { iSelection->AppendL( aSel.At(i) ); } } } DoConnectL(); }
void CPigeonServerMtm::ConstructL() { iScheduleSend = CPigeonScheduledSend::NewL(*iServerEntry); // Get the entry id for the pigeon service entry. User::LeaveIfError(iServerEntry->SetEntry(KMsvRootIndexEntryId)); CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); User::LeaveIfError(iServerEntry->GetChildrenWithMtm(KUidMsgTypePigeon, *sel)); TInt count = sel->Count(); if( count > 1 ) // should only be one service entry User::Leave(KErrCorrupt); if( count == 0 ) { // Create the settings TMsvEntry serviceEntry; serviceEntry.iType= KUidMsvServiceEntry; serviceEntry.iMtm = KUidMsgTypePigeon; User::LeaveIfError(iServerEntry->CreateEntry(serviceEntry)); iServiceId = serviceEntry.Id(); } else { iServiceId = sel->At(0); } CleanupStack::PopAndDestroy(sel); User::LeaveIfError(iServerEntry->SetEntry(KMsvNullIndexEntryId)); iHeapFailure = EFalse; }
void CImImap4Compound::GenericCopyL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel, const TMsvId aDestination, TInt* aSequence) { DBG((iSession->LogText(_L8("CImImap4Compound::GenericCopyL()")))); Queue(aStatus); // Save parameters iSource=aSourceSel[0]; delete iSourceSel; iSourceSel = NULL; iSourceSel=aSourceSel.CopyL(); iDestinationFolder=aDestination; iMessageSelection=iSelectionStillToCopy=iSelectionStillToDelete=aSourceSel.Count(); // Check that selection elements are contiguous. Just call Copy on contiguous selections. iSourceFolder=FindFolderL((*iSourceSel)[iSelectionStillToCopy-1]); // Find the offending source folder if (iSourceFolder == NULL && aSequence != SeqMoveFromLocal && aSequence != SeqCopyFromLocal) { Complete(KErrNotFound); return; } // Select it iStep=0; iSequence=aSequence; DoRunL(); }
// Delete void CImImap4Compound::DeleteL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel) { LOG_COMMANDS( (iSession->LogText(_L8("COMPOUND Delete selection")))); Queue(aStatus); // Save parameters iSource=aSourceSel[0]; delete iSourceSel; iSourceSel = NULL; iSourceSel=aSourceSel.CopyL(); iMessageSelection=iSelectionStillToDelete=aSourceSel.Count(); // Find the offending source folder if ((iSourceFolder=FindFolderL(iSource))==NULL) { Complete(KErrNotFound); return; } // Select it iStep=0; iSequence=SeqDelete; DoRunL(); }
void CMsvScheduleSend::GetMessagesL(const CMsvEntrySelection& aSelection) { iSchEntries->ResetAndDestroy(); const TInt entryCount = aSelection.Count(); iSchEntries->SetReserveL(entryCount); //so following AppendL()s won't leave CMsvScheduledEntry* schEntry = NULL; for (TInt curMsg = 0; curMsg < entryCount; ++curMsg) //not while because must transverse forward { //Retrieve each message from the message server TMsvId msvId = aSelection.At(curMsg); TRAPD(error, schEntry = GetMessageL(msvId)); if (error == KErrNone) { CleanupStack::PushL(schEntry); iSchEntries->AppendL(schEntry); CleanupStack::Pop(schEntry); } else if (error != KErrLocked && error != KErrNotFound) { User::Leave(error); } } }
/** GetMessagePartIndexL() Retrieves the part index id for the email identified by aEntry @param aEntry A valid email identifier @param aUid An identifier tfor the type of message part to be retrieved @return TMsvId - message part identifier */ TMsvId CT_MsgComparePopEmailMsgs::GetMessagePartIndexL(TMsvEntry& aEntry, TUid aUid) { static TBool msgPartFound = EFalse; TMsvId msgPartId = 0; CMsvEntry* baseEntry = iSharedDataPOP.iSession->GetEntryL(aEntry.Id()); CleanupStack::PushL(baseEntry); CMsvEntrySelection* selection = baseEntry->ChildrenL(); CleanupStack::PushL(selection); TInt count = selection->Count(); TInt ind1; CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId); CleanupStack::PushL(entry); for (ind1=0, msgPartFound=EFalse; ind1 < count; ind1++) { if(msgPartFound) { break; } TMsvId childId = selection->At(ind1); entry->SetEntryL(childId); if (entry->Entry().iType == aUid) { msgPartId = childId; break; } else if (entry->Entry().iType == KUidMsvFolderEntry) { TMsvEntry ent = entry->Entry(); msgPartId = GetMessagePartIndexL(ent, aUid); } } CleanupStack::PopAndDestroy(3, baseEntry); // entry,selection,baseEntry return msgPartId; }
EXPORT_C TInt CMsvServerEntry::DeleteEntries(CMsvEntrySelection& aSelection) // // Deletes the children of the current context in the selection recursively // Returns the children that could not be fully deleted in the selection // /** Deletes a selection of child entries. The delete works recursively through all the descendants. If a child or any descendant is locked by another client, then no entries are deleted. @param aSelection The entries to delete. On return, contains the children that could not be fully deleted @return KErrNone if successful, KErrAccessDenied if the entry or a descendant was locked by another client, KErrInUse if the store or a file associated with the entry is open, or KErrNotFound if the entry is not a child of the context. */ { __ASSERT_DEBUG(iEntry.Id()!=KMsvNullIndexEntryId, PanicServer(EMsvEntryWithNoContext4)); CMsvEntrySelection* deleted = NULL; CMsvEntrySelection* moved = NULL; TRAPD(error, DoDeleteEntriesL(aSelection, deleted, moved)); if (moved && deleted) { // Notify server of the deletions & moves if (deleted->Count()) iServer.NotifyChanged(EMsvEntriesDeleted, *deleted, iEntry.Id()); if (moved->Count()) iServer.NotifyChanged(EMsvEntriesMoved, *moved, KMsvDeletedEntryFolderEntryId, iEntry.Id()); // need to remove owner flag if has no children TMsvEntry* pEntry; TInt err = KErrNone; err = iServer.IndexAdapter().GetEntry(iEntry.Id(), pEntry); if (err ==KErrNone) iEntry.SetOwner(pEntry->Owner()); } delete moved; delete deleted; return error; }
void CMtfTestActionGetArrayCount::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetArrayCount); CMsvEntrySelection* paramSelection = ObtainParameterReferenceL<CMsvEntrySelection>(TestCase(),ActionParameters().Parameter(0)); TInt totalChildren = paramSelection->Count(); StoreParameterL<TInt>(TestCase(),totalChildren,ActionParameters().Parameter(1)); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetArrayCount); TestCase().ActionCompletedL(*this); }
void CPigeonServerMtm::UpdateProgressL(const CMsvEntrySelection& aSelection) { RFileLogger::WriteFormat(KSchSendLogDir, KPigeonLogFile, EFileLoggingModeAppend, _L("CPigeonServerMtm::UpdateProgressL(aSelection.Count() == %d)"), aSelection.Count()); //Uses Progess to return the time that the task scheduler //reports that the first message in the selection is scheduled for if (aSelection.Count()==0) return; //Make a big load of reference parameters TInt size = 0; RScheduler scheduler; User::LeaveIfError(scheduler.Connect()); CleanupClosePushL(scheduler); CMsvScheduledEntry* entry = ScheduledEntryLC(aSelection[0]); const TInt taskId = entry->iData.iTaskId; const TInt error = scheduler.GetTaskDataSize(taskId, size); if(error == KErrNone) { TTaskInfo info; HBufC* buf = HBufC::NewLC(size); TPtr ptr(buf->Des()); TSchedulerItemRef ref; TTime time; User::LeaveIfError(scheduler.GetTaskInfoL(taskId, info, ptr, ref, time)); iProgress().iTime = time; CleanupStack::PopAndDestroy(buf); } else if (error == KErrNotFound) { iProgress().iTime = entry->ScheduleDate(); } else User::Leave(error); CleanupStack::PopAndDestroy(2); //entry, scheduler }