summary refs log tree commit diff
path: root/resources/qml/TimelineView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/TimelineView.qml')
-rw-r--r--resources/qml/TimelineView.qml66
1 files changed, 48 insertions, 18 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml

index dd9c4029..f2390b18 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -9,6 +9,7 @@ import im.nheko.EmojiModel 1.0 import "./delegates" import "./emoji" +import "./device-verification" Page { id: timelineRoot @@ -90,7 +91,7 @@ Page { visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker height: visible ? implicitHeight : 0 text: qsTr("Save as") - onTriggered: timelineManager.timeline.saveMedia(messageContextMenu.eventId) + onTriggered: TimelineManager.timeline.saveMedia(messageContextMenu.eventId) } } @@ -98,8 +99,39 @@ Page { anchors.fill: parent color: colors.window + Component { + id: deviceVerificationDialog + DeviceVerification {} + } + Connections { + target: TimelineManager + function onNewDeviceVerificationRequest(flow,transactionId,userId,deviceId,isRequest) { + flow.userId = userId; + flow.sender = false; + flow.deviceId = deviceId; + switch(flow.type){ + case DeviceVerificationFlow.ToDevice: + flow.tranId = transactionId; + deviceVerificationList.add(flow.tranId); + break; + case DeviceVerificationFlow.RoomMsg: + deviceVerificationList.add(flow.tranId); + break; + } + var dialog = deviceVerificationDialog.createObject(timelineRoot, {flow: flow,isRequest = isRequest}); + dialog.show(); + } + } + Connections { + target: TimelineManager.timeline + function onOpenProfile(profile) { + var userProfile = userProfileComponent.createObject(timelineRoot,{profile: profile}); + userProfile.show(); + } + } + Label { - visible: !timelineManager.timeline && !timelineManager.isInitialSync + visible: !TimelineManager.timeline && !TimelineManager.isInitialSync anchors.centerIn: parent text: qsTr("No room open") font.pointSize: 24 @@ -109,7 +141,7 @@ Page { BusyIndicator { visible: running anchors.centerIn: parent - running: timelineManager.isInitialSync + running: TimelineManager.isInitialSync height: 200 width: 200 z: 3 @@ -118,7 +150,7 @@ Page { ListView { id: chat - visible: !!timelineManager.timeline + visible: TimelineManager.timeline != null cacheBuffer: 400 @@ -130,7 +162,7 @@ Page { anchors.leftMargin: 4 anchors.rightMargin: scrollbar.width - model: timelineManager.timeline + model: TimelineManager.timeline boundsBehavior: Flickable.StopAtBounds @@ -178,7 +210,7 @@ Page { onCountChanged: if (atYEnd) model.currentIndex = 0 // Mark last event as read, since we are at the bottom - property int delegateMaxWidth: (settings.timelineMaxWidth > 100 && (parent.width - settings.timelineMaxWidth) > 32) ? settings.timelineMaxWidth : (parent.width - 32) + property int delegateMaxWidth: (Settings.timelineMaxWidth > 100 && (parent.width - Settings.timelineMaxWidth) > 32) ? Settings.timelineMaxWidth : (parent.width - 32) delegate: Rectangle { // This would normally be previousSection, but our model's order is inverted. @@ -219,6 +251,11 @@ Page { } } + Component{ + id: userProfileComponent + UserProfile{} + } + section { property: "section" } @@ -255,6 +292,7 @@ Page { color: colors.base } } + Row { height: userName.height spacing: 8 @@ -277,25 +315,17 @@ Page { Label { id: userName text: chat.model.escapeEmoji(modelData.userName) - color: timelineManager.userColor(modelData.userId, colors.window) + color: TimelineManager.userColor(modelData.userId, colors.window) textFormat: Text.RichText MouseArea { anchors.fill: parent - onClicked: chat.model.openUserProfile(section.split(" ")[0]) + Layout.alignment: Qt.AlignHCenter + onClicked: chat.model.openUserProfile(modelData.userId) cursorShape: Qt.PointingHandCursor propagateComposedEvents: true } } - - Label { - color: colors.buttonText - text: timelineManager.userStatus(modelData.userId) - textFormat: Text.PlainText - elide: Text.ElideRight - width: chat.delegateMaxWidth - parent.spacing*2 - userName.implicitWidth - avatarSize - font.italic: true - } } } } @@ -359,7 +389,7 @@ Page { anchors.bottom: parent.bottom modelData: chat.model ? chat.model.getDump(chat.model.reply, chat.model.id) : {} - userColor: timelineManager.userColor(modelData.userId, colors.window) + userColor: TimelineManager.userColor(modelData.userId, colors.window) } ImageButton {