Merge pull request #1904

b758c79 AddressBook: hide 'Add' form when invoked from 'Send' tab (xiphon)
This commit is contained in:
luigi1111 2019-01-21 15:01:25 -06:00
commit 3577bef711
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
3 changed files with 37 additions and 18 deletions

View File

@ -34,6 +34,7 @@ ListView {
id: listView id: listView
clip: true clip: true
boundsBehavior: ListView.StopAtBounds boundsBehavior: ListView.StopAtBounds
property bool selectAndSend: false
footer: Rectangle { footer: Rectangle {
height: 127 height: 127
@ -57,6 +58,11 @@ ListView {
color: "transparent" color: "transparent"
z: listView.count - index z: listView.count - index
function collapseDropdown() { dropdown.expanded = false } function collapseDropdown() { dropdown.expanded = false }
function doSend() {
console.log("Sending to: ", address +" "+ paymentId);
middlePanel.sendTo(address, paymentId, description);
leftPanel.selectItem(middlePanel.state)
}
Text { Text {
id: descriptionText id: descriptionText
@ -148,6 +154,7 @@ ListView {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 5 anchors.rightMargin: 5
dataModel: dropModel dataModel: dropModel
visible: !listView.selectAndSend
z: 1 z: 1
onExpandedChanged: { onExpandedChanged: {
if(expanded) { if(expanded) {
@ -163,9 +170,7 @@ ListView {
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3) appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
} }
else if(option === 1){ else if(option === 1){
console.log("Sending to: ", address +" "+ paymentId); doSend()
middlePanel.sendTo(address, paymentId, description);
leftPanel.selectItem(middlePanel.state)
} else if(option === 2){ } else if(option === 2){
console.log("Delete: ", rowId); console.log("Delete: ", rowId);
currentWallet.addressBookModel.deleteRow(rowId); currentWallet.addressBookModel.deleteRow(rowId);
@ -180,5 +185,14 @@ ListView {
height: 1 height: 1
color: "#404040" color: "#404040"
} }
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
visible: listView.selectAndSend
onClicked: {
doSend();
}
}
} }
} }

View File

@ -32,18 +32,17 @@ import "../components"
import moneroComponents.AddressBook 1.0 import moneroComponents.AddressBook 1.0
import moneroComponents.AddressBookModel 1.0 import moneroComponents.AddressBookModel 1.0
Rectangle { ColumnLayout {
id: root id: root
color: "transparent"
property var model property var model
property bool selectAndSend: false
ColumnLayout { ColumnLayout {
id: columnLayout Layout.margins: (isMobile ? 17 : 20) * scaleRatio
anchors.margins: (isMobile)? 17 * scaleRatio : 20 * scaleRatio Layout.topMargin: 40 * scaleRatio
anchors.left: parent.left Layout.fillWidth: true
anchors.top: parent.top
anchors.right: parent.right
spacing: 26 * scaleRatio spacing: 26 * scaleRatio
visible: !root.selectAndSend
RowLayout { RowLayout {
StandardButton { StandardButton {
@ -119,13 +118,11 @@ Rectangle {
Rectangle { Rectangle {
id: tableRect id: tableRect
anchors.top: columnLayout.bottom Layout.leftMargin: (isMobile ? 17 : 40) * scaleRatio
anchors.leftMargin: (isMobile)? 17 : 40 Layout.rightMargin: (isMobile ? 17 : 40) * scaleRatio
anchors.rightMargin: (isMobile)? 17 : 40 Layout.topMargin: (root.selectAndSend ? 40 : 0) * scaleRatio
anchors.left: parent.left Layout.fillHeight: true
anchors.right: parent.right Layout.fillWidth: true
anchors.bottom: parent.bottom
height: parent.height - addButton.y - addButton.height - 36 * scaleRatio
color: "transparent" color: "transparent"
Behavior on height { Behavior on height {
@ -149,6 +146,7 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
onContentYChanged: flickableScroll.flickableContentYChanged() onContentYChanged: flickableScroll.flickableContentYChanged()
model: root.model model: root.model
selectAndSend: root.selectAndSend
} }
} }
@ -168,6 +166,10 @@ Rectangle {
return address_ok && payment_id_ok return address_ok && payment_id_ok
} }
function onPageClosed() {
root.selectAndSend = false;
}
function onPageCompleted() { function onPageCompleted() {
console.log("adress book"); console.log("adress book");
root.model = currentWallet.addressBookModel; root.model = currentWallet.addressBookModel;

View File

@ -213,7 +213,10 @@ Rectangle {
placeholderText: "4.. / 8.." placeholderText: "4.. / 8.."
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
addressValidation: true addressValidation: true
onInputLabelLinkActivated: { appWindow.showPageRequest("AddressBook") } onInputLabelLinkActivated: {
middlePanel.addressBookView.selectAndSend = true;
appWindow.showPageRequest("AddressBook");
}
pasteButton: true pasteButton: true
onPaste: function(clipboardText) { onPaste: function(clipboardText) {
const parsed = walletManager.parse_uri_to_object(clipboardText); const parsed = walletManager.parse_uri_to_object(clipboardText);