Merge pull request #1104 from RetroPooh/linkaddrtooltips

add tooltips with address to urls
This commit is contained in:
csoler 2017-11-11 16:33:30 +01:00 committed by GitHub
commit 240d3a6f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -388,6 +388,20 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
replaceAnchorWithImg(doc, element, textDocument, link);
}
}
else
{
QUrl url(element.attribute("href"));
if(url.isValid())
{
QString title = url.host();
if (!title.isEmpty()) {
element.setAttribute("title", title);
}
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
replaceAnchorWithImg(doc, element, textDocument, url);
}
}
}
} else {
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
RetroShareLink link(element.attribute("href"));
@ -443,6 +457,20 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
replaceAnchorWithImg(doc, insertedTag, textDocument, link);
}
}
else
{
QUrl url(myRE.cap(0));
if(url.isValid())
{
QString title = url.host();
if (!title.isEmpty()) {
insertedTag.setAttribute("title", title);
}
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
replaceAnchorWithImg(doc, insertedTag, textDocument, url);
}
}
}
}
break;
case Img: