aboutsummaryrefslogtreecommitdiff
path: root/wizard/WizardController.qml
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-04-08 14:35:29 -0400
committerluigi1111 <luigi1111w@gmail.com>2019-04-08 14:35:29 -0400
commitcd65cc12dabbdf49207c07d3a333b209427e9567 (patch)
tree33e9a8c3b8477c8859e60a2086f1833dbe068bc9 /wizard/WizardController.qml
parent2f22503c8b54208afbca9fbac8a51f0bfe397339 (diff)
parent1a2675b24669e51ac79324d2889494b95eddef62 (diff)
downloadmonzero-gui-cd65cc12dabbdf49207c07d3a333b209427e9567.tar.gz
monzero-gui-cd65cc12dabbdf49207c07d3a333b209427e9567.tar.xz
monzero-gui-cd65cc12dabbdf49207c07d3a333b209427e9567.zip
Merge pull request #2037
1a2675b async device open and create from device, passphrase (ph4r05)
Diffstat (limited to 'wizard/WizardController.qml')
-rw-r--r--wizard/WizardController.qml65
1 files changed, 60 insertions, 5 deletions
diff --git a/wizard/WizardController.qml b/wizard/WizardController.qml
index 4224e904..e380aed9 100644
--- a/wizard/WizardController.qml
+++ b/wizard/WizardController.qml
@@ -44,6 +44,7 @@ Rectangle {
anchors.fill: parent
signal useMoneroClicked()
+ signal walletCreatedFromDevice(bool success)
function restart() {
wizardStateView.state = "wizardHome"
@@ -65,6 +66,7 @@ Rectangle {
wizardController.walletRestoreMode = 'seed'
wizardController.walletOptionsSubaddressLookahead = '';
wizardController.remoteNodes = {};
+ disconnect();
}
property var m_wallet;
@@ -366,6 +368,28 @@ Rectangle {
return success;
}
+ function disconnect(){
+ walletManager.walletCreated.disconnect(onWalletCreated);
+ walletManager.walletPassphraseNeeded.disconnect(onWalletPassphraseNeeded);
+ walletManager.deviceButtonRequest.disconnect(onDeviceButtonRequest);
+ walletManager.deviceButtonPressed.disconnect(onDeviceButtonPressed);
+ }
+
+ function connect(){
+ walletManager.walletCreated.connect(onWalletCreated);
+ walletManager.walletPassphraseNeeded.connect(onWalletPassphraseNeeded);
+ walletManager.deviceButtonRequest.connect(onDeviceButtonRequest);
+ walletManager.deviceButtonPressed.connect(onDeviceButtonPressed);
+ }
+
+ function deviceAttentionSplash(){
+ appWindow.showProcessingSplash(qsTr("Please proceed to the device..."));
+ }
+
+ function creatingWalletDeviceSplash(){
+ appWindow.showProcessingSplash(qsTr("Creating wallet from device..."));
+ }
+
function createWalletFromDevice() {
// 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
@@ -376,30 +400,61 @@ Rectangle {
console.log("deleting wallet")
}
- var tmp_wallet_filename = oshelper.temporaryFilename();
- console.log("Creating temporary wallet", tmp_wallet_filename)
+ tmpWalletFilename = oshelper.temporaryFilename();
+ console.log("Creating temporary wallet", tmpWalletFilename)
var nettype = persistentSettings.nettype;
var restoreHeight = wizardController.walletOptionsRestoreHeight;
var subaddressLookahead = wizardController.walletOptionsSubaddressLookahead;
var deviceName = wizardController.walletOptionsDeviceName;
- var wallet = walletManager.createWalletFromDevice(tmp_wallet_filename, "", nettype, deviceName, restoreHeight, subaddressLookahead);
+ connect();
+ walletManager.createWalletFromDeviceAsync(tmpWalletFilename, "", nettype, deviceName, restoreHeight, subaddressLookahead);
+ creatingWalletDeviceSplash();
+ }
+
+ function onWalletCreated(wallet) {
+ splash.close()
var success = wallet.status === Wallet.Status_Ok;
if (success) {
wizardController.m_wallet = wallet;
wizardController.walletOptionsIsRecoveringFromDevice = true;
- wizardController.tmpWalletFilename = tmp_wallet_filename;
if (!wizardController.walletOptionsDeviceIsRestore) {
// User creates a hardware wallet for the first time. Use a recent block height from API.
wizardController.walletOptionsRestoreHeight = wizardController.m_wallet.walletCreationHeight;
}
} else {
console.log(wallet.errorString)
+ wizardController.tmpWalletFilename = '';
appWindow.showStatusMessage(qsTr(wallet.errorString), 5);
walletManager.closeWallet();
}
- return success;
+
+ disconnect();
+ walletCreatedFromDevice(success);
+ }
+
+ function onWalletPassphraseNeeded(){
+ splash.close()
+
+ console.log(">>> wallet passphrase needed: ");
+ passphraseDialog.onAcceptedCallback = function() {
+ walletManager.onPassphraseEntered(passphraseDialog.passphrase);
+ creatingWalletDeviceSplash();
+ }
+ passphraseDialog.onRejectedCallback = function() {
+ walletManager.onPassphraseEntered("", true);
+ creatingWalletDeviceSplash();
+ }
+ passphraseDialog.open()
+ }
+
+ function onDeviceButtonRequest(code){
+ deviceAttentionSplash();
+ }
+
+ function onDeviceButtonPressed(){
+ creatingWalletDeviceSplash();
}
function openWallet(){