2021-09-24 12:03:57 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-10-05 09:12:10 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-09-24 12:03:57 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2021-10-05 09:12:10 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2021-09-24 12:03:57 +00:00
|
|
|
import "../../shared"
|
|
|
|
|
2021-10-05 09:12:10 +00:00
|
|
|
StatusModal {
|
2021-09-24 12:03:57 +00:00
|
|
|
property bool pairingPasswordFieldValid: false
|
2021-09-30 11:52:46 +00:00
|
|
|
property bool submitted: false
|
2021-09-24 12:03:57 +00:00
|
|
|
|
|
|
|
id: popup
|
2021-10-05 09:12:10 +00:00
|
|
|
header.title: qsTr("Insert pairing code")
|
|
|
|
anchors.centerIn: parent
|
2021-09-24 12:03:57 +00:00
|
|
|
height: 400
|
|
|
|
|
|
|
|
onOpened: {
|
2021-10-01 10:22:51 +00:00
|
|
|
submitted = false
|
2021-09-24 12:03:57 +00:00
|
|
|
pairingPasswordField.text = "";
|
|
|
|
pairingPasswordField.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
}
|
|
|
|
|
2021-10-05 09:12:10 +00:00
|
|
|
contentItem: Item {
|
|
|
|
Input {
|
|
|
|
id: pairingPasswordField
|
|
|
|
anchors.rightMargin: 56
|
|
|
|
anchors.leftMargin: 56
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 88
|
|
|
|
anchors.bottomMargin: 0
|
|
|
|
placeholderText: qsTr("Pairing code")
|
|
|
|
textField.echoMode: TextInput.Password
|
|
|
|
onTextChanged: {
|
|
|
|
pairingPasswordFieldValid = pairingPasswordField.text !== "";
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
|
2021-10-05 09:12:10 +00:00
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Insert the Keycard pairing code")
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: 12
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
|
2021-10-05 09:12:10 +00:00
|
|
|
rightButtons: [
|
2021-09-24 12:03:57 +00:00
|
|
|
StatusButton {
|
|
|
|
id: submitBtn
|
|
|
|
text: qsTr("Pair")
|
|
|
|
enabled: pairingPasswordFieldValid
|
|
|
|
|
|
|
|
onClicked: {
|
2021-09-30 11:52:46 +00:00
|
|
|
submitted = true
|
|
|
|
keycardModel.pair(pairingPasswordField.text)
|
|
|
|
popup.close()
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-05 09:12:10 +00:00
|
|
|
]
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|