matrixion/resources/qml/device-verification/DeviceVerification.qml

80 lines
1.4 KiB
QML
Raw Normal View History

import QtQuick 2.3
import QtQuick.Controls 2.10
import QtQuick.Window 2.2
import im.nheko 1.0
ApplicationWindow {
2020-09-14 14:57:49 +03:00
property var flow
property bool isRequest
property var tran_id
title: stack.currentItem.title
id: dialog
flags: Qt.Dialog
palette: colors
height: stack.implicitHeight
width: stack.implicitWidth
2020-09-14 14:57:49 +03:00
Component{
id: newVerificationRequest
NewVerificationRequest {}
}
Component{
id: acceptNewVerificationRequest
AcceptNewVerificationRequest {}
}
StackView {
id: stack
initialItem: flow.sender == true?newVerificationRequest:acceptNewVerificationRequest
implicitWidth: currentItem.implicitWidth
implicitHeight: currentItem.implicitHeight
}
Component {
2020-09-14 14:57:49 +03:00
id: partnerAborted
PartnerAborted {}
}
Component {
2020-09-14 14:57:49 +03:00
id: timedout
TimedOut {}
}
Component {
2020-09-14 14:57:49 +03:00
id: verificationSuccess
VerificationSuccess {}
}
Component {
id: digitVerification
2020-09-14 14:57:49 +03:00
DigitVerification {}
}
Component {
id: emojiVerification
2020-09-14 14:57:49 +03:00
EmojiVerification {}
}
2020-09-14 14:57:49 +03:00
Connections {
target: flow
onVerificationCanceled: stack.replace(partnerAborted)
onTimedout: stack.replace(timedout)
onDeviceVerified: stack.replace(verificationSuccess)
2020-09-14 14:57:49 +03:00
onVerificationRequestAccepted: switch(method) {
case DeviceVerificationFlow.Decimal: stack.replace(digitVerification); break;
case DeviceVerificationFlow.Emoji: stack.replace(emojiVerification); break;
}
2020-09-14 14:57:49 +03:00
onRefreshProfile: {
deviceVerificationList.updateProfile(flow.userId);
}
}
}