Fixed message reply and forward.

The new lines were removed falsely.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4815 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-01-18 23:00:50 +00:00
parent 8a86c980fc
commit 80a20b41a3
3 changed files with 17 additions and 3 deletions

View File

@ -269,4 +269,17 @@ void optimizeHtml(QTextEdit *textEdit, QString &text)
std::cerr << "Optimized text to " << text.length() << " bytes , instead of " << textEdit->toHtml().length() << std::endl;
}
QString toHtml(QString text, bool realHtml)
{
// replace "\n" from the optimized html with "<br>"
text.replace("\n", "<br>");
if (!realHtml) {
return text;
}
QTextDocument doc;
doc.setHtml(text);
return doc.toHtml();
}
} // namespace RsHtml

View File

@ -114,6 +114,7 @@ QString formatText(const QString &text, unsigned int flag);
bool findAnchors(const QString &text, QStringList& urls);
void optimizeHtml(QTextEdit *textEdit, QString &text);
QString toHtml(QString text, bool realHtml = true);
} // namespace RsHtml

View File

@ -1018,7 +1018,7 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), REPLY);
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg));
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
msgComposer->insertPastedText(doc.toPlainText());
msgComposer->addRecipient(MessageComposer::TO, msgInfo.srcId, false);
@ -1062,7 +1062,7 @@ MessageComposer *MessageComposer::forwardMsg(const std::string &msgId)
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), FORWARD);
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
msgComposer->insertForwardPastedText(doc.toPlainText());