diff --git a/interface/resources/qml/hifi/commerce/wallet/Security.qml b/interface/resources/qml/hifi/commerce/wallet/Security.qml
index bf72c6b2b1..5d3dddb417 100644
--- a/interface/resources/qml/hifi/commerce/wallet/Security.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/Security.qml
@@ -27,6 +27,20 @@ Item {
Hifi.QmlCommerce {
id: commerce;
+
+ onSecurityImageResult: {
+ if (imageID !== 0) { // "If security image is set up"
+ var path = securityImageModel.getImagePathFromImageID(imageID);
+ topSecurityImage.source = path;
+ changeSecurityImageImage.source = path;
+ }
+ }
+
+ onKeyFilePathResult: {
+ if (path !== "") {
+ keyFilePath.text = path;
+ }
+ }
}
// Username Text
@@ -62,6 +76,12 @@ Item {
width: height;
fillMode: Image.PreserveAspectFit;
mipmap: true;
+
+ onVisibleChanged: {
+ if (visible) {
+ commerce.getSecurityImage();
+ }
+ }
}
// "Security picture" text below pic
RalewayRegular {
@@ -199,15 +219,15 @@ Item {
// Text below "your private keys"
RalewayRegular {
+ id: explanitoryText;
text: "Your money and purchases are secured with private keys that only you " +
- "have access to. If they are lost, you will not be able to access your money or purchases. " +
- "To ensure they are not lost, it is imperative that you back up your private keys.
" +
- "To safeguard your private keys, back up this file regularly:";
+ "have access to. If they are lost, you will not be able to access your money or purchases." +
+ "To safeguard your private keys, back up this file regularly:";
// Text size
size: 18;
// Anchors
anchors.top: yourPrivateKeysText.bottom;
- anchors.topMargin: 20;
+ anchors.topMargin: 10;
anchors.left: parent.left;
anchors.right: parent.right;
height: paintedHeight;
@@ -218,15 +238,26 @@ Item {
horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter;
}
+ HifiControlsUit.TextField {
+ id: keyFilePath;
+ anchors.top: explanitoryText.bottom;
+ anchors.topMargin: 10;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+ height: 40;
+ readOnly: true;
+
+ onVisibleChanged: {
+ if (visible) {
+ commerce.getKeyFilePath();
+ }
+ }
+ }
}
//
// FUNCTION DEFINITIONS START
//
- function setSecurityImages(imagePath) {
- topSecurityImage.source = imagePath;
- changeSecurityImageImage.source = imagePath;
- }
//
// Function Name: fromScript()
//
diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
index 2ee08147c6..fd9eb6dbe6 100644
--- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
@@ -25,7 +25,7 @@ Rectangle {
id: root;
- property string activeView: "notSetUp";
+ property string activeView: "";
// Style
color: hifi.colors.baseGray;
@@ -33,19 +33,20 @@ Rectangle {
id: commerce;
onSecurityImageResult: {
- if (imageID !== 0) { // "If security image is set up"
- if (walletHome) {
- walletHome.setSecurityImage(securityImageModel.getImagePathFromImageID(imageID));
- }
- if (security) {
- security.setSecurityImages(securityImageModel.getImagePathFromImageID(imageID));
- }
- } else if (root.lastPage === "securityImage") {
+ if (imageID === 0 && root.lastPage === "securityImage") { // "If security image is set up"
// ERROR! Invalid security image.
securityImageContainer.visible = true;
choosePassphraseContainer.visible = false;
}
}
+
+ onKeyFilePathResult: {
+ if (path === "") {
+ root.activeView = "notSetUp";
+ } else {
+ root.activeView = "walletHome";
+ }
+ }
}
SecurityImageModel {
@@ -284,6 +285,13 @@ Rectangle {
onEntered: parent.color = hifi.colors.blueHighlight;
onExited: parent.color = root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
}
+
+ onVisibleChanged: {
+ if (visible) {
+ commerce.getSecurityImage();
+ commerce.balance();
+ }
+ }
}
// "SEND MONEY" tab button
@@ -376,6 +384,13 @@ Rectangle {
onEntered: parent.color = hifi.colors.blueHighlight;
onExited: parent.color = root.activeView === "security" ? hifi.colors.blueAccent : hifi.colors.black;
}
+
+ onVisibleChanged: {
+ if (visible) {
+ commerce.getSecurityImage();
+ commerce.getKeyFilePath();
+ }
+ }
}
// "HELP" tab button
diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml
index 19da700de2..bf344e6430 100644
--- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml
@@ -1,8 +1,8 @@
//
-// AccountHome.qml
+// WalletHome.qml
// qml/hifi/commerce/wallet
//
-// AccountHome
+// WalletHome
//
// Created by Zach Fox on 2017-08-18
// Copyright 2017 High Fidelity, Inc.
@@ -22,11 +22,18 @@ import "../../../controls" as HifiControls
Item {
HifiConstants { id: hifi; }
-
+
id: root;
Hifi.QmlCommerce {
id: commerce;
+
+ onSecurityImageResult: {
+ if (imageID !== 0) { // "If security image is set up"
+ securityImage.source = securityImageModel.getImagePathFromImageID(imageID);
+ }
+ }
+
onBalanceResult : {
balanceText.text = parseFloat(result.data.balance/100).toFixed(2);
}
@@ -99,6 +106,7 @@ Item {
// Balance Text
FiraSansRegular {
id: balanceText;
+ text: --;
// Text size
size: 28;
// Anchors
@@ -308,9 +316,6 @@ Item {
//
// FUNCTION DEFINITIONS START
//
- function setSecurityImage(imagePath) {
- securityImage.source = imagePath;
- }
//
// Function Name: fromScript()
//
diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
index 1d12afda79..9b3bf535a3 100644
--- a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
@@ -55,6 +55,12 @@ Rectangle {
choosePassphraseContainer.visible = true;
}
}
+
+ onKeyFilePathResult: {
+ if (path !== "") {
+ keyFilePath.text = path;
+ }
+ }
}
//
@@ -452,6 +458,7 @@ Rectangle {
choosePassphraseContainer.visible = false;
privateKeysReadyContainer.visible = true;
commerce.balance(); // Do this here so that keys are generated. Order might change as backend changes?
+ commerce.getKeyFilePath();
}
}
}
@@ -520,6 +527,7 @@ Rectangle {
// Text below checkbox
RalewayRegular {
+ id: explanationText;
text: "Your money and purchases are secured with private keys that only you have access to. " +
"If they are lost, you will not be able to access your money or purchases.
" +
"To protect your privacy, High Fidelity has no access to your private keys and cannot " +
@@ -542,6 +550,16 @@ Rectangle {
verticalAlignment: Text.AlignVCenter;
}
+ HifiControlsUit.TextField {
+ id: keyFilePath;
+ anchors.top: explanationText.bottom;
+ anchors.topMargin: 10;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+ height: 40;
+ readOnly: true;
+ }
+
// Navigation Bar
Item {
// Size
diff --git a/interface/src/commerce/QmlCommerce.cpp b/interface/src/commerce/QmlCommerce.cpp
index f0b7ab25e6..151716854f 100644
--- a/interface/src/commerce/QmlCommerce.cpp
+++ b/interface/src/commerce/QmlCommerce.cpp
@@ -25,6 +25,7 @@ QmlCommerce::QmlCommerce(QQuickItem* parent) : OffscreenQmlDialog(parent) {
connect(ledger.data(), &Ledger::balanceResult, this, &QmlCommerce::balanceResult);
connect(ledger.data(), &Ledger::inventoryResult, this, &QmlCommerce::inventoryResult);
connect(wallet.data(), &Wallet::securityImageResult, this, &QmlCommerce::securityImageResult);
+ connect(wallet.data(), &Wallet::keyFilePathResult, this, &QmlCommerce::keyFilePathResult);
}
void QmlCommerce::buy(const QString& assetId, int cost, const QString& buyerUsername) {
@@ -68,3 +69,7 @@ void QmlCommerce::setPassphrase(const QString& passphrase) {
void QmlCommerce::getPassphraseSetupStatus() {
emit passphraseSetupStatusResult(false);
}
+void QmlCommerce::getKeyFilePath() {
+ auto wallet = DependencyManager::get();
+ wallet->getKeyFilePath();
+}
diff --git a/interface/src/commerce/QmlCommerce.h b/interface/src/commerce/QmlCommerce.h
index 2dafc0cff6..3e538670b5 100644
--- a/interface/src/commerce/QmlCommerce.h
+++ b/interface/src/commerce/QmlCommerce.h
@@ -34,6 +34,7 @@ signals:
void securityImageResult(uint imageID);
void loginStatusResult(bool isLoggedIn);
void passphraseSetupStatusResult(bool passphraseIsSetup);
+ void keyFilePathResult(const QString& path);
protected:
Q_INVOKABLE void buy(const QString& assetId, int cost, const QString& buyerUsername = "");
@@ -44,6 +45,7 @@ protected:
Q_INVOKABLE void getLoginStatus();
Q_INVOKABLE void setPassphrase(const QString& passphrase);
Q_INVOKABLE void getPassphraseSetupStatus();
+ Q_INVOKABLE void getKeyFilePath();
};
#endif // hifi_QmlCommerce_h
diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp
index 05ccea3a59..1eb912b26e 100644
--- a/interface/src/commerce/Wallet.cpp
+++ b/interface/src/commerce/Wallet.cpp
@@ -275,3 +275,6 @@ void Wallet::chooseSecurityImage(uint imageID) {
void Wallet::getSecurityImage() {
emit securityImageResult(_chosenSecurityImage);
}
+void Wallet::getKeyFilePath() {
+ emit keyFilePathResult(keyFilePath());
+}
diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h
index a1c7c7752b..6f99104229 100644
--- a/interface/src/commerce/Wallet.h
+++ b/interface/src/commerce/Wallet.h
@@ -28,9 +28,11 @@ public:
QString signWithKey(const QByteArray& text, const QString& key);
void chooseSecurityImage(uint imageID);
void getSecurityImage();
+ void getKeyFilePath();
signals:
void securityImageResult(uint imageID);
+ void keyFilePathResult(const QString& path);
protected:
// ALWAYS add SecurityImage enum values to the END of the enum.
diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js
index 77be746bf4..2889a1514a 100644
--- a/scripts/system/html/js/marketplacesInject.js
+++ b/scripts/system/html/js/marketplacesInject.js
@@ -115,7 +115,7 @@
itemId: id,
itemName: name,
itemAuthor: author,
- itemPrice: price ? parseInt(price, 10) : Math.round(Math.random() * 50),
+ itemPrice: price ? parseInt(price, 10) : 0,
itemHref: href
}));
}