diff --git a/electrum/gui/qml/components/AddressDetails.qml b/electrum/gui/qml/components/AddressDetails.qml index eaf4c610ef6..8f26a9dcacb 100644 --- a/electrum/gui/qml/components/AddressDetails.qml +++ b/electrum/gui/qml/components/AddressDetails.qml @@ -99,8 +99,17 @@ Pane { color: Material.accentColor } - Label { - text: addressdetails.numTx + RowLayout{ + Label { + text: addressdetails.numTx + } + + Label { + visible: addressdetails.numTx + text: '(' + qsTr("show...") + ')' + textFormat: Text.StyledText + onLinkActivated: app.stack.push(Qt.resolvedUrl('AddressHistory.qml'), { address: root.address }) + } } Label { diff --git a/electrum/gui/qml/components/AddressHistory.qml b/electrum/gui/qml/components/AddressHistory.qml new file mode 100644 index 00000000000..7f166722e4c --- /dev/null +++ b/electrum/gui/qml/components/AddressHistory.qml @@ -0,0 +1,57 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Controls.Material + +import org.electrum 1.0 + +import "controls" + +Pane { + id: root + width: parent.width + height: parent.height + padding: 0 + + required property string address + + ColumnLayout { + anchors.fill: parent + spacing: 10 + + ColumnLayout { + Layout.fillWidth: true + Layout.margins: 10 + Label { + text: qsTr('Transaction history for address:') + color: Material.accentColor + Layout.fillWidth: true + wrapMode: Text.Wrap + } + + TextHighlightPane { + Layout.fillWidth: true + Label { + text: address + width: parent.width + font.family: FixedFont + wrapMode: Text.Wrap + } + } + } + + Frame { + Layout.fillWidth: true + Layout.fillHeight: true + + verticalPadding: bg.lineWidth + horizontalPadding: 0 + background: PaneInsetBackground { id: bg; vertical: false } + + History { + anchors.fill: parent + forAddress: root.address + } + } + } +} diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml index ff41d8a6b8f..c0e16514fa0 100644 --- a/electrum/gui/qml/components/History.qml +++ b/electrum/gui/qml/components/History.qml @@ -18,6 +18,11 @@ Pane { vertical: false } + property string forAddress + property QtObject backingModel: forAddress + ? Daemon.currentWallet.historyModelForAddress(forAddress) + : Daemon.currentWallet.historyModel + ElListView { id: listview width: parent.width @@ -32,7 +37,8 @@ Pane { header: Item { width: parent.width - height: headerLayout.height + height: forAddress ? 0 : headerLayout.height + visible: !forAddress ColumnLayout { id: headerLayout anchors.centerIn: parent @@ -70,7 +76,7 @@ Pane { DelegateModel { id: visualModel - model: Daemon.currentWallet.historyModel + model: backingModel groups: [ DelegateModelGroup { name: 'today'; includeByDefault: false }, @@ -86,7 +92,7 @@ Pane { ScrollIndicator.vertical: ScrollIndicator { } Label { - visible: Daemon.currentWallet.historyModel.count == 0 && !Daemon.currentWallet.synchronizing + visible: !forAddress && Daemon.currentWallet.historyModel.count == 0 && !Daemon.currentWallet.synchronizing anchors.centerIn: parent width: listview.width * 4/5 font.pixelSize: constants.fontSizeXXLarge @@ -159,9 +165,9 @@ Pane { StackView.onVisibleChanged: { // refresh model if History becomes visible and the model is dirty. - if (StackView.visible) { + if (StackView.visible && backingModel) { listview.reuseItems = false - Daemon.currentWallet.historyModel.initModel(false) + backingModel.initModel(false) listview.reuseItems = true } } diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py index eeabf5261b4..97682d7927c 100644 --- a/electrum/gui/qml/qewallet.py +++ b/electrum/gui/qml/qewallet.py @@ -304,6 +304,11 @@ def historyModel(self): self._historyModel = QETransactionListModel(self.wallet) return self._historyModel + @pyqtSlot(str, result=QETransactionListModel) + def historyModelForAddress(self, address): + self._hmfa = QETransactionListModel(self.wallet, onchain_domain=[address], include_lightning=False) + return self._hmfa + addressCoinModelChanged = pyqtSignal() @pyqtProperty(QEAddressCoinListModel, notify=addressCoinModelChanged) def addressCoinModel(self):