diff --git a/LeftPanel.qml b/LeftPanel.qml index a9f01cfa..308e1954 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -238,7 +238,7 @@ Rectangle { font.pixelSize: 16 text: { if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { - return persistentSettings.fiatPriceCurrency == "xmrusd" ? "USD" : "EUR" + return appWindow.fiatApiCurrencySymbol(); } else { return "XMR" } diff --git a/components/LineEdit.qml b/components/LineEdit.qml index 68e981fa..554140d9 100644 --- a/components/LineEdit.qml +++ b/components/LineEdit.qml @@ -53,6 +53,8 @@ Item { property alias inlineButtonText: inlineButtonId.text property alias inlineIcon: inlineIcon.visible property bool copyButton: false + property alias copyButtonText: copyButtonId.text + property alias copyButtonEnabled: copyButtonId.enabled property bool borderDisabled: false property string borderColor: { diff --git a/main.qml b/main.qml index e489e573..b118c09b 100644 --- a/main.qml +++ b/main.qml @@ -1241,17 +1241,32 @@ ApplicationWindow { Prices.getJSON(url); } - function fiatApiUpdateBalance(balance){ - // update balance card + function fiatApiCurrencySymbol() { + switch (persistentSettings.fiatPriceCurrency) { + case "xmrusd": + return "USD"; + case "xmreur": + return "EUR"; + default: + console.error("unsupported currency", persistentSettings.fiatPriceCurrency); + return "UNSUPPORTED"; + } + } + + function fiatApiConvertToFiat(amount) { var ticker = persistentSettings.fiatPriceCurrency === "xmrusd" ? appWindow.fiatPriceXMRUSD : appWindow.fiatPriceXMREUR; if(ticker <= 0){ - console.log(fiatApiError("Could not update balance card; invalid ticker value")); - leftPanel.balanceFiatString = "?.??"; - return; + console.log(fiatApiError("Invalid ticker value: " + ticker)); + return "?.??"; } + return (amount * ticker).toFixed(2); + } + + function fiatApiUpdateBalance(balance){ + // update balance card var bFiat = "?.??" if (!hideBalanceForced && !persistentSettings.hideBalance) { - bFiat = (balance * ticker).toFixed(2); + bFiat = fiatApiConvertToFiat(balance); } leftPanel.balanceFiatString = bFiat; } diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 69b35b38..f5f8cb2a 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -168,6 +168,10 @@ Rectangle { labelText: qsTr("\ Amount ( Change account )") + translationManager.emptyString + copyButton: persistentSettings.fiatPriceEnabled + copyButtonText: fiatApiCurrencySymbol() + " ~" + fiatApiConvertToFiat(amountLine.text) + copyButtonEnabled: false + onLabelLinkActivated: { middlePanel.accountView.selectAndSend = true; appWindow.showPageRequest("Account")