2020-07-08 11:33:05 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../../../../Base"
|
|
|
|
import "../../../../Base/ButtonLayout"
|
|
|
|
|
|
|
|
HFlickableColumnPage {
|
|
|
|
id: page
|
|
|
|
|
|
|
|
|
|
|
|
property string deviceOwner
|
|
|
|
property string deviceOwnerDisplayName
|
|
|
|
property string deviceId
|
|
|
|
property string deviceName
|
|
|
|
property string ed25519Key
|
|
|
|
property HStackView stackView
|
|
|
|
|
2020-07-09 14:53:01 -04:00
|
|
|
property Item previouslyFocused: null
|
|
|
|
|
2020-07-08 17:33:02 -04:00
|
|
|
signal trustSet(bool trust)
|
|
|
|
|
2020-07-08 11:33:05 -04:00
|
|
|
|
2020-07-09 14:53:01 -04:00
|
|
|
function close() {
|
|
|
|
if (previouslyFocused) previouslyFocused.forceActiveFocus()
|
|
|
|
stackView.pop()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-08 11:33:05 -04:00
|
|
|
footer: ButtonLayout {
|
|
|
|
ApplyButton {
|
|
|
|
text: qsTr("They're the same")
|
|
|
|
icon.name: "device-verified"
|
|
|
|
onClicked: {
|
|
|
|
loading = true
|
|
|
|
|
2020-07-09 12:43:21 -04:00
|
|
|
py.callCoro(
|
|
|
|
"verify_device",
|
|
|
|
[deviceOwner, deviceId, ed25519Key.replace(/ /g, "")],
|
2020-07-08 11:33:05 -04:00
|
|
|
() => {
|
|
|
|
loading = false
|
2020-07-08 17:33:02 -04:00
|
|
|
page.trustSet(true)
|
2020-07-09 14:53:01 -04:00
|
|
|
page.close()
|
2020-07-08 11:33:05 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CancelButton {
|
|
|
|
text: qsTr("They differ")
|
|
|
|
icon.name: "device-blacklisted"
|
|
|
|
onClicked: {
|
|
|
|
loading = true
|
|
|
|
|
2020-07-09 12:43:21 -04:00
|
|
|
py.callCoro(
|
|
|
|
"blacklist_device",
|
|
|
|
[deviceOwner, deviceId, ed25519Key.replace(/ /g, "")],
|
2020-07-08 11:33:05 -04:00
|
|
|
() => {
|
|
|
|
loading = false
|
2020-07-08 17:33:02 -04:00
|
|
|
page.trustSet(false)
|
2020-07-09 14:53:01 -04:00
|
|
|
page.close()
|
2020-07-08 11:33:05 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CancelButton {
|
|
|
|
id: cancelButton
|
2020-07-09 14:53:01 -04:00
|
|
|
onClicked: page.close()
|
2020-07-08 11:33:05 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-09 14:53:01 -04:00
|
|
|
onKeyboardCancel: page.close()
|
2020-07-08 11:33:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
HRowLayout {
|
|
|
|
HButton {
|
|
|
|
id: closeButton
|
|
|
|
circle: true
|
|
|
|
icon.name: "close-view"
|
|
|
|
iconItem.small: true
|
2020-07-09 14:53:01 -04:00
|
|
|
onClicked: page.close()
|
2020-07-08 11:33:05 -04:00
|
|
|
|
|
|
|
Layout.rightMargin: theme.spacing
|
|
|
|
}
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
text: qsTr("Verification")
|
|
|
|
font.bold: true
|
|
|
|
elide: HLabel.ElideRight
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.preferredWidth: closeButton.width
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
wrapMode: HLabel.Wrap
|
|
|
|
textFormat: HLabel.StyledText
|
|
|
|
text: qsTr(
|
|
|
|
"Does %1 sees the same info in their session's account settings?"
|
|
|
|
).arg(utils.coloredNameHtml(deviceOwnerDisplayName, deviceOwner))
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HTextArea {
|
|
|
|
function formatInfo(info, value) {
|
|
|
|
return (
|
|
|
|
`<p style="line-height: 115%">` +
|
|
|
|
info +
|
|
|
|
`<br><span style="font-family: ${theme.fontFamily.mono}">` +
|
|
|
|
value +
|
|
|
|
`</span></p>`
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
readOnly: true
|
|
|
|
wrapMode: HSelectableLabel.Wrap
|
|
|
|
textFormat: Qt.RichText
|
|
|
|
text: (
|
|
|
|
formatInfo(qsTr("Session name: "), page.deviceName) +
|
|
|
|
formatInfo(qsTr("Session ID: "), page.deviceId) +
|
|
|
|
formatInfo(qsTr("Session key: "), "<b>"+page.ed25519Key+"</b>")
|
|
|
|
)
|
|
|
|
|
2020-07-11 16:10:55 -04:00
|
|
|
Component.onCompleted: {
|
|
|
|
page.previouslyFocused = window.activeFocusItem
|
|
|
|
forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
2020-07-08 11:33:05 -04:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
wrapMode: HLabel.Wrap
|
|
|
|
text:
|
|
|
|
qsTr(
|
2020-07-11 16:20:19 -04:00
|
|
|
"If you already know this user, compare the info you see us" +
|
|
|
|
"ing a trusted contact method, such as email or a phone call."
|
2020-07-08 11:33:05 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
}
|