mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Merge pull request #1985
61af76f
wizard: allow restore height when creating wallet from device (mmbyday)
This commit is contained in:
commit
7fd1f8e025
2 changed files with 17 additions and 9 deletions
|
@ -89,12 +89,14 @@ Rectangle {
|
||||||
MoneroComponents.LineEdit {
|
MoneroComponents.LineEdit {
|
||||||
id: restoreHeight
|
id: restoreHeight
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
labelText: qsTr("Wallet creation date as `YYYY-MM-DD` or restore height") + translationManager.emptyString
|
||||||
labelText: qsTr("Restore height (optional)") + translationManager.emptyString
|
|
||||||
labelFontSize: 14 * scaleRatio
|
labelFontSize: 14 * scaleRatio
|
||||||
placeholderFontSize: 16 * scaleRatio
|
placeholderFontSize: 16 * scaleRatio
|
||||||
placeholderText: "0"
|
placeholderText: qsTr("Restore height") + translationManager.emptyString
|
||||||
validator: RegExpValidator { regExp: /(\d+)?$/ }
|
validator: RegExpValidator {
|
||||||
|
regExp: /^(\d+|\d{4}-\d{2}-\d{2})$/
|
||||||
|
}
|
||||||
|
text: "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.LineEdit {
|
MoneroComponents.LineEdit {
|
||||||
|
@ -161,12 +163,18 @@ Rectangle {
|
||||||
wizardController.walletOptionsName = walletInput.walletName.text;
|
wizardController.walletOptionsName = walletInput.walletName.text;
|
||||||
wizardController.walletOptionsLocation = walletInput.walletLocation.text;
|
wizardController.walletOptionsLocation = walletInput.walletLocation.text;
|
||||||
wizardController.walletOptionsDeviceName = wizardCreateDevice1.deviceName;
|
wizardController.walletOptionsDeviceName = wizardCreateDevice1.deviceName;
|
||||||
|
|
||||||
if(restoreHeight.text)
|
|
||||||
wizardController.walletOptionsRestoreHeight = parseInt(restoreHeight.text);
|
|
||||||
if(lookahead.text)
|
if(lookahead.text)
|
||||||
wizardController.walletOptionsSubaddressLookahead = 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();
|
var written = wizardController.createWalletFromDevice();
|
||||||
if(written){
|
if(written){
|
||||||
wizardController.walletOptionsIsRecoveringFromDevice = true;
|
wizardController.walletOptionsIsRecoveringFromDevice = true;
|
||||||
|
|
|
@ -67,7 +67,7 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
header: qsTr("Restore height") + translationManager.emptyString
|
header: qsTr("Restore height") + translationManager.emptyString
|
||||||
value: wizardController.walletOptionsRestoreHeight
|
value: wizardController.walletOptionsRestoreHeight
|
||||||
visible: wizardStateView.state != "wizardCreateWallet4"
|
visible: wizardController.walletOptionsRestoreHeight > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardSummaryItem {
|
WizardSummaryItem {
|
||||||
|
|
Loading…
Reference in a new issue