Messages with plain text (like the welcome message) are shown correctly.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4080 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-03-06 12:58:18 +00:00
parent 1027621e07
commit b245ad7cf7
2 changed files with 27 additions and 27 deletions

View File

@ -501,24 +501,18 @@ void p3MsgService::loadWelcomeMsg()
/* Load Welcome Message */ /* Load Welcome Message */
RsMsgItem *msg = new RsMsgItem(); RsMsgItem *msg = new RsMsgItem();
//msg -> PeerId(mConnMgr->getOwnId()); //msg -> PeerId(mConnMgr->getOwnId());
msg -> sendTime = time(NULL); msg -> sendTime = time(NULL);
msg -> recvTime = time(NULL); msg -> recvTime = time(NULL);
msg -> msgFlags = RS_MSG_FLAGS_NEW; msg -> msgFlags = RS_MSG_FLAGS_NEW;
msg -> subject = L"Welcome to Retroshare"; msg -> subject = L"Welcome to Retroshare";
msg -> message = L"Send and receive messages\n"; msg -> message = L"Send and receive messages with your friends...\n";
msg -> message += L"with your friends...\n\n"; msg -> message += L"These can hold recommendations from your local shared files.\n\n";
msg -> message += L"Add recommendations through the Local Files Dialog.\n\n";
msg -> message += L"These can hold recommendations\n"; msg -> message += L"Enjoy.";
msg -> message += L"from your local shared files\n\n";
msg -> message += L"Add recommendations through\n";
msg -> message += L"the Local Files Dialog\n\n";
msg -> message += L"Enjoy.\n";
msg -> msgId = getNewUniqueMsgId(); msg -> msgId = getNewUniqueMsgId();
@ -1280,11 +1274,11 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
{ {
mi.msgflags |= RS_MSG_PENDING; mi.msgflags |= RS_MSG_PENDING;
} }
if (msg->msgFlags & RS_MSG_FLAGS_DRAFT) if (msg->msgFlags & RS_MSG_FLAGS_DRAFT)
{ {
mi.msgflags |= RS_MSG_DRAFT; mi.msgflags |= RS_MSG_DRAFT;
} }
if (msg->msgFlags & RS_MSG_FLAGS_NEW) if (msg->msgFlags & RS_MSG_FLAGS_NEW)
{ {
mi.msgflags |= RS_MSG_NEW; mi.msgflags |= RS_MSG_NEW;
} }
@ -1292,7 +1286,7 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
{ {
mi.msgflags |= RS_MSG_TRASH; mi.msgflags |= RS_MSG_TRASH;
} }
if (msg->msgFlags & RS_MSG_FLAGS_UNREAD_BY_USER) if (msg->msgFlags & RS_MSG_FLAGS_UNREAD_BY_USER)
{ {
mi.msgflags |= RS_MSG_UNREAD_BY_USER; mi.msgflags |= RS_MSG_UNREAD_BY_USER;
} }
@ -1348,7 +1342,7 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
it != msg->attachment.items.end(); it++) it != msg->attachment.items.end(); it++)
{ {
FileInfo fi; FileInfo fi;
fi.fname = RsDirUtil::getTopDir(it->name); fi.fname = RsDirUtil::getTopDir(it->name);
fi.size = it->filesize; fi.size = it->filesize;
fi.hash = it->hash; fi.hash = it->hash;
fi.path = it->path; fi.path = it->path;
@ -1375,11 +1369,11 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
{ {
mis.msgflags |= RS_MSG_PENDING; mis.msgflags |= RS_MSG_PENDING;
} }
if (msg->msgFlags & RS_MSG_FLAGS_DRAFT) if (msg->msgFlags & RS_MSG_FLAGS_DRAFT)
{ {
mis.msgflags |= RS_MSG_DRAFT; mis.msgflags |= RS_MSG_DRAFT;
} }
if (msg->msgFlags & RS_MSG_FLAGS_NEW) if (msg->msgFlags & RS_MSG_FLAGS_NEW)
{ {
mis.msgflags |= RS_MSG_NEW; mis.msgflags |= RS_MSG_NEW;
} }

View File

@ -19,6 +19,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <QTextBrowser>
#include "HandleRichText.h" #include "HandleRichText.h"
@ -49,7 +50,12 @@ QString formatText(const QString &text, unsigned int flag)
} }
QDomDocument doc; QDomDocument doc;
doc.setContent(text); if (doc.setContent(text) == false) {
// convert text with QTextBrowser
QTextBrowser textBrowser;
textBrowser.setText(text);
doc.setContent(textBrowser.toHtml());
}
QDomElement body = doc.documentElement(); QDomElement body = doc.documentElement();
if (flag & RSHTML_FORMATTEXT_EMBED_SMILEYS) { if (flag & RSHTML_FORMATTEXT_EMBED_SMILEYS) {