Wizard: added restore-height

pull/2/head
Jacob Brydolf 8 years ago committed by Ilya Kitaev
parent 7f0d6c4c28
commit 38d9034470

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

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

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