Set view to track new elements as they are added

Summary: Set the currentIndex of the ConversationDisplay to show the newest messages by default, but stay where the user positioned it if viewing older messages

Test Plan:
Launch SMS App:
 - Select conversation
 - View should show the most recent messages
 - Receive new message
 - View should scroll to show the new message
 - Scroll up to view older messages
 - Receive new message
 - View should continue to show older messages and not scroll to the bottom

Reviewers: nicolasfella

Reviewed By: nicolasfella

Subscribers: nicolasfella, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D15562
This commit is contained in:
Simon Redman 2018-09-16 15:52:32 -06:00
parent 707a4bd252
commit d742684d21

View file

@ -56,7 +56,13 @@ Kirigami.ScrollablePage
sentByMe: model.fromMe
dateTime: new Date(model.date)
}
// Set the view to start at the bottom of the page and track new elements if it was not manually scrolled up
currentIndex: atYEnd ?
count - 1 :
currentIndex
}
footer: RowLayout {
enabled: page.device
TextField {