From 8d400082017cf7b9b1f1398bf4c97de20e9e55f0 Mon Sep 17 00:00:00 2001 From: Johan Ouwerkerk Date: Sat, 28 Sep 2019 00:22:55 +0200 Subject: [PATCH] Use a SpinBox for more appropriate UI/UX when entering token lengths Due to our use of liboath for generating the actual tokens, we also support only a limited range of valid token lengths. This means that it is more user friendly to express those limits directly in the UI through a SpinBox instead of allowing the user type in values we do not currently support. --- src/contents/ui/main.qml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/contents/ui/main.qml b/src/contents/ui/main.qml index 1aa904e..05927e3 100644 --- a/src/contents/ui/main.qml +++ b/src/contents/ui/main.qml @@ -201,12 +201,18 @@ Kirigami.ApplicationWindow { inputMask: "0009" inputMethodHints: Qt.ImhDigitsOnly } - Controls.TextField { + /* + * The liboath API is documented to support tokens which are + * 6, 7 or 8 characters long only. + * + * Make a virtue of it by offering a spinner for better UX + */ + Controls.SpinBox { id: pinLengthField - Kirigami.FormData.label: "Pin length:" - text: "6" - inputMask: "0D" - inputMethodHints: Qt.ImhDigitsOnly + Kirigami.FormData.label: "Token length:" + from: 6 + to: 8 + value: 6 } } }