Hi all,
I want to get the text messages from the Inbox folder, and then display them on a RichText Editor.
I am able to get the msgText in a Tbuf Object, but when I show this text on the Editor , It shows strange characters.
Code:
///////////////////////////////////////////////////////////////////////////////////
TDes CSmsHandler::GetMsgTextL()
{
TBuf16<500> SMSContent;
CMsvEntry* entry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
CleanupStack::PushL(entry);
CMsvEntrySelection* entries = entry->ChildrenL();
CleanupStack::PopAndDestroy(entry) ;
//entry = NULL ;
TInt nCount = entries->Count();
for(TInt index = 0; index < 1; index++) // just getting the first
// entry for testing
{
TMsvId entryID = entries->At(index);
iSmsMtm->SwitchCurrentEntryL(entryID);
iSmsMtm->LoadMessageL();
entry = iSession->GetEntryL(entryID);
CleanupStack::PushL(entry);
TMsvEntry msvEntry = entry->Entry();
TPtrC nn = msvEntry.iDescription;
CMsvEntry* entry22= iSession->GetEntryL((*entries)[index]);
CMsvStore* inboxStore= entry22->ReadStoreL();
if (inboxStore->HasBodyTextL())
{
CRichText& richText= iSmsMtm->Body();
inboxStore->RestoreBodyTextL(richText);
const TInt length = richText.DocumentLength();
SMSContent.Zero();
SMSContent.Copy(richText.Read(0,length));
}
CleanupStack::PopAndDestroy(entry); // entry
}
return SMSContent;
}
/////////////////////////////////////////////////////////////////////////
In my Application View class I send this TBuf data as a parameter to following function,to draw it on a RichText Editor.
Code:
void CRichTextEditorRTE:rawTextWithoutCarriageL( const TDesC& aText )
{
CRichText* text = RichText();
TInt textSize = text->DocumentLength();
// Interested in color
iCharacterFormatMask.SetAttrib(EAttColor);
// Set it to Black
iCharacterFormat.iFontPresentation.iTextColor = KRgbBlack;
text->InsertL (textSize, aText);
// Apply formatting
text->ApplyCharFormatL(iCharacterFormat, iCharacterFormatMask,
textSize,aText.Length());
HandleTextChangedL();
}
///////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
But it is showing strange characters on the Mobile screen..
Is there any special way to show the RichText data??????
Waiting for ur valuable suggestions.......
Regards,
Saad Mansur

rawTextWithoutCarriageL( const TDesC& aText )


