Enabled clickable links in forums and messages.

Added new translation in messages (count of recommended files).
Fixed german translation.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3946 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-30 17:09:32 +00:00
parent 2307ef04a0
commit ad67844c7a
14 changed files with 80 additions and 77 deletions

View file

@ -22,8 +22,9 @@
#include "HandleRichText.h"
namespace RsChat {
namespace RsHtml {
EmbedInHtmlImg defEmbedImg;
void EmbedInHtmlImg::InitFromAwkwardHash(const QHash< QString, QString >& hash)
{
@ -40,6 +41,27 @@ void EmbedInHtmlImg::InitFromAwkwardHash(const QHash< QString, QString >& hash)
myRE.setPattern(newRE);
}
QString formatText(const QString &text, unsigned int flag)
{
if (flag == 0) {
// nothing to do
return text;
}
QDomDocument doc;
doc.setContent(text);
QDomElement body = doc.documentElement();
if (flag & RSHTML_FORMATTEXT_EMBED_SMILEYS) {
embedHtml(doc, body, defEmbedImg);
}
if (flag & RSHTML_FORMATTEXT_EMBED_LINKS) {
EmbedInHtmlAhref defEmbedAhref;
embedHtml(doc, body, defEmbedAhref);
}
return doc.toString(-1); // -1 removes any annoying carriage return misinterpreted by QTextEdit
}
/**
* Parses a DOM tree and replaces text by HTML tags.
@ -123,5 +145,4 @@ void embedHtml(QDomDocument& doc, QDomElement& currentElement, EmbedInHtml& embe
}
}
} // namespace RsChat
} // namespace RsHtml