[network/neochat] src: Improve the key verification UX some more
Joshua Goins <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit b0f785a3b433cec0a5471d40ce9796b51dc4bb8f by Joshua Goins.
Committed on 26/07/2026 at 15:51.
Pushed by redstrate into branch 'master'.
Improve the key verification UX some more
The actual dialog now opens when the verification starts and waits for
other devices, so we don't need the extra informational dialog anymore.
I also fixed it so the dialog clearly indicates when its
self-verification. When the verification session is finished, the dialog
closes itself now.
M +16 -3 src/app/qml/KeyVerificationDialog.qml
M +2 -1 src/app/qml/Main.qml
M +0 -2 src/app/qml/VerificationCanceled.qml
M +0 -11 src/app/qml/VerificationMessage.qml
M +1 -12 src/settings/DevicesPage.qml
https://invent.kde.org/network/neochat/-/commit/b0f785a3b433cec0a5471d40ce9796b51dc4bb8f
diff --git a/src/app/qml/KeyVerificationDialog.qml b/src/app/qml/KeyVerificationDialog.qml
index d11dd4716..fd91e85f3 100644
--- a/src/app/qml/KeyVerificationDialog.qml
+++ b/src/app/qml/KeyVerificationDialog.qml
@@ -18,6 +18,18 @@ Kirigami.Page {
title: i18n("Session Verification")
required property var session
+ required property NeoChatConnection connection
+ readonly property bool isSelfVerification: root.session.remoteUserId === root.connection.localUserId
+
+ Connections {
+ target: root.session
+
+ function onStateChanged(): void {
+ if (session.state === KeyVerificationSession.DONE) {
+ root.closeDialog();
+ }
+ }
+ }
states: [
State {
@@ -99,7 +111,7 @@ Kirigami.Page {
}
footer: QQC2.ToolBar {
- visible: root.session.state === KeyVerificationSession.INCOMING
+ visible: root.session.state === KeyVerificationSession.INCOMING && !root.isSelfVerification
QQC2.DialogButtonBox {
anchors.fill: parent
Item {
@@ -166,6 +178,9 @@ Kirigami.Page {
case KeyVerificationSession.WAITINGFORREADY:
return i18n("Waiting for device to accept verification.");
case KeyVerificationSession.INCOMING: {
+ if (root.isSelfVerification) {
+ return i18nc("@info:label Encryption device verification", "Waiting for a device to respond to our verification request.");
+ }
if (root.session.remoteDeviceId.length > 0) {
return i18n("Incoming key verification request from device **%1**", root.session.remoteDeviceId);
} else {
@@ -201,8 +216,6 @@ Kirigami.Page {
return "";
}
}
- isDone: root.session.state === KeyVerificationSession.DONE
- onDone: root.closeDialog()
}
}
diff --git a/src/app/qml/Main.qml b/src/app/qml/Main.qml
index e9787550a..f23115243 100644
--- a/src/app/qml/Main.qml
+++ b/src/app/qml/Main.qml
@@ -282,7 +282,8 @@ Kirigami.ApplicationWindow {
function onNewKeyVerificationSession(session) {
root.pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "KeyVerificationDialog"), {
- session: session
+ session: session,
+ connection: root.connection,
}, {
title: i18nc("@title:window", "Session Verification")
});
diff --git a/src/app/qml/VerificationCanceled.qml b/src/app/qml/VerificationCanceled.qml
index e6c7ee754..a9f35fb16 100644
--- a/src/app/qml/VerificationCanceled.qml
+++ b/src/app/qml/VerificationCanceled.qml
@@ -11,8 +11,6 @@ VerificationMessage {
required property int reason
- isDone: false
-
icon: {
switch (root.reason) {
case KeyVerificationSession.TIMEOUT:
diff --git a/src/app/qml/VerificationMessage.qml b/src/app/qml/VerificationMessage.qml
index c6f66516b..0bce4f214 100644
--- a/src/app/qml/VerificationMessage.qml
+++ b/src/app/qml/VerificationMessage.qml
@@ -13,9 +13,6 @@ ColumnLayout {
required property string icon
required property string text
- required property bool isDone
-
- signal done
anchors.fill: parent
@@ -35,14 +32,6 @@ ColumnLayout {
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
- QQC2.Button {
- text: i18nc("@action:button Done, we are finished with verification", "Done")
- visible: root.isDone
- onClicked: root.done()
-
- Layout.topMargin: Kirigami.Units.largeSpacing
- Layout.alignment: Qt.AlignHCenter
- }
Item {
Layout.fillHeight: true
}
diff --git a/src/settings/DevicesPage.qml b/src/settings/DevicesPage.qml
index 2b9db4829..1c1f46684 100644
--- a/src/settings/DevicesPage.qml
+++ b/src/settings/DevicesPage.qml
@@ -45,18 +45,7 @@ FormCard.FormCardPage {
description: !root.connection.isVerifiedSession ? i18nc("@info:description", "This device is marked as insecure until it's verified by another device. It's recommended to verify as soon as possible.")
: i18nc("@info:description", "This device is marked as secure.")
visible: !root.connection.isVerifiedSession || NeoChatConfig.alwaysVerifyDevice
- onClicked: {
- root.connection.startSelfVerification();
- const dialog = Qt.createComponent("org.kde.kirigami", "PromptDialog").createObject(QQC2.Overlay.overlay, {
- title: i18nc("@title", "Verification Request Sent"),
- subtitle: i18nc("@info:label", "To proceed, accept the verification request on another device."),
- standardButtons: Kirigami.Dialog.Ok
- })
- dialog.open();
- root.connection.newKeyVerificationSession.connect(() => {
- dialog.close();
- });
- }
+ onClicked: root.connection.startSelfVerification()
}
}
DevicesCard {