Fixed handling of html links in HandleRichText::formatText.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5162 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-05-12 16:04:18 +00:00
parent 02a7548de4
commit 27c0535a8a

View File

@ -277,18 +277,17 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
switch(embedInfos.myType) {
case Ahref:
{
insertedTag = doc.createElement("a");
insertedTag.setAttribute("href", embedInfos.myRE.cap(0));
insertedTag.appendChild(doc.createTextNode(embedInfos.myRE.cap(0)));
RetroShareLink link(embedInfos.myRE.cap(0));
if (link.valid()) {
insertedTag = doc.createElement("a");
insertedTag.setAttribute("href", embedInfos.myRE.cap(0));
QString title = link.title();
if (!title.isEmpty()) {
insertedTag.setAttribute("title", title);
}
insertedTag.appendChild(doc.createTextNode(embedInfos.myRE.cap(0)));
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
replaceAnchorWithImg(doc, insertedTag, textDocument, link);
}
@ -304,10 +303,8 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
break;
}
if (!insertedTag.isNull()) {
currentElement.insertBefore(insertedTag, node);
index++;
}
currentElement.insertBefore(insertedTag, node);
index++;
currentPos = nextPos + embedInfos.myRE.matchedLength();
}