|
|
|
@ -13,6 +13,7 @@ ElDialog { |
|
|
|
property string name |
|
|
|
property string name |
|
|
|
property string path |
|
|
|
property string path |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool _invalidPassword: false |
|
|
|
property bool _unlockClicked: false |
|
|
|
property bool _unlockClicked: false |
|
|
|
|
|
|
|
|
|
|
|
title: qsTr('Open Wallet') |
|
|
|
title: qsTr('Open Wallet') |
|
|
|
@ -38,17 +39,15 @@ ElDialog { |
|
|
|
|
|
|
|
|
|
|
|
InfoTextArea { |
|
|
|
InfoTextArea { |
|
|
|
id: notice |
|
|
|
id: notice |
|
|
|
text: Daemon.singlePasswordEnabled |
|
|
|
text: Daemon.singlePasswordEnabled || !Daemon.currentWallet |
|
|
|
? qsTr('Please enter password') |
|
|
|
? qsTr('Please enter password') |
|
|
|
: qsTr('Wallet <b>%1</b> requires password to unlock').arg(name) |
|
|
|
: qsTr('Wallet <b>%1</b> requires password to unlock').arg(name) |
|
|
|
visible: wallet_db.needsPassword |
|
|
|
|
|
|
|
iconStyle: InfoTextArea.IconStyle.Warn |
|
|
|
iconStyle: InfoTextArea.IconStyle.Warn |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
Label { |
|
|
|
text: qsTr('Password') |
|
|
|
text: qsTr('Password') |
|
|
|
visible: wallet_db.needsPassword |
|
|
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
color: Material.accentColor |
|
|
|
color: Material.accentColor |
|
|
|
} |
|
|
|
} |
|
|
|
@ -57,7 +56,6 @@ ElDialog { |
|
|
|
id: password |
|
|
|
id: password |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.leftMargin: constants.paddingXLarge |
|
|
|
Layout.leftMargin: constants.paddingXLarge |
|
|
|
visible: wallet_db.needsPassword |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onTextChanged: { |
|
|
|
onTextChanged: { |
|
|
|
unlockButton.enabled = true |
|
|
|
unlockButton.enabled = true |
|
|
|
@ -70,7 +68,7 @@ ElDialog { |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
Label { |
|
|
|
Layout.alignment: Qt.AlignHCenter |
|
|
|
Layout.alignment: Qt.AlignHCenter |
|
|
|
text: !wallet_db.validPassword && _unlockClicked ? qsTr("Invalid Password") : '' |
|
|
|
text: _invalidPassword && _unlockClicked ? qsTr("Invalid Password") : '' |
|
|
|
color: constants.colorError |
|
|
|
color: constants.colorError |
|
|
|
font.pixelSize: constants.fontSizeLarge |
|
|
|
font.pixelSize: constants.fontSizeLarge |
|
|
|
} |
|
|
|
} |
|
|
|
@ -79,7 +77,6 @@ ElDialog { |
|
|
|
FlatButton { |
|
|
|
FlatButton { |
|
|
|
id: unlockButton |
|
|
|
id: unlockButton |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
visible: wallet_db.needsPassword |
|
|
|
|
|
|
|
icon.source: '../../icons/unlock.png' |
|
|
|
icon.source: '../../icons/unlock.png' |
|
|
|
text: qsTr("Unlock") |
|
|
|
text: qsTr("Unlock") |
|
|
|
onClicked: { |
|
|
|
onClicked: { |
|
|
|
@ -92,32 +89,22 @@ ElDialog { |
|
|
|
function unlock() { |
|
|
|
function unlock() { |
|
|
|
unlockButton.enabled = false |
|
|
|
unlockButton.enabled = false |
|
|
|
_unlockClicked = true |
|
|
|
_unlockClicked = true |
|
|
|
wallet_db.password = password.text |
|
|
|
Daemon.loadWallet(openwalletdialog.path, password.text) |
|
|
|
wallet_db.verify() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WalletDB { |
|
|
|
Connections { |
|
|
|
id: wallet_db |
|
|
|
target: Daemon |
|
|
|
path: openwalletdialog.path |
|
|
|
function onWalletRequiresPassword() { |
|
|
|
onReadyChanged: { |
|
|
|
console.log('invalid password') |
|
|
|
if (ready) { |
|
|
|
_invalidPassword = true |
|
|
|
Daemon.loadWallet(openwalletdialog.path, password.text) |
|
|
|
|
|
|
|
openwalletdialog.close() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onInvalidPassword: { |
|
|
|
|
|
|
|
password.tf.forceActiveFocus() |
|
|
|
password.tf.forceActiveFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
onNeedsPasswordChanged: { |
|
|
|
function onWalletLoaded() { |
|
|
|
notice.visible = needsPassword |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onWalletOpenProblem: { |
|
|
|
|
|
|
|
openwalletdialog.close() |
|
|
|
openwalletdialog.close() |
|
|
|
Daemon.onWalletOpenProblem(error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: { |
|
|
|
Component.onCompleted: { |
|
|
|
wallet_db.verify() |
|
|
|
password.tf.forceActiveFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|