2020-08-19 15:29:42 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-14 20:30:51 +00:00
|
|
|
import StatusQ.Controls 0.1 as StatusQ
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-14 20:30:51 +00:00
|
|
|
|
2021-10-14 13:47:12 +00:00
|
|
|
import "../status"
|
|
|
|
import "../panels"
|
|
|
|
import "../controls"
|
2020-08-19 15:29:42 +00:00
|
|
|
|
2021-10-25 19:37:44 +00:00
|
|
|
import StatusQ.Controls 0.1 as StatusQControls
|
|
|
|
|
2020-08-19 15:29:42 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
height: signingPhraseItem.height + signingPhrase.height + txtPassword.height + Style.current.smallPadding + Style.current.bigPadding
|
|
|
|
|
2020-08-20 04:45:29 +00:00
|
|
|
property alias signingPhrase: signingPhrase.text
|
|
|
|
property string enteredPassword
|
|
|
|
property alias validationError: txtPassword.validationError
|
2022-04-04 11:26:30 +00:00
|
|
|
property string noInputErrorMessage: qsTr("You need to enter a password")
|
|
|
|
property string invalidInputErrorMessage: qsTr("Password needs to be 6 characters or more")
|
2020-08-20 04:45:29 +00:00
|
|
|
property bool isValid: false
|
|
|
|
|
|
|
|
function forceActiveFocus(reason) {
|
|
|
|
txtPassword.forceActiveFocus(reason)
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate() {
|
|
|
|
txtPassword.validationError = ""
|
|
|
|
const noInput = txtPassword.text === ""
|
|
|
|
if (noInput) {
|
|
|
|
txtPassword.validationError = noInputErrorMessage
|
2020-12-03 22:26:05 +00:00
|
|
|
} else if (txtPassword.text.length < 6) {
|
2020-08-20 04:45:29 +00:00
|
|
|
txtPassword.validationError = invalidInputErrorMessage
|
|
|
|
}
|
|
|
|
isValid = txtPassword.validationError === ""
|
|
|
|
return isValid
|
|
|
|
}
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2020-08-19 15:29:42 +00:00
|
|
|
Item {
|
|
|
|
id: signingPhraseItem
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-02-09 09:43:23 +00:00
|
|
|
height: labelSigningPhrase.height
|
2020-08-19 15:29:42 +00:00
|
|
|
width: labelSigningPhrase.width + infoButton.width + infoButton.anchors.leftMargin
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: labelSigningPhrase
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: 15
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Signing phrase")
|
2020-08-19 15:29:42 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 19:37:44 +00:00
|
|
|
StatusQControls.StatusRoundButton {
|
2020-08-19 15:29:42 +00:00
|
|
|
id: infoButton
|
|
|
|
anchors.left: labelSigningPhrase.right
|
|
|
|
anchors.leftMargin: 7
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 13
|
|
|
|
height: 13
|
2020-11-16 14:04:40 +00:00
|
|
|
icon.width: width
|
|
|
|
icon.height: height
|
|
|
|
icon.name: "info"
|
2021-10-14 20:30:51 +00:00
|
|
|
StatusQ.StatusToolTip {
|
2020-08-21 11:23:47 +00:00
|
|
|
visible: infoButton.hovered
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Signing phrase is a 3 word combination that displayed when you entered the wallet on this device for the first time.")
|
2020-08-21 11:23:47 +00:00
|
|
|
}
|
2020-08-19 15:29:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: signingPhrase
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: signingPhraseItem.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
font.pixelSize: 15
|
|
|
|
text: root.signingPhrase
|
|
|
|
}
|
|
|
|
|
2021-10-25 19:37:44 +00:00
|
|
|
StatusQControls.StatusRoundButton {
|
2020-08-19 15:29:42 +00:00
|
|
|
id: passwordInfoButton
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 67
|
|
|
|
anchors.top: txtPassword.top
|
|
|
|
anchors.topMargin: 2
|
|
|
|
width: 13
|
|
|
|
height: 13
|
2020-11-16 14:04:40 +00:00
|
|
|
icon.width: width
|
|
|
|
icon.height: height
|
|
|
|
icon.name: "info"
|
2021-10-14 20:30:51 +00:00
|
|
|
StatusQ.StatusToolTip {
|
2020-08-21 11:23:47 +00:00
|
|
|
visible: passwordInfoButton.hovered
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Enter the password you use to unlock this device")
|
2020-08-21 11:23:47 +00:00
|
|
|
}
|
2020-08-19 15:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Input {
|
2020-08-20 04:45:29 +00:00
|
|
|
id: txtPassword
|
2022-07-25 13:22:09 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-08-19 15:29:42 +00:00
|
|
|
anchors.top: signingPhrase.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2022-07-21 12:15:02 +00:00
|
|
|
textField.objectName: "transactionSignerPasswordInput"
|
2020-08-20 04:45:29 +00:00
|
|
|
focus: true
|
|
|
|
customHeight: 56
|
2022-04-04 11:26:30 +00:00
|
|
|
label: qsTr("Password")
|
|
|
|
placeholderText: qsTr("Enter password")
|
2020-08-19 15:29:42 +00:00
|
|
|
textField.echoMode: TextInput.Password
|
2020-08-20 04:45:29 +00:00
|
|
|
validationErrorAlignment: TextEdit.AlignRight
|
|
|
|
validationErrorTopMargin: 8
|
|
|
|
onTextChanged: {
|
|
|
|
if(root.validate()) {
|
|
|
|
root.enteredPassword = this.text
|
|
|
|
}
|
|
|
|
}
|
2020-08-19 15:29:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|