Example #1
0
TBool CSmsFile::DeleteSentEntry(TMsvId entry)
{
    TInt err;
    // Load this entry to our mtm
    TRAP(err, iReceiveMtm->SwitchCurrentEntryL(entry));
    // probably wasn't compatible, ignore
    if (err!=KErrNone) return EFalse;
    TRAP(err, iReceiveMtm->LoadMessageL());
    // probably wasn't compatible, ignore
    if (err!=KErrNone) return EFalse;

    TMsvEntry msvEntry( (iReceiveMtm->Entry()).Entry() );

    if (msvEntry.iMtmData3 == KUidRippleVaultApp.iUid)    // this entry has been created by our app
    {
        // Taking a handle to the Sent folder...
        TMsvSelectionOrdering sort;
        sort.SetShowInvisibleEntries(ETrue);    // we want to handle also the invisible entries
        // Take a handle to the parent entry
        CMsvEntry* parentEntry = CMsvEntry::NewL(iReceiveMtm->Session(), msvEntry.Parent(), sort);
        CleanupStack::PushL(parentEntry);

        // here parentEntry is the Sent folder (must be so that we can call DeleteL)
        parentEntry->DeleteL(msvEntry.Id());

        CleanupStack::Pop();

        //if(iBillSms == 1)
        //iAppUi.CheckBillingStatus(5);

        return ETrue; // entry was deleted
    }

    return EFalse; // no entries deleted
}
Example #2
0
void CMsvSendExe::RestoreScheduleSettingsL(TMsvId aServiceId, const TUid& aMtm, CMsvScheduleSettings& aSettings)
	{
	TMsvSelectionOrdering order;
	order.SetShowInvisibleEntries(ETrue);
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvRootIndexEntryId, order);
	CleanupStack::PushL(cEntry);

	if (aServiceId == KMsvLocalServiceIndexEntryId)
		{
		const TInt count = cEntry->Count();

		for (TInt i = 0; i < count; i++)
			{
			const TMsvEntry& entry = (*cEntry)[i];
			if (entry.iType == KUidMsvServiceEntry && entry.iMtm == aMtm)
				{
				aServiceId = entry.Id();
				break;
				}
			}
		}

	if (aServiceId == KMsvLocalServiceIndexEntryId)
		User::Leave(KErrNotFound);
	
	CRepository* repository = CRepository::NewLC(aMtm);
	TMsvScheduleSettingsUtils::LoadScheduleSettingsL(aSettings, *repository);
	CleanupStack::PopAndDestroy(2, cEntry); // repository, cEntry
	}
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;
	}
Example #4
0
/*
-----------------------------------------------------------------------------
RFile GetAttachmentFileL(TMsvAttachmentId aId)
----------------------------------------------------------------------------
*/
void CMailBoxContainer::OpenFileL(TBool /*aOpenWith*/)
{
	if(iSession && iSelectionBox)
	{	
		TInt CurrItmIndex = iSelectionBox->CurrentItemIndex();
		
		TMsvSelectionOrdering sort;
		sort.SetShowInvisibleEntries(ETrue);
		sort.SetSorting(EMsvSortByDate);
		// Take a handle to the folder entry
		CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,iCurrentMailBox,sort);
		CleanupStack::PushL(parentEntry);
		
		// A selection of all BT entries
		CMsvEntrySelection* entries = parentEntry->ChildrenL();//ChildrenWithMtmL(KUidMsgTypeBt);
		CleanupStack::PushL(entries);
			
		//Process all entries
		if(CurrItmIndex >= 0 && CurrItmIndex < iIDArray->Count())
		{
			//Get entry
			CMsvEntry* btEntry = iSession->GetEntryL(iIDArray->At(CurrItmIndex).iEnt);
			CleanupStack::PushL(btEntry);
			
			//Then get entrys child
			CMsvEntrySelection* btChildren = btEntry->ChildrenL();
			CleanupStack::PushL(btChildren);
		
			btEntry->SetEntryL(iIDArray->At(CurrItmIndex).iMsg);
									
			if (btEntry->HasStoreL())
			{
				CMsvStore* store = btEntry->ReadStoreL();
				CleanupStack::PushL(store);
				
				MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
				CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(iIDArray->At(CurrItmIndex).iAtt);
				if(attachment)
				{
					RFile SourceFil(attMngr.GetAttachmentFileL(iIDArray->At(CurrItmIndex).iAtt));
					iUtils.GetFileUtils().OpenFileWithHandler(SourceFil);
					SourceFil.Close();
				}
				
				CleanupStack::PopAndDestroy(store);
			}
			
			CleanupStack::PopAndDestroy(2);
		}				
		CleanupStack::PopAndDestroy(2);
	}
}
EXPORT_C void CMsvTestUtils::ServiceIdL(TUid aMtm, TMsvId& rFirstId, CMsvEntrySelection* rServiceIds)
	{
//Returns the Service IDs of MTM aMtm

	rFirstId = KMsvNullIndexEntryId;

	SetEntryL(KMsvRootIndexEntryId);

//	TMsvSelectionOrdering oldOrder = aEntry.SortType();
	TMsvSelectionOrdering order;
	order.SetShowInvisibleEntries(ETrue);
	SetSortTypeL(order);

	//Get the children on the Root Index Entry
	CMsvEntrySelection* selection = ChildrenWithTypeLC(KUidMsvServiceEntry);

	TInt count = selection->Count();

	//Find an entry for MTM aMtm
	for (TInt curChild = 0; curChild < count && (rFirstId == KMsvNullIndexEntryId || rServiceIds); curChild++)
		{
		SetEntryL(selection->At(curChild));

		if (Entry().iMtm == aMtm)
			{
			TMsvId id = Entry().Id();

			if (rFirstId == KMsvNullIndexEntryId)
				rFirstId = id;

			if (rServiceIds)
				rServiceIds->AppendL(id);
			}
		}

	//Leave if no Service Entry found for MTM aMtm
	if (rFirstId == KMsvNullIndexEntryId)
		{
		CleanupStack::PopAndDestroy(); //selection
		User::Leave(KErrNotFound);
		}

	CleanupStack::PopAndDestroy(); //selection
	}
Example #6
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TBool CSMSSender::MoveMessageEntryL(TMsvId aTarget)
    {
    ASSERT(iMtm);

    TMsvEntry msvEntry((iMtm->Entry()).Entry());

    if (msvEntry.Parent() != aTarget)
        {
        TMsvSelectionOrdering sort;
        sort.SetShowInvisibleEntries(ETrue);    // we want to also handle the invisible entries
        // Take a handle to the parent entry
        CMsvEntry* parentEntry = CMsvEntry::NewL(iMtm->Session(), msvEntry.Parent(), sort);
        CleanupStack::PushL(parentEntry);

        // Move original from the parent to the new location
        iOperation = parentEntry->MoveL(msvEntry.Id(), aTarget, iStatus);

        CleanupStack::PopAndDestroy(parentEntry);
        SetActive();

        return ETrue;
        }
    return EFalse;
    }
Example #7
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::ReadMailFolderL(TMsvId aSelected)
{
	iCurrentMailBox = aSelected;

	delete iIDArray;
	iIDArray = NULL;
	
	if(iSession && iSelectionBox)
	{
		TInt OrgCount = iSelectionBox->Model()->ItemTextArray()->MdcaCount();
		STATIC_CAST(CDesCArray*,iSelectionBox->Model()->ItemTextArray())->Reset();
		
		RPointerArray<CFFileTypeItem> ItemTypeArray  = iUtils.GetFileUtils().GetItemTypeArray();

		iIDArray = new(ELeave)CArrayFixFlat<TMyMailEntry>(10);
	
		TMsvSelectionOrdering sort;
		sort.SetShowInvisibleEntries(ETrue);
		sort.SetSorting(EMsvSortByDate);
		// Take a handle to the folder entry
		CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,aSelected,sort);
		CleanupStack::PushL(parentEntry);
		
		// A selection of all BT entries
		CMsvEntrySelection* entries = parentEntry->ChildrenL();//ChildrenWithMtmL(KUidMsgTypeBt);
		CleanupStack::PushL(entries);
			
	
		//Process all entries
		for(TInt ii = 0; ii < entries->Count(); ii++)
		{
			//Get entry
			CMsvEntry* btEntry = iSession->GetEntryL((*entries)[ii]);
			CleanupStack::PushL(btEntry);
			
			//Then get entrys child
			CMsvEntrySelection* btChildren = btEntry->ChildrenL();
			CleanupStack::PushL(btChildren);
			
			TInt childc = btChildren->Count();
			if (childc>0)
			{
				for(TInt i=0; i<childc; i++)
				{
					TMsvId btAtt = (*btChildren)[i];
					btEntry->SetEntryL(btAtt);
				
					if(btEntry->Entry().iMtm == KUidMsgTypePOP3)
					{
						CImEmailMessage* emailMessage = CImEmailMessage::NewL(*btEntry);
						CleanupStack::PushL(emailMessage);
						
						MMsvAttachmentManager& attMngr = emailMessage->AttachmentManager(); 
						GetAttachmentsL(attMngr,*btEntry,(*entries)[ii],btAtt);
						
						CleanupStack::PopAndDestroy(emailMessage);
					}
					else if (btEntry->HasStoreL())
					{
						CMsvStore* store = btEntry->ReadStoreL();
						CleanupStack::PushL(store);
						
						MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
						GetAttachmentsL(attMngr,*btEntry,(*entries)[ii],btAtt);
						
						CleanupStack::PopAndDestroy(store);
					}

				}
				
			}
			
			CleanupStack::PopAndDestroy(2);
		}	
					
		CleanupStack::PopAndDestroy(2);

		CDesCArray* itemArray = STATIC_CAST( CDesCArray* ,iSelectionBox->Model()->ItemTextArray());		
		if(itemArray->Count() > OrgCount)
		{
			iSelectionBox->HandleItemAdditionL();
			iSelectionBox->SetCurrentItemIndex(0); 
		}
		else
		{
			iSelectionBox->HandleItemRemovalL();
			
			if(itemArray->Count())
			{
				iSelectionBox->SetCurrentItemIndex(0); 
			}
		}
		
		UpdateScrollBar(iSelectionBox);
		DrawNow();
	}
Example #8
0
/*
-----------------------------------------------------------------------------
RFile GetAttachmentFileL(TMsvAttachmentId aId)
----------------------------------------------------------------------------
*/
void CMailBoxContainer::CopyFileL(const TDesC& aFolderName)
{

	TFileName fileName,FullFilName;

	if(iSession && iSelectionBox && iListArray)
	{	
		TInt CurrItmIndex = iSelCopyItemIndex;
		iSelCopyItemIndex = -1;
		
		if(CurrItmIndex < 0 || CurrItmIndex >= iIDArray->Count())
		{
			CurrItmIndex = iSelectionBox->CurrentItemIndex();
		}
		
		TMsvSelectionOrdering sort;
		sort.SetShowInvisibleEntries(ETrue);
		sort.SetSorting(EMsvSortByDate);
		// Take a handle to the folder entry
		CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,iCurrentMailBox,sort);
		CleanupStack::PushL(parentEntry);
		
		// A selection of all BT entries
		CMsvEntrySelection* entries = parentEntry->ChildrenL();//ChildrenWithMtmL(KUidMsgTypeBt);
		CleanupStack::PushL(entries);
			
		//Process all entries
		if(CurrItmIndex >= 0 && CurrItmIndex < iIDArray->Count())
		{
			//Get entry
			CMsvEntry* btEntry = iSession->GetEntryL(iIDArray->At(CurrItmIndex).iEnt);
			CleanupStack::PushL(btEntry);
			
			//Then get entrys child
			CMsvEntrySelection* btChildren = btEntry->ChildrenL();
			CleanupStack::PushL(btChildren);
		
			btEntry->SetEntryL(iIDArray->At(CurrItmIndex).iMsg);
									
	
			if (btEntry->HasStoreL())
			{
				CMsvStore* store = btEntry->ReadStoreL();
				CleanupStack::PushL(store);
				
				MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
				CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(iIDArray->At(CurrItmIndex).iAtt);
				if(attachment)
				{
					fileName.Copy(attachment->AttachmentName());
					
					delete attachment;
					attachment = NULL;
				
					TBool OkToSave(EFalse),SkipMe(EFalse);
				
					do
					{
						FullFilName.Zero();
						StringLoader::Load(FullFilName,R_SH_STR_FILENAME);
					
						CAknTextQueryDialog* Dialog = CAknTextQueryDialog::NewL(fileName,CAknQueryDialog::ENoTone);
						Dialog->PrepareLC(R_ASK_NAME_DIALOG);
						Dialog->SetPromptL(FullFilName);
						if(Dialog->RunLD())
						{
							FullFilName.Copy(aFolderName);
							FullFilName.Append(fileName);
			
							if(BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),FullFilName))
							{
								HBufC* TmpText = StringLoader::LoadLC(R_SH_STR_FILOVERRT);
								
								CAknQueryDialog* dlg = CAknQueryDialog::NewL();
								if(dlg->ExecuteLD(R_QUERY,*TmpText))
								{
									TInt Err = CEikonEnv::Static()->FsSession().Delete(FullFilName);
									if(Err == KErrNone)
									{
										OkToSave = ETrue;
									}
									else
									{
										iUtils.GetFileUtils().ShowFileErrorNoteL(FullFilName,Err);
									}
								}
								
								CleanupStack::PopAndDestroy(TmpText);
							}
							else
							{
								OkToSave = ETrue;
							}
						}
						else
						{
							SkipMe = ETrue;
						}
						
					}while(!SkipMe && !OkToSave);
					
					if(OkToSave)
					{
						
						delete iRFileCopier;
						iRFileCopier = NULL;
						
						iRFileCopier = CRFileCopier::NewL(*this,CEikonEnv::Static()->FsSession(),ETrue);
						
						RFile SourceFil(attMngr.GetAttachmentFileL(iIDArray->At(CurrItmIndex).iAtt));
						iRFileCopier->StartCopyL(SourceFil,FullFilName);
						SourceFil.Close();
					}
				}
				
				CleanupStack::PopAndDestroy(store);
			}
			
			CleanupStack::PopAndDestroy(2);
		}				
		CleanupStack::PopAndDestroy(2);
	}

}
void CMtfTestActionUtilsSmsScripts::ReadSmsSettingsFromConfigurationFileL(CMtfTestCase& aTestCase, const TDesC& aSettingsFile, CSmsSettings& aSmsSettings)
	{
	CMtfTestActionUtilsConfigFileParser* scriptFileParser = CMtfTestActionUtilsConfigFileParser::NewL(aSettingsFile);
	CleanupStack::PushL(scriptFileParser);

	TPtrC stringPtr;
	TInt intValue;

	// Service Centre
	if(scriptFileParser->GetFieldAsString(KScriptItemSC, stringPtr) == KErrNone)
		{
		// get the addresses from the config file
		TLex detailsToParse(stringPtr);
		TPtrC scName;
		TPtrC scNumber;
		
		detailsToParse.SkipSpaceAndMark();
		while(!detailsToParse.Eos())
			{
			scName.Set(_L("Unknown")); // default SC name
			
			while(detailsToParse.Peek() != ';' && !detailsToParse.Eos()) // SCs' details separated by semi-colon
				{
				if(detailsToParse.Peek() == ',')  // name and number separated by comma
					{ // has a name specified
					scName.Set(detailsToParse.MarkedToken());
					detailsToParse.Inc();
					detailsToParse.SkipSpaceAndMark();
					}
				else
					detailsToParse.Inc();
				}
			
			scNumber.Set(detailsToParse.MarkedToken());
			
			// add the address to the SCs list
		
			aSmsSettings.AddServiceCenterL(scName, scNumber);
		
		
			detailsToParse.Inc();
			detailsToParse.SkipSpaceAndMark();
			}
		}
	
	// Default Service Centre
	if(scriptFileParser->GetFieldAsInteger(KScriptItemDefaultSC, intValue) == KErrNone)
		{
	
		aSmsSettings.SetDefaultServiceCenter(intValue);
	
		}
		
	// Bearer
	if(scriptFileParser->GetFieldAsString(KScriptItemBearer, stringPtr) == KErrNone)
		{
		CSmsSettings::TMobileSmsBearer smsBearer = ObtainValueParameterL<CSmsSettings::TMobileSmsBearer>(aTestCase, stringPtr);
		aSmsSettings.SetSmsBearer(smsBearer);
		}

	// Encoding
	if(scriptFileParser->GetFieldAsString(KScriptItemEncoding, stringPtr) == KErrNone)
		{
		TSmsDataCodingScheme::TSmsAlphabet characterSet = ObtainValueParameterL<TSmsDataCodingScheme::TSmsAlphabet>(aTestCase, stringPtr);
		aSmsSettings.SetCharacterSet(characterSet);
		}
		
	// Delivery Report
	if(scriptFileParser->GetFieldAsString(KScriptItemDeliveryReport, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetDeliveryReport(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetDeliveryReport(ETrue);
			}
		}
		
	// Reply quoted
	if(scriptFileParser->GetFieldAsString(KScriptItemReplyQuoted, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetReplyQuoted(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetReplyQuoted(ETrue);
			}
		}
	
	// Description length
	if(scriptFileParser->GetFieldAsInteger(KScriptItemDescriptionLength, intValue) == KErrNone)
		{
		aSmsSettings.SetDescriptionLength(intValue);
		}
		
		
	// Can Concatenate
	if(scriptFileParser->GetFieldAsString(KScriptItemCanConcatenate, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetCanConcatenate(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetCanConcatenate(ETrue);
			}
		}
	
	// Reply path
	if(scriptFileParser->GetFieldAsString(KScriptItemReplyPath, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetReplyPath(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetReplyPath(ETrue);
			}
		}
		
	// Reject duplicate
	if(scriptFileParser->GetFieldAsString(KScriptItemRejectDuplicate, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetRejectDuplicate(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetRejectDuplicate(ETrue);
			}
		}
		
	// Validity period, value is read in minutes
	if(scriptFileParser->GetFieldAsInteger(KScriptItemValidityPeriod, intValue) == KErrNone)
		{
		aSmsSettings.SetValidityPeriod(TTimeIntervalMinutes(intValue));
		}
		
	// Delivery
	if(scriptFileParser->GetFieldAsString(KScriptItemDelivery, stringPtr) == KErrNone)
		{
		TSmsDelivery delivery = ObtainValueParameterL<TSmsDelivery>(aTestCase, stringPtr);
		aSmsSettings.SetDelivery(delivery);
		}
	
	// Status Report Handling
	if(scriptFileParser->GetFieldAsString(KScriptItemStatusReportHandling, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsReportHandling statusReportHandling = ObtainValueParameterL<CSmsSettings::TSmsReportHandling>(aTestCase, stringPtr);
		aSmsSettings.SetStatusReportHandling(statusReportHandling);
		}

	// Special Message Handling
	if(scriptFileParser->GetFieldAsString(KScriptItemSpecialMessageHandling, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsReportHandling specialMessageHandling = ObtainValueParameterL<CSmsSettings::TSmsReportHandling>(aTestCase, stringPtr);
		aSmsSettings.SetSpecialMessageHandling(specialMessageHandling);
		}

	// Commdb action
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsCommdbAction, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsSettingsCommDbAction commdbAction = ObtainValueParameterL<CSmsSettings::TSmsSettingsCommDbAction>(aTestCase, stringPtr);
		aSmsSettings.SetCommDbAction(commdbAction);
		}
		
	// Sms Bearer Action
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsBearerAction, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsSettingsCommDbAction smsBearerAction = ObtainValueParameterL<CSmsSettings::TSmsSettingsCommDbAction>(aTestCase, stringPtr);
		aSmsSettings.SetSmsBearerAction(smsBearerAction);
		}

	// Message Conversion
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsMessageConversion, stringPtr) == KErrNone)
		{
		TSmsPIDConversion messageConversion = ObtainValueParameterL<TSmsPIDConversion>(aTestCase, stringPtr);
		aSmsSettings.SetMessageConversion(messageConversion);
		}
	
	// Vailidity Period Format
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsValidityPeriodFormat, stringPtr) == KErrNone)
		{
		TSmsFirstOctet::TSmsValidityPeriodFormat valPeriodFormat = ObtainValueParameterL<TSmsFirstOctet::TSmsValidityPeriodFormat>(aTestCase, stringPtr);
		aSmsSettings.SetValidityPeriodFormat(valPeriodFormat);
		}
	
	// Class2 Folder
	if(scriptFileParser->GetFieldAsString(KScriptItemClass2Folder, stringPtr) == KErrNone)
		{
		// Try to find a folder with that name
		MDummySessionObserver obser;
		CMsvSession* session = CMsvSession::OpenSyncL(obser);
		CleanupStack::PushL(session);
		
		CMsvEntry* entry = CMsvEntry::NewL(*session, KMsvLocalServiceIndexEntryId, TMsvSelectionOrdering(KMsvGroupByStandardFolders||KMsvGroupByType,EMsvSortByNone));
		CleanupStack::PushL(entry);
		entry->SetEntryL(KMsvLocalServiceIndexEntryId); // Search only the local folders

		TMsvSelectionOrdering order;
		order.SetShowInvisibleEntries(ETrue);
		entry->SetSortTypeL(order);

		CMsvEntrySelection* selection = entry->ChildrenL();
		CleanupStack::PushL(selection);

		TBool found = EFalse;
		TInt count = selection->Count();
		for (TInt i=0; i<count; i++) 
			{	
			entry->SetEntryL((*selection)[i]);
			if ((stringPtr.CompareF(entry->Entry().iDescription) == 0) ||
			    (stringPtr.CompareF(entry->Entry().iDetails) == 0))
				{
				found = ETrue;
				break;
				}
			}

		TMsvId entryId = KMsvGlobalInBoxIndexEntryId;
		if (found)
			entryId = entry->Entry().Id();
		else
			User::Leave(KErrNotFound);

		aSmsSettings.SetClass2Folder(entryId); 
		
		CleanupStack::PopAndDestroy(3, session); // selection, entry, session
		}

	//Last Segment Delivery Report
	if(scriptFileParser->GetFieldAsString(KLastSegmentDeliveryReport, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetLastSegmentDeliveryReport(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetLastSegmentDeliveryReport(ETrue);
			}
		}
	
	CleanupStack::PopAndDestroy(scriptFileParser);
	}
Example #10
0
TInt CMsvTestUtils::DoNavigateMessageStoreL(TMsvId& aParent, TInt& aStart)
	{
	TMsvSelectionOrdering order;
	order.SetShowInvisibleEntries(ETrue);
	CMsvEntry* parent = CMsvEntry::NewL(*iMsvSession, aParent, order);
	CleanupStack::PushL(parent);

	iRTest.Printf(KMsvTestUtilsNewLine);
	TInt more = 0;
	const TInt KMax = 10;
	ShowChildrenL(*parent, aStart, more, KMax);
	iRTest.Printf(KMsvTestUtilsNewLine);

	iRTest.Printf(_L("Select a message or '.' (for parent) or 'N'ext or 'P'revious or e'X'it\n"));

	const TInt count = Min(KMax, parent->Count() - aStart);
	const TChar startChar = '0';
	const TChar endChar = startChar + count - 1;
	const TChar key = iRTest.Getch();

	TInt ret = KErrNotFound;

	if (key >= '0' && key <= endChar)
		{
		iRTest.Printf(KMsvTestUtilsNewLine);

		TMsvEntry entry((*parent)[key - startChar + aStart]);

		if (entry.Owner())
			{
			aStart = 0;
			aParent = entry.Id();
			}
		else
			{
			DisplayChildDetailsL(entry);
			}

		ret = KErrNone;
		}
	else if (key == '.')
		{
		aStart = 0;
		if (aParent != KMsvRootIndexEntryId)
			aParent = parent->Entry().Parent();

		ret = KErrNone;
		}
	else if (key == 'n' || key == 'N')
		{
		if (more > 0)
			{
			aStart += KMax;
			}

		ret = KErrNone;
		}
	else if (key == 'p' || key == 'P')
		{
		if (aStart > 0)
			{
			aStart -= KMax;
			}

		ret = KErrNone;
		}
	else if (key == 'x' || key == 'X')
		{
		ret = KErrDied;
		}

	CleanupStack::PopAndDestroy(parent);
	return ret;
	}
Example #11
0
EXPORT_C void CMsvTestUtils::FindChildrenL(TMsvId aFolderToTraverse, TBool aReplace, TBool aOtherFiles)
	{
	iFileCount=0;

	CDir* rfcFileList;
	// Loads the any test files into an EntryList
	iFs.GetDir(iRfc822Dir, KEntryAttNormal, ESortByName, rfcFileList);
		
	TMsvSelectionOrdering ordering;
	ordering.SetShowInvisibleEntries(ETrue);

	TMsvId entryId;
	if (iClientServer==EClientSide)
		{
		entryId=iMsvEntry->Entry().Id();
		iMsvEntry->SetEntryL(aFolderToTraverse);
		iMsvEntry->SetSortTypeL(ordering);
		}
	else
		{
		entryId=iServerEntry->Entry().Id();
		iServerEntry->SetEntry(aFolderToTraverse);
		iServerEntry->SetSort(ordering);
		}


	RFile file;
	TFileName filename(iLogsDir);
	filename.Append(KFileNameEntryStructure);

	// Print out Hierarchy - Save to file
		
	if (aReplace)
		{
		// replace both Entry_Structure.txt and Entry_RichTextBodies.txt
		TInt err1 = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
		if (err1==KErrNotFound) // file does not exist - create it
			err1=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
		if (err1 == KErrNone)
			ListChildrenL(aReplace, aOtherFiles, file, *rfcFileList);
		}
	else
		{
		TInt err1 = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
		if (err1==KErrNotFound)
			file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
		else if (err1 != KErrNone)
			User::Leave(err1);
		TInt position=1;
		User::LeaveIfError(file.Seek(ESeekEnd, position));
		ListChildrenL(aReplace, aOtherFiles, file, *rfcFileList);
		}

	file.Close();
	
	if (iClientServer==EClientSide)
		iMsvEntry->SetEntryL(entryId);
	else
		iServerEntry->SetEntry(entryId);
	delete rfcFileList;
	}
// -----------------------------------------------------------------------------
// CMessageMonitorPlugin::HandleMsgMovedL
// -----------------------------------------------------------------------------
//
void CMessageMonitorPlugin::HandleMsgMovedL( const TMsvId aFolderId1, 
											 const TMsvId aFolderId2, 
								   			 const CMsvEntrySelection& aSelection )
	{
	
	
	
	WRITELOG("ENTER CMessageMonitorPlugin::HandleMsgMovedL");
	
	TInt count( aSelection.Count() );
	// cycle through every message in the CMsvEntrySelection
	for ( TInt i=0; i < count; ++i )
		{
		TMsvId msgId = aSelection[i];
		WRITELOG1("msgId: %d", msgId );					
		
		TMsvId service = 0;
        TMsvEntry entry;
		TInt err = iMsvSession->GetEntry( msgId, service, entry );

        // if we have a message and it has been moved from the outbox to the sent 
        // items, and it is a valid message
        if ( ( !err ) &&
            ( KUidMsvMessageEntry == entry.iType ) &&
            ( KMsvSentEntryId == aFolderId1 ) &&
            ( KMsvGlobalOutBoxIndexEntryId == aFolderId2 ) && 
            ( IsValidMessageTypeL( entry, *iMsvSession ) ) )
            {            
            HBufC* uri = CreateUriL( entry.iMtm, msgId );
            CleanupStack::PushL( uri );
            CHarvesterData* hd = CHarvesterData::NewL( uri );
            CleanupStack::Pop( uri );
            hd->SetEventType( EHarvesterAdd );
            hd->SetTakeSnapshot( EFalse );
            hd->SetBinary( EFalse );
            iMonitorPluginObserver->MonitorEvent( hd );
            }
            
               
#ifdef __WINSCW__
		else if (!err && KMsvDraftEntryId == aFolderId2 && KMsvGlobalOutBoxIndexEntryId == aFolderId1 )
			{
		    if( entry.iMtm.iUid != KUidMsgTypeMultimedia.iUid )
		        {
                CClientMtmRegistry* clientMtmReg;
                clientMtmReg = CClientMtmRegistry::NewL(*iMsvSession);
                CleanupStack::PushL(clientMtmReg);
            
                CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*>(clientMtmReg->NewMtmL(KUidMsgTypeSMS)); 
                CleanupStack::PushL(smsMtm);
                smsMtm->SwitchCurrentEntryL( msgId );
            
                TMsvSelectionOrdering selection;
                selection.SetShowInvisibleEntries(ETrue);
            
                CMsvEntry* parentEntry = CMsvEntry::NewL( smsMtm->Session(),
                    smsMtm->Entry().Entry().Parent(), selection );
             
                CleanupStack::PushL(parentEntry);
                // Move the message
                TRAP_IGNORE( parentEntry->MoveL( msgId, KMsvSentEntryId ) );
                CleanupStack::PopAndDestroy(3,clientMtmReg); // parentEntry
		        }
			}
#endif             
		
        }
	WRITELOG("END CMessageMonitorPlugin::HandleMsgMovedL");	        
	}
void CPerformanceInitialisationClient::RunL()
	{

	User::LeaveIfError(iStatus.Int());
	CMsvEntry* imapService=NULL;
	TMsvSelectionOrdering ordering;
	TPckg<MMsvImapConnectionObserver*> param(this);
	CMsvEntry* entry=NULL;
	TBuf8<4> buf;
	
	switch(iState)
		{
		
		case EConnectAndSync:
			iTestStep.INFO_PRINTF1(_L("Intialisation - Connect and sync..."));
			iSelection = new (ELeave) CMsvEntrySelection;
			//select the imap service entry
			iSelection->AppendL(iImapAccount.iImapService);
			//make the service entry the current context
			iClientMtm->SwitchCurrentEntryL(iImapAccount.iImapService);
			//sync the account
			iState=EWait;
			iMsvOperation = iClientMtm->InvokeAsyncFunctionL(KIMAP4MTMConnectAndSyncCompleteAfterFullSync,*iSelection,param,iStatus);			
			SetActive();
			break;
			
		case EWait:
			delete iMsvOperation;
			iMsvOperation=NULL;
			iMsvOperation = iClientMtm->InvokeAsyncFunctionL(KIMAP4MTMWaitForBackground,*iSelection,buf,iStatus);	
			SetActive();
			iState=EDeleteRemoteEntries;
			break;	
			
		case EDeleteRemoteEntries:
			iTestStep.INFO_PRINTF1(_L("Intialisation - Deleting remote entries..."));
			// delete all messages in the Inbox
			imapService = CMsvEntry::NewL(*iSession, iImapAccount.iImapService,ordering);
			CleanupStack::PushL(imapService);
			//retrieve the inbox from the imap service entry
			CMsvEntrySelection* msvEntrySelection;
			msvEntrySelection=imapService->ChildrenL();
			CleanupStack::PushL(msvEntrySelection);
			//create a CMsvEntry for the inbox entry
			iInboxEntry = CMsvEntry::NewL(*iSession, (*msvEntrySelection)[0],ordering);
			CleanupStack::PopAndDestroy(2,imapService);
			
			iChildren = iInboxEntry->ChildrenL();
			if(iChildren->Count()>0)
				{
				iInboxEntry->DeleteL(*iChildren,iStatus);
				SetActive();	
				}
			else
				{
				CompleteSelf();		
				}
			
			iState=EDisconnect;
			break;
		
		case EUploadMessages:
			iTestStep.INFO_PRINTF1(_L("Intialisation - Uploading messages..."));
			//select the message in the outbox
			ordering.SetShowInvisibleEntries(ETrue);
			entry = CMsvEntry::NewL(*iSession,KMsvGlobalOutBoxIndexEntryIdValue,ordering);
			CleanupStack::PushL(entry);
    		entry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
    
			iEntrySelectionToSend=entry->ChildrenL();	
    		//copy the message to the smtp service
  			iOperation = entry->CopyL(*iEntrySelectionToSend,iSmtpAccount.iSmtpService,iStatus);
			CleanupStack::PopAndDestroy(1,entry); 
			SetActive();	
			iState=EComplete;
			break;
				
		case EDisconnect:
			iTestStep.INFO_PRINTF1(_L("Intialisation - Disconnecting..."));
			delete iMsvOperation;
			iMsvOperation=NULL;
			iMsvOperation = iClientMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*iSelection,buf,iStatus);	
			SetActive();
			iState=EComplete;
			break;	
			
		case EComplete:
			User::After(10000000);
			iTestStep.INFO_PRINTF1(_L("EComplete"));
			//inform the owning object that the process is complete
			iTestStep.InitialisationComplete(KErrNone);
			break;
			
		default:
			__ASSERT_DEBUG(0, User::Panic(_L("CPerformanceInitialisationClient unknown state"), KErrUnknown));
			break;			
		}

	}