monero-gui/pages/Transfer.qml

683 lines
26 KiB
QML
Raw Normal View History

2018-01-07 05:20:45 +00:00
// Copyright (c) 2014-2018, The Monero Project
2015-04-01 08:56:05 +00:00
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2014-07-07 17:08:30 +00:00
import QtQuick 2.0
2016-12-17 15:57:42 +00:00
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
2017-12-06 13:09:37 +00:00
import moneroComponents.Clipboard 1.0
import moneroComponents.PendingTransaction 1.0
import moneroComponents.Wallet 1.0
2017-11-25 21:53:07 +00:00
import "../components"
import "." 1.0
2014-07-07 17:08:30 +00:00
2016-06-27 12:45:48 +00:00
2014-07-07 17:08:30 +00:00
Rectangle {
2016-08-23 13:07:52 +00:00
id: root
signal paymentClicked(string address, string paymentId, string amount, int mixinCount,
int priority, string description)
signal sweepUnmixableClicked()
2017-11-25 21:53:07 +00:00
color: "transparent"
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
2017-02-27 21:05:28 +00:00
property bool showAdvanced: false
2014-07-10 22:18:36 +00:00
2017-12-06 13:09:37 +00:00
Clipboard { id: clipboard }
2017-11-25 21:53:07 +00:00
function scaleValueToMixinCount(scaleValue) {
var scaleToMixinCount = [6,7,8,9,10,11,12,13,14,16,18,20,22,25];
if (scaleValue < scaleToMixinCount.length) {
return scaleToMixinCount[scaleValue];
} else {
return 0;
}
}
2016-12-17 15:57:42 +00:00
function isValidOpenAliasAddress(address) {
address = address.trim()
var dot = address.indexOf('.')
if (dot < 0)
return false
// we can get an awful lot of valid domains, including non ASCII chars... accept anything
return true
}
function oa_message(text) {
oaPopup.title = qsTr("OpenAlias error") + translationManager.emptyString
oaPopup.text = text
oaPopup.icon = StandardIcon.Information
oaPopup.onCloseCallback = null
oaPopup.open()
}
function updateMixin() {
2017-08-08 09:10:44 +00:00
var fillLevel = (isMobile) ? privacyLevelItemSmall.fillLevel : privacyLevelItem.fillLevel
var mixin = scaleValueToMixinCount(fillLevel)
2017-08-08 09:10:44 +00:00
console.log("PrivacyLevel changed:" + fillLevel)
console.log("mixin count: " + mixin)
2018-04-15 13:45:30 +00:00
privacyLabel.text = qsTr("Ring size: %1").arg(mixin+1) + translationManager.emptyString
}
2017-01-31 04:36:08 +00:00
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
console.log("updateFromQrCode")
addressLine.text = address
paymentIdLine.text = payment_id
amountLine.text = amount
descriptionLine.text = recipient_name + " " + tx_description
cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
}
2017-02-04 13:44:30 +00:00
function clearFields() {
addressLine.text = ""
paymentIdLine.text = ""
amountLine.text = ""
descriptionLine.text = ""
}
2016-12-17 15:57:42 +00:00
// Information dialog
StandardDialog {
// dynamically change onclose handler
property var onCloseCallback
id: oaPopup
cancelVisible: false
onAccepted: {
if (onCloseCallback) {
onCloseCallback()
}
}
}
2017-08-08 09:10:44 +00:00
ColumnLayout {
id: pageRoot
2017-12-08 23:01:10 +00:00
anchors.margins: (isMobile)? 17 : 20
2017-12-06 13:09:37 +00:00
anchors.topMargin: 40 * scaleRatio
2017-01-12 19:53:27 +00:00
anchors.left: parent.left
2017-12-06 13:09:37 +00:00
anchors.top: parent.top
2017-01-12 19:53:27 +00:00
anchors.right: parent.right
2017-08-08 09:10:44 +00:00
spacing: 30 * scaleRatio
RowLayout{
visible: warningText.text !== ""
Rectangle {
id: statusRect
Layout.preferredHeight: warningText.height + 40
Layout.fillWidth: true
radius: 2
border.color: Qt.rgba(255, 255, 255, 0.25)
border.width: 1
color: "transparent"
GridLayout{
Layout.fillWidth: true
Layout.preferredHeight: warningText.height + 40
Image {
2018-03-24 19:48:19 +00:00
Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 33
Layout.preferredWidth: 33
Layout.leftMargin: 10
Layout.topMargin: 10
source: "../images/warning.png"
}
Text {
id: warningText
Layout.topMargin: 12 * scaleRatio
Layout.preferredWidth: statusRect.width - 80
Layout.leftMargin: 6
text: qsTr("This page lets you sign/verify a message (or file contents) with your address.") + translationManager.emptyString
wrapMode: Text.Wrap
2018-03-24 19:48:19 +00:00
font.family: Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
color: Style.defaultFontColor
textFormat: Text.RichText
onLinkActivated: {
appWindow.startDaemon(appWindow.persistentSettings.daemonFlags);
}
}
}
}
}
2017-08-08 09:10:44 +00:00
GridLayout {
columns: (isMobile)? 1 : 2
Layout.fillWidth: true
2017-12-08 23:01:10 +00:00
columnSpacing: 32
2017-12-06 13:09:37 +00:00
2017-08-08 09:10:44 +00:00
ColumnLayout {
Layout.fillWidth: true
2017-02-27 21:05:28 +00:00
2017-08-08 09:10:44 +00:00
RowLayout {
id: amountRow
Layout.fillWidth: true
2017-08-08 09:10:44 +00:00
Layout.minimumWidth: 200
// Amount input
LineEdit {
id: amountLine
2017-11-25 21:53:07 +00:00
Layout.fillWidth: true
inlineIcon: true
2017-12-06 13:09:37 +00:00
labelText: qsTr("Amount") + translationManager.emptyString
2017-08-08 09:10:44 +00:00
placeholderText: qsTr("") + translationManager.emptyString
2017-11-25 21:53:07 +00:00
width: 100
fontBold: true
2017-11-25 21:53:07 +00:00
inlineButtonText: qsTr("All") + translationManager.emptyString
inlineButton.onClicked: amountLine.text = "(all)"
2017-08-08 09:10:44 +00:00
validator: DoubleValidator {
bottom: 0.0
top: 18446744.073709551615
decimals: 12
notation: DoubleValidator.StandardNotation
locale: "C"
}
}
2017-02-27 21:05:28 +00:00
}
2017-08-08 09:10:44 +00:00
}
2017-02-27 21:05:28 +00:00
2017-08-08 09:10:44 +00:00
ColumnLayout {
Layout.fillWidth: true
Label {
id: transactionPriority
Layout.topMargin: 14
2017-08-08 09:10:44 +00:00
text: qsTr("Transaction priority") + translationManager.emptyString
fontBold: false
2018-03-24 19:48:19 +00:00
fontSize: 16
2017-08-08 09:10:44 +00:00
}
// Note: workaround for translations in listElements
// ListElement: cannot use script for property value, so
// code like this wont work:
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
// For translations to work, the strings need to be listed in
// the file components/StandardDropdown.qml too.
2017-11-25 21:53:07 +00:00
2017-08-08 09:10:44 +00:00
// Priorites after v5
ListModel {
id: priorityModelV5
ListElement { column1: qsTr("Default") ; column2: ""; priority: 0}
2017-08-08 09:10:44 +00:00
ListElement { column1: qsTr("Slow (x0.25 fee)") ; column2: ""; priority: 1}
ListElement { column1: qsTr("Normal (x1 fee)") ; column2: ""; priority: 2 }
2017-08-08 09:10:44 +00:00
ListElement { column1: qsTr("Fast (x5 fee)") ; column2: ""; priority: 3 }
ListElement { column1: qsTr("Fastest (x41.5 fee)") ; column2: ""; priority: 4 }
}
StandardDropdown {
Layout.fillWidth: true
id: priorityDropdown
Layout.topMargin: 6
2017-08-08 09:10:44 +00:00
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
2017-12-06 13:09:37 +00:00
releasedColor: "#363636"
pressedColor: "#202020"
2017-08-08 09:10:44 +00:00
}
}
// Make sure dropdown is on top
z: parent.z + 1
2017-02-27 21:05:28 +00:00
}
2017-12-06 13:09:37 +00:00
// recipient address input
RowLayout {
id: addressLineRow
2017-08-08 09:10:44 +00:00
Layout.fillWidth: true
2017-11-25 21:53:07 +00:00
LineEditMulti {
2017-12-08 23:01:10 +00:00
id: addressLine
spacing: 0
fontBold: true
2018-03-21 22:56:53 +00:00
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
2017-12-08 23:01:10 +00:00
Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
+ translationManager.emptyString
labelButtonText: qsTr("Resolve") + translationManager.emptyString
placeholderText: "4.."
onInputLabelLinkActivated: { appWindow.showPageRequest("AddressBook") }
onLabelButtonClicked: {
var result = walletManager.resolveOpenAlias(addressLine.text)
if (result) {
var parts = result.split("|")
if (parts.length == 2) {
2018-03-27 00:03:59 +00:00
var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.nettype)
2017-12-08 23:01:10 +00:00
if (parts[0] === "true") {
if (address_ok) {
addressLine.text = parts[1]
addressLine.cursorPosition = 0
}
else
oa_message(qsTr("No valid address found at this OpenAlias address"))
} else if (parts[0] === "false") {
if (address_ok) {
addressLine.text = parts[1]
addressLine.cursorPosition = 0
oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed"))
2017-02-27 21:05:28 +00:00
} else {
2017-12-08 23:01:10 +00:00
oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed"))
2017-02-27 21:05:28 +00:00
}
2017-12-08 23:01:10 +00:00
} else {
oa_message(qsTr("Internal error"))
2016-12-17 15:57:42 +00:00
}
2017-12-08 23:01:10 +00:00
} else {
oa_message(qsTr("Internal error"))
}
} else {
oa_message(qsTr("No address found"))
2016-12-17 15:57:42 +00:00
}
2017-02-27 21:05:28 +00:00
}
}
2017-12-06 13:09:37 +00:00
StandardButton {
id: qrfinderButton
text: qsTr("QR Code") + translationManager.emptyString
visible : appWindow.qrScannerEnabled
enabled : visible
width: visible ? 60 * scaleRatio : 0
onClicked: {
cameraUi.state = "Capture"
cameraUi.qrcode_decoded.connect(updateFromQrCode)
}
2017-08-08 09:10:44 +00:00
}
2017-12-06 13:09:37 +00:00
}
2017-02-27 21:05:28 +00:00
2017-12-06 13:09:37 +00:00
RowLayout {
2017-08-08 09:10:44 +00:00
// payment id input
LineEdit {
id: paymentIdLine
fontBold: true
2017-12-06 13:09:37 +00:00
labelText: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString
2017-08-08 09:10:44 +00:00
placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString
Layout.fillWidth: true
}
2017-12-06 13:09:37 +00:00
}
2017-02-27 21:05:28 +00:00
2017-12-06 13:09:37 +00:00
RowLayout {
2017-08-08 09:10:44 +00:00
LineEdit {
id: descriptionLine
2017-12-06 13:09:37 +00:00
labelText: qsTr("Description <font size='2'>( Optional )</font>") + translationManager.emptyString
2017-08-08 09:10:44 +00:00
placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString
Layout.fillWidth: true
}
2017-12-06 13:09:37 +00:00
}
2017-02-27 21:05:28 +00:00
2017-12-06 13:09:37 +00:00
RowLayout {
2017-03-08 19:54:11 +00:00
StandardButton {
id: sendButton
rightIcon: "../images/rightArrow.png"
rightIconInactive: "../images/rightArrowInactive.png"
Layout.topMargin: 4 * scaleRatio
2017-03-08 19:54:11 +00:00
text: qsTr("Send") + translationManager.emptyString
// Send button is enabled when:
enabled : {
// Currently opened wallet is not view-only
if(appWindow.viewOnly){
return false;
}
// There is no warning box displayed
if(warningText.text !== ''){
return false;
}
// The transactional information is correct
if(!pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)){
return false;
}
// There are sufficient unlocked funds available
2018-03-31 14:25:11 +00:00
if(parseFloat(amountLine.text) > parseFloat(unlockedBalanceText)){
return false;
}
return true;
}
2017-03-08 19:54:11 +00:00
onClicked: {
console.log("Transfer: paymentClicked")
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
2017-03-08 19:54:11 +00:00
console.log("priority: " + priority)
console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim()
paymentIdLine.text = paymentIdLine.text.trim()
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel),
priority, descriptionLine.text)
}
2017-02-27 21:05:28 +00:00
}
}
2017-03-08 19:54:11 +00:00
2018-03-05 16:19:45 +00:00
function checkInformation(amount, address, payment_id, nettype) {
2017-08-08 09:10:44 +00:00
address = address.trim()
payment_id = payment_id.trim()
var amount_ok = amount.length > 0
2018-03-05 16:19:45 +00:00
var address_ok = walletManager.addressValid(address, nettype)
2017-08-08 09:10:44 +00:00
var payment_id_ok = payment_id.length == 0 || walletManager.paymentIdValid(payment_id)
2018-03-05 16:19:45 +00:00
var ipid = walletManager.paymentIdFromAddress(address, nettype)
2017-08-08 09:10:44 +00:00
if (ipid.length > 0 && payment_id.length > 0)
payment_id_ok = false
addressLine.error = !address_ok
amountLine.error = !amount_ok
paymentIdLine.error = !payment_id_ok
return amount_ok && address_ok && payment_id_ok
}
2017-03-08 19:54:11 +00:00
2017-01-12 19:53:27 +00:00
} // pageRoot
Rectangle {
id: desaturate
color:"black"
anchors.fill: parent
opacity: 0.1
visible: (pageRoot.enabled)? 0 : 1;
}
2017-01-12 19:53:27 +00:00
ColumnLayout {
anchors.top: pageRoot.bottom
anchors.left: parent.left
anchors.right: parent.right
2017-12-08 23:01:10 +00:00
anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 32 * scaleRatio
2017-12-08 23:01:10 +00:00
spacing: 26 * scaleRatio
2017-01-12 19:53:27 +00:00
enabled: !viewOnly || pageRoot.enabled
RowLayout {
CheckBox2 {
2017-02-27 21:05:28 +00:00
id: showAdvancedCheckbox
checked: persistentSettings.transferShowAdvanced
onClicked: {
persistentSettings.transferShowAdvanced = !persistentSettings.transferShowAdvanced
}
text: qsTr("Advanced options") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
}
}
Rectangle {
2017-02-27 21:05:28 +00:00
visible: persistentSettings.transferShowAdvanced
2017-01-12 19:53:27 +00:00
Layout.fillWidth: true
height: 1
2017-12-07 16:33:46 +00:00
color: Style.dividerColor
opacity: Style.dividerOpacity
2017-08-07 14:05:54 +00:00
Layout.bottomMargin: 30 * scaleRatio
2017-01-12 19:53:27 +00:00
}
2017-02-27 21:05:28 +00:00
RowLayout {
visible: persistentSettings.transferShowAdvanced
anchors.left: parent.left
anchors.right: parent.right
2017-08-07 14:05:54 +00:00
Layout.fillWidth: true
2017-02-27 21:05:28 +00:00
Label {
id: privacyLabel
2018-03-24 19:48:19 +00:00
fontSize: 15
2017-02-27 21:05:28 +00:00
text: ""
}
Label {
id: costLabel
fontSize: 14
text: qsTr("Transaction cost") + translationManager.emptyString
2017-02-27 21:05:28 +00:00
anchors.right: parent.right
}
}
PrivacyLevel {
2017-08-08 09:10:44 +00:00
visible: persistentSettings.transferShowAdvanced && !isMobile
2017-02-27 21:05:28 +00:00
id: privacyLevelItem
anchors.left: parent.left
anchors.right: parent.right
2017-08-08 09:10:44 +00:00
anchors.rightMargin: 17 * scaleRatio
onFillLevelChanged: updateMixin()
}
PrivacyLevelSmall {
visible: persistentSettings.transferShowAdvanced && isMobile
id: privacyLevelItemSmall
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 17 * scaleRatio
2017-02-27 21:05:28 +00:00
onFillLevelChanged: updateMixin()
}
2017-04-03 16:51:55 +00:00
GridLayout {
2017-02-27 21:05:28 +00:00
visible: persistentSettings.transferShowAdvanced
2017-08-07 14:05:54 +00:00
Layout.topMargin: 50 * scaleRatio
2017-04-03 16:51:55 +00:00
columns: (isMobile) ? 2 : 6
2017-01-12 19:53:27 +00:00
StandardButton {
id: sweepUnmixableButton
2017-02-27 22:02:33 +00:00
text: qsTr("Sweep Unmixable") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
enabled : pageRoot.enabled
small: true
2017-01-12 19:53:27 +00:00
onClicked: {
console.log("Transfer: sweepUnmixableClicked")
root.sweepUnmixableClicked()
}
}
StandardButton {
id: saveTxButton
2017-03-28 23:15:55 +00:00
text: qsTr("Create tx file") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
visible: appWindow.viewOnly
2018-03-05 16:19:45 +00:00
enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)
small: true
2017-01-12 19:53:27 +00:00
onClicked: {
console.log("Transfer: saveTx Clicked")
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
2017-01-12 19:53:27 +00:00
console.log("priority: " + priority)
console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim()
paymentIdLine.text = paymentIdLine.text.trim()
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel),
priority, descriptionLine.text)
}
}
StandardButton {
id: signTxButton
2017-03-19 02:57:48 +00:00
text: qsTr("Sign tx file") + translationManager.emptyString
small: true
2017-01-12 19:53:27 +00:00
visible: !appWindow.viewOnly
onClicked: {
console.log("Transfer: sign tx clicked")
signTxDialog.open();
}
}
StandardButton {
id: submitTxButton
2017-03-19 02:57:48 +00:00
text: qsTr("Submit tx file") + translationManager.emptyString
small: true
2017-01-12 19:53:27 +00:00
visible: appWindow.viewOnly
enabled: pageRoot.enabled
onClicked: {
console.log("Transfer: submit tx clicked")
submitTxDialog.open();
}
}
}
}
//SignTxDialog
FileDialog {
id: signTxDialog
title: qsTr("Please choose a file") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
folder: "file://" +moneroAccountsDir
nameFilters: [ "Unsigned transfers (*)"]
onAccepted: {
var path = walletManager.urlToLocalPath(fileUrl);
// Load the unsigned tx from file
var transaction = currentWallet.loadTxFile(path);
if (transaction.status !== PendingTransaction.Status_Ok) {
console.error("Can't load unsigned transaction: ", transaction.errorString);
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Can't load unsigned transaction: ") + transaction.errorString
informationPopup.icon = StandardIcon.Critical
informationPopup.onCloseCallback = null
informationPopup.open();
// deleting transaction object, we don't want memleaks
transaction.destroy();
} else {
confirmationDialog.text = qsTr("\nNumber of transactions: ") + transaction.txCount
for (var i = 0; i < transaction.txCount; ++i) {
confirmationDialog.text += qsTr("\nTransaction #%1").arg(i+1)
+qsTr("\nRecipient: ") + transaction.recipientAddress[i]
+ (transaction.paymentId[i] == "" ? "" : qsTr("\n\payment ID: ") + transaction.paymentId[i])
+ qsTr("\nAmount: ") + walletManager.displayAmount(transaction.amount(i))
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee(i))
2017-02-22 19:19:50 +00:00
+ qsTr("\nRingsize: ") + transaction.mixin(i+1)
2017-01-12 19:53:27 +00:00
// TODO: add descriptions to unsigned_tx_set?
// + (transactionDescription === "" ? "" : (qsTr("\n\nDescription: ") + transactionDescription))
+ translationManager.emptyString
if (i > 0) {
confirmationDialog.text += "\n\n"
}
}
console.log(transaction.confirmationMessage);
// Show confirmation dialog
confirmationDialog.title = qsTr("Confirmation") + translationManager.emptyString
confirmationDialog.icon = StandardIcon.Question
confirmationDialog.onAcceptedCallback = function() {
transaction.sign(path+"_signed");
transaction.destroy();
};
confirmationDialog.onRejectedCallback = transaction.destroy;
confirmationDialog.open()
}
}
onRejected: {
// File dialog closed
console.log("Canceled")
}
}
//SignTxDialog
FileDialog {
id: submitTxDialog
title: qsTr("Please choose a file") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
folder: "file://" +moneroAccountsDir
nameFilters: [ "signed transfers (*)"]
onAccepted: {
if(!currentWallet.submitTxFile(walletManager.urlToLocalPath(fileUrl))){
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Can't submit transaction: ") + currentWallet.errorString
informationPopup.icon = StandardIcon.Critical
informationPopup.onCloseCallback = null
informationPopup.open();
} else {
informationPopup.title = qsTr("Information") + translationManager.emptyString
2018-03-23 22:53:29 +00:00
informationPopup.text = qsTr("Monero sent successfully") + translationManager.emptyString
2017-01-12 19:53:27 +00:00
informationPopup.icon = StandardIcon.Information
informationPopup.onCloseCallback = null
informationPopup.open();
}
}
onRejected: {
console.log("Canceled")
}
}
Component.onCompleted: {
//Disable password page until enabled by updateStatus
pageRoot.enabled = false
}
// fires on every page load
function onPageCompleted() {
console.log("transfer page loaded")
updateStatus();
2017-03-09 15:46:03 +00:00
updateMixin();
updatePriorityDropdown()
}
function updatePriorityDropdown() {
priorityDropdown.dataModel = priorityModelV5;
priorityDropdown.currentIndex = 0
priorityDropdown.update()
}
//TODO: Add daemon sync status
//TODO: enable send page when we're connected and daemon is synced
function updateStatus() {
pageRoot.enabled = true;
if(typeof currentWallet === "undefined") {
warningText.text = qsTr("Wallet is not connected to daemon.") + root.startLinkText
return;
}
if (currentWallet.viewOnly) {
// warningText.text = qsTr("Wallet is view only.")
2017-01-12 19:53:27 +00:00
//return;
}
//pageRoot.enabled = false;
switch (currentWallet.connected()) {
case Wallet.ConnectionStatus_Disconnected:
warningText.text = qsTr("Wallet is not connected to daemon.") + root.startLinkText
break
case Wallet.ConnectionStatus_WrongVersion:
warningText.text = qsTr("Connected daemon is not compatible with GUI. \n" +
"Please upgrade or connect to another daemon")
break
default:
if(!appWindow.daemonSynced){
warningText.text = qsTr("Waiting on daemon synchronization to finish")
} else {
// everything OK, enable transfer page
2017-08-08 09:10:44 +00:00
// Light wallet is always ready
pageRoot.enabled = true;
warningText.text = "";
}
}
}
2016-12-10 01:01:04 +00:00
// Popuplate fields from addressbook.
function sendTo(address, paymentId, description){
addressLine.text = address
paymentIdLine.text = paymentId
descriptionLine.text = description
}
2014-07-07 17:08:30 +00:00
}