From 303e40bdcfa59bcf8ddf85128c44e92d5790680a Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Mon, 27 Sep 2021 12:07:20 +0300 Subject: [PATCH] card connection prompt --- src/app/keycard/view.nim | 8 +++++++- ui/onboarding/Keycard.qml | 14 ++++++++++++++ ui/onboarding/Keycard/CreatePINModal.qml | 7 ++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/app/keycard/view.nim b/src/app/keycard/view.nim index 44708cec70..45b5b9c8df 100644 --- a/src/app/keycard/view.nim +++ b/src/app/keycard/view.nim @@ -1,6 +1,9 @@ -import NimQml +import NimQml, chronicles import status/status +logScope: + topics = "keycard-model" + QtObject: type KeycardView* = ref object of QObject status*: Status @@ -19,3 +22,6 @@ QtObject: proc cardConnected*(self: KeycardView) {.signal.} proc cardDisconnected*(self: KeycardView) {.signal.} + + proc simulateDisconnected*(self: KeycardView) {.slot.} = + self.cardDisconnected() \ No newline at end of file diff --git a/ui/onboarding/Keycard.qml b/ui/onboarding/Keycard.qml index c30b758a68..07560c28ff 100644 --- a/ui/onboarding/Keycard.qml +++ b/ui/onboarding/Keycard.qml @@ -38,4 +38,18 @@ Item { keycardView.onClosed() } } + + Connections { + id: connection + target: keycardModel + ignoreUnknownSignals: true + + onCardConnected: { + insertCard.close() + } + + onCardDisconnected: { + insertCard.open() + } + } } \ No newline at end of file diff --git a/ui/onboarding/Keycard/CreatePINModal.qml b/ui/onboarding/Keycard/CreatePINModal.qml index 2c4df60a1f..0036568778 100644 --- a/ui/onboarding/Keycard/CreatePINModal.qml +++ b/ui/onboarding/Keycard/CreatePINModal.qml @@ -4,6 +4,7 @@ import QtQuick.Dialogs 1.3 import StatusQ.Controls 0.1 import "../../imports" import "../../shared" +import "../../shared/keycard" ModalPopup { property bool firstPINFieldValid: false @@ -27,7 +28,7 @@ ModalPopup { anchors.top: parent.top anchors.topMargin: 88 placeholderText: qsTr("New PIN") - textField.echoMode: TextInput.PIN + textField.echoMode: TextInput.Password onTextChanged: { [firstPINFieldValid, pinValidationError] = Utils.validatePINs("first", firstPINField, repeatPINField); @@ -44,7 +45,7 @@ ModalPopup { anchors.top: firstPINField.bottom anchors.topMargin: Style.current.xlPadding placeholderText: qsTr("Confirm PIN") - textField.echoMode: TextInput.PIN + textField.echoMode: TextInput.Password Keys.onReturnPressed: function(event) { if (submitBtn.enabled) { submitBtn.clicked(event) @@ -101,7 +102,7 @@ ModalPopup { enabled: firstPINFieldValid && repeatPINFieldValid onClicked: { - + keycardModel.simulateDisconnected() } } }