mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
8a86c980fc
commit
80a20b41a3
@ -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;
|
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
|
} // namespace RsHtml
|
||||||
|
@ -113,7 +113,8 @@ extern EmbedInHtmlImg defEmbedImg;
|
|||||||
QString formatText(const QString &text, unsigned int flag);
|
QString formatText(const QString &text, unsigned int flag);
|
||||||
bool findAnchors(const QString &text, QStringList& urls);
|
bool findAnchors(const QString &text, QStringList& urls);
|
||||||
|
|
||||||
void optimizeHtml(QTextEdit *textEdit, QString &text);
|
void optimizeHtml(QTextEdit *textEdit, QString &text);
|
||||||
|
QString toHtml(QString text, bool realHtml = true);
|
||||||
|
|
||||||
} // namespace RsHtml
|
} // namespace RsHtml
|
||||||
|
|
||||||
|
@ -1018,7 +1018,7 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
|||||||
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), REPLY);
|
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), REPLY);
|
||||||
|
|
||||||
QTextDocument doc ;
|
QTextDocument doc ;
|
||||||
doc.setHtml(QString::fromStdWString(msgInfo.msg));
|
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
|
||||||
|
|
||||||
msgComposer->insertPastedText(doc.toPlainText());
|
msgComposer->insertPastedText(doc.toPlainText());
|
||||||
msgComposer->addRecipient(MessageComposer::TO, msgInfo.srcId, false);
|
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);
|
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), FORWARD);
|
||||||
|
|
||||||
QTextDocument doc ;
|
QTextDocument doc ;
|
||||||
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
|
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
|
||||||
|
|
||||||
msgComposer->insertForwardPastedText(doc.toPlainText());
|
msgComposer->insertForwardPastedText(doc.toPlainText());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user