card connection prompt
This commit is contained in:
parent
2a027d44d0
commit
303e40bdcf
|
@ -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()
|
|
@ -38,4 +38,18 @@ Item {
|
|||
keycardView.onClosed()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
id: connection
|
||||
target: keycardModel
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
onCardConnected: {
|
||||
insertCard.close()
|
||||
}
|
||||
|
||||
onCardDisconnected: {
|
||||
insertCard.open()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue