aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/Sign.qml444
1 files changed, 278 insertions, 166 deletions
diff --git a/pages/Sign.qml b/pages/Sign.qml
index 61318a82..49b80166 100644
--- a/pages/Sign.qml
+++ b/pages/Sign.qml
@@ -32,12 +32,14 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
-import "../components"
import moneroComponents.Clipboard 1.0
import moneroComponents.WalletManager 1.0
+import "../components" as MoneroComponents
Rectangle {
id: mainLayout
+ property bool messageMode: true
+ property bool fileMode: false
color: "transparent"
@@ -84,231 +86,342 @@ Rectangle {
// sign / verify
ColumnLayout {
- anchors.top: parent.top
- anchors.margins: 40 * scaleRatio
+ id: root
+ spacing: 20 * scaleRatio
+ anchors.margins: (isMobile ? 17 : 20) * scaleRatio
+ anchors.topMargin: 40 * scaleRatio
anchors.left: parent.left
+ anchors.top: parent.top
anchors.right: parent.right
- spacing: 20 * scaleRatio
- // sign
- ColumnLayout {
- id: signBox
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 20 * scaleRatio
+ Rectangle {
+ id: instructionsRect
+ Layout.preferredHeight: (instructionsText.height + 26) * scaleRatio
+ Layout.fillWidth: true
+ radius: 2 * scaleRatio
+ border.color: Qt.rgba(255, 255, 255, 0.25)
+ border.width: 1 * scaleRatio
+ color: "transparent"
- Label {
- id: signTitleLabel
- fontSize: 24 * scaleRatio
- text: qsTr("Sign") + translationManager.emptyString
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.preferredHeight: (instructionsText.height + 40) * scaleRatio
+
+ Image {
+ Layout.alignment: Qt.AlignVCenter
+ Layout.preferredHeight: 22 * scaleRatio
+ Layout.preferredWidth: 22 * scaleRatio
+ Layout.leftMargin: 10 * scaleRatio
+ Layout.topMargin: 10 * scaleRatio
+ source: "../images/editIcon.png"
+ }
+
+ Text {
+ id: instructionsText
+ Layout.topMargin: 12 * scaleRatio
+ Layout.preferredWidth: (instructionsRect.width - 80) * scaleRatio
+ Layout.leftMargin: 6 * scaleRatio
+ 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.name
+ font.pixelSize: 15 * scaleRatio
+ textFormat: Text.RichText
+ color: MoneroComponents.Style.defaultFontColor
+ }
}
+ }
+
+ ColumnLayout {
+ id: modeRow
+ Layout.fillWidth: true
Text {
- text: qsTr("This page lets you sign/verify a message (or file contents) with your address.") + translationManager.emptyString
- wrapMode: Text.Wrap
+ id: modeText
Layout.fillWidth: true
+ Layout.topMargin: 12 * scaleRatio
+ Layout.preferredWidth: (instructionsRect.width - 80) * scaleRatio
+ text: qsTr("Mode") + translationManager.emptyString
+ wrapMode: Text.Wrap
font.family: Style.fontRegular.name
- font.pixelSize: 14 * scaleRatio
- color: Style.defaultFontColor
+ font.pixelSize: 20 * scaleRatio
+ textFormat: Text.RichText
+ color: MoneroComponents.Style.defaultFontColor
+ }
+
+ RowLayout {
+ id: modeButtonsRow
+ Layout.topMargin: 10 * scaleRatio
+
+ MoneroComponents.StandardButton {
+ id: handleMessageButton
+ text: qsTr("Message") + translationManager.emptyString
+ enabled: fileMode
+ onClicked: {
+ messageMode = true;
+ fileMode = false;
+ }
+ }
+
+ MoneroComponents.StandardButton {
+ id: handleFileButton
+ text: qsTr("File") + translationManager.emptyString
+ enabled: messageMode
+ onClicked: {
+ fileMode = true;
+ messageMode = false;
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ // divider
+ Layout.preferredHeight: 1 * scaleRatio
+ Layout.fillWidth: true
+ Layout.topMargin: 8 * scaleRatio
+ Layout.bottomMargin: 8 * scaleRatio
+ color: MoneroComponents.Style.dividerColor
+ opacity: MoneroComponents.Style.dividerOpacity
+ }
+
+ ColumnLayout {
+ id: signSection
+ spacing: 10 * scaleRatio
+
+ MoneroComponents.Label {
+ id: signTitleLabel
+ fontSize: 20 * scaleRatio
+ text: fileMode ? qsTr("Sign file") + translationManager.emptyString : qsTr("Sign message") + translationManager.emptyString
}
ColumnLayout{
id: signMessageRow
+ Layout.fillWidth: true
+ spacing: 10 * scaleRatio
+ visible: messageMode
- RowLayout {
+ MoneroComponents.LineEditMulti{
+ id: signMessageLine
Layout.fillWidth: true
-
- LineEdit {
- id: signMessageLine
- Layout.fillWidth: true
- placeholderText: qsTr("Message to sign") + translationManager.emptyString;
- labelText: qsTr("Message") + translationManager.emptyString;
- readOnly: false
- onTextChanged: signSignatureLine.text = ""
- }
+ placeholderText: qsTr("Enter a message to sign") + translationManager.emptyString;
+ labelText: qsTr("Message") + translationManager.emptyString;
+ readOnly: false
+ onTextChanged: signSignatureLine.text = ''
+ wrapMode: Text.WrapAnywhere
+ pasteButton: true
}
+ }
+
+ RowLayout {
+ id: signFileRow
+ Layout.fillWidth: true
+ visible: fileMode
- RowLayout{
+ MoneroComponents.LineEditMulti {
+ id: signFileLine
+ labelText: qsTr("File") + translationManager.emptyString
+ placeholderText: qsTr("Enter path to file") + translationManager.emptyString;
+ readOnly: false
Layout.fillWidth: true
- Layout.topMargin: 18
+ onTextChanged: signSignatureLine.text = ""
+ wrapMode: Text.WrapAnywhere
+ text: ''
+ }
- 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
- }
+ MoneroComponents.StandardButton {
+ id: loadFileToSignButton
+ Layout.alignment: Qt.AlignBottom
+ small: false
+ text: qsTr("Browse") + translationManager.emptyString
+ enabled: true
+ onClicked: {
+ signFileDialog.open();
}
}
}
ColumnLayout {
- id: signFileRow
+ id: signSignatureRow
- RowLayout {
- LineEdit {
- id: signFileLine
- labelText: qsTr("Message from file") + translationManager.emptyString
- placeholderText: qsTr("Path to file") + translationManager.emptyString;
- readOnly: false
- Layout.fillWidth: true
- onTextChanged: signSignatureLine.text = ""
- }
+ MoneroComponents.LineEditMulti {
+ id: signSignatureLine
+ labelText: qsTr("Signature") + translationManager.emptyString;
+ placeholderText: messageMode ? qsTr("Click [Sign Message] to generate signature") + translationManager.emptyString : qsTr("Click [Sign File] to generate signature") + translationManager.emptyString;
+ readOnly: true
+ Layout.fillWidth: true
+ copyButton: true
+ wrapMode: Text.WrapAnywhere
}
+ }
- RowLayout {
- Layout.fillWidth: true
- Layout.topMargin: 18
+ RowLayout{
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignRight
- StandardButton {
- id: loadFileToSignButton
- small: true
- text: qsTr("Browse") + translationManager.emptyString
- enabled: true
- onClicked: {
- signFileDialog.open();
- }
+ MoneroComponents.StandardButton {
+ id: clearSignButton
+ text: qsTr("Clear") + translationManager.emptyString
+ enabled: signMessageLine.text !== '' || signFileLine.text !== ''
+ small: true
+ onClicked: {
+ signMessageLine.text = '';
+ signSignatureLine.text = '';
+ signFileLine.text = '';
}
+ }
- 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;
- }
+ MoneroComponents.StandardButton {
+ id: signMessageButton
+ visible: messageMode
+ text: qsTr("Sign Message") + translationManager.emptyString
+ enabled: signMessageLine.text !== ''
+ small: true
+ onClicked: {
+ var signature = appWindow.currentWallet.signMessage(signMessageLine.text, false)
+ signSignatureLine.text = signature
}
}
- }
-
- ColumnLayout {
- id: signSignatureRow
-
- RowLayout {
- LineEdit {
- id: signSignatureLine
- labelText: qsTr("Signature") + translationManager.emptyString;
- placeholderText: qsTr("Signature") + translationManager.emptyString;
- readOnly: true
- Layout.fillWidth: true
- copyButton: true
+ MoneroComponents.StandardButton {
+ id: signFileButton
+ visible: fileMode
+ small: true
+ Layout.alignment: Qt.AlignBottom
+ text: qsTr("Sign File") + translationManager.emptyString
+ enabled: signFileLine.text !== ''
+ onClicked: {
+ var signature = appWindow.currentWallet.signMessage(signFileLine.text, true);
+ signSignatureLine.text = signature;
}
}
}
+ }
- Label {
+ Rectangle {
+ // divider
+ Layout.preferredHeight: 1 * scaleRatio
+ Layout.fillWidth: true
+ Layout.topMargin: 8 * scaleRatio
+ Layout.bottomMargin: 8 * scaleRatio
+ color: MoneroComponents.Style.dividerColor
+ opacity: MoneroComponents.Style.dividerOpacity
+ }
+
+ ColumnLayout {
+ id: verifySection
+ spacing: 16 * scaleRatio
+
+ MoneroComponents.Label {
id: verifyTitleLabel
- fontSize: 24 * scaleRatio
- Layout.topMargin: 40
- text: qsTr("Verify") + translationManager.emptyString
+ fontSize: 20 * scaleRatio
+ text: fileMode ? qsTr("Verify file") + translationManager.emptyString : qsTr("Verify message") + translationManager.emptyString
}
- ColumnLayout {
- RowLayout {
- id: verifyMessageRow
+ MoneroComponents.LineEditMulti {
+ id: verifyMessageLine
+ visible: messageMode
+ Layout.fillWidth: true
+ labelText: qsTr("Message") + translationManager.emptyString;
+ placeholderText: qsTr("Enter the message to verify") + translationManager.emptyString;
+ readOnly: false
+ wrapMode: Text.WrapAnywhere
+ text: ''
+ pasteButton: true
+ }
- LineEdit {
- id: verifyMessageLine
- Layout.fillWidth: true
- labelText: qsTr("Verify message") + translationManager.emptyString;
- placeholderText: qsTr("Message to verify") + translationManager.emptyString;
- readOnly: false
- }
- }
+ RowLayout {
+ id: verifyFileRow
+ Layout.fillWidth: true
+ visible: fileMode
- RowLayout{
+ MoneroComponents.LineEditMulti {
+ id: verifyFileLine
+ labelText: qsTr("File") + translationManager.emptyString;
+ placeholderText: qsTr("Enter path to file") + translationManager.emptyString;
+ readOnly: false
Layout.fillWidth: true
- Layout.topMargin: 18
+ wrapMode: Text.WrapAnywhere
+ text: ''
+ }
- StandardButton {
- id: verifyMessageButton
- small: true
- text: qsTr("Verify") + translationManager.emptyString
- enabled: true
- onClicked: {
- var verified = appWindow.currentWallet.verifySignedMessage(verifyMessageLine.text, verifyAddressLine.text, verifySignatureLine.text, false)
- displayVerificationResult(verified)
- }
+ MoneroComponents.StandardButton {
+ id: loadFileToVerifyButton
+ Layout.alignment: Qt.AlignBottom
+ small: false
+ text: qsTr("Browse") + translationManager.emptyString;
+ enabled: true
+ onClicked: {
+ verifyFileDialog.open()
}
}
}
- ColumnLayout {
- RowLayout {
- LineEdit {
- id: verifyFileLine
- labelText: qsTr("Verify file") + translationManager.emptyString;
- placeholderText: qsTr("Filename with message to verify") + translationManager.emptyString;
- readOnly: false
- Layout.fillWidth: true
- }
- }
+ MoneroComponents.LineEditMulti {
+ id: verifyAddressLine
+ Layout.fillWidth: true
+ labelText: qsTr("Address") + translationManager.emptyString;
+ addressValidation: true
+ placeholderText: qsTr("Enter the Monero Address (example: 44AFFq5kSiGBoZ...)") + translationManager.emptyString;
+ wrapMode: Text.WrapAnywhere
+ text: ''
+ pasteButton: true
+ }
- RowLayout{
- Layout.fillWidth: true
- Layout.topMargin: 18
+ MoneroComponents.LineEditMulti {
+ id: verifySignatureLine
+ labelText: qsTr("Signature") + translationManager.emptyString;
+ placeholderText: qsTr("Enter the signature to verify") + translationManager.emptyString;
+ Layout.fillWidth: true
+ pasteButton: true
+ wrapMode: Text.WrapAnywhere
+ text: ''
+ }
- StandardButton {
- id: loadFileToVerifyButton
- small: true
- text: qsTr("Browse") + translationManager.emptyString
- enabled: true
- onClicked: {
- verifyFileDialog.open()
- }
- }
+ RowLayout{
+ Layout.fillWidth: true
+ Layout.topMargin: 12 * scaleRatio
+ Layout.alignment: Qt.AlignRight
- 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)
- }
+ MoneroComponents.StandardButton {
+ id: clearVerifyButton
+ text: qsTr("Clear") + translationManager.emptyString
+ enabled: verifyMessageLine.text !== '' || verifyFileLine.text !== '' || verifyAddressLine.text !== '' || verifySignatureLine.text !== ''
+ small: true
+ onClicked: {
+ verifyMessageLine.text = '';
+ verifySignatureLine.text = '';
+ verifyAddressLine.text = '';
+ verifyFileLine.text = '';
}
}
- }
- ColumnLayout {
- RowLayout{
-
- LineEditMulti {
- id: verifyAddressLine
- Layout.fillWidth: true
- labelText: qsTr("Address") + translationManager.emptyString;
- addressValidation: true
- anchors.topMargin: 5 * scaleRatio
- placeholderText: "4.. / 8.."
+ MoneroComponents.StandardButton {
+ id: verifyFileButton
+ visible: fileMode
+ small: true
+ text: qsTr("Verify File") + translationManager.emptyString
+ enabled: verifyFileLine.text !== '' && verifyAddressLine.text !== '' && verifySignatureLine.text !== ''
+ onClicked: {
+ var verified = appWindow.currentWallet.verifySignedMessage(verifyFileLine.text, verifyAddressLine.text, verifySignatureLine.text, true)
+ displayVerificationResult(verified)
}
}
- }
- ColumnLayout {
- id: verifySignatureRow
-
- LineEdit {
- id: verifySignatureLine
- labelText: qsTr("Signature") + translationManager.emptyString;
- placeholderText: qsTr("Signature") + translationManager.emptyString;
- Layout.fillWidth: true
- copyButton: true
+ MoneroComponents.StandardButton {
+ id: verifyMessageButton
+ visible: messageMode
+ small: true
+ text: qsTr("Verify Message") + translationManager.emptyString
+ enabled: verifyMessageLine.text !== '' && verifyAddressLine.text !== '' && verifySignatureLine.text !== ''
+ onClicked: {
+ var verified = appWindow.currentWallet.verifySignedMessage(verifyMessageLine.text, verifyAddressLine.text, verifySignatureLine.text, false)
+ displayVerificationResult(verified)
+ }
}
}
}
-
FileDialog {
id: signFileDialog
title: qsTr("Please choose a file to sign") + translationManager.emptyString;
@@ -335,5 +448,4 @@ Rectangle {
function onPageCompleted() {
console.log("Sign/verify page loaded");
}
-
}