diff options
author | Catalin Badea <catalin.badea392@gmail.com> | 2012-07-29 13:42:06 (GMT) |
---|---|---|
committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-11 15:59:13 (GMT) |
commit | 94ff6ec9e699a2db97775063eb7fa2f6d24b281a (patch) | |
tree | 80d093df35ea27b258957130c53b859faad5e177 /Swift/QtUI/QtHistoryWindow.cpp | |
parent | c0f0ab471345fe3f3a3517bb302c7da1549c8f25 (diff) | |
download | swift-contrib-94ff6ec9e699a2db97775063eb7fa2f6d24b281a.zip swift-contrib-94ff6ec9e699a2db97775063eb7fa2f6d24b281a.tar.bz2 |
Fix adding messages at the top.
Diffstat (limited to 'Swift/QtUI/QtHistoryWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index a0ccbf9..d9b587f 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -117,8 +117,8 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string & QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); if (addAtTheTop) { - // bool appendToPrevious = ((senderIsSelf && previousTopMessageWasSelf_) || (!senderIsSelf && !previousTopMessageWasSelf_&& previousTopSenderName_ == P2QSTRING(senderName))); - conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, false, theme_, P2QSTRING(id)))); + bool appendToPrevious = ((senderIsSelf && previousTopMessageWasSelf_) || (!senderIsSelf && !previousTopMessageWasSelf_&& previousTopSenderName_ == P2QSTRING(senderName))); + conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); previousTopMessageWasSelf_ = senderIsSelf; previousTopSenderName_ = P2QSTRING(senderName); @@ -206,4 +206,10 @@ void QtHistoryWindow::handleFontResized(int fontSizeSteps) { emit fontResized(fontSizeSteps); } +void QtHistoryWindow::resetConversationViewTopInsertPoint() { + previousTopMessageWasSelf_ = false; + previousTopSenderName_ = QString(); + conversation_->resetTopInsertPoint(); +} + } |