From 27c0535a8a7becd719b48fc11f8e723884138b3f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sat, 12 May 2012 16:04:18 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/util/HandleRichText.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index dc7e25f89..8dda57671 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -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(); }