diff --git a/smsapp/conversationmodel.h b/smsapp/conversationmodel.h --- a/smsapp/conversationmodel.h +++ b/smsapp/conversationmodel.h @@ -44,6 +44,8 @@ DateRole, }; + Q_ENUMS(Roles) + QString threadId() const; void setThreadId(const QString &threadId); diff --git a/smsapp/qml/ConversationDisplay.qml b/smsapp/qml/ConversationDisplay.qml --- a/smsapp/qml/ConversationDisplay.qml +++ b/smsapp/qml/ConversationDisplay.qml @@ -39,11 +39,14 @@ title: person && person.name ? i18n("%1: %2", person.name, phoneNumber) : phoneNumber ListView { - - model: ConversationModel { + model: QSortFilterProxyModel { id: model - deviceId: device.id() - threadId: page.conversationId + sortOrder: Qt.AscendingOrder + sortRole: ConversationModel.DateRole + sourceModel: ConversationModel { + deviceId: device.id() + threadId: page.conversationId + } } spacing: Kirigami.Units.largeSpacing @@ -62,7 +65,7 @@ placeholderText: i18n("Say hi...") onAccepted: { console.log("sending sms", page.phoneNumber) - model.sendReplyToConversation(message.text) + model.sourceModel.sendReplyToConversation(message.text) text = "" } }