forked from Public/monero-gui
AddressBook mobile redesign
This commit is contained in:
@@ -33,167 +33,106 @@ import moneroComponents.AddressBook 1.0
|
|||||||
import moneroComponents.AddressBookModel 1.0
|
import moneroComponents.AddressBookModel 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "#F0EEEE"
|
|
||||||
id: root
|
id: root
|
||||||
|
color: "#F0EEEE"
|
||||||
property var model
|
property var model
|
||||||
|
|
||||||
Text {
|
ColumnLayout {
|
||||||
id: newEntryText
|
anchors.margins: 17 * scaleRatio
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.leftMargin: 17
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 17
|
spacing: 10 * scaleRatio
|
||||||
|
|
||||||
elide: Text.ElideRight
|
Label {
|
||||||
font.family: "Arial"
|
id: addressLabel
|
||||||
font.pixelSize: 18
|
anchors.left: parent.left
|
||||||
color: "#4A4949"
|
text: qsTr("Address") + translationManager.emptyString
|
||||||
text: qsTr("Add new entry") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: addressLabel
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.top: newEntryText.bottom
|
|
||||||
anchors.leftMargin: 17
|
|
||||||
anchors.topMargin: 17
|
|
||||||
text: qsTr("Address") + translationManager.emptyString
|
|
||||||
fontSize: 14
|
|
||||||
}
|
|
||||||
|
|
||||||
StandardButton {
|
|
||||||
id: qrfinderButton
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 17
|
|
||||||
anchors.topMargin: 5
|
|
||||||
anchors.top: addressLabel.bottom
|
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LineEdit {
|
RowLayout {
|
||||||
id: addressLine
|
StandardButton {
|
||||||
anchors.left: qrfinderButton.right
|
id: qrfinderButton
|
||||||
anchors.right: parent.right
|
text: qsTr("QRCODE") + translationManager.emptyString
|
||||||
anchors.top: addressLabel.bottom
|
shadowReleasedColor: "#FF4304"
|
||||||
anchors.rightMargin: 17
|
shadowPressedColor: "#B32D00"
|
||||||
anchors.topMargin: 5
|
releasedColor: "#FF6C3C"
|
||||||
error: true;
|
pressedColor: "#FF4304"
|
||||||
placeholderText: qsTr("4...") + translationManager.emptyString
|
visible : appWindow.qrScannerEnabled
|
||||||
}
|
enabled : visible
|
||||||
|
width: visible ? 60 * scaleRatio : 0
|
||||||
|
onClicked: {
|
||||||
|
cameraUi.state = "Capture"
|
||||||
|
cameraUi.qrcode_decoded.connect(updateFromQrCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
LineEdit {
|
||||||
id: paymentIdLabel
|
Layout.fillWidth: true;
|
||||||
anchors.left: parent.left
|
id: addressLine
|
||||||
anchors.top: addressLine.bottom
|
error: true;
|
||||||
anchors.leftMargin: 17
|
placeholderText: qsTr("4...") + translationManager.emptyString
|
||||||
anchors.topMargin: 17
|
}
|
||||||
text: qsTr("Payment ID <font size='2'>(Optional)</font>") + translationManager.emptyString
|
}
|
||||||
fontSize: 14
|
|
||||||
}
|
|
||||||
|
|
||||||
LineEdit {
|
Label {
|
||||||
id: paymentIdLine
|
id: paymentIdLabel
|
||||||
anchors.left: parent.left
|
text: qsTr("Payment ID <font size='2'>(Optional)</font>") + translationManager.emptyString
|
||||||
anchors.right: parent.right
|
tipText: qsTr("<b>Payment ID</b><br/><br/>A unique user name used in<br/>the address book. It is not a<br/>transfer of information sent<br/>during the transfer")
|
||||||
anchors.top: paymentIdLabel.bottom
|
+ translationManager.emptyString
|
||||||
anchors.leftMargin: 17
|
}
|
||||||
anchors.rightMargin: 17
|
|
||||||
anchors.topMargin: 5
|
|
||||||
placeholderText: qsTr("Paste 64 hexadecimal characters") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
LineEdit {
|
||||||
id: descriptionLabel
|
id: paymentIdLine
|
||||||
anchors.left: parent.left
|
Layout.fillWidth: true;
|
||||||
anchors.top: paymentIdLine.bottom
|
placeholderText: qsTr("Paste 64 hexadecimal characters") + translationManager.emptyString
|
||||||
anchors.leftMargin: 17
|
}
|
||||||
anchors.topMargin: 17
|
|
||||||
text: qsTr("Description <font size='2'>(Optional)</font>") + translationManager.emptyString
|
|
||||||
fontSize: 14
|
|
||||||
}
|
|
||||||
|
|
||||||
LineEdit {
|
Label {
|
||||||
id: descriptionLine
|
id: descriptionLabel
|
||||||
anchors.left: parent.left
|
text: qsTr("Description <font size='2'>(Optional)</font>") + translationManager.emptyString
|
||||||
anchors.right: parent.right
|
}
|
||||||
anchors.top: descriptionLabel.bottom
|
|
||||||
anchors.leftMargin: 17
|
LineEdit {
|
||||||
anchors.rightMargin: 17
|
id: descriptionLine
|
||||||
anchors.topMargin: 5
|
Layout.fillWidth: true;
|
||||||
placeholderText: qsTr("Give this entry a name or description") + translationManager.emptyString
|
placeholderText: qsTr("Give this entry a name or description") + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: addButton
|
id: addButton
|
||||||
anchors.left: parent.left
|
Layout.bottomMargin: 17 * scaleRatio
|
||||||
anchors.top: descriptionLine.bottom
|
StandardButton {
|
||||||
anchors.leftMargin: 17
|
shadowReleasedColor: "#FF4304"
|
||||||
anchors.topMargin: 17
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
text: qsTr("Add") + translationManager.emptyString
|
||||||
|
enabled: checkInformation(addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
|
||||||
|
|
||||||
StandardButton {
|
onClicked: {
|
||||||
shadowReleasedColor: "#FF4304"
|
if (!currentWallet.addressBook.addRow(addressLine.text.trim(), paymentIdLine.text.trim(), descriptionLine.text)) {
|
||||||
shadowPressedColor: "#B32D00"
|
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||||
releasedColor: "#FF6C3C"
|
// TODO: check currentWallet.addressBook.errorString() instead.
|
||||||
pressedColor: "#FF4304"
|
if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
|
||||||
text: qsTr("Add") + translationManager.emptyString
|
informationPopup.text = qsTr("Invalid address") + translationManager.emptyString
|
||||||
enabled: checkInformation(addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
|
else if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Payment_Id)
|
||||||
|
informationPopup.text = currentWallet.addressBook.errorString()
|
||||||
|
else
|
||||||
|
informationPopup.text = qsTr("Can't create entry") + translationManager.emptyString
|
||||||
|
|
||||||
onClicked: {
|
informationPopup.onCloseCallback = null
|
||||||
if (!currentWallet.addressBook.addRow(addressLine.text.trim(), paymentIdLine.text.trim(), descriptionLine.text)) {
|
informationPopup.open();
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
} else {
|
||||||
// TODO: check currentWallet.addressBook.errorString() instead.
|
addressLine.text = "";
|
||||||
if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Address)
|
paymentIdLine.text = "";
|
||||||
informationPopup.text = qsTr("Invalid address") + translationManager.emptyString
|
descriptionLine.text = "";
|
||||||
else if(currentWallet.addressBook.errorCode() === AddressBook.Invalid_Payment_Id)
|
}
|
||||||
informationPopup.text = currentWallet.addressBook.errorString()
|
|
||||||
else
|
|
||||||
informationPopup.text = qsTr("Can't create entry") + translationManager.emptyString
|
|
||||||
|
|
||||||
informationPopup.onCloseCallback = null
|
|
||||||
informationPopup.open();
|
|
||||||
} else {
|
|
||||||
addressLine.text = "";
|
|
||||||
paymentIdLine.text = "";
|
|
||||||
descriptionLine.text = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: expandItem
|
|
||||||
property bool expanded: false
|
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: tableRect.top
|
|
||||||
width: 34
|
|
||||||
height: 34
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
source: "../images/expandTable.png"
|
|
||||||
rotation: parent.expanded ? 180 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: parent.expanded = !parent.expanded
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -201,8 +140,7 @@ Rectangle {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
height: expandItem.expanded ? parent.height - newEntryText.y - newEntryText.height - 17 :
|
height: parent.height - addButton.y - addButton.height - 36 * scaleRatio
|
||||||
parent.height - addButton.y - addButton.height - 17
|
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
|
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
@@ -217,44 +155,6 @@ Rectangle {
|
|||||||
color: "#DBDBDB"
|
color: "#DBDBDB"
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: columnsModel
|
|
||||||
// ListElement { columnName: qsTr("Address") + translationManager.emptyString; columnWidth: 148 }
|
|
||||||
// ListElement { columnName: qsTr("Payment ID") + translationManager.emptyString; columnWidth: 148 }
|
|
||||||
// ListElement { columnName: qsTr("Description") + translationManager.emptyString; columnWidth: 148 }
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
TableHeader {
|
|
||||||
id: header
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 17
|
|
||||||
anchors.leftMargin: 14
|
|
||||||
anchors.rightMargin: 14
|
|
||||||
dataModel: columnsModel
|
|
||||||
onSortRequest: console.log("column: " + column + " desc: " + desc)
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: testModel
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: ""; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "Client from Australia" }
|
|
||||||
ListElement { paymentId: ""; address: "faef56b9acf67a7dba75ec01f403497049d7cff111628edfe7b57278554dc798"; description: "" }
|
|
||||||
}
|
|
||||||
|
|
||||||
Scroll {
|
Scroll {
|
||||||
id: flickableScroll
|
id: flickableScroll
|
||||||
anchors.right: table.right
|
anchors.right: table.right
|
||||||
@@ -268,7 +168,7 @@ Rectangle {
|
|||||||
id: table
|
id: table
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: header.bottom
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.leftMargin: 14
|
anchors.leftMargin: 14
|
||||||
anchors.rightMargin: 14
|
anchors.rightMargin: 14
|
||||||
|
|||||||
Reference in New Issue
Block a user