From 49c022b64132e586a856914ff75f7f2e3ecb57e4 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Fri, 28 Oct 2016 21:20:05 +0200 Subject: Wizard: check pwd on page load --- wizard/WizardPassword.qml | 1 + 1 file changed, 1 insertion(+) (limited to 'wizard') diff --git a/wizard/WizardPassword.qml b/wizard/WizardPassword.qml index 476c5742..8645a300 100644 --- a/wizard/WizardPassword.qml +++ b/wizard/WizardPassword.qml @@ -46,6 +46,7 @@ Item { function onPageOpened(settingsObject) { wizard.nextButton.enabled = true + handlePassword(); if (wizard.currentPath === "create_wallet") { passwordPage.titleText = qsTr("Now that your wallet has been created, please set a password for the wallet") + translationManager.emptyString -- cgit v1.2.3 From 675e35d7179941931c15e06de3ad3f7df3877183 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 14:07:55 +0200 Subject: wizard: skip language page if only 1 language is availible --- wizard/WizardWelcome.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardWelcome.qml b/wizard/WizardWelcome.qml index ef97f984..3553a6a5 100644 --- a/wizard/WizardWelcome.qml +++ b/wizard/WizardWelcome.qml @@ -45,13 +45,18 @@ Item { onOpacityChanged: visible = opacity !== 0 + function onPageClosed(settingsObject) { + // set default language to first item if none selected + if(gridView.currentIndex === -1) { + gridView.currentIndex = 0 + } - function onPageClosed(settingsObject) { var lang = languagesModel.get(gridView.currentIndex); settingsObject['language'] = lang.display_name; settingsObject['wallet_language'] = lang.wallet_language; settingsObject['locale'] = lang.locale; + console.log("Language chosen: ",lang.display_name) return true } @@ -108,7 +113,15 @@ Item { // and set current language accordingly XmlRole { name: "isCurrent"; query: "@enabled/string()" } - + onStatusChanged: { + if(status === XmlListModel.Ready){ + console.log("languages availible: ",count); + if(count === 1){ + console.log("Skipping language page until more languages are availible") + wizard.switchPage(true); + } + } + } } // Flags view -- cgit v1.2.3 From 1d0ddff0e1340b3576fcc504f980a24a29ccaa42 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 16:34:24 +0200 Subject: wizard: open fallet from file --- wizard/WizardMain.qml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml index 543ee14d..24a0b534 100644 --- a/wizard/WizardMain.qml +++ b/wizard/WizardMain.qml @@ -39,17 +39,35 @@ Rectangle { property var paths: { "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ], - "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ] + "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ], + } property string currentPath: "create_wallet" property var pages: paths[currentPath] signal useMoneroClicked() + signal openWalletFromFileClicked() border.color: "#DBDBDB" border.width: 1 color: "#FFFFFF" + function restart(){ + wizard.currentPage = 0; + wizard.settings = ({}) + wizard.currentPath = "create_wallet" + wizard.pages = paths[currentPath] + + //hide all pages except first + for (var i = 1; i < wizard.pages.length; i++){ + wizard.pages[i].opacity = 0; + } + //Show first pages + wizard.pages[0].opacity = 1; + + } + function switchPage(next) { + console.log("hepp") // save settings for current page; if (next && typeof pages[currentPage].onPageClosed !== 'undefined') { if (pages[currentPage].onPageClosed(settings) !== true) { @@ -103,13 +121,19 @@ Rectangle { currentPage = pages.indexOf(recoveryWalletPage) wizard.nextButton.visible = true recoveryWalletPage.onPageOpened(settings); + } + function openOpenWalletPage() { + console.log("open wallet from file page"); + wizard.openWalletFromFileClicked(); } //! actually writes the wallet function applySettings() { console.log("Here we apply the settings"); // here we need to actually move wallet to the new location + console.log(settings.wallet_full_path); + // Remove trailing slash - (default on windows and mac) if (settings.wallet_path.substring(settings.wallet_path.length -1) === "/"){ @@ -120,7 +144,7 @@ Rectangle { + settings.account_name + "/" + settings.account_name; - console.log("saving to wizard: "+ new_wallet_filename) + console.log("saving in wizard: "+ new_wallet_filename) // moving wallet files to the new destination, if user changed it if (new_wallet_filename !== settings.wallet_filename) { // using previously saved wallet; @@ -140,7 +164,7 @@ Rectangle { appWindow.persistentSettings.language = settings.language appWindow.persistentSettings.locale = settings.locale appWindow.persistentSettings.account_name = settings.account_name - appWindow.persistentSettings.wallet_path = settings.wallet_path + appWindow.persistentSettings.wallet_path = new_wallet_filename appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount @@ -153,7 +177,6 @@ Rectangle { // reading settings from persistent storage Component.onCompleted: { - console.log("rootItem: ", appWindow); settings['allow_background_mining'] = appWindow.persistentSettings.allow_background_mining settings['auto_donations_enabled'] = appWindow.persistentSettings.auto_donations_enabled settings['auto_donations_amount'] = appWindow.persistentSettings.auto_donations_amount @@ -206,6 +229,7 @@ Rectangle { anchors.rightMargin: 50 onCreateWalletClicked: wizard.openCreateWalletPage() onRecoveryWalletClicked: wizard.openRecoveryWalletPage() + onOpenWalletClicked: wizard.openOpenWalletPage(); } WizardCreateWallet { @@ -228,8 +252,6 @@ Rectangle { anchors.rightMargin: 50 } - - WizardPassword { id: passwordPage anchors.top: parent.top @@ -299,7 +321,7 @@ Rectangle { visible: parent.paths[currentPath][currentPage] === finishPage onClicked: { wizard.applySettings(); - wizard.useMoneroClicked() + wizard.useMoneroClicked(); } } } -- cgit v1.2.3 From 469bb9f25f1e8b710f038fa2e5c082e21df810d1 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 16:35:16 +0200 Subject: wizard: disable donation page --- wizard/WizardMain.qml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml index 24a0b534..34835a5f 100644 --- a/wizard/WizardMain.qml +++ b/wizard/WizardMain.qml @@ -38,8 +38,11 @@ Rectangle { property int currentPage: 0 property var paths: { - "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ], - "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ], + // "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ], + // "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ], + // disable donation page + "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, finishPage ], + "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, finishPage ], } property string currentPath: "create_wallet" @@ -165,14 +168,15 @@ Rectangle { appWindow.persistentSettings.locale = settings.locale appWindow.persistentSettings.account_name = settings.account_name appWindow.persistentSettings.wallet_path = new_wallet_filename - appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining - appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled - appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount + appWindow.persistentSettings.allow_background_mining = false //settings.allow_background_mining + appWindow.persistentSettings.auto_donations_enabled = false //settings.auto_donations_enabled + appWindow.persistentSettings.auto_donations_amount = false //settings.auto_donations_amount appWindow.persistentSettings.daemon_address = settings.daemon_address appWindow.persistentSettings.testnet = settings.testnet appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering + } // reading settings from persistent storage -- cgit v1.2.3 From ec3d586fd0e695be92f6f784da317f7aefed8877 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 16:36:32 +0200 Subject: wizard: change default account name + validation nextButton --- wizard/WizardManageWalletUI.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'wizard') diff --git a/wizard/WizardManageWalletUI.qml b/wizard/WizardManageWalletUI.qml index 7104dc9f..ad0f2e7e 100644 --- a/wizard/WizardManageWalletUI.qml +++ b/wizard/WizardManageWalletUI.qml @@ -126,7 +126,13 @@ Item { renderType: Text.NativeRendering color: "#FF6C3C" focus: true - text: qsTr("My account name") + translationManager.emptyString + text: defaultAccountName + + + Keys.onReleased: { + wizard.nextButton.enabled = (accountName.length > 0) + } + } Rectangle { -- cgit v1.2.3 From 21414d75a48a7fbd275457cee8a87eae0c1f0e09 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 16:39:32 +0200 Subject: wizardOptions: open from file button --- wizard/WizardOptions.qml | 70 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardOptions.qml b/wizard/WizardOptions.qml index 8f9a2753..f926be02 100644 --- a/wizard/WizardOptions.qml +++ b/wizard/WizardOptions.qml @@ -35,8 +35,10 @@ Item { id: page signal createWalletClicked() signal recoveryWalletClicked() + signal openWalletClicked() opacity: 0 visible: false + property var buttonSize: 190 function saveDaemonAddress() { wizard.settings["daemon_address"] = daemonAddress.text @@ -96,16 +98,23 @@ Item { anchors.centerIn: parent spacing: 40 + Column { anchors.verticalCenter: parent.verticalCenter spacing: 30 Rectangle { - width: 202; height: 202 - radius: 101 + width: page.buttonSize; height: page.buttonSize + radius: page.buttonSize color: createWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF" + Image { + width:page.buttonSize -30 + height:page.buttonSize -30 + fillMode: Image.PreserveAspectFit + horizontalAlignment: Image.AlignRight + verticalAlignment: Image.AlignTop anchors.centerIn: parent source: "qrc:///images/createWallet.png" } @@ -126,7 +135,9 @@ Item { font.pixelSize: 16 color: "#4A4949" horizontalAlignment: Text.AlignHCenter - text: qsTr("This is my first time, I want to
create a new account") + translationManager.emptyString + width:page.buttonSize + wrapMode: Text.WordWrap + text: qsTr("This is my first time, I want to create a new account") + translationManager.emptyString } } @@ -135,11 +146,14 @@ Item { spacing: 30 Rectangle { - width: 202; height: 202 - radius: 101 + width: page.buttonSize; height: page.buttonSize + radius: page.buttonSize color: recoverWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF" Image { + width:page.buttonSize -30 + height:page.buttonSize -30 + fillMode: Image.PreserveAspectFit anchors.centerIn: parent source: "qrc:///images/recoverWallet.png" } @@ -160,9 +174,53 @@ Item { font.pixelSize: 16 color: "#4A4949" horizontalAlignment: Text.AlignHCenter - text: qsTr("I want to recover my account
from my 25 word seed") + translationManager.emptyString + text: qsTr("I want to recover my account from my 25 word seed") + translationManager.emptyString + width:page.buttonSize + wrapMode: Text.WordWrap } } + + Column { + anchors.verticalCenter: parent.verticalCenter + spacing: 30 + + Rectangle { + width: page.buttonSize; height: page.buttonSize + radius: page.buttonSize + color: openWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF" + + Image { + width:page.buttonSize -30 + height:page.buttonSize -30 + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + source: "qrc:///images/recoverWallet.png" + } + + MouseArea { + id: openWalletArea + anchors.fill: parent + hoverEnabled: true + onClicked: { + page.saveDaemonAddress() + page.openWalletClicked() + } + } + } + + Text { + font.family: "Arial" + font.pixelSize: 16 + color: "#4A4949" + horizontalAlignment: Text.AlignHCenter + text: qsTr("I want to open a wallet from file") + translationManager.emptyString + width:page.buttonSize + wrapMode: Text.WordWrap + } + } + + + } -- cgit v1.2.3 From 097449079d73a680ee5a1ddd7d8acbdf022b7882 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 16:44:13 +0200 Subject: wizard: default account name on recover page --- wizard/WizardMain.qml | 3 +-- wizard/WizardRecoveryWallet.qml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml index 34835a5f..b52ea92d 100644 --- a/wizard/WizardMain.qml +++ b/wizard/WizardMain.qml @@ -70,7 +70,6 @@ Rectangle { } function switchPage(next) { - console.log("hepp") // save settings for current page; if (next && typeof pages[currentPage].onPageClosed !== 'undefined') { if (pages[currentPage].onPageClosed(settings) !== true) { @@ -79,7 +78,7 @@ Rectangle { }; } - print ("switchpage: currentPage: ", currentPage); + console.log("switchpage: currentPage: ", currentPage); if (currentPage > 0 || currentPage < pages.length - 1) { pages[currentPage].opacity = 0 diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index f4c5091e..837f9f86 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -76,7 +76,7 @@ Item { WizardManageWalletUI { id: uiItem - accountNameText: qsTr("My account name") + translationManager.emptyString + accountNameText: defaultAccountName titleText: qsTr("We're ready to recover your account") + translationManager.emptyString wordsTextTitle: qsTr("Please enter your 25 word private key") + translationManager.emptyString wordsTextItem.clipboardButtonVisible: false -- cgit v1.2.3 From d637b5883e666349f74040eb771ab15f0815a35c Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sun, 30 Oct 2016 18:07:56 +0100 Subject: wizard: warn user if wallet exists in path --- wizard/WizardCreateWallet.qml | 6 ++---- wizard/WizardMain.qml | 36 +++++++++++++++++++++++++++--------- wizard/WizardRecoveryWallet.qml | 4 ++++ 3 files changed, 33 insertions(+), 13 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml index 6d632cbe..d05dd596 100644 --- a/wizard/WizardCreateWallet.qml +++ b/wizard/WizardCreateWallet.qml @@ -54,7 +54,8 @@ Item { settingsObject['account_name'] = uiItem.accountNameText settingsObject['words'] = uiItem.wordsTexttext settingsObject['wallet_path'] = uiItem.walletPath - return true; + var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText); + return !wizard.walletExists(walletFullPath); } function checkNextButton() { @@ -86,9 +87,6 @@ Item { settingsObject.wallet_filename = wallet_filename } - - - WizardManageWalletUI { id: uiItem titleText: qsTr("A new wallet has been created for you") + translationManager.emptyString diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml index b52ea92d..446d7720 100644 --- a/wizard/WizardMain.qml +++ b/wizard/WizardMain.qml @@ -28,6 +28,7 @@ import QtQuick 2.2 import Qt.labs.settings 1.0 +import QtQuick.Dialogs 1.2 import "../components" @@ -130,21 +131,31 @@ Rectangle { wizard.openWalletFromFileClicked(); } + function createWalletPath(folder_path,account_name){ + + // Remove trailing slash - (default on windows and mac) + if (folder_path.substring(folder_path.length -1) === "/"){ + folder_path = folder_path.substring(0,folder_path.length -1) + } + + return folder_path + "/" + account_name + "/" + account_name + } + + function walletExists(path){ + if(walletManager.walletExists(path)){ + walletExistsErrorDialog.open(); + return true; + } + return false; + } + //! actually writes the wallet function applySettings() { console.log("Here we apply the settings"); // here we need to actually move wallet to the new location console.log(settings.wallet_full_path); - - // Remove trailing slash - (default on windows and mac) - if (settings.wallet_path.substring(settings.wallet_path.length -1) === "/"){ - settings.wallet_path = settings.wallet_path.substring(0,settings.wallet_path.length -1) - } - - var new_wallet_filename = settings.wallet_path + "/" - + settings.account_name + "/" - + settings.account_name; + var new_wallet_filename = createWalletPath(settings.wallet_path,settings.account_name) console.log("saving in wizard: "+ new_wallet_filename) // moving wallet files to the new destination, if user changed it @@ -185,6 +196,13 @@ Rectangle { settings['auto_donations_amount'] = appWindow.persistentSettings.auto_donations_amount } + MessageDialog { + id: walletExistsErrorDialog + title: "Error" + text: qsTr("A wallet with same name already exists. Please change wallet name") + translationManager.emptyString + onAccepted: { + } + } Rectangle { id: nextButton diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index 837f9f86..70bf3d78 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -55,6 +55,10 @@ Item { settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText) settingsObject['wallet_path'] = uiItem.walletPath settingsObject['restore_height'] = parseInt(uiItem.restoreHeight) + var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText); + if(wizard.walletExists(walletFullPath)){ + return false + } return recoveryWallet(settingsObject) } -- cgit v1.2.3 From 9afa5d782dcf9d171c2ce98d7307d4fd2094015a Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sun, 30 Oct 2016 18:08:37 +0100 Subject: wizard: updated open from file icon --- wizard/WizardOptions.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wizard') diff --git a/wizard/WizardOptions.qml b/wizard/WizardOptions.qml index f926be02..e2eaa958 100644 --- a/wizard/WizardOptions.qml +++ b/wizard/WizardOptions.qml @@ -194,7 +194,7 @@ Item { height:page.buttonSize -30 fillMode: Image.PreserveAspectFit anchors.centerIn: parent - source: "qrc:///images/recoverWallet.png" + source: "qrc:///images/openAccount.png" } MouseArea { -- cgit v1.2.3 From 776a5911905d1c5edec020f814a4341c2db1b567 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sun, 30 Oct 2016 21:31:33 +0100 Subject: Wizard: Delete old wallet object before creating new --- wizard/WizardCreateWallet.qml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml index d05dd596..bef91bc2 100644 --- a/wizard/WizardCreateWallet.qml +++ b/wizard/WizardCreateWallet.qml @@ -71,19 +71,21 @@ Item { // TODO: create wallet in temporary filename and a) move it to the path specified by user after the final // page submitted or b) delete it when program closed before reaching final page - var wallet_filename = oshelper.temporaryFilename(); - if (typeof settingsObject.wallet === 'undefined') { - //var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language) - var testnet = appWindow.persistentSettings.testnet; - var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language, - testnet) - uiItem.wordsTextItem.memoText = wallet.seed - // saving wallet in "global" settings object - // TODO: wallet should have a property pointing to the file where it stored or loaded from - settingsObject.wallet = wallet - } else { - print("wallet already created. we just stepping back"); + // Always delete the wallet object before creating new - we could be stepping back from recovering wallet + if (typeof settingsObject.wallet !== 'undefined') { + settingsObject.wallet.destroy() + console.log("deleting wallet") } + + var wallet_filename = oshelper.temporaryFilename(); + //var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language) + var testnet = appWindow.persistentSettings.testnet; + var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language, + testnet) + uiItem.wordsTextItem.memoText = wallet.seed + // saving wallet in "global" settings object + // TODO: wallet should have a property pointing to the file where it stored or loaded from + settingsObject.wallet = wallet settingsObject.wallet_filename = wallet_filename } -- cgit v1.2.3 From e6fe9d3045100daa9c5b45507ba5c16ad2b54e27 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sun, 30 Oct 2016 21:33:14 +0100 Subject: wizard: empty seed box on page load --- wizard/WizardRecoveryWallet.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'wizard') diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index 70bf3d78..236c59a1 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -43,6 +43,8 @@ Item { function onPageOpened(settingsObject) { checkNextButton(); + // Empty seedText when restoring multiple times in one session + uiItem.wordsTextItem.memoText = ""; } function checkNextButton() { @@ -54,7 +56,8 @@ Item { settingsObject['account_name'] = uiItem.accountNameText settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText) settingsObject['wallet_path'] = uiItem.walletPath - settingsObject['restore_height'] = parseInt(uiItem.restoreHeight) + var restoreHeight = parseInt(uiItem.restoreHeight); + settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText); if(wizard.walletExists(walletFullPath)){ return false -- cgit v1.2.3