From 08028d5c57d134fb3d0ca9004730f0b2c99e5e67 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 4 Jul 2020 04:24:28 +0200 Subject: Refactor UserProfile --- resources/qml/TimelineView.qml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'resources/qml/TimelineView.qml') diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 3618140a..ec634878 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -106,17 +106,23 @@ Page { } Connections { target: TimelineManager - onNewDeviceVerificationRequest: { + function onNewDeviceVerificationRequest(flow) { flow.userId = userId; flow.sender = false; flow.deviceId = deviceId; flow.tranId = transactionId; deviceVerificationList.add(flow.tranId); - var dialog = deviceVerificationDialog.createObject(timelineRoot, - {flow: flow}); + var dialog = deviceVerificationDialog.createObject(timelineRoot, {flow: flow}); dialog.show(); } } + Connections { + target: TimelineManager.timeline + function onOpenProfile(profile) { + var userProfile = userProfileComponent.createObject(timelineRoot,{profile: profile}); + userProfile.show(); + } + } Label { visible: !TimelineManager.timeline && !TimelineManager.isInitialSync @@ -293,10 +299,7 @@ Page { MouseArea { anchors.fill: parent - onClicked: { - userProfile = userProfileComponent.createObject(timelineRoot,{user_data: modelData,avatarUrl:chat.model.avatarUrl(modelData.userId)}); - userProfile.show(); - } + onClicked: chat.model.openUserProfile(modelData.userId) cursorShape: Qt.PointingHandCursor propagateComposedEvents: true } @@ -311,10 +314,7 @@ Page { MouseArea { anchors.fill: parent Layout.alignment: Qt.AlignHCenter - onClicked: { - userProfile = userProfileComponent.createObject(timelineRoot,{user_data: modelData,avatarUrl:chat.model.avatarUrl(modelData.userId)}); - userProfile.show(); - } + onClicked: chat.model.openUserProfile(modelData.userId) cursorShape: Qt.PointingHandCursor propagateComposedEvents: true } -- cgit 1.5.1