From 03d607e379ac9fe48315ce121ada76338ed6686d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 12 Jul 2017 00:45:41 +0200 Subject: Instead of emulating it we can also just layout the items in reverse order --- framework/qml/ConversationView.qml | 30 ++---------------------------- framework/src/domain/maillistmodel.cpp | 4 ++-- 2 files changed, 4 insertions(+), 30 deletions(-) (limited to 'framework') diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index d5b64ea4..2f499752 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml @@ -17,7 +17,6 @@ */ import QtQuick 2.7 -import QtQuick.Controls 1.3 as Controls1 import QtQuick.Controls 2 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube @@ -65,6 +64,8 @@ Rectangle { anchors.fill: parent + verticalLayoutDirection: ListView.BottomToTop + function setCurrentIndex() { /** @@ -117,33 +118,6 @@ Rectangle { //Optimize for view quality pixelAligned: true - Timer { - id: scrollToEndTimer - interval: 10 - running: false - repeat: false - onTriggered: { - //Only do this once per conversation - root.scrollToEnd = false; - root.currentIndex = listView.count - 1 - //positionViewAtEnd/Index don't work - listView.contentY = Math.max(listView.contentHeight - listView.height, 0) - } - } - - onCountChanged: { - if (root.scrollToEnd) { - scrollToEndTimer.restart() - } - } - - onContentHeightChanged: { - //Initially it will resize a lot, so we keep waiting - if (root.scrollToEnd) { - scrollToEndTimer.restart() - } - } - onContentYChanged: { //We have to track our current mail manually setCurrentIndex(); diff --git a/framework/src/domain/maillistmodel.cpp b/framework/src/domain/maillistmodel.cpp index fa0dda04..2d9f3147 100644 --- a/framework/src/domain/maillistmodel.cpp +++ b/framework/src/domain/maillistmodel.cpp @@ -295,8 +295,8 @@ void MailListModel::setMail(const QVariant &variant) mFetchMails = true; mFetchedMails.clear(); qDebug() << "Running mail query: " << mail->resourceInstanceIdentifier() << mail->identifier(); - //Latest mail at the bottom - sort(0, Qt::AscendingOrder); + //Latest mail on top + sort(0, Qt::DescendingOrder); runQuery(query); } -- cgit v1.2.3