Browse Source

qml: apply long-press implementation also on ReceiveRequests

master
Sander van Grieken 3 years ago
parent
commit
e059a3c04b
  1. 1
      electrum/gui/qml/components/Invoices.qml
  2. 28
      electrum/gui/qml/components/ReceiveRequests.qml

1
electrum/gui/qml/components/Invoices.qml

@ -44,6 +44,7 @@ Pane {
anchors.fill: parent
clip: true
currentIndex: -1
model: DelegateModel {
id: delegateModel
model: Daemon.currentWallet.invoiceModel

28
electrum/gui/qml/components/ReceiveRequests.qml

@ -12,10 +12,16 @@ import "controls"
Pane {
id: root
objectName: 'ReceiveRequests'
property string selected_key
padding: 0
ColumnLayout {
anchors.fill: parent
spacing: 0
ColumnLayout {
Layout.fillWidth: true
Layout.margins: constants.paddingLarge
InfoTextArea {
Layout.fillWidth: true
@ -40,6 +46,7 @@ Pane {
id: listview
anchors.fill: parent
clip: true
currentIndex: -1
model: DelegateModel {
id: delegateModel
@ -47,13 +54,12 @@ Pane {
delegate: InvoiceDelegate {
onClicked: {
app.stack.getRoot().openRequest(model.key)
selected_key = ''
}
onPressAndHold: {
selected_key = model.key
listview.currentIndex = -1
}
onPressAndHold: listview.currentIndex = index
}
}
add: Transition {
NumberAnimation { properties: 'scale'; from: 0.75; to: 1; duration: 500 }
NumberAnimation { properties: 'opacity'; from: 0; to: 1; duration: 500 }
@ -76,6 +82,8 @@ Pane {
ScrollIndicator.vertical: ScrollIndicator { }
}
}
}
ButtonContainer {
Layout.fillWidth: true
FlatButton {
@ -83,10 +91,9 @@ Pane {
Layout.preferredWidth: 1
text: qsTr('Delete')
icon.source: '../../icons/delete.png'
visible: selected_key != ''
visible: listview.currentIndex >= 0
onClicked: {
Daemon.currentWallet.delete_request(selected_key)
selected_key = ''
Daemon.currentWallet.delete_request(listview.currentItem.getKey())
}
}
FlatButton {
@ -94,10 +101,9 @@ Pane {
Layout.preferredWidth: 1
text: qsTr('View')
icon.source: '../../icons/tab_receive.png'
visible: selected_key != ''
visible: listview.currentIndex >= 0
onClicked: {
app.stack.getRoot().openRequest(selected_key)
selected_key = ''
app.stack.getRoot().openRequest(listview.currentItem.getKey())
}
}
}

Loading…
Cancel
Save