Fix emoji verification clipped on sway

fixes #917
This commit is contained in:
Nicolas Werner 2022-07-03 03:39:01 +02:00
parent 678806749d
commit f387e3b033
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
7 changed files with 572 additions and 605 deletions

View File

@ -14,21 +14,29 @@ ApplicationWindow {
property var flow property var flow
onClosing: VerificationManager.removeVerificationFlow(flow) onClosing: VerificationManager.removeVerificationFlow(flow)
title: stack.currentItem.title_ title: stack.currentItem ? (stack.currentItem.title_ || "") : ""
modality: Qt.NonModal modality: Qt.NonModal
palette: Nheko.colors palette: Nheko.colors
color: Nheko.colors.window color: Nheko.colors.window
minimumHeight: stack.implicitHeight //height: stack.currentItem.implicitHeight
width: stack.implicitWidth minimumHeight: stack.currentItem.implicitHeight + 2 * Nheko.paddingLarge
height: stack.currentItem.implicitHeight + 2 * Nheko.paddingMedium
minimumWidth: 400
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
background: Rectangle {
color: Nheko.colors.window
}
StackView { StackView {
id: stack id: stack
anchors.fill: parent anchors.centerIn: parent
initialItem: newVerificationRequest initialItem: newVerificationRequest
implicitWidth: currentItem.implicitWidth implicitWidth: dialog.width - 2* Nheko.paddingMedium
implicitHeight: currentItem.implicitHeight implicitHeight: dialog.height - 2* Nheko.paddingMedium
} }
Component { Component {
@ -86,7 +94,7 @@ ApplicationWindow {
name: "PromptStartVerification" name: "PromptStartVerification"
StateChangeScript { StateChangeScript {
script: stack.replace(newVerificationRequest) script: stack.replace(null, newVerificationRequest)
} }
}, },
@ -94,7 +102,7 @@ ApplicationWindow {
name: "CompareEmoji" name: "CompareEmoji"
StateChangeScript { StateChangeScript {
script: stack.replace(emojiVerification) script: stack.replace(null, emojiVerification)
} }
}, },
@ -102,7 +110,7 @@ ApplicationWindow {
name: "CompareNumber" name: "CompareNumber"
StateChangeScript { StateChangeScript {
script: stack.replace(digitVerification) script: stack.replace(null, digitVerification)
} }
}, },
@ -110,7 +118,7 @@ ApplicationWindow {
name: "WaitingForKeys" name: "WaitingForKeys"
StateChangeScript { StateChangeScript {
script: stack.replace(waiting) script: stack.replace(null, waiting)
} }
}, },
@ -118,7 +126,7 @@ ApplicationWindow {
name: "WaitingForOtherToAccept" name: "WaitingForOtherToAccept"
StateChangeScript { StateChangeScript {
script: stack.replace(waiting) script: stack.replace(null, waiting)
} }
}, },
@ -126,7 +134,7 @@ ApplicationWindow {
name: "WaitingForMac" name: "WaitingForMac"
StateChangeScript { StateChangeScript {
script: stack.replace(waiting) script: stack.replace(null, waiting)
} }
}, },
@ -134,7 +142,7 @@ ApplicationWindow {
name: "Success" name: "Success"
StateChangeScript { StateChangeScript {
script: stack.replace(success) script: stack.replace(null, success)
} }
}, },
@ -142,7 +150,7 @@ ApplicationWindow {
name: "Failed" name: "Failed"
StateChangeScript { StateChangeScript {
script: stack.replace(failed) script: stack.replace(null, failed)
} }
} }

View File

@ -8,70 +8,63 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: qsTr("Verification Code") property string title: qsTr("Verification Code")
background: Rectangle {
color: Nheko.colors.window spacing: 16
Label {
Layout.preferredWidth: 400
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!")
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
ColumnLayout { Item { Layout.fillHeight: true; }
anchors.fill: parent RowLayout {
spacing: 16 Layout.alignment: Qt.AlignHCenter
Label { Label {
Layout.preferredWidth: 400 font.pixelSize: Qt.application.font.pixelSize * 2
Layout.fillWidth: true text: flow.sasList[0]
wrapMode: Text.Wrap
text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!")
color: Nheko.colors.text color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
Item { Layout.fillHeight: true; } Label {
RowLayout { font.pixelSize: Qt.application.font.pixelSize * 2
Layout.alignment: Qt.AlignHCenter text: flow.sasList[1]
color: Nheko.colors.text
Label {
font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[0]
color: Nheko.colors.text
}
Label {
font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[1]
color: Nheko.colors.text
}
Label {
font.pixelSize: Qt.application.font.pixelSize * 2
text: flow.sasList[2]
color: Nheko.colors.text
}
} }
Item { Layout.fillHeight: true; }
RowLayout { Label {
Button { font.pixelSize: Qt.application.font.pixelSize * 2
Layout.alignment: Qt.AlignLeft text: flow.sasList[2]
text: qsTr("They do not match!") color: Nheko.colors.text
onClicked: { }
flow.cancel();
dialog.close(); }
} Item { Layout.fillHeight: true; }
RowLayout {
Button {
Layout.alignment: Qt.AlignLeft
text: qsTr("They do not match!")
onClicked: {
flow.cancel();
dialog.close();
} }
}
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("They match!")
onClicked: flow.next()
}
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("They match!")
onClicked: flow.next()
} }
} }

View File

@ -8,386 +8,379 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: qsTr("Verification Code") property string title: qsTr("Verification Code")
background: Rectangle {
color: Nheko.colors.window spacing: 16
Label {
Layout.preferredWidth: 400
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!")
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
ColumnLayout { Item { Layout.fillHeight: true; }
anchors.fill: parent RowLayout {
spacing: 16 id: emojis
Label { property var mapping: [{
Layout.preferredWidth: 400 "number": 0,
Layout.fillWidth: true "emoji": "🐶",
wrapMode: Text.Wrap "description": "Dog",
text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!") "unicode": "U+1F436"
color: Nheko.colors.text }, {
verticalAlignment: Text.AlignVCenter "number": 1,
} "emoji": "🐱",
"description": "Cat",
"unicode": "U+1F431"
}, {
"number": 2,
"emoji": "🦁",
"description": "Lion",
"unicode": "U+1F981"
}, {
"number": 3,
"emoji": "🐎",
"description": "Horse",
"unicode": "U+1F40E"
}, {
"number": 4,
"emoji": "🦄",
"description": "Unicorn",
"unicode": "U+1F984"
}, {
"number": 5,
"emoji": "🐷",
"description": "Pig",
"unicode": "U+1F437"
}, {
"number": 6,
"emoji": "🐘",
"description": "Elephant",
"unicode": "U+1F418"
}, {
"number": 7,
"emoji": "🐰",
"description": "Rabbit",
"unicode": "U+1F430"
}, {
"number": 8,
"emoji": "🐼",
"description": "Panda",
"unicode": "U+1F43C"
}, {
"number": 9,
"emoji": "🐓",
"description": "Rooster",
"unicode": "U+1F413"
}, {
"number": 10,
"emoji": "🐧",
"description": "Penguin",
"unicode": "U+1F427"
}, {
"number": 11,
"emoji": "🐢",
"description": "Turtle",
"unicode": "U+1F422"
}, {
"number": 12,
"emoji": "🐟",
"description": "Fish",
"unicode": "U+1F41F"
}, {
"number": 13,
"emoji": "🐙",
"description": "Octopus",
"unicode": "U+1F419"
}, {
"number": 14,
"emoji": "🦋",
"description": "Butterfly",
"unicode": "U+1F98B"
}, {
"number": 15,
"emoji": "🌷",
"description": "Flower",
"unicode": "U+1F337"
}, {
"number": 16,
"emoji": "🌳",
"description": "Tree",
"unicode": "U+1F333"
}, {
"number": 17,
"emoji": "🌵",
"description": "Cactus",
"unicode": "U+1F335"
}, {
"number": 18,
"emoji": "🍄",
"description": "Mushroom",
"unicode": "U+1F344"
}, {
"number": 19,
"emoji": "🌏",
"description": "Globe",
"unicode": "U+1F30F"
}, {
"number": 20,
"emoji": "🌙",
"description": "Moon",
"unicode": "U+1F319"
}, {
"number": 21,
"emoji": "☁️",
"description": "Cloud",
"unicode": "U+2601U+FE0F"
}, {
"number": 22,
"emoji": "🔥",
"description": "Fire",
"unicode": "U+1F525"
}, {
"number": 23,
"emoji": "🍌",
"description": "Banana",
"unicode": "U+1F34C"
}, {
"number": 24,
"emoji": "🍎",
"description": "Apple",
"unicode": "U+1F34E"
}, {
"number": 25,
"emoji": "🍓",
"description": "Strawberry",
"unicode": "U+1F353"
}, {
"number": 26,
"emoji": "🌽",
"description": "Corn",
"unicode": "U+1F33D"
}, {
"number": 27,
"emoji": "🍕",
"description": "Pizza",
"unicode": "U+1F355"
}, {
"number": 28,
"emoji": "🎂",
"description": "Cake",
"unicode": "U+1F382"
}, {
"number": 29,
"emoji": "❤️",
"description": "Heart",
"unicode": "U+2764U+FE0F"
}, {
"number": 30,
"emoji": "😀",
"description": "Smiley",
"unicode": "U+1F600"
}, {
"number": 31,
"emoji": "🤖",
"description": "Robot",
"unicode": "U+1F916"
}, {
"number": 32,
"emoji": "🎩",
"description": "Hat",
"unicode": "U+1F3A9"
}, {
"number": 33,
"emoji": "👓",
"description": "Glasses",
"unicode": "U+1F453"
}, {
"number": 34,
"emoji": "🔧",
"description": "Spanner",
"unicode": "U+1F527"
}, {
"number": 35,
"emoji": "🎅",
"description": "Santa",
"unicode": "U+1F385"
}, {
"number": 36,
"emoji": "👍",
"description": "Thumbs Up",
"unicode": "U+1F44D"
}, {
"number": 37,
"emoji": "☂️",
"description": "Umbrella",
"unicode": "U+2602U+FE0F"
}, {
"number": 38,
"emoji": "⌛",
"description": "Hourglass",
"unicode": "U+231B"
}, {
"number": 39,
"emoji": "⏰",
"description": "Clock",
"unicode": "U+23F0"
}, {
"number": 40,
"emoji": "🎁",
"description": "Gift",
"unicode": "U+1F381"
}, {
"number": 41,
"emoji": "💡",
"description": "Light Bulb",
"unicode": "U+1F4A1"
}, {
"number": 42,
"emoji": "📕",
"description": "Book",
"unicode": "U+1F4D5"
}, {
"number": 43,
"emoji": "✏️",
"description": "Pencil",
"unicode": "U+270FU+FE0F"
}, {
"number": 44,
"emoji": "📎",
"description": "Paperclip",
"unicode": "U+1F4CE"
}, {
"number": 45,
"emoji": "✂️",
"description": "Scissors",
"unicode": "U+2702U+FE0F"
}, {
"number": 46,
"emoji": "🔒",
"description": "Lock",
"unicode": "U+1F512"
}, {
"number": 47,
"emoji": "🔑",
"description": "Key",
"unicode": "U+1F511"
}, {
"number": 48,
"emoji": "🔨",
"description": "Hammer",
"unicode": "U+1F528"
}, {
"number": 49,
"emoji": "☎️",
"description": "Telephone",
"unicode": "U+260EU+FE0F"
}, {
"number": 50,
"emoji": "🏁",
"description": "Flag",
"unicode": "U+1F3C1"
}, {
"number": 51,
"emoji": "🚂",
"description": "Train",
"unicode": "U+1F682"
}, {
"number": 52,
"emoji": "🚲",
"description": "Bicycle",
"unicode": "U+1F6B2"
}, {
"number": 53,
"emoji": "✈️",
"description": "Aeroplane",
"unicode": "U+2708U+FE0F"
}, {
"number": 54,
"emoji": "🚀",
"description": "Rocket",
"unicode": "U+1F680"
}, {
"number": 55,
"emoji": "🏆",
"description": "Trophy",
"unicode": "U+1F3C6"
}, {
"number": 56,
"emoji": "⚽",
"description": "Ball",
"unicode": "U+26BD"
}, {
"number": 57,
"emoji": "🎸",
"description": "Guitar",
"unicode": "U+1F3B8"
}, {
"number": 58,
"emoji": "🎺",
"description": "Trumpet",
"unicode": "U+1F3BA"
}, {
"number": 59,
"emoji": "🔔",
"description": "Bell",
"unicode": "U+1F514"
}, {
"number": 60,
"emoji": "⚓",
"description": "Anchor",
"unicode": "U+2693"
}, {
"number": 61,
"emoji": "🎧",
"description": "Headphones",
"unicode": "U+1F3A7"
}, {
"number": 62,
"emoji": "📁",
"description": "Folder",
"unicode": "U+1F4C1"
}, {
"number": 63,
"emoji": "📌",
"description": "Pin",
"unicode": "U+1F4CC"
}]
Item { Layout.fillHeight: true; } Layout.alignment: Qt.AlignHCenter
RowLayout {
id: emojis
property var mapping: [{ Repeater {
"number": 0, id: repeater
"emoji": "🐶",
"description": "Dog",
"unicode": "U+1F436"
}, {
"number": 1,
"emoji": "🐱",
"description": "Cat",
"unicode": "U+1F431"
}, {
"number": 2,
"emoji": "🦁",
"description": "Lion",
"unicode": "U+1F981"
}, {
"number": 3,
"emoji": "🐎",
"description": "Horse",
"unicode": "U+1F40E"
}, {
"number": 4,
"emoji": "🦄",
"description": "Unicorn",
"unicode": "U+1F984"
}, {
"number": 5,
"emoji": "🐷",
"description": "Pig",
"unicode": "U+1F437"
}, {
"number": 6,
"emoji": "🐘",
"description": "Elephant",
"unicode": "U+1F418"
}, {
"number": 7,
"emoji": "🐰",
"description": "Rabbit",
"unicode": "U+1F430"
}, {
"number": 8,
"emoji": "🐼",
"description": "Panda",
"unicode": "U+1F43C"
}, {
"number": 9,
"emoji": "🐓",
"description": "Rooster",
"unicode": "U+1F413"
}, {
"number": 10,
"emoji": "🐧",
"description": "Penguin",
"unicode": "U+1F427"
}, {
"number": 11,
"emoji": "🐢",
"description": "Turtle",
"unicode": "U+1F422"
}, {
"number": 12,
"emoji": "🐟",
"description": "Fish",
"unicode": "U+1F41F"
}, {
"number": 13,
"emoji": "🐙",
"description": "Octopus",
"unicode": "U+1F419"
}, {
"number": 14,
"emoji": "🦋",
"description": "Butterfly",
"unicode": "U+1F98B"
}, {
"number": 15,
"emoji": "🌷",
"description": "Flower",
"unicode": "U+1F337"
}, {
"number": 16,
"emoji": "🌳",
"description": "Tree",
"unicode": "U+1F333"
}, {
"number": 17,
"emoji": "🌵",
"description": "Cactus",
"unicode": "U+1F335"
}, {
"number": 18,
"emoji": "🍄",
"description": "Mushroom",
"unicode": "U+1F344"
}, {
"number": 19,
"emoji": "🌏",
"description": "Globe",
"unicode": "U+1F30F"
}, {
"number": 20,
"emoji": "🌙",
"description": "Moon",
"unicode": "U+1F319"
}, {
"number": 21,
"emoji": "☁️",
"description": "Cloud",
"unicode": "U+2601U+FE0F"
}, {
"number": 22,
"emoji": "🔥",
"description": "Fire",
"unicode": "U+1F525"
}, {
"number": 23,
"emoji": "🍌",
"description": "Banana",
"unicode": "U+1F34C"
}, {
"number": 24,
"emoji": "🍎",
"description": "Apple",
"unicode": "U+1F34E"
}, {
"number": 25,
"emoji": "🍓",
"description": "Strawberry",
"unicode": "U+1F353"
}, {
"number": 26,
"emoji": "🌽",
"description": "Corn",
"unicode": "U+1F33D"
}, {
"number": 27,
"emoji": "🍕",
"description": "Pizza",
"unicode": "U+1F355"
}, {
"number": 28,
"emoji": "🎂",
"description": "Cake",
"unicode": "U+1F382"
}, {
"number": 29,
"emoji": "❤️",
"description": "Heart",
"unicode": "U+2764U+FE0F"
}, {
"number": 30,
"emoji": "😀",
"description": "Smiley",
"unicode": "U+1F600"
}, {
"number": 31,
"emoji": "🤖",
"description": "Robot",
"unicode": "U+1F916"
}, {
"number": 32,
"emoji": "🎩",
"description": "Hat",
"unicode": "U+1F3A9"
}, {
"number": 33,
"emoji": "👓",
"description": "Glasses",
"unicode": "U+1F453"
}, {
"number": 34,
"emoji": "🔧",
"description": "Spanner",
"unicode": "U+1F527"
}, {
"number": 35,
"emoji": "🎅",
"description": "Santa",
"unicode": "U+1F385"
}, {
"number": 36,
"emoji": "👍",
"description": "Thumbs Up",
"unicode": "U+1F44D"
}, {
"number": 37,
"emoji": "☂️",
"description": "Umbrella",
"unicode": "U+2602U+FE0F"
}, {
"number": 38,
"emoji": "⌛",
"description": "Hourglass",
"unicode": "U+231B"
}, {
"number": 39,
"emoji": "⏰",
"description": "Clock",
"unicode": "U+23F0"
}, {
"number": 40,
"emoji": "🎁",
"description": "Gift",
"unicode": "U+1F381"
}, {
"number": 41,
"emoji": "💡",
"description": "Light Bulb",
"unicode": "U+1F4A1"
}, {
"number": 42,
"emoji": "📕",
"description": "Book",
"unicode": "U+1F4D5"
}, {
"number": 43,
"emoji": "✏️",
"description": "Pencil",
"unicode": "U+270FU+FE0F"
}, {
"number": 44,
"emoji": "📎",
"description": "Paperclip",
"unicode": "U+1F4CE"
}, {
"number": 45,
"emoji": "✂️",
"description": "Scissors",
"unicode": "U+2702U+FE0F"
}, {
"number": 46,
"emoji": "🔒",
"description": "Lock",
"unicode": "U+1F512"
}, {
"number": 47,
"emoji": "🔑",
"description": "Key",
"unicode": "U+1F511"
}, {
"number": 48,
"emoji": "🔨",
"description": "Hammer",
"unicode": "U+1F528"
}, {
"number": 49,
"emoji": "☎️",
"description": "Telephone",
"unicode": "U+260EU+FE0F"
}, {
"number": 50,
"emoji": "🏁",
"description": "Flag",
"unicode": "U+1F3C1"
}, {
"number": 51,
"emoji": "🚂",
"description": "Train",
"unicode": "U+1F682"
}, {
"number": 52,
"emoji": "🚲",
"description": "Bicycle",
"unicode": "U+1F6B2"
}, {
"number": 53,
"emoji": "✈️",
"description": "Aeroplane",
"unicode": "U+2708U+FE0F"
}, {
"number": 54,
"emoji": "🚀",
"description": "Rocket",
"unicode": "U+1F680"
}, {
"number": 55,
"emoji": "🏆",
"description": "Trophy",
"unicode": "U+1F3C6"
}, {
"number": 56,
"emoji": "⚽",
"description": "Ball",
"unicode": "U+26BD"
}, {
"number": 57,
"emoji": "🎸",
"description": "Guitar",
"unicode": "U+1F3B8"
}, {
"number": 58,
"emoji": "🎺",
"description": "Trumpet",
"unicode": "U+1F3BA"
}, {
"number": 59,
"emoji": "🔔",
"description": "Bell",
"unicode": "U+1F514"
}, {
"number": 60,
"emoji": "⚓",
"description": "Anchor",
"unicode": "U+2693"
}, {
"number": 61,
"emoji": "🎧",
"description": "Headphones",
"unicode": "U+1F3A7"
}, {
"number": 62,
"emoji": "📁",
"description": "Folder",
"unicode": "U+1F4C1"
}, {
"number": 63,
"emoji": "📌",
"description": "Pin",
"unicode": "U+1F4CC"
}]
Layout.alignment: Qt.AlignHCenter model: 7
Repeater { delegate: Rectangle {
id: repeater color: "transparent"
implicitHeight: Qt.application.font.pixelSize * 8
implicitWidth: col.width
model: 7 ColumnLayout {
id: col
delegate: Rectangle { property var emoji: emojis.mapping[flow.sasList[index]]
color: "transparent"
implicitHeight: Qt.application.font.pixelSize * 8
implicitWidth: col.width
ColumnLayout { Layout.fillWidth: true
id: col anchors.bottom: parent.bottom
property var emoji: emojis.mapping[flow.sasList[index]] Label {
//height: font.pixelSize * 2
Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter
anchors.bottom: parent.bottom text: col.emoji.emoji
font.pixelSize: Qt.application.font.pixelSize * 2
Label { font.family: Settings.emojiFont
//height: font.pixelSize * 2 color: Nheko.colors.text
Layout.alignment: Qt.AlignHCenter }
text: col.emoji.emoji
font.pixelSize: Qt.application.font.pixelSize * 2
font.family: Settings.emojiFont
color: Nheko.colors.text
}
Label {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
text: col.emoji.description
color: Nheko.colors.text
}
Label {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
text: col.emoji.description
color: Nheko.colors.text
} }
} }
@ -395,28 +388,28 @@ Pane {
} }
} }
Item { Layout.fillHeight: true; }
RowLayout { }
Button { Item { Layout.fillHeight: true; }
Layout.alignment: Qt.AlignLeft
text: qsTr("They do not match!") RowLayout {
onClicked: { Button {
flow.cancel(); Layout.alignment: Qt.AlignLeft
dialog.close(); text: qsTr("They do not match!")
} onClicked: {
flow.cancel();
dialog.close();
} }
}
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("They match!")
onClicked: flow.next()
}
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("They match!")
onClicked: flow.next()
} }
} }

View File

@ -8,57 +8,49 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: qsTr("Verification failed") property string title: qsTr("Verification failed")
background: Rectangle { spacing: 16
color: Nheko.colors.window
}
ColumnLayout { Text {
anchors.fill: parent id: content
spacing: 16
Text { Layout.preferredWidth: 400
id: content Layout.fillWidth: true
wrapMode: Text.Wrap
Layout.preferredWidth: 400 text: {
Layout.fillWidth: true switch (flow.error) {
wrapMode: Text.Wrap
text: {
switch (flow.error) {
case DeviceVerificationFlow.UnknownMethod: case DeviceVerificationFlow.UnknownMethod:
return qsTr("Other client does not support our verification protocol."); return qsTr("Other client does not support our verification protocol.");
case DeviceVerificationFlow.MismatchedCommitment: case DeviceVerificationFlow.MismatchedCommitment:
case DeviceVerificationFlow.MismatchedSAS: case DeviceVerificationFlow.MismatchedSAS:
case DeviceVerificationFlow.KeyMismatch: case DeviceVerificationFlow.KeyMismatch:
return qsTr("Key mismatch detected!"); return qsTr("Key mismatch detected!");
case DeviceVerificationFlow.Timeout: case DeviceVerificationFlow.Timeout:
return qsTr("Device verification timed out."); return qsTr("Device verification timed out.");
case DeviceVerificationFlow.User: case DeviceVerificationFlow.User:
return qsTr("Other party canceled the verification."); return qsTr("Other party canceled the verification.");
case DeviceVerificationFlow.OutOfOrder: case DeviceVerificationFlow.OutOfOrder:
return qsTr("Verification messages received out of order!"); return qsTr("Verification messages received out of order!");
default: default:
return qsTr("Unknown verification error."); return qsTr("Unknown verification error.");
}
} }
color: Nheko.colors.text }
verticalAlignment: Text.AlignVCenter color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
}
Item { Layout.fillHeight: true; }
RowLayout {
Item {
Layout.fillWidth: true
} }
Item { Layout.fillHeight: true; } Button {
Layout.alignment: Qt.AlignRight
RowLayout { text: qsTr("Close")
Item { onClicked: dialog.close()
Layout.fillWidth: true
}
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("Close")
onClicked: dialog.close()
}
} }
} }

View File

@ -8,66 +8,59 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Received Verification Request") property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Received Verification Request")
background: Rectangle {
color: Nheko.colors.window spacing: 16
Label {
// Self verification
Layout.preferredWidth: 400
Layout.fillWidth: true
wrapMode: Text.Wrap
text: {
if (flow.sender) {
if (flow.isSelfVerification)
if (flow.isMultiDeviceVerification)
return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify an unverified device now? (Please make sure you have one of those devices available.)");
else
return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify %1 now?").arg(flow.deviceId);
else
return qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications you can verify the other party.");
} else {
if (!flow.isSelfVerification && flow.isDeviceVerification)
return qsTr("%1 has requested to verify their device %2.").arg(flow.userId).arg(flow.deviceId);
else if (!flow.isSelfVerification && !flow.isDeviceVerification)
return qsTr("%1 using the device %2 has requested to be verified.").arg(flow.userId).arg(flow.deviceId);
else
return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId);
}
}
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
ColumnLayout { Item { Layout.fillHeight: true; }
anchors.fill: parent
spacing: 16
Label { RowLayout {
// Self verification Button {
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: 400 text: flow.sender ? qsTr("Cancel") : qsTr("Deny")
Layout.fillWidth: true onClicked: {
wrapMode: Text.Wrap flow.cancel();
text: { dialog.close();
if (flow.sender) {
if (flow.isSelfVerification)
if (flow.isMultiDeviceVerification)
return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify an unverified device now? (Please make sure you have one of those devices available.)");
else
return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify %1 now?").arg(flow.deviceId);
else
return qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications you can verify the other party.");
} else {
if (!flow.isSelfVerification && flow.isDeviceVerification)
return qsTr("%1 has requested to verify their device %2.").arg(flow.userId).arg(flow.deviceId);
else if (!flow.isSelfVerification && !flow.isDeviceVerification)
return qsTr("%1 using the device %2 has requested to be verified.").arg(flow.userId).arg(flow.deviceId);
else
return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId);
}
} }
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
Item { Layout.fillHeight: true; } Item {
Layout.fillWidth: true
RowLayout { }
Button {
Layout.alignment: Qt.AlignLeft
text: flow.sender ? qsTr("Cancel") : qsTr("Deny")
onClicked: {
flow.cancel();
dialog.close();
}
}
Item {
Layout.fillWidth: true
}
Button {
Layout.alignment: Qt.AlignRight
text: flow.sender ? qsTr("Start verification") : qsTr("Accept")
onClicked: flow.next()
}
Button {
Layout.alignment: Qt.AlignRight
text: flow.sender ? qsTr("Start verification") : qsTr("Accept")
onClicked: flow.next()
} }
} }

View File

@ -8,40 +8,33 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: qsTr("Successful Verification") property string title: qsTr("Successful Verification")
background: Rectangle {
color: Nheko.colors.window spacing: 16
Label {
id: content
Layout.preferredWidth: 400
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("Verification successful! Both sides verified their devices!")
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
ColumnLayout { Item { Layout.fillHeight: true; }
anchors.fill: parent
spacing: 16
Label { RowLayout {
id: content Item {
Layout.preferredWidth: 400
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("Verification successful! Both sides verified their devices!")
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
Item { Layout.fillHeight: true; } Button {
Layout.alignment: Qt.AlignRight
RowLayout { text: qsTr("Close")
Item { onClicked: dialog.close()
Layout.fillWidth: true
}
Button {
Layout.alignment: Qt.AlignRight
text: qsTr("Close")
onClicked: dialog.close()
}
} }
} }

View File

@ -9,59 +9,54 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
import im.nheko 1.0 import im.nheko 1.0
Pane { ColumnLayout {
property string title: qsTr("Waiting for other party…") property string title: qsTr("Waiting for other party…")
background: Rectangle { spacing: 16
color: Nheko.colors.window
}
ColumnLayout { Label {
anchors.fill: parent id: content
spacing: 16
Label { Layout.preferredWidth: 400
id: content Layout.fillWidth: true
wrapMode: Text.Wrap
Layout.preferredWidth: 400 text: {
Layout.fillWidth: true switch (flow.state) {
wrapMode: Text.Wrap
text: {
switch (flow.state) {
case "WaitingForOtherToAccept": case "WaitingForOtherToAccept":
return qsTr("Waiting for other side to accept the verification request."); return qsTr("Waiting for other side to accept the verification request.");
case "WaitingForKeys": case "WaitingForKeys":
return qsTr("Waiting for other side to continue the verification process."); return qsTr("Waiting for other side to continue the verification process.");
case "WaitingForMac": case "WaitingForMac":
return qsTr("Waiting for other side to complete the verification process."); return qsTr("Waiting for other side to complete the verification process.");
} default:
return "";
}
}
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
}
Item { Layout.fillHeight: true; }
Spinner {
Layout.alignment: Qt.AlignHCenter
foreground: Nheko.colors.mid
}
Item { Layout.fillHeight: true; }
RowLayout {
Button {
Layout.alignment: Qt.AlignLeft
text: qsTr("Cancel")
onClicked: {
flow.cancel();
dialog.close();
} }
color: Nheko.colors.text
verticalAlignment: Text.AlignVCenter
} }
Item { Layout.fillHeight: true; } Item {
Spinner { Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
foreground: Nheko.colors.mid
}
Item { Layout.fillHeight: true; }
RowLayout {
Button {
Layout.alignment: Qt.AlignLeft
text: qsTr("Cancel")
onClicked: {
flow.cancel();
dialog.close();
}
}
Item {
Layout.fillWidth: true
}
} }
} }
} }