2015-04-01 08:56:05 +00:00
|
|
|
// Copyright (c) 2014-2015, The Monero Project
|
|
|
|
//
|
|
|
|
// 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
|
2016-10-02 18:40:40 +00:00
|
|
|
import moneroComponents.PendingTransaction 1.0
|
2014-07-10 22:18:36 +00:00
|
|
|
import "../components"
|
2016-11-26 14:47:25 +00:00
|
|
|
import moneroComponents.Wallet 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
|
2016-11-06 12:33:17 +00:00
|
|
|
signal paymentClicked(string address, string paymentId, string amount, int mixinCount,
|
2016-11-05 23:19:28 +00:00
|
|
|
int priority, string description)
|
2016-11-08 20:23:50 +00:00
|
|
|
signal sweepUnmixableClicked()
|
2016-06-16 14:13:46 +00:00
|
|
|
|
2014-07-10 22:18:36 +00:00
|
|
|
color: "#F0EEEE"
|
2016-12-10 19:56:35 +00:00
|
|
|
property string startLinkText: "<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>"
|
2014-07-10 22:18:36 +00:00
|
|
|
|
2016-06-20 20:36:56 +00:00
|
|
|
function scaleValueToMixinCount(scaleValue) {
|
2016-10-31 18:28:48 +00:00
|
|
|
var scaleToMixinCount = [4,5,6,7,8,9,10,11,12,13,14,15,20,25];
|
2016-06-20 20:36:56 +00:00
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
2016-12-27 20:53:17 +00:00
|
|
|
function updateMixin() {
|
|
|
|
var fillLevel = privacyLevelItem.fillLevel
|
|
|
|
var mixin = scaleValueToMixinCount(fillLevel)
|
|
|
|
print ("PrivacyLevel changed:" + fillLevel)
|
|
|
|
print ("mixin count: " + mixin)
|
2017-02-22 19:19:50 +00:00
|
|
|
privacyLabel.text = qsTr("Privacy level (ringsize %1)").arg(mixin+1) + translationManager.emptyString
|
2016-12-27 20:53:17 +00:00
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-06-16 14:13:46 +00:00
|
|
|
|
2016-12-10 19:56:35 +00:00
|
|
|
Item {
|
|
|
|
id: pageRoot
|
2017-01-12 19:53:27 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
height:550
|
2014-07-10 22:18:36 +00:00
|
|
|
Label {
|
|
|
|
id: amountLabel
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
2014-07-16 14:48:17 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 17
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("Amount") + translationManager.emptyString
|
2014-07-11 14:19:13 +00:00
|
|
|
fontSize: 14
|
2014-07-10 22:18:36 +00:00
|
|
|
}
|
2016-06-27 12:45:48 +00:00
|
|
|
|
2014-07-10 22:18:36 +00:00
|
|
|
Label {
|
|
|
|
id: transactionPriority
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 17
|
2014-07-11 14:19:13 +00:00
|
|
|
fontSize: 14
|
2014-07-10 22:18:36 +00:00
|
|
|
x: (parent.width - 17) / 2 + 17
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("Transaction priority") + translationManager.emptyString
|
2014-07-10 22:18:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
2016-06-20 12:58:13 +00:00
|
|
|
id: amountRow
|
2014-07-10 22:18:36 +00:00
|
|
|
anchors.top: amountLabel.bottom
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.topMargin: 5
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 7
|
|
|
|
width: (parent.width - 17) / 2 + 10
|
2014-07-10 22:18:36 +00:00
|
|
|
Item {
|
|
|
|
width: 37
|
|
|
|
height: 37
|
|
|
|
|
|
|
|
Image {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
source: "../images/moneroIcon.png"
|
|
|
|
}
|
|
|
|
}
|
2016-06-16 14:13:46 +00:00
|
|
|
// Amount input
|
2014-07-10 22:18:36 +00:00
|
|
|
LineEdit {
|
2016-06-16 14:13:46 +00:00
|
|
|
id: amountLine
|
2016-10-23 20:56:44 +00:00
|
|
|
placeholderText: qsTr("") + translationManager.emptyString
|
2016-11-09 13:00:43 +00:00
|
|
|
width: parent.width - 37 - 17 - 60
|
2016-08-23 13:07:52 +00:00
|
|
|
validator: DoubleValidator {
|
|
|
|
bottom: 0.0
|
2016-10-16 20:40:10 +00:00
|
|
|
top: 18446744.073709551615
|
|
|
|
decimals: 12
|
2016-08-23 13:07:52 +00:00
|
|
|
notation: DoubleValidator.StandardNotation
|
|
|
|
locale: "C"
|
|
|
|
}
|
2014-07-10 22:18:36 +00:00
|
|
|
}
|
2016-11-09 13:00:43 +00:00
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: amountAllButton
|
|
|
|
//anchors.left: amountLine.right
|
|
|
|
//anchors.top: amountLine.top
|
|
|
|
//anchors.bottom: amountLine.bottom
|
|
|
|
width: 60
|
2017-01-23 18:37:23 +00:00
|
|
|
text: qsTr("ALL") + translationManager.emptyString
|
2016-11-09 13:00:43 +00:00
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
enabled : true
|
|
|
|
onClicked: amountLine.text = "(all)"
|
|
|
|
}
|
2014-07-10 22:18:36 +00:00
|
|
|
}
|
|
|
|
|
2014-07-16 16:04:34 +00:00
|
|
|
ListModel {
|
|
|
|
id: priorityModel
|
2016-08-09 12:05:53 +00:00
|
|
|
// ListElement: cannot use script for property value, so
|
|
|
|
// code like this wont work:
|
|
|
|
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
|
|
|
|
|
2016-11-26 13:59:00 +00:00
|
|
|
ListElement { column1: qsTr("LOW (x1 fee)") ; column2: ""; priority: PendingTransaction.Priority_Low }
|
|
|
|
ListElement { column1: qsTr("MEDIUM (x20 fee)") ; column2: ""; priority: PendingTransaction.Priority_Medium }
|
|
|
|
ListElement { column1: qsTr("HIGH (x166 fee)") ; column2: ""; priority: PendingTransaction.Priority_High }
|
2014-07-16 16:04:34 +00:00
|
|
|
}
|
2016-06-27 12:45:48 +00:00
|
|
|
|
2014-07-10 22:18:36 +00:00
|
|
|
StandardDropdown {
|
2014-07-11 14:19:13 +00:00
|
|
|
id: priorityDropdown
|
2014-07-10 22:18:36 +00:00
|
|
|
anchors.top: transactionPriority.bottom
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 17
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.topMargin: 5
|
2014-07-10 22:18:36 +00:00
|
|
|
anchors.left: transactionPriority.left
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
2014-07-16 16:04:34 +00:00
|
|
|
dataModel: priorityModel
|
2014-07-10 22:18:36 +00:00
|
|
|
z: 1
|
|
|
|
}
|
2016-06-27 12:45:48 +00:00
|
|
|
|
2016-06-20 12:58:13 +00:00
|
|
|
|
2014-07-11 14:19:13 +00:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: privacyLabel
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2016-06-20 12:58:13 +00:00
|
|
|
anchors.top: amountRow.bottom
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 30
|
|
|
|
fontSize: 14
|
2016-12-27 20:53:17 +00:00
|
|
|
text: ""
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PrivacyLevel {
|
|
|
|
id: privacyLevelItem
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: privacyLabel.bottom
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 5
|
2016-12-27 20:53:17 +00:00
|
|
|
onFillLevelChanged: updateMixin()
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
2016-06-20 12:58:13 +00:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: costLabel
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: amountRow.bottom
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 30
|
|
|
|
fontSize: 14
|
2016-10-23 20:56:44 +00:00
|
|
|
text: qsTr("Transaction cost")
|
2016-06-20 12:58:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-11 14:19:13 +00:00
|
|
|
Label {
|
|
|
|
id: addressLabel
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: privacyLevelItem.bottom
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 30
|
|
|
|
fontSize: 14
|
|
|
|
textFormat: Text.RichText
|
|
|
|
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>\
|
2016-12-14 01:25:13 +00:00
|
|
|
Address <font size='2'> ( Paste in or select from </font> <a href='#'>Address book</a><font size='2'> )</font>")
|
2016-08-23 13:07:52 +00:00
|
|
|
+ translationManager.emptyString
|
2014-07-11 14:19:13 +00:00
|
|
|
|
2014-07-13 12:27:50 +00:00
|
|
|
onLinkActivated: appWindow.showPageRequest("AddressBook")
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
2016-06-16 14:13:46 +00:00
|
|
|
// recipient address input
|
2016-12-17 15:57:42 +00:00
|
|
|
RowLayout {
|
|
|
|
id: addressLineRow
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: addressLabel.bottom
|
2016-12-17 15:57:42 +00:00
|
|
|
|
2017-01-31 04:36:08 +00:00
|
|
|
StandardButton {
|
|
|
|
id: qrfinderButton
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.topMargin: 5
|
|
|
|
text: qsTr("QRCODE") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
visible : appWindow.qrScannerEnabled
|
|
|
|
enabled : visible
|
|
|
|
width: visible ? 60 : 0
|
|
|
|
onClicked: {
|
|
|
|
cameraUi.state = "Capture"
|
|
|
|
cameraUi.qrcode_decoded.connect(updateFromQrCode)
|
|
|
|
}
|
|
|
|
}
|
2016-12-17 15:57:42 +00:00
|
|
|
LineEdit {
|
|
|
|
id: addressLine
|
2017-01-31 04:36:08 +00:00
|
|
|
anchors.left: qrfinderButton.right
|
2016-12-17 15:57:42 +00:00
|
|
|
anchors.right: resolveButton.left
|
2017-01-31 04:36:08 +00:00
|
|
|
//anchors.leftMargin: 17
|
2016-12-17 15:57:42 +00:00
|
|
|
anchors.topMargin: 5
|
|
|
|
placeholderText: "4..."
|
|
|
|
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }
|
|
|
|
}
|
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: resolveButton
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.topMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
width: 60
|
|
|
|
text: qsTr("RESOLVE") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
enabled : isValidOpenAliasAddress(addressLine.text)
|
|
|
|
onClicked: {
|
|
|
|
var result = walletManager.resolveOpenAlias(addressLine.text)
|
|
|
|
if (result) {
|
|
|
|
var parts = result.split("|")
|
|
|
|
if (parts.length == 2) {
|
|
|
|
var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.testnet)
|
|
|
|
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"))
|
|
|
|
} else {
|
|
|
|
oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed"))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
oa_message(qsTr("Internal error"))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
oa_message(qsTr("Internal error"))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
oa_message(qsTr("No address found"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
2016-06-16 14:13:46 +00:00
|
|
|
id: paymentIdLabel
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2016-12-17 15:57:42 +00:00
|
|
|
anchors.top: addressLineRow.bottom
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 17
|
|
|
|
fontSize: 14
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
|
|
|
|
2016-06-16 14:13:46 +00:00
|
|
|
// payment id input
|
2014-07-15 14:03:39 +00:00
|
|
|
LineEdit {
|
2016-06-16 14:13:46 +00:00
|
|
|
id: paymentIdLine
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2016-06-16 14:13:46 +00:00
|
|
|
anchors.top: paymentIdLabel.bottom
|
2014-07-11 14:19:13 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 5
|
2016-10-16 20:25:19 +00:00
|
|
|
placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString
|
2016-06-16 14:13:46 +00:00
|
|
|
// validator: DoubleValidator { top: 0.0 }
|
2014-07-15 14:03:39 +00:00
|
|
|
}
|
2014-07-11 14:19:13 +00:00
|
|
|
|
2014-07-16 14:48:17 +00:00
|
|
|
Label {
|
|
|
|
id: descriptionLabel
|
2014-07-15 14:03:39 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2016-06-16 14:13:46 +00:00
|
|
|
anchors.top: paymentIdLine.bottom
|
2014-07-15 14:03:39 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 17
|
2014-07-16 14:48:17 +00:00
|
|
|
fontSize: 14
|
2017-01-23 18:58:31 +00:00
|
|
|
text: qsTr("Description <font size='2'>( Optional )</font>")
|
2016-08-23 13:07:52 +00:00
|
|
|
+ translationManager.emptyString
|
2014-07-16 14:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LineEdit {
|
|
|
|
id: descriptionLine
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: descriptionLabel.bottom
|
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.rightMargin: 17
|
|
|
|
anchors.topMargin: 5
|
2017-01-23 18:58:31 +00:00
|
|
|
placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString
|
2014-07-16 14:48:17 +00:00
|
|
|
}
|
|
|
|
|
2016-11-06 12:12:37 +00:00
|
|
|
function checkInformation(amount, address, payment_id, testnet) {
|
|
|
|
address = address.trim()
|
|
|
|
payment_id = payment_id.trim()
|
|
|
|
|
|
|
|
var amount_ok = amount.length > 0
|
|
|
|
var address_ok = walletManager.addressValid(address, testnet)
|
|
|
|
var payment_id_ok = payment_id.length == 0 || walletManager.paymentIdValid(payment_id)
|
|
|
|
var ipid = walletManager.paymentIdFromAddress(address, testnet)
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2014-07-22 15:15:52 +00:00
|
|
|
StandardButton {
|
|
|
|
id: sendButton
|
2014-07-16 14:48:17 +00:00
|
|
|
anchors.left: parent.left
|
2014-07-22 15:15:52 +00:00
|
|
|
anchors.top: descriptionLine.bottom
|
2014-07-16 14:48:17 +00:00
|
|
|
anchors.leftMargin: 17
|
|
|
|
anchors.topMargin: 17
|
2014-07-22 15:15:52 +00:00
|
|
|
width: 60
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("SEND") + translationManager.emptyString
|
2014-07-22 15:15:52 +00:00
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
2017-01-12 19:53:27 +00:00
|
|
|
enabled : !appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
|
2016-06-16 14:13:46 +00:00
|
|
|
onClicked: {
|
2016-08-23 13:07:52 +00:00
|
|
|
console.log("Transfer: paymentClicked")
|
|
|
|
var priority = priorityModel.get(priorityDropdown.currentIndex).priority
|
|
|
|
console.log("priority: " + priority)
|
|
|
|
console.log("amount: " + amountLine.text)
|
2016-09-05 20:06:05 +00:00
|
|
|
addressLine.text = addressLine.text.trim()
|
|
|
|
paymentIdLine.text = paymentIdLine.text.trim()
|
2016-08-23 13:07:52 +00:00
|
|
|
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel),
|
2016-11-05 23:19:28 +00:00
|
|
|
priority, descriptionLine.text)
|
2016-09-05 20:06:05 +00:00
|
|
|
|
2016-06-16 14:13:46 +00:00
|
|
|
}
|
2014-07-11 14:19:13 +00:00
|
|
|
}
|
2016-11-08 20:23:50 +00:00
|
|
|
|
2017-01-12 19:53:27 +00:00
|
|
|
} // pageRoot
|
2016-11-26 14:47:25 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id:desaturate
|
|
|
|
color:"black"
|
|
|
|
anchors.fill: parent
|
|
|
|
opacity: 0.1
|
2016-12-10 19:56:35 +00:00
|
|
|
visible: (pageRoot.enabled)? 0 : 1;
|
2016-11-26 14:47:25 +00:00
|
|
|
}
|
2017-01-12 19:53:27 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.top: pageRoot.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.margins: 17
|
|
|
|
spacing:10
|
|
|
|
enabled: !viewOnly || pageRoot.enabled
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Label {
|
|
|
|
id: manageWalletLabel
|
|
|
|
Layout.fillWidth: true
|
|
|
|
color: "#4A4949"
|
|
|
|
text: qsTr("Advanced") + translationManager.emptyString
|
|
|
|
fontSize: 16
|
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 1
|
|
|
|
color: "#DEDEDE"
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
StandardButton {
|
|
|
|
id: sweepUnmixableButton
|
|
|
|
text: qsTr("SWEEP UNMIXABLE") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
enabled : pageRoot.enabled
|
|
|
|
onClicked: {
|
|
|
|
console.log("Transfer: sweepUnmixableClicked")
|
|
|
|
root.sweepUnmixableClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: saveTxButton
|
|
|
|
text: qsTr("create tx file") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
visible: appWindow.viewOnly
|
|
|
|
enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
|
|
|
|
onClicked: {
|
|
|
|
console.log("Transfer: saveTx Clicked")
|
|
|
|
var priority = priorityModel.get(priorityDropdown.currentIndex).priority
|
|
|
|
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
|
|
|
|
text: qsTr("sign tx file") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
visible: !appWindow.viewOnly
|
|
|
|
onClicked: {
|
|
|
|
console.log("Transfer: sign tx clicked")
|
|
|
|
signTxDialog.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: submitTxButton
|
|
|
|
text: qsTr("submit tx file") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
visible: appWindow.viewOnly
|
|
|
|
enabled: pageRoot.enabled
|
|
|
|
onClicked: {
|
|
|
|
console.log("Transfer: submit tx clicked")
|
|
|
|
submitTxDialog.open();
|
|
|
|
}
|
|
|
|
}
|
2017-01-12 21:28:37 +00:00
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: rescanSpentButton
|
|
|
|
text: qsTr("Rescan spent") + translationManager.emptyString
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
enabled: pageRoot.enabled
|
|
|
|
onClicked: {
|
|
|
|
if (!currentWallet.rescanSpent()) {
|
|
|
|
console.error("Error: ", currentWallet.errorString);
|
|
|
|
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
|
|
|
informationPopup.text = qsTr("Error: ") + currentWallet.errorString
|
|
|
|
informationPopup.icon = StandardIcon.Critical
|
|
|
|
informationPopup.onCloseCallback = null
|
|
|
|
informationPopup.open();
|
|
|
|
} else {
|
|
|
|
informationPopup.title = qsTr("Information") + translationManager.emptyString
|
|
|
|
informationPopup.text = qsTr("Sucessfully rescanned spent outputs") + translationManager.emptyString
|
|
|
|
informationPopup.icon = StandardIcon.Information
|
|
|
|
informationPopup.onCloseCallback = null
|
|
|
|
informationPopup.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-12 19:53:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//SignTxDialog
|
|
|
|
FileDialog {
|
|
|
|
id: signTxDialog
|
|
|
|
title: "Please choose a file"
|
|
|
|
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: "Please choose a file"
|
|
|
|
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
|
|
|
|
informationPopup.text = qsTr("Money sent successfully") + translationManager.emptyString
|
|
|
|
informationPopup.icon = StandardIcon.Information
|
|
|
|
informationPopup.onCloseCallback = null
|
|
|
|
informationPopup.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
console.log("Canceled")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-11-26 14:47:25 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
x: root.width/2 - width/2
|
|
|
|
y: root.height/2 - height/2
|
|
|
|
height:statusText.paintedHeight + 50
|
|
|
|
width:statusText.paintedWidth + 40
|
|
|
|
visible: statusText.text != ""
|
|
|
|
opacity: 0.9
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: statusText
|
|
|
|
anchors.fill:parent
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2016-12-10 19:56:35 +00:00
|
|
|
textFormat: Text.RichText
|
2016-12-21 13:30:15 +00:00
|
|
|
onLinkActivated: { appWindow.startDaemon(appWindow.persistentSettings.daemonFlags); }
|
2016-11-26 14:47:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
//Disable password page until enabled by updateStatus
|
2016-12-10 19:56:35 +00:00
|
|
|
pageRoot.enabled = false
|
2016-12-27 20:53:17 +00:00
|
|
|
updateMixin()
|
2016-11-26 14:47:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// fires on every page load
|
|
|
|
function onPageCompleted() {
|
|
|
|
console.log("transfer page loaded")
|
|
|
|
updateStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
//TODO: Add daemon sync status
|
|
|
|
//TODO: enable send page when we're connected and daemon is synced
|
|
|
|
|
|
|
|
function updateStatus() {
|
|
|
|
if(typeof currentWallet === "undefined") {
|
2016-12-10 19:56:35 +00:00
|
|
|
statusText.text = qsTr("Wallet is not connected to daemon.") + "<br>" + root.startLinkText
|
2016-11-26 14:47:25 +00:00
|
|
|
return;
|
2017-01-04 16:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (currentWallet.viewOnly) {
|
2017-01-12 19:53:27 +00:00
|
|
|
// statusText.text = qsTr("Wallet is view only.")
|
|
|
|
//return;
|
2016-11-26 14:47:25 +00:00
|
|
|
}
|
2017-01-12 19:53:27 +00:00
|
|
|
pageRoot.enabled = false;
|
2016-11-26 14:47:25 +00:00
|
|
|
|
2017-02-23 18:47:58 +00:00
|
|
|
switch (currentWallet.connected()) {
|
2016-11-26 14:47:25 +00:00
|
|
|
case Wallet.ConnectionStatus_Disconnected:
|
2016-12-10 19:56:35 +00:00
|
|
|
statusText.text = qsTr("Wallet is not connected to daemon.") + "<br>" + root.startLinkText
|
2016-11-26 14:47:25 +00:00
|
|
|
break
|
|
|
|
case Wallet.ConnectionStatus_WrongVersion:
|
|
|
|
statusText.text = qsTr("Connected daemon is not compatible with GUI. \n" +
|
|
|
|
"Please upgrade or connect to another daemon")
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
if(!appWindow.daemonSynced){
|
|
|
|
statusText.text = qsTr("Waiting on daemon synchronization to finish")
|
|
|
|
} else {
|
|
|
|
// everything OK, enable transfer page
|
2016-12-10 19:56:35 +00:00
|
|
|
pageRoot.enabled = true;
|
2016-11-26 14:47:25 +00:00
|
|
|
statusText.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
|
|
|
}
|