Ejemplo n.º 1
0
// ----------------------------------------------------------------------------
// CWebClientContainer::AddToHeaderWindowL()
// Add a single line of text to the header window.
// ----------------------------------------------------------------------------
//
void CWebClientContainer::AddToHeaderWindowL( const TDesC& aText )
    {
    // Append aText to header window with line break
    CRichText* text = iHeaderWindow->RichText();
    text->InsertL( text->DocumentLength(), aText );
    text->InsertL( text->DocumentLength(), CEditableText::ELineBreak );
    iHeaderWindow->HandleTextChangedL();
    }
Ejemplo n.º 2
0
EXPORT_C void CMsvTestUtils::WriteBodyDataL(TMsvId aId, const TFileName& aFilepath, CMsvStore& fileStore, TBool aReplace)
	{
	CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
	CCharFormatLayer* charLayer = CCharFormatLayer::NewL();
	CRichText* body = CRichText::NewL(paraLayer,charLayer);

	fileStore.RestoreBodyTextL(*body);

	HBufC* pBodyText = HBufC::NewLC(body->DocumentLength()+(body->DocumentLength()/70)+1);
	TPtr pBody = pBodyText->Des();
	body->Extract(pBody, 0);

	RFile file;
	TFileName filename(aFilepath);
	filename.Append(KFileNameBodies);
	
	TInt err = KErrNone;
	if (aReplace)
		err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	else
		err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
	if(err==KErrNotFound) // file does not exist - create it
		err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);

	TInt offset=0;
	iRTest(file.Seek(ESeekEnd, offset)==KErrNone);

	TBuf<100> buf;
	buf.Zero();
	buf.AppendFormat(_L("*** %d *************** RichText Data ***************\n"), aId);
	buf.AppendFormat(_L("Size >>> %d\n"), body->DocumentLength());	
	WriteToFileL(file, buf);
	
	RemoveRichtextFormating(pBody);
	WriteToFileL(file, pBody);
	
	buf.Zero();
	buf.AppendFormat(_L("\n********************* end of Body ***********************\n"));
	WriteToFileL(file, buf);
	
	CleanupStack::PopAndDestroy(); // pBodyText
	file.Close();
	delete paraLayer;
	delete charLayer;
	delete body;
	}
Ejemplo n.º 3
0
// ----------------------------------------------------------------------------
// CWebClientContainer::AddToStatusWindowL()
// Add a single line of text to the status window.
// ----------------------------------------------------------------------------
//
void CWebClientContainer::AddToStatusWindowL( const TDesC& aText )
    {
    // Append aText to status window with line break
    CRichText* text = iStatusWindow->RichText();
    text->InsertL( text->DocumentLength(), aText );
    text->InsertL( text->DocumentLength(), CEditableText::ELineBreak );
    iStatusWindow->HandleTextChangedL();
    iStatusWindow->MoveCursorL( TCursorPosition::EFLineDown, EFalse );
    }
Ejemplo n.º 4
0
// -----------------------------------------------------------------------------
// CWPMessage::StoreMsgL
// -----------------------------------------------------------------------------
//
void CWPMessage::StoreMsgL( TInt aResource )
    {
    FLOG( _L( "CWPMessage::StoreMsgL(aResource)" ) );
    
    // create an invisible blank entry 
    TMsvEntry entry;
    PrepareEntryLC( entry ); // details on cleanup stack
    entry.iMtm = KUidMsgTypeSMS;     

    // Store entry in inbox
    CMsvEntry* msvEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
    CleanupStack::PushL(msvEntry);
    msvEntry->CreateL(entry);
    msvEntry->Session().CleanupEntryPushL(entry.Id());
    msvEntry->SetEntryL(entry.Id());

    // Save the message body
    CMsvStore* store = msvEntry->EditStoreL();
    CleanupStack::PushL(store);
    CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
    CleanupStack::PushL( paraFormat );
    CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
    CleanupStack::PushL( charFormat );
    CRichText* body = CRichText::NewL( paraFormat, charFormat );
    CleanupStack::PushL( body );
    HBufC* text = LoadStringLC( aResource );
    body->InsertL( body->DocumentLength(), *text );
    store->StoreBodyTextL( *body );

    // Store the actual message for post-mortem analysis
    iMessage->StoreL( *store );

    // Save the SMS header and create a description field
    CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *body );
    CleanupStack::PushL( header );
    TBuf<KSmsDescriptionLength> description;

    CSmsGetDetDescInterface* smsPlugin = CSmsGetDetDescInterface::NewL();
    CleanupStack::PushL( smsPlugin );
    smsPlugin->GetDescription( header->Message(), description );
    CleanupStack::PopAndDestroy( smsPlugin );

    entry.iDescription.Set( description );
    header->StoreL( *store );
    store->CommitL();
    CleanupStack::PopAndDestroy( 5 ); // header, text, body, charformat, paraFormat

    // Complete processing the message
    PostprocessEntryL( *msvEntry, entry );

    CleanupStack::PopAndDestroy(); //store
    msvEntry->Session().CleanupEntryPop(); //entry
    CleanupStack::PopAndDestroy(2); //details, msvEntry
    }
Ejemplo n.º 5
0
// ----------------------------------------------------------------------------
// CWebClientContainer::AddToSourceWindowL()
// Add text to Sourcewindow. No formatting is provided.
// ----------------------------------------------------------------------------
//
void CWebClientContainer::AddToSourceWindowL( const TDesC8& aText )
    {
    // Convert 8-bit aText to 16-bit and append it to end of Source window
    HBufC* tempBuf = HBufC::NewL( aText.Length() );
    CleanupStack::PushL( tempBuf );
    tempBuf->Des().Copy( aText );
    CRichText* text = iSourceWindow->RichText();
    text->InsertL( text->DocumentLength(), *tempBuf );
    iSourceWindow->HandleTextChangedL();
    CleanupStack::PopAndDestroy( tempBuf );
    }
Ejemplo n.º 6
0
/**
@SYMTestCaseID SYSLIB-FORMA-UT-1899
@SYMTestCaseDesc This function runs the scrolling tests. It sets up the documents then calls the ScrollTestL function
to scroll through them.
@SYMTestPriority High
@SYMTestActions The following paragraphs are tested by scrolling up and down through them:
A LTR paragraph containing a few lines of RTL text
A LTR paragraph containing less than a line of RTL text
A LTR paragraph containing a portion of RTL text which is greater than the band
A RTL paragraph containing a few lines of LTR text
A RTL paragraph containing less than a line of LTR text
A RTL paragraph containing a portion of LTR text which is greater than the band
@SYMTestExpectedResults The test must not fail or panic .
@SYMDEF DEF092140, DEF092139
*/
void RunScrollingTestsL(CRichText& aRichText, CBandMaintainer& aMaintainer, CBandValidator& aValidator)
	{
// set up 3 paragraphs of LTR with runs of RTL embedded in each paragraph
	aRichText.Reset();
	test.Start(_L("Scrolling LTR document with embedded RTL"));
	aMaintainer.InitialiseViewL();
//LTR paragraph containing a few lines of RTL text
	aRichText.InsertL(aRichText.DocumentLength(), KLTRWithRTL);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
//LTR paragraph containing less than a line of RTL text
	aRichText.InsertL(aRichText.DocumentLength(), KLTRWithSmallRTL);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
//LTR paragraph containing a portion of RTL text which is greater than the band
	aRichText.InsertL(aRichText.DocumentLength(), KLTRWithLargeRTL);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	ScrollingTestL(aMaintainer, aValidator);

// 3 paragraphs of RTL with runs of LTR embedded in each paragraph
	aRichText.Reset();
	test.Next(_L("Scrolling RTL document with embedded LTR"));
	aMaintainer.InitialiseViewL();
//RTL paragraph containing a few lines of LTR text
	aRichText.InsertL(aRichText.DocumentLength(), KRTLWithLTR);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
//RTL paragraph containing less than a line of LTR text
	aRichText.InsertL(aRichText.DocumentLength(), KRTLWithSmallLTR);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
//RTL paragraph containing a portion of LTR text which is greater than the band
	aRichText.InsertL(aRichText.DocumentLength(), KRTLWithLargeLTR);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	ScrollingTestL(aMaintainer, aValidator);
	test.End();
	}
Ejemplo n.º 7
0
TMsvPartList CTextMtmClient::Find(const TDesC& aTextToFind, TMsvPartList aPartList)
// Find text in entry 
	{
	__ASSERT_DEBUG(iMsvEntry!=NULL, gPanic(ETxtcNoCMsvEntrySet));
	TBool found=EFalse;
	if (aPartList & KMsvMessagePartBody)
		{
		CRichText *body = &Body();
		if (body != NULL)
			{
			TInt textSize = body->DocumentLength();
			// Get searchable text

			if (textSize>0)  // Symbian OS doesn't handle allocing zero byte arrays too
				{               
				TText *bodyText = new TText[textSize];
				if (bodyText != NULL)
					{
					// search the rich text
					TPtr p(bodyText,textSize,textSize);
					body->Extract(p);
					if (p.FindF( aTextToFind ) >= 0)
						{
						found = ETrue;
						}
					}
				delete bodyText;
				}
			}
		}

	if (aPartList & KMsvMessagePartOriginator)
		{
		if (iMsvEntry->Entry().iDetails.FindF( aTextToFind ) >= 0)
			{
			found=ETrue;
			}
		}
	
	if (aPartList & KMsvMessagePartDescription)
		{
		if (iMsvEntry->Entry().iDescription.FindF( aTextToFind ) >= 0)
			{
			found=ETrue;
			}
		}
	
	// Never searched - KMsvMessagePartAttachments, KMsvMessagePartRecipient 
	// and KMsvMessagePartDate
	return found;
	}
/**
  ExecuteActionL
  Obtains the parameters for the test action. Get the Message Id at given index. The Message 
  Id is stored as output parameters of this Test Action
  @internalTechnology 
  @pre    None
  @post   None
  @leave  System wide errors
*/
void CMtfTestActionSendAsSetBodyText::ExecuteActionL()
	{
	if((TestCase().TestStepResult()) == EPass)
		{
		TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsSetBodyText);
	
		// Get test action input parameters
		RSendAsMessage sendAsMessage = ObtainValueParameterL<RSendAsMessage>(TestCase(),
														ActionParameters().Parameter(0));
		
		// Buffer type to be used for adding the body text 
		// 0 => Set body text using Descriptor 
		// 1 => Set body text using CRichText object (Default)	
		TInt bufferType = ObtainValueParameterL<TInt>(TestCase(),
														ActionParameters().Parameter(1),1);
	
		TInt index = ObtainValueParameterL<TInt>(TestCase(),
														ActionParameters().Parameter(2));
	
		// Get the body text configuration file name												
		TPtrC fileName = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfDataFile,index);

		// Create a Rich text object to store the Body text contents
		CPlainText::TTextOrganisation ttOrg = {CPlainText::EOrganiseByLine};

		CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
		CleanupStack::PushL(paraFormatLayer);
		CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
		CleanupStack::PushL(charFormatLayer);
		CRichText* bodyCRichText = CRichText::NewL(paraFormatLayer, charFormatLayer);
		CleanupStack::PushL(bodyCRichText);

		HBufC* bodyTextFileName = fileName.Alloc();
		CleanupStack::PushL(bodyTextFileName);

		// Read the body text contents into the Rich text object
		bodyCRichText->ImportTextFileL(0, bodyTextFileName->Des(), ttOrg);	
	
		TInt err = KErrNone;
		// Set body text using descriptor
		if( bufferType  == 0 )
			{
			// Create a heap buffer and copy the file contents
			TInt len1 = bodyCRichText->DocumentLength();
			HBufC* buf1 = HBufC::NewL(len1);
			CleanupStack::PushL(buf1);
			
			TPtr fileContents = buf1->Des();
			bodyCRichText->Extract(fileContents,0,(len1));
			
			// Set the body text to the message
			TRAP(err, sendAsMessage.SetBodyTextL(fileContents));
			
			if(err == KErrNone)
				{
				TestCase().INFO_PRINTF1(_L("SetBodyTextL using Descriptor was successful"));
				}
			else
				{
				TestCase().ERR_PRINTF2(_L("SetBodyTextL using Descriptor failed with error: %d"), err);
				TestCase().SetTestStepResult(EFail);
				}
				
			// destroy the temporary storage of the text
			CleanupStack::PopAndDestroy(buf1);
			}
		else if (bufferType  == 1)
			{
			// Set body text using CRichText
			TRAP(err, sendAsMessage.SetBodyTextL(*bodyCRichText));
			
			if(err == KErrNone)
				{
				TestCase().INFO_PRINTF1(_L("SetBodyTextL using Rich Text was successful"));
				}
			else
				{
				TestCase().ERR_PRINTF2(_L("SetBodyTextL using Rich Text failed with error: %d"), err);
				TestCase().SetTestStepResult(EFail);
				}
			}
	 	else
			{
			err = KErrArgument;
			TestCase().ERR_PRINTF2(_L("Incorrent input parameter: Buffer type value should be either 0 or 1. The value provided is  %d"),bufferType );
			TestCase().SetTestStepResult(EFail);
			}
		StoreParameterL<TInt>(TestCase(),err,ActionParameters().Parameter(3));
			
		CleanupStack::PopAndDestroy(4);	//bodyTextFileName, bodyCRichText, charFormatLayer, paraFormatLayer
		TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsSetBodyText);
		}
	TestCase().ActionCompletedL(*this);
	}
Ejemplo n.º 9
0
// Called by EText to scan an area of text
TBool CParserList::ParseThisText(CRichText& aTextObj,TInt aStartScan,TInt aScanLength,TInt& aStartOfTags,TInt& aLength)
	{
	TBool foundSomething = EFalse;
	TCharFormatX format;
	TCharFormatXMask varies;
	TPtrC ptr;
	TInt endRange;

	// Scan either side of the range in case part of some tagged text was deleted.
	if (aStartScan > 0)
		{
		aStartScan--;
		aScanLength++;
		}
	if (aStartScan + aScanLength < aTextObj.DocumentLength())
		aScanLength++;

	if (iNumberInList && aScanLength)
		{
		aStartOfTags = aStartScan + aScanLength;
		aLength = 0;
		for (TInt count = 0; count < iNumberInList; count++)
			{
			// For each parser in the list
			TUint tagIndex = iParserList[count]->TagIndex();
			TInt pos;
			MParser* parser = iParserList[count]->Parser();
			TInt localStartScan = aStartScan;
			TInt localScanLength = aScanLength;
			// Start by removing existing tags for this parser. This ensures
			// that old tags that have been invalidated by subsequent editing
			// are removed. Any that are still valid will be replaced.
			aTextObj.GetExtendedCharFormat(format, varies, localStartScan, aScanLength);

			if (format.iParserTag || varies.AttribIsSet(EAttParserTag))
				{
				// At least some of the object contains a non-zero tag - go through it
				// Are we starting part way through a tag?
				aTextObj.GetExtendedCharFormat(format, varies, localStartScan, 1);
				if (format.iParserTag == tagIndex)
					{
					// The first char of this range has the current parsers tag
					// so we need to check backwards for the start of that tag
					for (pos = localStartScan; pos > 0; pos--)
						{
						aTextObj.GetExtendedCharFormat(format, varies, pos - 1, 1);
						if (format.iParserTag != tagIndex)
							break;
						}
					// Since we are going to remove a tag starting from here
					// we need to allow this area to be rescanned
					localScanLength += localStartScan - pos;
					localStartScan = pos;
					}
				// What about off the end?
				aTextObj.GetExtendedCharFormat(format, varies, localStartScan + localScanLength - 1, 1);
				if (format.iParserTag == tagIndex)
					{
					// The last char of this range has the current parsers tag
					// so we need to check forwards for the end of that tag
					pos = localStartScan + localScanLength;
					TInt end = aTextObj.DocumentLength();
					while (pos < end)
						{
						aTextObj.GetTextAndExtendedFormat(ptr, format, pos);
						if (format.iParserTag != tagIndex)
							break;
						pos += ptr.Length();
						}
					// Adjust scan length
					localScanLength = pos - localStartScan;
					}
				pos = localStartScan;
				while (pos < localStartScan + localScanLength)
					{
					// Run along the scan range
					aTextObj.GetTextAndExtendedFormat(ptr, format, pos);
					if (format.iParserTag == tagIndex)
						{
						// Remove this tag
						format.iParserTag = 0;
						varies.ClearAll();
						varies.SetAttrib(EAttParserTag);
						TRAPD(leaveCode, aTextObj.ApplyExtendedCharFormatL(format, varies, pos, ptr.Length()));
						if (leaveCode==KErrNone)
							foundSomething = ETrue;	// We are removing a tag
						if (aLength)
							{
							if (pos < aStartOfTags)
								{
								aLength += aStartOfTags - pos;
								aStartOfTags = pos;
								}
							if (pos + ptr.Length() > aStartOfTags + aLength)
								aLength = pos + ptr.Length() - aStartOfTags;
							}
						else
							{
							aStartOfTags = pos;
							aLength = ptr.Length();
							}
						}
					pos += ptr.Length();
					}
				}
			endRange = localStartScan + localScanLength;

			// For this parser, run through text looking for changes
			TBool allowBack = ETrue;
			for (;;)	// Run forever
				{
				TInt localStartTag = aTextObj.DocumentLength();
				TInt localTagLength = 0;
				TInt result = parser->ParseThisText(aTextObj, allowBack, localStartScan, localScanLength, localStartTag, localTagLength);
				if (!result)
					break;
				if (!allowBack && (localStartTag < localStartScan))
				    {
				    OstTrace0( TRACE_DUMP, CPARSERLIST_PARSETHISTEXT, "EParserIgnoringAllowFlag" );
				    }
				__ASSERT_DEBUG(allowBack || (localStartTag >= localStartScan), Panic(EParserIgnoringAllowFlag));
				TInt startNewTag = localStartTag;
				TInt lengthNewTag = localTagLength;
				aTextObj.GetExtendedCharFormat(format, varies, localStartTag, localTagLength);
				if (format.iParserTag || varies.AttribIsSet(EAttParserTag))
					{
					// At least some of this area contains a non-zero tag - go through it
					pos = localStartTag;
					TBool higher = EFalse;
					while (pos < localStartTag + localTagLength)
						{
						aTextObj.GetTextAndExtendedFormat(ptr, format, pos);
						if (format.iParserTag && (MaskedTag(format.iParserTag) < MaskedTag(tagIndex)))
							{
							// A higher precedence tag is already here so we can't
							// insert our tag - let's see how far it goes
							TUint tag = format.iParserTag;	// Stash tag before overwriting it
							TInt len = aTextObj.DocumentLength();
							while (pos < len)
								{
								aTextObj.GetTextAndExtendedFormat(ptr, format, pos);
								if (format.iParserTag != tag)
									break;
								pos += ptr.Length();
								}
							result = EFalse;
							startNewTag = pos;
							lengthNewTag = 0;
							break;
							}
						// If there aren't any higher precedence tags in here then this
						// will save us having to go through again if there aren't any
						// lower precedence tags either
						if (MaskedTag(format.iParserTag) >= MaskedTag(tagIndex))
							higher = ETrue;
						pos += ptr.Length();
						}
					if (higher)
						{
						// There are lower or equal precedence tags in this range
						// Do they extend back off the start?
						aTextObj.GetExtendedCharFormat(format, varies, localStartTag, 1);
						if (format.iParserTag)
							{
							// need to check backwards
							TUint tag = format.iParserTag;	// Stash tag before overwriting it
							for (pos = localStartTag; pos > 0; pos--)
								{
								aTextObj.GetExtendedCharFormat(format, varies, pos - 1, 1);
								if (format.iParserTag != tag)
									break;
								}
							localTagLength += localStartTag - pos;
							localStartTag = pos;
							}
						// What about off the end?
						pos = localStartTag + localTagLength;
						aTextObj.GetExtendedCharFormat(format, varies, pos - 1, 1);
						if (format.iParserTag)
							{
							// need to check forwards
							TUint tag = format.iParserTag;	// Stash tag before overwriting it
							TInt len = aTextObj.DocumentLength();
							while (pos < len)
								{
								aTextObj.GetTextAndExtendedFormat(ptr, format, pos);
								if (format.iParserTag != tag)
									break;
								pos += ptr.Length();
								}
							localTagLength = pos - localStartTag;
							}

						// Remove all tags in this area - they all have lower precedence
						format.iParserTag = 0;
						varies.ClearAll();
						varies.SetAttrib(EAttCharLanguage);
						TRAPD(leaveCode, aTextObj.ApplyExtendedCharFormatL(format, varies, localStartTag, localTagLength));
						if (leaveCode==KErrNone)
							foundSomething = ETrue;	// We are removing a tag
						}
					}

				if (result)
					{
					// Format tag this area with tagIndex
					format.iParserTag = tagIndex;
					varies.ClearAll();
					varies.SetAttrib(EAttParserTag);
					// Use the original length, not the possibly expanded version
					TRAPD(leaveCode, aTextObj.ApplyExtendedCharFormatL(format, varies, startNewTag, lengthNewTag));
					if (leaveCode==KErrNone)
						foundSomething = ETrue;		// We are applying a tag
					if (aLength)
						{
						if (localStartTag < aStartOfTags)
							{
							aLength += aStartOfTags - localStartTag;
							aStartOfTags = localStartTag;
							}
						if (localStartTag + localTagLength > aStartOfTags + aLength)
							aLength = localStartTag + localTagLength - aStartOfTags;
						}
					else
						{
						aStartOfTags = localStartTag;
						aLength = localTagLength;
						}
					}
				// Jump over
				localScanLength -= startNewTag + lengthNewTag - localStartScan;
				localStartScan = startNewTag + lengthNewTag;	// Adjust start of next scan run
				if (localStartScan >= endRange)	// Have we reached the end of the range yet?
					break;
				allowBack = EFalse;
				}
			}
		}

	return foundSomething;
	}
TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
                                                   TBIOMessageType aMessageType)
{
		// Ensure that we have a valid service ID to work with:
		TMsvId iBioServiceId;

		iBioServiceId = SetBIOServiceIdL();

		HBufC* localBuffer = aText.AllocL();
		CleanupStack::PushL(localBuffer);

		TPtr messDes = localBuffer->Des();

		if (aMessageType != EBiovCardMessage && aMessageType
            != EBiovCalenderMessage)
			{
				// convert \r\n to \n since this is what is expected from SMS when not vCard data
				for (TInt i = 0; i < messDes.Length(); i++)
					{
						if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
								&& messDes[i + 1] == (TText) '\n')
							messDes.Delete(i, 1);
					}
			}

		//  Create and fill a CRichText object for the jobbie:
		CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
		CleanupStack::PushL(paraFormatLayer);
		CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
		CleanupStack::PushL(charFormatLayer);
		CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
		CleanupStack::PushL(richText);

		TInt pos = richText->DocumentLength();
		richText->InsertL(pos, messDes);

		TMsvEntry newBioEntry;
		newBioEntry.SetNew(ETrue);
		newBioEntry.SetComplete(EFalse);
		newBioEntry.SetUnread(ETrue);
		newBioEntry.SetVisible(ETrue);
		newBioEntry.SetReadOnly(EFalse);
		newBioEntry.SetFailed(EFalse);
		newBioEntry.SetOperation(EFalse);
		newBioEntry.SetMultipleRecipients(EFalse);
		newBioEntry.SetAttachment(EFalse);
		newBioEntry.iMtm = KUidBIOMessageTypeMtm;
		newBioEntry.iType = KUidMsvMessageEntry;
		newBioEntry.iServiceId = iBioServiceId;
		TTime now;
		now.UniversalTime();
		newBioEntry.iDate = now;

		TTime unixEpoch(KUnixEpoch);
		TTimeIntervalSeconds seconds;
		TTime timeStamp = newBioEntry.iDate;
		timeStamp.SecondsFrom(unixEpoch, seconds);
		retTimeStamp.setTime_t(seconds.Int());

		newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
		TBufC<KTelephoneNumberMaxLength> telNumber;

		QString recepient(TEST_MSG_FROM1);
		tempNumber = XQConversions::qStringToS60Desc(recepient);

		telNumber = tempNumber->Des();
		newBioEntry.iDetails.Set(telNumber);

		SetForMtmTypeL(newBioEntry, aMessageType);

		newBioEntry.iSize = richText->DocumentLength();// msgSize;
		CreateBioEntryClientSideL(newBioEntry, *richText);

		CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
		return newBioEntry.Id();
}
// ---------------------------------------------------------
// MsgStoreHandler::HandleClass0SmsL()
// ---------------------------------------------------------
//
void MsgStoreHandler::HandleClass0SmsL(CMsvEntry* aMsgEntry, TMsvId aMsgId)
{
    CleanupStack::PushL(aMsgEntry);

    CMsvStore* store = aMsgEntry->ReadStoreL();
    CleanupStack::PushL(store);

    CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
    CleanupStack::PushL(paraFormatLayer);

    CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
    CleanupStack::PushL(charFormatLayer);

    CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
    CleanupStack::PushL(richText);

    store->RestoreBodyTextL(*richText);

    TInt len = richText->DocumentLength();
    HBufC* bufBody = HBufC::NewLC(len * 2);

    // Get Body content of SMS message
    TPtr bufBodyPtr = bufBody->Des();
    richText->Extract(bufBodyPtr, 0, len);

    //convert bufbody to qstring..
    QString body = XQConversions::s60DescToQString(*bufBody);

    Class0Info class0Info;

    class0Info.body = body;
    CleanupStack::PopAndDestroy(bufBody);

    // Get From address of SMS message
    CPlainText* nullString = CPlainText::NewL();
    CleanupStack::PushL(nullString);

    CSmsHeader* smsheader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *nullString);
    CleanupStack::PushL(smsheader);
    smsheader->RestoreL(*store);

    QString address = XQConversions::s60DescToQString(smsheader->FromAddress());
    class0Info.address = address;

    // Get alias of SMS message
    QString alias;
    int count;
    MsgContactHandler::resolveContactDisplayName(address, alias, count);
    class0Info.alias = alias;

    // Get timestamp of SMS message
    QDateTime timeStamp;
    TTime time = aMsgEntry->Entry().iDate;
    TTime unixEpoch(KUnixEpoch);
    TTimeIntervalSeconds seconds;
    time.SecondsFrom(unixEpoch, seconds);
    timeStamp.setTime_t(seconds.Int());

    const QString times = timeStamp.toString("dd/MM/yy hh:mm ap");
    class0Info.time = times;

    class0Info.messageId = aMsgId;
    CleanupStack::PopAndDestroy(7);
    aMsgEntry = NULL;

    // Show the SMS message..  
    iNotifier->ShowClass0Message(class0Info);
}
Ejemplo n.º 12
0
/**
@SYMTestCaseID SYSLIB-FORMA-UT-1900
@SYMTestCaseDesc This function will run tests to check if the bidirectional state is being
maintained correctly. Documents containing a mix of different directionality are created and
specific edits which are of interest for each document are performed. These edits are location
specific and will depend on the bidirectional state of surrounding text.
@SYMTestPriority High
@SYMTestActions Edits are performed:
changing the base directionality of a paragraph
changing the directionality of text above the edit position
changing the directionality of neutral characters before and after edit position
changing the directionality of mirrored characters such as parenthesis
changing text directinality by adding explicit embedding
@SYMTestExpectedResults The test must not fail or panic .
@SYMDEF DEF092140, DEF092139
*/
void RunBidirectionalTestL(CRichText& aRichText, CBandMaintainer& aMaintainer, CBandValidator& aValidator)
	{

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

//set up paragraph of just LTR text
	aRichText.InsertL(0, KBleak2);
	aMaintainer.InitialiseViewL();
	User::After(3000000);

//change paragraph base directionality by inserting a RLM marker at the beginning of the paragraph
	TInsertText insertRLM(aMaintainer, aRichText, aValidator, KRLM());
	insertRLM.ExecuteL(0, 1);
	User::After(3000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

//set up paragraph of LLL-RRR-LLL-NNN-RRR-LLL
	aRichText.InsertL(0, KEnglishLongWords_1);
	aRichText.InsertL(aRichText.DocumentLength(), KArabicLessThanALine);
	aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_1);
	aRichText.InsertL(aRichText.DocumentLength(), KPuncs);
	aRichText.InsertL(aRichText.DocumentLength(), KArabicLessThanALine);
	aRichText.InsertL(aRichText.DocumentLength(), KBleak2);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	aMaintainer.InitialiseViewL();
	User::After(1000000);

//delete the second run of LTR changing the directionality of the neutrals
	TDeleteText deleteText(aMaintainer, aRichText, aValidator);
	TInt editPos = KEnglishLongWords_1().Length()+KArabicLessThanALine().Length();
	deleteText.ExecuteL(editPos,KEnglishLessThanALine_1().Length());
	User::After(1000000);

//delete the second run of RTL characters to check if neutral directionality is maintained
	editPos = KEnglishLongWords_1().Length()+KArabicLessThanALine().Length()+KPuncs().Length();
	deleteText.ExecuteL(editPos,KArabicLessThanALine().Length());
	User::After(1000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

//set up band to be a paragraph of numbers followed by LTR i.e. EN-EN-EN-LLL
	aRichText.InsertL(aRichText.DocumentLength(), KNumbers);
	aRichText.InsertL(aRichText.DocumentLength(), KBleak2);
	aMaintainer.InitialiseViewL();
	User::After(3000000);

//edit to change directionality of numbers above the edit by inserting RTL text before the LTR
//This RLM works perfectly
	TInsertText insertArabic(aMaintainer, aRichText, aValidator, KArabicMoreThanALine());
	insertArabic.ExecuteL(KNumbers().Length(), KArabicMoreThanALine().Length());
	User::After(3000000);

//undo previous edit text will return to previous directionality
	deleteText.ExecuteL(KNumbers().Length(),KArabicMoreThanALine().Length());
	User::After(10000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

// Document containing RRRRR ( LLLL ) LLLL
	aRichText.InsertL(0, KArabicMoreThanALine);
	aRichText.InsertL(aRichText.DocumentLength(), KOpenBracket);
	aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_1);
	aRichText.InsertL(aRichText.DocumentLength(), KCloseBracket);
	aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_2);
	aRichText.InsertL(aRichText.DocumentLength(), KOpenBracket);
	aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_4);
	aRichText.InsertL(aRichText.DocumentLength(), KCloseBracket);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	aMaintainer.InitialiseViewL();

// Insert LTR after RTL test Doc should now be RRRR LLLL ( LLLL ) LLLL
	TInsertText insertEnglish(aMaintainer, aRichText, aValidator, KEnglishLessThanALine_3());
	insertEnglish.ExecuteL(KArabicMoreThanALine().Length(), KEnglishLessThanALine_3().Length());
// The brackets are now being displayed correctly
// BUT is the neutral English text meant to be displayed as RTL as initially inserted (no RLM)??
	User::After(10000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

// Just an arabic RTL sentence.
	aRichText.InsertL(0, KArabicMoreThanALine);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	aMaintainer.InitialiseViewL();

// Test formatting when inserting RTL enclosed in parenthesis
	TInsertText insertArabBrackets(aMaintainer, aRichText, aValidator, KArabicInParenthesis());
	insertArabBrackets.ExecuteL(KArabicMoreThanALine().Length(), KArabicInParenthesis().Length());
	User::After(1000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

// Just an arabic RTL sentence.
	aRichText.InsertL(0, KArabicMoreThanALine);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	aMaintainer.InitialiseViewL();

// Test formatting when inserting open parenthesis
	TInsertText insertOpen(aMaintainer, aRichText, aValidator, KOpenBracket());
	insertOpen.ExecuteL(KArabicMoreThanALine().Length(), KOpenBracket().Length());
	User::After(1000000);

// Test formatting when inserting RTL after opening parenthesis
	TInsertText insertArabicLessLine(aMaintainer, aRichText, aValidator, KArabicLessThanALine());
	insertArabicLessLine.ExecuteL(aRichText.DocumentLength()-1, KArabicLessThanALine().Length());
	User::After(1000000);

// Test formatting when inserting closing parenthesis after RTL text
	TInsertText insertClose(aMaintainer, aRichText, aValidator, KCloseBracket());
	insertClose.ExecuteL(aRichText.DocumentLength()-1, KOpenBracket().Length());
// This is now being displayed correctly
	User::After(10000000);

// Insert RTL text after parenthesis
	insertArabicLessLine.ExecuteL(aRichText.DocumentLength()-1, KArabicLessThanALine().Length());
// This is now being displayed correctly
	User::After(10000000);

	aRichText.Reset();
	aMaintainer.InitialiseViewL();

//Explicit Embedding testing
	aRichText.InsertL(0, KEnglishShortParagraph);
	aRichText.InsertL(aRichText.DocumentLength(), KRLE);
	aRichText.InsertL(aRichText.DocumentLength(), KFirstWordArabic);
	aRichText.InsertL(aRichText.DocumentLength(), KFirstWord);
	aRichText.InsertL(aRichText.DocumentLength(), KSecondWordArabic);
	aRichText.InsertL(aRichText.DocumentLength(), KSecondWord);
	aRichText.InsertL(aRichText.DocumentLength(), KThirdWordArabic);
	aRichText.InsertL(aRichText.DocumentLength(), KPDF);
	aRichText.InsertL(aRichText.DocumentLength(), KEnglishMoreThanALine_1);
	aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter);
	aMaintainer.InitialiseViewL();

	User::After(1000000);
	editPos=KEnglishShortParagraph().Length()+1;
//	TInsertText insertText2(aMaintainer, aRichText, aValidator, KEnglishLessThanALine_1());
	insertEnglish.ExecuteL(editPos,KEnglishLessThanALine_3().Length());
	User::After(1000000);
	}