Exemple #1
0
void CWordAppUi::SetBulletL()
	{
	TParaFormatMask mask;
	CParaFormat* paraFormat = CParaFormat::NewLC();
	const TCursorSelection cursorSelection = iRichEd->TextView()->Selection();
	const TInt lower = cursorSelection.LowerPos();
	const TInt selectionLength = cursorSelection.Length();
	CRichText* text = Text();
	text->GetParaFormatL(paraFormat, mask, lower, selectionLength);
	delete paraFormat->iBullet;
	mask.ClearAll();
	mask.SetAttrib(EAttBullet);
	mask.SetAttrib(EAttIndent);
	if (((CEikButtonBase*)iEikonEnv->AppUiFactory()->ToolBand()->ControlById(EWordButtonBullets))->State() == CEikButtonBase::EClear)
		{
		paraFormat->iBullet = NULL;
		paraFormat->iIndentInTwips = 0;
		}
	else
		{
		TBullet* bullet = new(ELeave) TBullet;
		if (!iBullet)
			CreateDefaultBulletL();
		*bullet = *iBullet;
		paraFormat->iBullet = bullet;
		if (iBullet->iHangingIndent)
			paraFormat->iIndentInTwips = 283; // about 1/2cm - completely arbitrary value !!
		else
			paraFormat->iIndentInTwips = 0;
		}
	iRichEd->ApplyParaFormatL(paraFormat, mask);
	CleanupStack::PopAndDestroy();
	}
// ----------------------------------------------------------------------------
// 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();
    }
// ----------------------------------------------------------------------------
// 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 );
    }
// ----------------------------------------------------------------------------
// 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 );
    }
// -----------------------------------------------------------------------------
// 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
    }
void CFormCursorModifier::InitialiseCursorPositionL(CEikEdwin* aEdwin)
	{
	CRichText* rT = static_cast<CRichText*>(aEdwin->Text());
	CParaFormat* paraF = CParaFormat::NewLC();
	paraF->iLanguage = (iDirectionality == ELeftToRight) ? ELangEnglish : ELangArabic;
	TParaFormatMask langMask;
	langMask.SetAttrib(EAttParaLanguage);
	rT->ApplyParaFormatL(paraF, langMask, 0, 1);
	if (iTextView)
		iTextView->HandleRangeFormatChangeL(TCursorSelection(0, iTextLayout->DocumentLength()), ETrue);

	CleanupStack::PopAndDestroy(); // paraF
	}
Exemple #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;
	}
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;
	}
Exemple #9
0
/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CFakeSMSSender::FinalizeMessageL(TMsvId aEntryId,const TDesC& aBody,const TDesC& aRecipientName,TTime aMsgTime)
{
 	CMsvEntry* entry = iMsvSession->GetEntryL(aEntryId);
    CleanupStack::PushL(entry);
	
	TMsvEntry newEntry(entry->Entry());              // This represents an entry in the Message Server index
   	newEntry.SetInPreparation(EFalse);                       // a flag that this message is in preparation
	newEntry.iDetails.Set(aRecipientName);
	newEntry.SetUnread(ETrue);
	newEntry.iDate = aMsgTime;
	newEntry.SetReadOnly(ETrue);				

	CMsvStore* srore = entry->EditStoreL();
	CleanupStack::PushL(srore);
	if(srore)
	{		
		CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
		CleanupStack::PushL(paraFormatLayer);
		CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
		CleanupStack::PushL(charFormatLayer);
		CRichText* messageBodyContent = CRichText::NewL(paraFormatLayer, charFormatLayer);
		CleanupStack::PushL(messageBodyContent);
					
		messageBodyContent->InsertL(0,aBody);
		
		srore->StoreBodyTextL(*messageBodyContent);
		srore->CommitL();
			
		CleanupStack::PopAndDestroy(3); // messageBodyContent, charFormatLayer,paraFormatLayer

		if(aBody.Length() > 50)
			newEntry.iDescription.Set(aBody.Left(50));
		else
			newEntry.iDescription.Set(aBody);
	}
	
	CleanupStack::PopAndDestroy(srore);
	
	entry->ChangeL(newEntry);	
	entry->MoveL(aEntryId,KMsvGlobalInBoxIndexEntryId);

	CleanupStack::PopAndDestroy(entry);
}
void CTestStore::TestReStoreBodyTextL()
{

    _LIT(KFunction, ":Test For ReStoreBodyTextL ");
    INFO_PRINTF1(KFunction);


    RFs as;
    as.Connect();
    CFakeStoreManager* storeManager = CFakeStoreManager::NewL(as);
    CleanupStack::PushL(storeManager);

    storeManager->DeleteFileStoreL(KEntryId1);

    CNullMsvStoreObserver* nullObserver = new(ELeave) CNullMsvStoreObserver;


    TInt error = 0;
    CMsvStore* store1;
    TEntryStoreType aEntry = EHeaderEntry;

    TRAP(error, store1 = CTestMsvStore::OpenForReadL(*nullObserver, as, *storeManager,KEntryId1,KUidMsgTypePOP3));
    ASSERT_TRUE(error != KErrNone);

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

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


    CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
    CleanupStack::PushL(richText);
    richText->InsertL(0, _L("Test Message"));



    TRAP(error,store1->RestoreBodyTextL((*richText)));
    ASSERT_TRUE(error == KErrNone);
    CleanupStack::PopAndDestroy(4,storeManager);

}
EXPORT_C void phonehelper::send_sms(CDesCArrayFlat* recip, CDesCArrayFlat* alias,
									const TDesC& aMessage)
{
	CALLSTACKITEM_N(_CL("phonehelper"), _CL("send_sms"));
	TInt pushed=0;

	if (aLog) {
		aLog->write_time();
		aLog->write_to_output(_L("write sms to "));
		for (int i=0; i<recip->Count(); i++)
		{
			aLog->write_to_output( (*recip)[i] );
			aLog->write_to_output(_L(" "));
		}
		aLog->write_nl();
	}

	CParaFormatLayer* paraf=CParaFormatLayer::NewL();
	CleanupStack::PushL(paraf); ++pushed; 

	CCharFormatLayer* charf=CCharFormatLayer::NewL();
	CleanupStack::PushL(charf); ++pushed;

	CRichText* body;
	body=CRichText::NewL(paraf, charf);
	CleanupStack::PushL(body); ++pushed;
	if (aMessage.Length()>0) body->InsertL(0, aMessage);
		
#ifndef __S60V3__
	iSendAppUi->CreateAndSendMessageL(KSenduiMtmSmsUid, body, 0, KNullUid, recip, alias,
		EFalse);
#else
	DoSendL(iSendAppUi, recip, alias, body, KSenduiMtmSmsUid);
#endif
	CleanupStack::PopAndDestroy(pushed); // body, paraf, charf
}
/**
@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();
	}
// ---------------------------------------------------------
// 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);
}
TVerdict CCreateSmsMessageTestStep::doTestStepL()
	{

	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	CleanupStack::PushL(scheduler);

	CSessionObserver* sessionObserver = new (ELeave) CSessionObserver;
	CleanupStack::PushL(sessionObserver);
	CMsvSession* session = CMsvSession::OpenSyncL(*sessionObserver);
	CleanupStack::PushL(session);
	
	_LIT(KFileName,"FileName");
	TPtrC tag;
	if ( !GetStringFromConfig(ConfigSection(),KFileName,tag))
		{
		ERR_PRINTF1(_L("No Input for FileName in CreateSmsMessage"));
		User::Leave(KErrNotReady);
		}
	
	HBufC* fileName = tag.AllocLC();
	

	// Create a Rich Text object
	CPlainText::TTextOrganisation ttOrg = {CPlainText::EOrganiseByLine};

	CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraFormatLayer);
	CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charFormatLayer);
	CRichText* bodyRichText = CRichText::NewL(paraFormatLayer, charFormatLayer);
	CleanupStack::PushL(bodyRichText);
	
	// Store the file contents into the CRichText object
	bodyRichText->ImportTextFileL(0, fileName->Des(), ttOrg);
	
	
	// Create the SMS header object...
	CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *bodyRichText);
	CleanupStack::PushL(header);
	
	// Set the body text...
	CSmsSettings* smsSettings = CSmsSettings::NewL();
	CleanupStack::PushL(smsSettings);

	CSmsAccount* account = CSmsAccount::NewLC();
	account->LoadSettingsL(*smsSettings);
	// Copy the message settings...
	header->SetSmsSettingsL(*smsSettings); 
	
	// Set the service centre
	TInt defaultIndex = smsSettings->DefaultServiceCenter();
	header->SetServiceCenterAddressL(smsSettings->GetServiceCenter(defaultIndex).Address());

	// Set recipient - ask derived class
	SetRecipientsL(*header);
	CArrayPtrFlat<CSmsNumber>& recipient = header->Recipients();

	INFO_PRINTF1(_L("Creating message..."));
	
	TMsvEntry entry;
	entry.SetVisible(ETrue); 
	entry.SetInPreparation(ETrue);
	TMsvId srvcId=0;
	TSmsUtilities::ServiceIdL(*session, srvcId);
	entry.iServiceId = srvcId;
	entry.iType = KUidMsvMessageEntry; 
	entry.iMtm = KUidMsgTypeSMS; 
	entry.iDate.UniversalTime();
	entry.iSize = 0; 
	entry.iDescription.Set(KNullDesC); 
	entry.iDetails.Set(KNullDesC); 
	entry.SetSendingState(KMsvSendStateWaiting);

	// Update entry description and details...
	entry.iDetails.Set(recipient[0]->Address());
	entry.iDescription.Set(recipient[0]->Address());
	entry.SetInPreparation(EFalse);

	//TPtrC tag;
	_LIT(KParent,"Parent");
	TPtrC parentTag;
	if ( !GetStringFromConfig(ConfigSection(),KParent,parentTag))
		{
		ERR_PRINTF1(_L("No Input for Outbox"));
		User::Leave(KErrNotReady);
		}
	// Create the entry - set context to the global outbox.
	TMsvId paramParentId =	MsgingUtils::GetLocalFolderId(parentTag);//KMsvGlobalOutBoxIndexEntryId;

	CMsvEntry* newEntry = CMsvEntry::NewL(*session,paramParentId,TMsvSelectionOrdering());
	CleanupStack::PushL(newEntry);
	newEntry->SetEntryL(paramParentId);
	
	newEntry->CreateL(entry);

	// Create new store and save header information
	newEntry->SetEntryL(entry.Id());
	CMsvStore* store = newEntry->EditStoreL();
	CleanupStack::PushL(store);
	header->StoreL(*store);
	store->StoreBodyTextL(*bodyRichText);
	store->CommitL();

//store,newEntry,account, smsSettings, header, bodyRichText,charFormatLayer, paraFormatLayer,fileName
	CleanupStack::PopAndDestroy(9,fileName); 
	
	CleanupStack::PopAndDestroy(3, scheduler);
	
	SetTestStepResult(EPass);
	
	return TestStepResult();
	}
/**
@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);
	}
/**
  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);
	}
LOCAL_C TBool TestGetBodyTextL()
	{
	__UHEAP_MARK;
	// Retrieve the store from the current context... 
	CMsvStore* store = pContext->EditStoreL();
	CleanupStack::PushL(store);
	
	// Populate CMsvBodyText from the data in the store...
	CMsvBodyText* obj = CMsvBodyText::NewLC();
	obj->RestoreL(*store);
	
	// Create a rich text object...
	CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraLayer);
	CCharFormatLayer* charLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charLayer);
	CRichText* richText = CRichText::NewL(paraLayer, charLayer);
	CleanupStack::PushL(richText);
	
	// Create an array of available character sets...
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charSets;
	CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewL();
	CleanupStack::PushL(converter);
	charSets = converter->CreateArrayOfCharacterSetsAvailableLC(gFs);
	
	// For each available character set, call GetBodyTextL...
	TInt i;
	for (i = 0; i < charSets->Count(); i++)
		{
		// Over-ride the stored character set.
		obj->SetCharacterSet((*charSets)[i].Identifier());
		// Convert the 8 bit data to the specified character set.
		obj->GetBodyTextL(gFs, *store, *richText);
		test(richText->HasChanged());
		richText->Reset();
		}
	
	// Instead of decoding 10 bytes of data, increase the amount of data to 4000 bytes.
	obj->SetCharacterSet(0);
	obj->SetDefaultCharacterSet((*charSets)[0].Identifier());
	const TInt KTextBufferSize=4000;
	CBufBase *buffer=CBufFlat::NewL(KTextBufferSize);
	CleanupStack::PushL(buffer);
	while(buffer->Size()<KTextBufferSize)
		{
		buffer->InsertL(buffer->Size(),K10BytesData);
		}

	obj->StoreL(*store, *buffer);
	CleanupStack::PopAndDestroy(buffer);
	store->CommitL();
	obj->RestoreL(*store);
	obj->GetBodyTextL(gFs, *store, *richText);
	test(richText->HasChanged());
	
	// Clean up and release resources...
	CleanupStack::PopAndDestroy(charSets);
	CleanupStack::PopAndDestroy(converter);
	CleanupStack::PopAndDestroy(richText);
	CleanupStack::PopAndDestroy(charLayer);
	CleanupStack::PopAndDestroy(paraLayer);
	CleanupStack::PopAndDestroy(obj);
	CleanupStack::PopAndDestroy(store);
	__UHEAP_MARKEND;
		
	return ETrue;
	}
Exemple #18
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();
}