本文整理汇总了C++中CMsvStore::RestoreBodyTextL方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvStore::RestoreBodyTextL方法的具体用法?C++ CMsvStore::RestoreBodyTextL怎么用?C++ CMsvStore::RestoreBodyTextL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvStore
的用法示例。
在下文中一共展示了CMsvStore::RestoreBodyTextL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteBodyDataL
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;
}
示例2: CheckMessageL
TBool CSmsReplyToStep::CheckMessageL()
{
INFO_PRINTF1(_L("Received new message in Inbox - should be status report..."));
TMsvSelectionOrdering ordering;
ordering.ShowInvisibleEntries();
CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId,ordering);
CleanupStack::PushL(entry);
CMsvEntrySelection* msvEntrySelection;
msvEntrySelection=entry->ChildrenL();
CleanupStack::PushL(msvEntrySelection);
// Check how many mesasges there are - should be just 1
TInt count = msvEntrySelection->Count();
INFO_PRINTF3(_L("Number of new messages: %d, should be: %d"), count, 1);
// Restore the message
CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *iTestUtils->iRichText);
CleanupStack::PushL(header);
entry->SetEntryL((*msvEntrySelection)[0]);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
header->RestoreL(*store);
if(store->HasBodyTextL())
{
store->RestoreBodyTextL(*iTestUtils->iRichText);
}
TBuf<KSmsDescriptionLength> desc;
User::LeaveIfError(TSmsUtilities::GetDescription(header->Message(), desc));
//Check for a reply address field
CSmsReplyAddressOperations& operations = STATIC_CAST(CSmsReplyAddressOperations&,header->Message().GetOperationsForIEL(CSmsInformationElement::ESmsReplyAddressFormat));
TBool result=operations.ContainsReplyAddressIEL();
CleanupStack::PopAndDestroy(4,entry);
return result;
}
示例3: unixEpoch
// ---------------------------------------------------------
// 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);
}