|
|
|
@ -52,6 +52,7 @@ ApplicationWindow {
|
|
|
|
|
property alias persistentSettings : persistentSettings
|
|
|
|
|
property var currentWallet;
|
|
|
|
|
property var transaction;
|
|
|
|
|
property var transactionDescription;
|
|
|
|
|
property alias password : passwordDialog.password
|
|
|
|
|
property int splashCounter: 0
|
|
|
|
|
property bool isNewWallet: false
|
|
|
|
@ -346,13 +347,14 @@ ApplicationWindow {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// called on "transfer"
|
|
|
|
|
function handlePayment(address, paymentId, amount, mixinCount, priority) {
|
|
|
|
|
function handlePayment(address, paymentId, amount, mixinCount, priority, description) {
|
|
|
|
|
console.log("Creating transaction: ")
|
|
|
|
|
console.log("\taddress: ", address,
|
|
|
|
|
", payment_id: ", paymentId,
|
|
|
|
|
", amount: ", amount,
|
|
|
|
|
", mixins: ", mixinCount,
|
|
|
|
|
", priority: ", priority);
|
|
|
|
|
", priority: ", priority,
|
|
|
|
|
", description: ", description);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// validate amount;
|
|
|
|
@ -398,6 +400,8 @@ ApplicationWindow {
|
|
|
|
|
console.log("Transaction created, amount: " + walletManager.displayAmount(transaction.amount)
|
|
|
|
|
+ ", fee: " + walletManager.displayAmount(transaction.fee));
|
|
|
|
|
|
|
|
|
|
transactionDescription = description;
|
|
|
|
|
|
|
|
|
|
// here we show confirmation popup;
|
|
|
|
|
|
|
|
|
|
transactionConfirmationPopup.title = qsTr("Confirmation") + translationManager.emptyString
|
|
|
|
@ -407,6 +411,7 @@ ApplicationWindow {
|
|
|
|
|
+ qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount)
|
|
|
|
|
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee)
|
|
|
|
|
+ qsTr("\n\nMixin: ") + mixinCount
|
|
|
|
|
+ qsTr("\n\nDescription: ") + description
|
|
|
|
|
+ translationManager.emptyString
|
|
|
|
|
transactionConfirmationPopup.icon = StandardIcon.Question
|
|
|
|
|
transactionConfirmationPopup.open()
|
|
|
|
@ -416,6 +421,16 @@ ApplicationWindow {
|
|
|
|
|
|
|
|
|
|
// called after user confirms transaction
|
|
|
|
|
function handleTransactionConfirmed() {
|
|
|
|
|
// grab transaction.txid before commit, since it clears it.
|
|
|
|
|
// we actually need to copy it, because QML will incredibly
|
|
|
|
|
// call the function multiple times when the variable is used
|
|
|
|
|
// after commit, where it returns another result...
|
|
|
|
|
// Of course, this loop is also calling the function multiple
|
|
|
|
|
// times, but at least with the same result.
|
|
|
|
|
var txid = [], txid_org = transaction.txid, txid_text = ""
|
|
|
|
|
for (var i = 0; i < txid_org.length; ++i)
|
|
|
|
|
txid[i] = txid_org[i]
|
|
|
|
|
|
|
|
|
|
if (!transaction.commit()) {
|
|
|
|
|
console.log("Error committing transaction: " + transaction.errorString);
|
|
|
|
|
informationPopup.title = qsTr("Error") + translationManager.emptyString
|
|
|
|
@ -423,8 +438,17 @@ ApplicationWindow {
|
|
|
|
|
informationPopup.icon = StandardIcon.Critical
|
|
|
|
|
} else {
|
|
|
|
|
informationPopup.title = qsTr("Information") + translationManager.emptyString
|
|
|
|
|
informationPopup.text = qsTr("Money sent successfully") + translationManager.emptyString
|
|
|
|
|
for (var i = 0; i < txid.length; ++i) {
|
|
|
|
|
if (txid_text.length > 0)
|
|
|
|
|
txid_text += ", "
|
|
|
|
|
txid_text += txid[i]
|
|
|
|
|
}
|
|
|
|
|
informationPopup.text = qsTr("Money sent successfully: %1 transaction(s) ").arg(txid.length) + txid_text + translationManager.emptyString
|
|
|
|
|
informationPopup.icon = StandardIcon.Information
|
|
|
|
|
if (transactionDescription.length > 0) {
|
|
|
|
|
for (var i = 0; i < txid.length; ++i)
|
|
|
|
|
currentWallet.setUserNote(txid[i], transactionDescription);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
informationPopup.onCloseCallback = null
|
|
|
|
|
informationPopup.open()
|
|
|
|
|