Wizard: added restore-height

This commit is contained in:
Jacob Brydolf 2016-10-08 01:48:42 +02:00 committed by Ilya Kitaev
parent 7f0d6c4c28
commit 38d9034470
3 changed files with 23 additions and 3 deletions

View file

@ -96,5 +96,6 @@ Item {
wordsTextItem.clipboardButtonVisible: true
wordsTextItem.tipTextVisible: true
wordsTextItem.memoTextReadOnly: true
restoreHeightVisible:false
}
}

View file

@ -29,6 +29,8 @@
import QtQuick 2.2
import moneroComponents.TranslationManager 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import "../components"
// Reusable component for managing wallet (account name, path, private key)
@ -39,6 +41,8 @@ Item {
property alias wordsTextTitle: frameHeader.text
property alias walletPath: fileUrlInput.text
property alias wordsTextItem : memoTextItem
property alias restoreHeight : restoreHeightItem.text
property alias restoreHeightVisible: restoreHeightItem.visible
// TODO extend properties if needed
@ -112,7 +116,7 @@ Item {
width: 300
height: 62
TextInput {
TextEdit {
id: accountName
anchors.fill: parent
horizontalAlignment: TextInput.AlignHCenter
@ -159,10 +163,22 @@ Item {
anchors.topMargin: 16
}
// Restore Height
LineEdit {
id: restoreHeightItem
anchors.top: memoTextItem.bottom
width: 250
anchors.topMargin: 20
placeholderText: qsTr("Restore height")
Layout.alignment: Qt.AlignCenter
validator: IntValidator {
bottom:0
}
}
Row {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: memoTextItem.bottom
anchors.top: (restoreHeightItem.visible)? restoreHeightItem.bottom : memoTextItem.bottom
anchors.topMargin: 24
spacing: 16

View file

@ -54,12 +54,14 @@ Item {
settingsObject['account_name'] = uiItem.accountNameText
settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText)
settingsObject['wallet_path'] = uiItem.walletPath
settingsObject['restoreHeight'] = parseInt(uiItem.restoreHeight)
return recoveryWallet(settingsObject)
}
function recoveryWallet(settingsObject) {
var testnet = appWindow.persistentSettings.testnet;
var wallet = walletManager.recoveryWallet(oshelper.temporaryFilename(), settingsObject.words, testnet);
var restoreHeight = settingsObject.restoreHeight;
var wallet = walletManager.recoveryWallet(oshelper.temporaryFilename(), settingsObject.words, testnet, restoreHeight);
var success = wallet.status === Wallet.Status_Ok;
if (success) {
settingsObject['wallet'] = wallet;
@ -80,6 +82,7 @@ Item {
wordsTextItem.tipTextVisible: false
wordsTextItem.memoTextReadOnly: false
wordsTextItem.memoText: ""
restoreHeightVisible: true
wordsTextItem.onMemoTextChanged: {
checkNextButton();
}