aboutsummaryrefslogtreecommitdiff
path: root/wizard/WizardController.qml
diff options
context:
space:
mode:
authorDusan Klinec <dusan.klinec@gmail.com>2019-03-27 09:28:42 +0100
committerDusan Klinec <dusan.klinec@gmail.com>2019-04-06 14:52:14 +0200
commit1a2675b24669e51ac79324d2889494b95eddef62 (patch)
tree3482ffda535e8e80ff18879e055c1550cd6fe998 /wizard/WizardController.qml
parent19c2208dc447ccb5ba9ff990cbdd6ecf6b96f23d (diff)
downloadmonzero-gui-1a2675b24669e51ac79324d2889494b95eddef62.tar.gz
monzero-gui-1a2675b24669e51ac79324d2889494b95eddef62.tar.xz
monzero-gui-1a2675b24669e51ac79324d2889494b95eddef62.zip
async device open and create from device, passphrase
- passphrase entry on host added, requires early listener setting monero pull #5355 - wallet open and create from device shows splash to indicate possible long process - create from device is async to support passphrase entry
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(){