aboutsummaryrefslogtreecommitdiff
path: root/wizard/WizardCreateDevice1.qml
diff options
context:
space:
mode:
authormmbyday <mmbyday@protonmail.com>2019-02-28 11:08:54 -0800
committermmbyday <mmbyday@protonmail.com>2019-02-28 11:23:19 -0800
commit61af76fcb852f8f2be10267355edc3f1c7626fca (patch)
treed4c71b20249cd92c870a11a139f1e37506472f9b /wizard/WizardCreateDevice1.qml
parent07df0f41bf8d5f735480289854f08f9e19356d39 (diff)
downloadmonzero-gui-61af76fcb852f8f2be10267355edc3f1c7626fca.tar.gz
monzero-gui-61af76fcb852f8f2be10267355edc3f1c7626fca.tar.xz
monzero-gui-61af76fcb852f8f2be10267355edc3f1c7626fca.zip
wizard: allow restore height when creating wallet from device
Diffstat (limited to 'wizard/WizardCreateDevice1.qml')
-rw-r--r--wizard/WizardCreateDevice1.qml24
1 files changed, 16 insertions, 8 deletions
diff --git a/wizard/WizardCreateDevice1.qml b/wizard/WizardCreateDevice1.qml
index a9b15303..060c4f12 100644
--- a/wizard/WizardCreateDevice1.qml
+++ b/wizard/WizardCreateDevice1.qml
@@ -89,12 +89,14 @@ Rectangle {
MoneroComponents.LineEdit {
id: restoreHeight
Layout.fillWidth: true
-
- labelText: qsTr("Restore height (optional)") + translationManager.emptyString
+ labelText: qsTr("Wallet creation date as `YYYY-MM-DD` or restore height") + translationManager.emptyString
labelFontSize: 14 * scaleRatio
placeholderFontSize: 16 * scaleRatio
- placeholderText: "0"
- validator: RegExpValidator { regExp: /(\d+)?$/ }
+ placeholderText: qsTr("Restore height") + translationManager.emptyString
+ validator: RegExpValidator {
+ regExp: /^(\d+|\d{4}-\d{2}-\d{2})$/
+ }
+ text: "0"
}
MoneroComponents.LineEdit {
@@ -161,12 +163,18 @@ Rectangle {
wizardController.walletOptionsName = walletInput.walletName.text;
wizardController.walletOptionsLocation = walletInput.walletLocation.text;
wizardController.walletOptionsDeviceName = wizardCreateDevice1.deviceName;
-
- if(restoreHeight.text)
- wizardController.walletOptionsRestoreHeight = parseInt(restoreHeight.text);
if(lookahead.text)
wizardController.walletOptionsSubaddressLookahead = lookahead.text;
-
+ var _restoreHeight = 0;
+ if(restoreHeight.text){
+ // Parse date string or restore height as integer
+ if(restoreHeight.text.indexOf('-') === 4 && restoreHeight.text.length === 10){
+ _restoreHeight = Wizard.getApproximateBlockchainHeight(restoreHeight.text);
+ } else {
+ _restoreHeight = parseInt(restoreHeight.text)
+ }
+ wizardController.walletOptionsRestoreHeight = _restoreHeight;
+ }
var written = wizardController.createWalletFromDevice();
if(written){
wizardController.walletOptionsIsRecoveringFromDevice = true;