mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-14 17:57:26 -04:00
Merge pull request #115
d95e4a3 Write support for tx notes (moneromooo.monero)
This commit is contained in:
30
main.qml
30
main.qml
@@ -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
|
||||
@@ -347,13 +348,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;
|
||||
@@ -399,6 +401,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
|
||||
@@ -408,6 +412,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()
|
||||
@@ -417,6 +422,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
|
||||
@@ -424,8 +439,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()
|
||||
|
||||
Reference in New Issue
Block a user