diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-09-17 18:25:42 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-09-17 18:25:42 (GMT) |
commit | 4ef1fd90a178b8525644181615844f6a16e2afd2 (patch) | |
tree | 9167c23042350554ebb65db1bff0c8580b4e5ece /Swift | |
parent | 9a960adf955b2af95ecd34b81b7a29c0ee9e5aa7 (diff) | |
download | swift-contrib-4ef1fd90a178b8525644181615844f6a16e2afd2.zip swift-contrib-4ef1fd90a178b8525644181615844f6a16e2afd2.tar.bz2 |
Scroll to bottom after amending messages as well.
Resolves: #570
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 696d16a..0f7e87b 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -87,19 +87,21 @@ void QtChatView::addToDOM(boost::shared_ptr<ChatSnippet> snippet) { } lastElement_ = newElement; if (bottom) { - /* Warning: I'm not confident about this.*/ + /* Warning: I'm not confident about this, although it does work.*/ QTimer::singleShot(0, this, SLOT(scrollToBottom())); } } void QtChatView::replaceLastMessage(const QString& newMessage) { - /* FIXME: must be queued */ + /* FIXME: must be queued? */ + bool bottom = isScrolledToBottom(); QWebElement replace = lastElement_.findFirst("span.swift_message"); assert(!replace.isNull()); QString old = lastElement_.toOuterXml(); replace.setInnerXml(ChatSnippet::escape(newMessage)); - //qDebug() << "Replacing old: " << old; - //qDebug() << "With new: " << lastElement_.toOuterXml(); + if (bottom) { + QTimer::singleShot(0, this, SLOT(scrollToBottom())); + } } void QtChatView::replaceLastMessage(const QString& newMessage, const QString& note) { |