Files
purple-electrumwallet/electrum/gui/qml/components/Addresses.qml
T

80 lines
2.1 KiB
QML
Raw Normal View History

import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import org.electrum 1.0
import "controls"
Pane {
id: rootItem
objectName: 'Addresses'
2022-03-25 11:45:49 +01:00
padding: 0
ColumnLayout {
id: layout
2023-02-09 01:17:13 +01:00
anchors.fill: parent
2023-02-09 01:17:13 +01:00
ListView {
id: listview
Layout.fillWidth: true
Layout.fillHeight: true
2023-02-09 01:17:13 +01:00
clip: true
model: Daemon.currentWallet.addressModel
currentIndex: -1
section.property: 'type'
section.criteria: ViewSection.FullString
section.delegate: sectionDelegate
delegate: AddressDelegate {
2023-02-09 01:17:13 +01:00
onClicked: {
var page = app.stack.push(Qt.resolvedUrl('AddressDetails.qml'), {'address': model.address})
page.addressDetailsChanged.connect(function() {
// update listmodel when details change
listview.model.updateAddress(model.address)
2023-02-09 01:17:13 +01:00
})
}
}
2023-02-09 01:17:13 +01:00
ScrollIndicator.vertical: ScrollIndicator { }
}
2023-02-09 01:17:13 +01:00
}
2022-03-24 21:19:29 +01:00
Component {
id: sectionDelegate
2022-11-11 16:00:11 +01:00
Item {
2022-03-24 21:19:29 +01:00
id: root
width: ListView.view.width
height: childrenRect.height
required property string section
2023-04-21 17:04:21 +02:00
property string section_label: section == 'receive'
? qsTr('receive addresses')
: section == 'change'
? qsTr('change addresses')
: section == 'imported'
? qsTr('imported addresses')
: section + ' ' + qsTr('addresses')
2022-03-24 21:19:29 +01:00
2022-11-11 16:00:11 +01:00
ColumnLayout {
width: parent.width
Heading {
2022-11-11 16:00:11 +01:00
Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge
2023-04-21 17:04:21 +02:00
text: root.section_label
2022-03-24 21:19:29 +01:00
}
}
}
}
Component.onCompleted: {
Daemon.currentWallet.addressModel.initModel()
}
}