import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import org.yachat.app 1.0 Page { header: CustToolbar { title: qsTr("Contacts") ToolButton { text: qsTr("+") anchors.left: parent.left onClicked: stack.push("qrc:/org/yachat/app/Accounts.qml", {}) } } ListView { ListModel { id: cmodel } Connections { target: Yc function onNewConversation(jid, to, lastmsg) { console.log("jid:", jid, ", to:", to, ", lastmsg:", lastmsg) cmodel.append({ "jid": jid, "to": to, "lastmsg": lastmsg, }) } } width: parent.width anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter model: cmodel delegate: ItemDelegate { required property var model width: parent.width text: model.to + " (" + model.jid + ")" anchors.horizontalCenter: parent.horizontalCenter onClicked: { Yc.startChat(model.jid, model.to) stack.push( "qrc:/org/yachat/app/ChatView.qml", {destination: model.to} ) } } } }