Warning, /network/neochat/src/qml/KeyVerificationDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 import QtQml
0008 
0009 import com.github.quotient_im.libquotient
0010 
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.kirigamiaddons.delegates as Delegates
0013 import org.kde.neochat
0014 
0015 Kirigami.Page {
0016     id: root
0017 
0018     title: i18n("Session Verification")
0019 
0020     required property var session
0021 
0022     Item {
0023         anchors.fill: parent
0024         VerificationCanceled {
0025             visible: root.session.state === KeyVerificationSession.CANCELED
0026             anchors.centerIn: parent
0027             reason: root.session.error
0028         }
0029         EmojiSas {
0030             anchors.centerIn: parent
0031             visible: root.session.state === KeyVerificationSession.WAITINGFORVERIFICATION
0032             model: root.session.sasEmojis
0033             onReject: root.session.cancelVerification(KeyVerificationSession.MISMATCHED_SAS)
0034             onAccept: root.session.sendMac()
0035         }
0036         Message {
0037             visible: root.session.state === KeyVerificationSession.WAITINGFORREADY
0038             anchors.centerIn: parent
0039             icon: "security-medium-symbolic"
0040             text: i18n("Waiting for device to accept verification.")
0041         }
0042         Message {
0043             visible: root.session.state === KeyVerificationSession.INCOMING
0044             anchors.centerIn: parent
0045             icon: "security-medium-symbolic"
0046             text: i18n("Incoming key verification request from device **%1**", root.session.remoteDeviceId)
0047         }
0048         Message {
0049             visible: root.session.state === KeyVerificationSession.WAITINGFORMAC
0050             anchors.centerIn: parent
0051             icon: "security-medium-symbolic"
0052             text: i18n("Waiting for other party to verify.")
0053         }
0054         Delegates.RoundedItemDelegate {
0055             id: emojiVerification
0056             text: i18n("Emoji Verification")
0057             visible: root.session.state === KeyVerificationSession.READY
0058             contentItem: Delegates.SubtitleContentItem {
0059                 subtitle: i18n("Compare a set of emoji on both devices")
0060                 itemDelegate: emojiVerification
0061             }
0062             onClicked: root.session.sendStartSas()
0063             anchors.centerIn: parent
0064         }
0065         Message {
0066             visible: root.session.state === KeyVerificationSession.DONE
0067             anchors.centerIn: parent
0068             text: i18n("Successfully verified device **%1**", root.session.remoteDeviceId)
0069             icon: "security-high"
0070         }
0071     }
0072 
0073     footer: QQC2.ToolBar {
0074         visible: root.session.state === KeyVerificationSession.INCOMING
0075         QQC2.DialogButtonBox {
0076             anchors.fill: parent
0077             Item {
0078                 Layout.fillWidth: true
0079             }
0080             QQC2.Button {
0081                 text: i18n("Accept")
0082                 icon.name: "dialog-ok"
0083                 onClicked: root.session.sendReady()
0084                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
0085             }
0086             QQC2.Button {
0087                 text: i18n("Decline")
0088                 icon.name: "dialog-cancel"
0089                 onClicked: root.session.cancelVerification("m.user", "Declined")
0090                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
0091             }
0092         }
0093     }
0094 }