~nicohman/signal-rs

ref: ad7bba6ed316afe281e38a8327baf7c1bbf824da signal-rs/qml/chats/ChatList.qml -rw-r--r-- 1.7 KiB
ad7bba6e — nicohman Basic attachments 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.13 as Kirigami

Kirigami.ScrollablePage {
    title: qsTr("Chats")
    objectName: "chats"
    property string avatar: ""
    actions.main: Kirigami.Action {
        id: addChatAction
        icon.name: "list-add"
        text: "Create Chat"
        onTriggered: signalState.openView("createChat");
    }
    
    ListView {
        id: chatView
        anchors.fill: parent
        anchors.topMargin: 15
        delegate: ItemDelegate {
            x: 5
            width: chatView.width
            height: 40
            onClicked: {
                console.log("ChatList clicked");
                console.log(tel);
                signalState.currentChat = model;
                if (model.is_group) {
                    signalState.currentIsGroup = true;
                } else {
                    signalState.currentIsGroup = false;
                }
                signalState.setCurrent(tel);
                signal.show_chat(tel);
                signalState.openView("chatHistory");
            }
            Row {
                id: row1
                spacing: 10
                bottomPadding: 20
                Avatar {
                    tel: model.tel
                    width: 40
                    height: 40
                }
                Column {
                    Label {
                        text: signal.resolve_name(model.tel)
                        color: theme.text
                    }
                    Label {
                        color: theme.text
                        text: last
                    }          
                }
            }
        }
        model: signal.chats
    }

}