diff --git a/interface/resources/qml/hifi/commerce/wallet/PassphraseSelection.qml b/interface/resources/qml/hifi/commerce/wallet/PassphraseSelection.qml index 7f9f034d09..86ef776b6d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/PassphraseSelection.qml +++ b/interface/resources/qml/hifi/commerce/wallet/PassphraseSelection.qml @@ -30,6 +30,10 @@ Item { onSecurityImageResult: { passphrasePageSecurityImage.source = gridModel.getImagePathFromImageID(imageID); } + + onPassphraseSetupStatusResult: { + sendMessageToLightbox({method: 'statusResult', status: passphraseIsSetup}); + } } onVisibleChanged: { @@ -52,6 +56,12 @@ Item { height: 50; echoMode: TextInput.Password; placeholderText: "passphrase"; + + onVisibleChanged: { + if (visible) { + text = ""; + } + } } HifiControlsUit.TextField { id: passphraseFieldAgain; @@ -62,6 +72,12 @@ Item { height: 50; echoMode: TextInput.Password; placeholderText: "re-enter passphrase"; + + onVisibleChanged: { + if (visible) { + text = ""; + } + } } // Security Image @@ -202,8 +218,5 @@ Item { errorText.text = text; } - function clearText() { - passphraseField.text = ""; - passphraseFieldAgain.text = ""; - } + signal sendMessageToLightbox(var msg); } diff --git a/interface/resources/qml/hifi/commerce/wallet/PassphraseSelectionLightbox.qml b/interface/resources/qml/hifi/commerce/wallet/PassphraseSelectionLightbox.qml index 611dad7f6a..ffc1b3a175 100644 --- a/interface/resources/qml/hifi/commerce/wallet/PassphraseSelectionLightbox.qml +++ b/interface/resources/qml/hifi/commerce/wallet/PassphraseSelectionLightbox.qml @@ -27,19 +27,19 @@ Rectangle { // Style color: hifi.colors.baseGray; - Hifi.QmlCommerce { - id: commerce; - - onPassphraseSetupStatusResult: { - console.log("ZRF HERE " + passphraseIsSetup); - if (passphraseIsSetup) { - // Success submitting new passphrase - passphraseSubmitButton.enabled = true; - root.visible = false; - } else { - // Error submitting new passphrase - passphraseSubmitButton.enabled = true; - passphraseSelection.setErrorText("Backend error"); + Connections { + target: passphraseSelection; + onSendMessageToLightbox: { + if (msg.method === 'statusResult') { + if (msg.status) { + // Success submitting new passphrase + root.resetSubmitButton(); + root.visible = false; + } else { + // Error submitting new passphrase + root.resetSubmitButton(); + passphraseSelection.setErrorText("Backend error"); + } } } } @@ -132,7 +132,6 @@ Rectangle { width: 100; text: "Cancel" onClicked: { - passphraseSelection.clearText(); root.visible = false; } } @@ -151,10 +150,7 @@ Rectangle { width: 100; text: "Submit"; onClicked: { - if (passphraseSelection.validateAndSubmitPassphrase()) { - passphraseSubmitButton.text = "Submitting..."; - passphraseSubmitButton.enabled = false; - } + passphraseSelection.validateAndSubmitPassphrase() } } } @@ -162,4 +158,9 @@ Rectangle { // // SECURE PASSPHRASE SELECTION END // + + function resetSubmitButton() { + passphraseSubmitButton.enabled = true; + passphraseSubmitButton.text = "Submit"; + } } diff --git a/interface/resources/qml/hifi/commerce/wallet/SecurityImageSelectionLightbox.qml b/interface/resources/qml/hifi/commerce/wallet/SecurityImageSelectionLightbox.qml index 461154c8d4..cba697cbd8 100644 --- a/interface/resources/qml/hifi/commerce/wallet/SecurityImageSelectionLightbox.qml +++ b/interface/resources/qml/hifi/commerce/wallet/SecurityImageSelectionLightbox.qml @@ -35,11 +35,13 @@ Rectangle { if (imageID !== 0) { // Success submitting new security image if (root.justSubmitted) { securityImageSubmitButton.enabled = true; + securityImageSubmitButton.text = "Submit"; root.visible = false; } - } else if (root.lastPage === "securityImage") { + } else if (root.justSubmitted) { // Error submitting new security image. - securityImageSubmitButton.enabled = true; + securityImageSubmitButton.enabled = true + securityImageSubmitButton.text = "Submit"; root.justSubmitted = false; } } @@ -176,6 +178,7 @@ Rectangle { root.justSubmitted = true; securityImageSubmitButton.text = "Submitting..."; securityImageSubmitButton.enabled = false; + commerce.chooseSecurityImage(securityImageSelection.getSelectedImageIndex()); } } }