mirror of
https://github.com/monero-project/monero-gui
synced 2025-01-10 17:26:24 +01:00
Redoing the Sign/Verify page
This commit is contained in:
parent
7c0f704fbd
commit
6e794e3c50
@ -136,7 +136,7 @@ Rectangle {
|
||||
}, State {
|
||||
name: "Sign"
|
||||
PropertyChanges { target: root; currentView: signView }
|
||||
PropertyChanges { target: mainFlickable; contentHeight: minHeight }
|
||||
PropertyChanges { target: mainFlickable; contentHeight: 1200 * scaleRatio }
|
||||
}, State {
|
||||
name: "Settings"
|
||||
PropertyChanges { target: root; currentView: settingsView }
|
||||
|
@ -29,6 +29,7 @@
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import QtQuick 2.10
|
||||
import "../js/TxUtils.js" as TxUtils
|
||||
import "." 1.0
|
||||
|
||||
|
||||
@ -37,6 +38,7 @@ TextArea {
|
||||
property bool addressValidation: false
|
||||
property bool wrapAnywhere: true
|
||||
property int fontSize: 18 * scaleRatio
|
||||
|
||||
id: textArea
|
||||
font.family: Style.fontRegular
|
||||
font.pixelSize: fontSize
|
||||
@ -56,6 +58,9 @@ TextArea {
|
||||
if(addressValidation){
|
||||
// js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }`
|
||||
textArea.text = textArea.text.replace(/[^a-z0-9]/gi,'');
|
||||
var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.testnet);
|
||||
if(!address_ok) error = true;
|
||||
else error = false;
|
||||
TextArea.cursorPosition = textArea.text.length;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ ColumnLayout {
|
||||
id: lineditmulti
|
||||
property alias text: multiLine.text
|
||||
property alias placeholderText: placeholderLabel.text
|
||||
property alias inputLabelText: inputLabel.text
|
||||
property alias labelText: inputLabel.text
|
||||
property alias error: multiLine.error
|
||||
property alias readOnly: multiLine.readOnly
|
||||
property alias addressValidation: multiLine.addressValidation
|
||||
|
@ -65,6 +65,7 @@ ListView {
|
||||
|
||||
showingHeader: false
|
||||
showBorder: false
|
||||
addressValidation: false
|
||||
}
|
||||
|
||||
IconButton {
|
||||
|
446
pages/Sign.qml
446
pages/Sign.qml
@ -43,10 +43,6 @@ Rectangle {
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
|
||||
function checkAddress(address, nettype) {
|
||||
return walletManager.addressValid(address, nettype)
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
// dynamically change onclose handler
|
||||
property var onCloseCallback
|
||||
@ -88,302 +84,215 @@ Rectangle {
|
||||
|
||||
// sign / verify
|
||||
ColumnLayout {
|
||||
anchors.margins: 17 * scaleRatio
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 40 * scaleRatio
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
spacing: 20 * scaleRatio
|
||||
|
||||
// sign
|
||||
ColumnLayout {
|
||||
id: signBox
|
||||
|
||||
RowLayout {
|
||||
|
||||
Text {
|
||||
text: qsTr("Sign a message or file contents with your address:") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
font.family: Style.fontRegular
|
||||
font.pixelSize: 16 * scaleRatio
|
||||
color: Style.defaultFontColor
|
||||
}
|
||||
}
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: 20 * scaleRatio
|
||||
|
||||
Label {
|
||||
id: signMessageLabel
|
||||
text: qsTr("Either message:") + translationManager.emptyString
|
||||
id: signTitleLabel
|
||||
fontSize: 24 * scaleRatio
|
||||
text: qsTr("Sign") + translationManager.emptyString
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Text {
|
||||
text: qsTr("This page lets you sign/verify a message (or file contents) with your address.") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
font.family: Style.fontRegular
|
||||
font.pixelSize: 14 * scaleRatio
|
||||
color: Style.defaultFontColor
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
id: signMessageRow
|
||||
anchors.topMargin: 17
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
LineEdit {
|
||||
id: signMessageLine
|
||||
anchors.left: parent.left
|
||||
anchors.right: signMessageButton.left
|
||||
placeholderText: qsTr("Message to sign") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
onTextChanged: signSignatureLine.text = ""
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (signMessageLine.text.length > 0) {
|
||||
clipboard.setText(signMessageLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: signMessageButton
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Sign") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
var signature = appWindow.currentWallet.signMessage(signMessageLine.text, false)
|
||||
signSignatureLine.text = signature
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: signMessageFileLabel
|
||||
text: qsTr("Or file:") + translationManager.emptyString
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: signFileRow
|
||||
anchors.topMargin: 17
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
FileDialog {
|
||||
id: signFileDialog
|
||||
title: qsTr("Please choose a file to sign") + translationManager.emptyString;
|
||||
folder: "file://"
|
||||
nameFilters: [ "*"]
|
||||
|
||||
onAccepted: {
|
||||
signFileLine.text = walletManager.urlToLocalPath(signFileDialog.fileUrl)
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: loadFileToSignButton
|
||||
anchors.rightMargin: 17 * scaleRatio
|
||||
text: qsTr("Select") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
signFileDialog.open()
|
||||
}
|
||||
}
|
||||
LineEdit {
|
||||
id: signFileLine
|
||||
anchors.left: loadFileToSignButton.right
|
||||
anchors.right: signFileButton.left
|
||||
placeholderText: qsTr("Filename with message to sign") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: signSignatureLine.text = ""
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (signFileLine.text.length > 0) {
|
||||
clipboard.setText(signFileLine.text)
|
||||
}
|
||||
}
|
||||
LineEdit {
|
||||
id: signMessageLine
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("Message to sign") + translationManager.emptyString;
|
||||
labelText: qsTr("Message") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
onTextChanged: signSignatureLine.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: signFileButton
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Sign") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
var signature = appWindow.currentWallet.signMessage(signFileLine.text, true)
|
||||
signSignatureLine.text = signature
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 18
|
||||
|
||||
StandardButton {
|
||||
id: signMessageButton
|
||||
text: qsTr("Sign") + translationManager.emptyString
|
||||
enabled: signMessageLine.text !== ''
|
||||
small: true
|
||||
onClicked: {
|
||||
var signature = appWindow.currentWallet.signMessage(signMessageLine.text, false)
|
||||
signSignatureLine.text = signature
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: signFileRow
|
||||
|
||||
RowLayout {
|
||||
LineEdit {
|
||||
id: signFileLine
|
||||
labelText: "Message from file"
|
||||
placeholderText: qsTr("Path to file") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: signSignatureLine.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 18
|
||||
|
||||
StandardButton {
|
||||
id: loadFileToSignButton
|
||||
small: true
|
||||
text: qsTr("Browse") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
signFileDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: signFileButton
|
||||
small: true
|
||||
anchors.left: loadFileToSignButton.right
|
||||
anchors.leftMargin: 20
|
||||
text: qsTr("Sign") + translationManager.emptyString
|
||||
enabled: signFileLine.text !== ''
|
||||
onClicked: {
|
||||
var signature = appWindow.currentWallet.signMessage(signFileLine.text, true);
|
||||
signSignatureLine.text = signature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: signSignatureRow
|
||||
anchors.topMargin: 17 * scaleRatio
|
||||
|
||||
Label {
|
||||
id: signSignatureLabel
|
||||
text: qsTr("Signature") + translationManager.emptyString
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: signSignatureLine
|
||||
placeholderText: qsTr("Signature") + translationManager.emptyString;
|
||||
readOnly: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (signSignatureLine.text.length > 0) {
|
||||
clipboard.setText(signSignatureLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// verify
|
||||
ColumnLayout {
|
||||
id: verifyBox
|
||||
|
||||
RowLayout {
|
||||
Text {
|
||||
text: qsTr("Verify a message or file signature from an address:") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
font.family: Style.fontRegular
|
||||
font.pixelSize: 16 * scaleRatio
|
||||
color: Style.defaultFontColor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
id: verifyMessageLabel
|
||||
text: qsTr("Either message:") + translationManager.emptyString
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: verifyMessageRow
|
||||
anchors.topMargin: 17 * scaleRatio
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
LineEdit {
|
||||
id: verifyMessageLine
|
||||
anchors.left: parent.left
|
||||
anchors.right: verifyMessageButton.left
|
||||
placeholderText: qsTr("Message to verify") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (verifyMessageLine.text.length > 0) {
|
||||
clipboard.setText(verifyMessageLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: verifyMessageButton
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Verify") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
var verified = appWindow.currentWallet.verifySignedMessage(verifyMessageLine.text, verifyAddressLine.text, verifySignatureLine.text, false)
|
||||
displayVerificationResult(verified)
|
||||
RowLayout {
|
||||
LineEdit {
|
||||
id: signSignatureLine
|
||||
labelText: qsTr("Signature")
|
||||
placeholderText: qsTr("Signature") + translationManager.emptyString;
|
||||
readOnly: true
|
||||
Layout.fillWidth: true
|
||||
copyButton: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: verifyMessageFileLabel
|
||||
text: qsTr("Or file:") + translationManager.emptyString
|
||||
id: verifyTitleLabel
|
||||
fontSize: 24 * scaleRatio
|
||||
Layout.topMargin: 40
|
||||
text: qsTr("Verify") + translationManager.emptyString
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: verifyFileRow
|
||||
anchors.topMargin: 17 * scaleRatio
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
id: verifyMessageRow
|
||||
|
||||
FileDialog {
|
||||
id: verifyFileDialog
|
||||
title: qsTr("Please choose a file to verify") + translationManager.emptyString;
|
||||
folder: "file://"
|
||||
nameFilters: [ "*"]
|
||||
|
||||
onAccepted: {
|
||||
verifyFileLine.text = walletManager.urlToLocalPath(verifyFileDialog.fileUrl)
|
||||
LineEdit {
|
||||
id: verifyMessageLine
|
||||
Layout.fillWidth: true
|
||||
labelText: qsTr("Verify message")
|
||||
placeholderText: qsTr("Message to verify") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: loadFileToVerifyButton
|
||||
anchors.rightMargin: 17 * scaleRatio
|
||||
text: qsTr("Select") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
verifyFileDialog.open()
|
||||
}
|
||||
}
|
||||
LineEdit {
|
||||
id: verifyFileLine
|
||||
anchors.left: loadFileToVerifyButton.right
|
||||
anchors.right: verifyFileButton.left
|
||||
placeholderText: qsTr("Filename with message to verify") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 18
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
StandardButton {
|
||||
id: verifyMessageButton
|
||||
small: true
|
||||
text: qsTr("Verify") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
if (verifyFileLine.text.length > 0) {
|
||||
clipboard.setText(verifyFileLine.text)
|
||||
}
|
||||
var verified = appWindow.currentWallet.verifySignedMessage(verifyMessageLine.text, verifyAddressLine.text, verifySignatureLine.text, false)
|
||||
displayVerificationResult(verified)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: verifyFileButton
|
||||
anchors.right: parent.right
|
||||
text: qsTr("Verify") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
var verified = appWindow.currentWallet.verifySignedMessage(verifyFileLine.text, verifyAddressLine.text, verifySignatureLine.text, true)
|
||||
displayVerificationResult(verified)
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
LineEdit {
|
||||
id: verifyFileLine
|
||||
labelText: qsTr("Verify file")
|
||||
placeholderText: qsTr("Filename with message to verify") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 18
|
||||
|
||||
StandardButton {
|
||||
id: loadFileToVerifyButton
|
||||
small: true
|
||||
text: qsTr("Browse") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
verifyFileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: verifyFileButton
|
||||
small: true
|
||||
anchors.left: loadFileToVerifyButton.right
|
||||
anchors.leftMargin: 20
|
||||
text: qsTr("Verify") + translationManager.emptyString
|
||||
enabled: true
|
||||
onClicked: {
|
||||
var verified = appWindow.currentWallet.verifySignedMessage(verifyFileLine.text, verifyAddressLine.text, verifySignatureLine.text, true)
|
||||
displayVerificationResult(verified)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: verifyAddressLabel
|
||||
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: " + (16 * scaleRatio) + "px;}</style>" +
|
||||
qsTr("Signing address") +
|
||||
"<font size='" + (2 * scaleRatio) + "'> ( " +
|
||||
qsTr("Paste in or select from <a href='#'>Address book</a>") +
|
||||
" )</font>" +
|
||||
translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 16 * scaleRatio
|
||||
Layout.fillWidth: true
|
||||
textFormat: Text.RichText
|
||||
onLinkActivated: appWindow.showPageRequest("AddressBook")
|
||||
}
|
||||
ColumnLayout {
|
||||
RowLayout{
|
||||
|
||||
LineEdit {
|
||||
id: verifyAddressLine
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: verifyAddressLabel.bottom
|
||||
anchors.topMargin: 5 * scaleRatio
|
||||
placeholderText: "4..."
|
||||
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }
|
||||
LineEditMulti {
|
||||
id: verifyAddressLine
|
||||
Layout.fillWidth: true
|
||||
labelText: qsTr("Address")
|
||||
addressValidation: true
|
||||
anchors.topMargin: 5 * scaleRatio
|
||||
placeholderText: "4..."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@ -399,18 +308,33 @@ Rectangle {
|
||||
id: verifySignatureLine
|
||||
placeholderText: qsTr("Signature") + translationManager.emptyString;
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (verifySignatureLine.text.length > 0) {
|
||||
clipboard.setText(verifySignatureLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
copyButton: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileDialog {
|
||||
id: signFileDialog
|
||||
title: qsTr("Please choose a file to sign") + translationManager.emptyString;
|
||||
folder: "file://"
|
||||
nameFilters: [ "*"]
|
||||
|
||||
onAccepted: {
|
||||
signFileLine.text = walletManager.urlToLocalPath(signFileDialog.fileUrl)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: verifyFileDialog
|
||||
title: qsTr("Please choose a file to verify") + translationManager.emptyString;
|
||||
folder: "file://"
|
||||
nameFilters: [ "*"]
|
||||
|
||||
onAccepted: {
|
||||
verifyFileLine.text = walletManager.urlToLocalPath(verifyFileDialog.fileUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onPageCompleted() {
|
||||
|
@ -205,7 +205,7 @@ Rectangle {
|
||||
LineEditMulti {
|
||||
id: addressLine
|
||||
spacing: 0
|
||||
inputLabelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
labelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
|
||||
Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
|
||||
+ translationManager.emptyString
|
||||
labelButtonText: qsTr("Resolve") + translationManager.emptyString
|
||||
|
@ -132,7 +132,6 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
anchors.bottomMargin: 3 * scaleRatio
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
|
Loading…
Reference in New Issue
Block a user