summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-07-04 13:27:46 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-07-04 13:27:46 (GMT)
commit481067086c5df2e1d9b87ee863c1f5a6ccbd8933 (patch)
tree844e7d80c84cc7d2f5985dea821c57fb25f9e57a
parent5f006623bf624423a57ed5fbae2b8b1e90e4a66e (diff)
downloadswift-481067086c5df2e1d9b87ee863c1f5a6ccbd8933.zip
swift-481067086c5df2e1d9b87ee863c1f5a6ccbd8933.tar.bz2
Fix for avatar display in chatlog where the cache has spaces in the name.
This particularly hit c:\Documents and Settings on Windows.
-rw-r--r--Swift/QtUI/QtChatWindow.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index f4e0b0b..e6e0100 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -15,6 +15,7 @@
#include <QString>
#include <QTextEdit>
#include <QTime>
+#include <QUrl>
namespace Swift {
QtChatWindow::QtChatWindow(const QString &contact, QtTreeWidgetFactory *treeWidgetFactory) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false) {
@@ -146,7 +147,8 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b
htmlString += messageHTML;
bool appendToPrevious = !previousMessageWasSystem_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName)));
- messageLog_->addMessage(MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), QDateTime::currentDateTime(), (avatarPath.isEmpty() ? "qrc:/icons/avatar.png" : "file://" + P2QSTRING(avatarPath)), senderIsSelf, appendToPrevious));
+ 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));
previousMessageWasSelf_ = senderIsSelf;
previousSenderName_ = P2QSTRING(senderName);