From 8867a5e938bcfd9ddb55830373dd46b45daca1d9 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 6 Jul 2015 17:32:49 +0200
Subject: Stay scrolled at bottom of chat view during a file transfer

Swift did not remember the correct scrolled-at-bottom position for
the current chat view after it added/updated file-transfer UI to the
chat view.

Test-Information:

Tested with two Swift instances (one with the fix, one without) and
send files in both directions. The instance with this fix, scrolls
down along with new messages as they are recevied if the chat view
is scrolled to the bottom.

Change-Id: Ia9afa68254c3add5f7677b1f4b7ed3c7e1edcf6f

diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp
index 57706d4..0c82e73 100644
--- a/Swift/QtUI/QtWebKitChatView.cpp
+++ b/Swift/QtUI/QtWebKitChatView.cpp
@@ -418,6 +418,7 @@ static QWebElement findElementWithID(QWebElement document, QString elementName,
 }
 
 void QtWebKitChatView::setFileTransferProgress(QString id, const int percentageDone) {
+	rememberScrolledToBottom();
 	QWebElement ftElement = findElementWithID(document_, "div", id);
 	if (ftElement.isNull()) {
 		SWIFT_LOG(debug) << "Tried to access FT UI via invalid id!" << std::endl;
@@ -431,6 +432,7 @@ void QtWebKitChatView::setFileTransferProgress(QString id, const int percentageD
 }
 
 void QtWebKitChatView::setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& /* msg */) {
+	rememberScrolledToBottom();
 	QWebElement ftElement = findElementWithID(document_, "div", id);
 	if (ftElement.isNull()) {
 		SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl;
-- 
cgit v0.10.2-6-g49f6