diff options
| author | Remko Tronçon <git@el-tramo.be> | 2009-11-15 13:03:05 (GMT) |
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2009-11-15 13:33:17 (GMT) |
| commit | bd4e48adb3f23f80abc8441bf359166fbe9b621c (patch) | |
| tree | 9141e6e7c68e28e14961491459d5996a1d957067 /Swift/QtUI/QtChatWindow.cpp | |
| parent | 22973faaced00f3307efbb8b8fc4e914de7023e8 (diff) | |
| download | swift-bd4e48adb3f23f80abc8441bf359166fbe9b621c.zip swift-bd4e48adb3f23f80abc8441bf359166fbe9b621c.tar.bz2 | |
Linkify URLs.
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
| -rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index fc8dc1e..bebebe8 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -1,10 +1,11 @@ #include "QtChatWindow.h" #include "QtSwiftUtil.h" #include "Roster/QtTreeWidget.h" #include "Roster/QtTreeWidgetFactory.h" +#include "SwifTools/Linkify.h" #include "QtChatView.h" #include "MessageSnippet.h" #include "SystemMessageSnippet.h" #include "QtTextEdit.h" #include <QApplication> @@ -152,12 +153,13 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b if (label) { htmlString = QString("<span style=\"border: thin dashed grey; padding-left: .5em; padding-right: .5em; color: %1; background-color: %2; font-size: 90%; margin-right: .5em; \">").arg(Qt::escape(P2QSTRING(label->getForegroundColor()))).arg(Qt::escape(P2QSTRING(label->getBackgroundColor()))); htmlString += QString("%3</span> ").arg(Qt::escape(P2QSTRING(label->getDisplayMarking()))); } QString messageHTML(Qt::escape(P2QSTRING(message))); messageHTML.replace("\n","<br/>"); + messageHTML = P2QSTRING(Linkify::linkify(Q2PSTRING(messageHTML))); htmlString += messageHTML; bool appendToPrevious = !previousMessageWasSystem_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); QString qAvatarPath = avatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded(); messageLog_->addMessage(MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), QDateTime::currentDateTime(), qAvatarPath, senderIsSelf, appendToPrevious)); |
Swift