GUI cold signing

This commit is contained in:
Jaquee
2017-01-12 20:53:27 +01:00
parent fd983955b4
commit 15c79df378
10 changed files with 454 additions and 35 deletions

View File

@@ -228,6 +228,8 @@ ApplicationWindow {
currentWallet = wallet
updateSyncing(false)
viewOnly = currentWallet.viewOnly;
// connect handlers
currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate)
@@ -293,7 +295,6 @@ ApplicationWindow {
// wallet opened successfully, subscribing for wallet updates
connectWallet(wallet)
}
@@ -474,7 +475,7 @@ ApplicationWindow {
// called on "transfer"
function handlePayment(address, paymentId, amount, mixinCount, priority, description) {
function handlePayment(address, paymentId, amount, mixinCount, priority, description, createFile) {
console.log("Creating transaction: ")
console.log("\taddress: ", address,
", payment_id: ", paymentId,
@@ -522,6 +523,24 @@ ApplicationWindow {
currentWallet.createTransactionAsync(address, paymentId, amountxmr, mixinCount, priority);
}
//Choose where to save transaction
FileDialog {
id: saveTxDialog
title: "Please choose a location"
folder: "file://" +moneroAccountsDir
selectExisting: false;
onAccepted: {
handleTransactionConfirmed()
}
onRejected: {
// do nothing
}
}
function handleSweepUnmixable() {
console.log("Creating transaction: ")
@@ -562,7 +581,7 @@ ApplicationWindow {
}
// called after user confirms transaction
function handleTransactionConfirmed() {
function handleTransactionConfirmed(fileName) {
// 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
@@ -573,6 +592,20 @@ ApplicationWindow {
for (var i = 0; i < txid_org.length; ++i)
txid[i] = txid_org[i]
// View only wallet - we save the tx
if(viewOnly && saveTxDialog.fileUrl){
// No file specified - abort
if(!saveTxDialog.fileUrl) {
currentWallet.disposeTransaction(transaction)
return;
}
var path = walletManager.urlToLocalPath(saveTxDialog.fileUrl)
// Store to file
transaction.setFilename(path);
}
if (!transaction.commit()) {
console.log("Error committing transaction: " + transaction.errorString);
informationPopup.title = qsTr("Error") + translationManager.emptyString
@@ -585,7 +618,7 @@ ApplicationWindow {
txid_text += ", "
txid_text += txid[i]
}
informationPopup.text = qsTr("Money sent successfully: %1 transaction(s) ").arg(txid.length) + txid_text + translationManager.emptyString
informationPopup.text = (viewOnly)? qsTr("Transaction saved to file: %1").arg(path) : 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)
@@ -771,10 +804,31 @@ ApplicationWindow {
id: transactionConfirmationPopup
onAccepted: {
close();
handleTransactionConfirmed()
// Save transaction to file if view only wallet
if(viewOnly) {
saveTxDialog.open();
return;
} else
handleTransactionConfirmed()
}
}
StandardDialog {
id: confirmationDialog
property var onAcceptedCallback
property var onRejectedCallback
onAccepted: {
if (onAcceptedCallback)
onAcceptedCallback()
}
onRejected: {
if (onRejectedCallback)
onRejectedCallback();
}
}
//Open Wallet from file
FileDialog {
id: fileDialog