qml: create PasswordField control
This commit is contained in:
@@ -44,22 +44,27 @@ Pane {
|
|||||||
error: true
|
error: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
RowLayout {
|
||||||
text: qsTr('Password')
|
Layout.columnSpan: 2
|
||||||
visible: wallet_db.needsPassword
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
Layout.maximumWidth: parent.width * 2/3
|
||||||
|
Label {
|
||||||
TextField {
|
text: qsTr('Password')
|
||||||
id: password
|
visible: wallet_db.needsPassword
|
||||||
visible: wallet_db.needsPassword
|
Layout.fillWidth: true
|
||||||
echoMode: TextInput.Password
|
|
||||||
inputMethodHints: Qt.ImhSensitiveData
|
|
||||||
onTextChanged: {
|
|
||||||
unlockButton.enabled = true
|
|
||||||
_unlockClicked = false
|
|
||||||
}
|
}
|
||||||
onAccepted: {
|
|
||||||
unlock()
|
PasswordField {
|
||||||
|
id: password
|
||||||
|
visible: wallet_db.needsPassword
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onTextChanged: {
|
||||||
|
unlockButton.enabled = true
|
||||||
|
_unlockClicked = false
|
||||||
|
}
|
||||||
|
onAccepted: {
|
||||||
|
unlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ ElDialog {
|
|||||||
rowSpacing: 0
|
rowSpacing: 0
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
source: "../../../icons/lock.png"
|
source: "../../icons/lock.png"
|
||||||
Layout.preferredWidth: constants.iconSizeXLarge
|
Layout.preferredWidth: constants.iconSizeXLarge
|
||||||
Layout.preferredHeight: constants.iconSizeXLarge
|
Layout.preferredHeight: constants.iconSizeXLarge
|
||||||
Layout.leftMargin: constants.paddingMedium
|
Layout.leftMargin: constants.paddingMedium
|
||||||
@@ -76,9 +76,8 @@ ElDialog {
|
|||||||
text: qsTr('Password')
|
text: qsTr('Password')
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
PasswordField {
|
||||||
id: pw_1
|
id: pw_1
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@@ -86,9 +85,8 @@ ElDialog {
|
|||||||
visible: confirmPassword
|
visible: confirmPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
PasswordField {
|
||||||
id: pw_2
|
id: pw_2
|
||||||
echoMode: TextInput.Password
|
|
||||||
visible: confirmPassword
|
visible: confirmPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
electrum/gui/qml/components/controls/PasswordField.qml
Normal file
24
electrum/gui/qml/components/controls/PasswordField.qml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import QtQuick 2.6
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: root
|
||||||
|
property alias text: password_tf.text
|
||||||
|
|
||||||
|
signal accepted
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: password_tf
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
inputMethodHints: Qt.ImhSensitiveData
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onAccepted: root.accepted()
|
||||||
|
}
|
||||||
|
ToolButton {
|
||||||
|
icon.source: '../../../icons/eye1.png'
|
||||||
|
onClicked: {
|
||||||
|
password_tf.echoMode = password_tf.echoMode == TextInput.Password ? TextInput.Normal : TextInput.Password
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,10 +75,9 @@ Item {
|
|||||||
enabled: password_tf.enabled
|
enabled: password_tf.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
PasswordField {
|
||||||
id: password_tf
|
id: password_tf
|
||||||
enabled: proxytype.enabled && proxytype.currentIndex > 0
|
enabled: proxytype.enabled && proxytype.currentIndex > 0
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import QtQuick 2.6
|
|||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
import "../controls"
|
||||||
|
|
||||||
WizardComponent {
|
WizardComponent {
|
||||||
valid: password1.text === password2.text && password1.text.length > 4
|
valid: password1.text === password2.text && password1.text.length > 4
|
||||||
|
|
||||||
@@ -13,13 +15,11 @@ WizardComponent {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
columns: 1
|
columns: 1
|
||||||
Label { text: qsTr('Password protect wallet?') }
|
Label { text: qsTr('Password protect wallet?') }
|
||||||
TextField {
|
PasswordField {
|
||||||
id: password1
|
id: password1
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
}
|
||||||
TextField {
|
PasswordField {
|
||||||
id: password2
|
id: password2
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user