From 46641e7874f7fa803483aa51f8cf87e252a58980 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 15 Aug 2022 15:21:12 +0200 Subject: [PATCH] qml: handle unsigned, local tx in history --- .../qml/components/controls/HistoryItemDelegate.qml | 6 +++++- electrum/gui/qml/qetransactionlistmodel.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qml/components/controls/HistoryItemDelegate.qml b/electrum/gui/qml/components/controls/HistoryItemDelegate.qml index 4d8abe2c3..983465320 100644 --- a/electrum/gui/qml/components/controls/HistoryItemDelegate.qml +++ b/electrum/gui/qml/components/controls/HistoryItemDelegate.qml @@ -59,7 +59,11 @@ Item { Layout.preferredHeight: constants.iconSizeLarge Layout.alignment: Qt.AlignVCenter Layout.rowSpan: 2 - source: model.lightning ? "../../../icons/lightning.png" : tx_icons[Math.min(6,model.confirmations)] + source: model.lightning + ? "../../../icons/lightning.png" + : model.complete + ? tx_icons[Math.min(6,model.confirmations)] + : '../../../icons/offline_tx.png' } Label { diff --git a/electrum/gui/qml/qetransactionlistmodel.py b/electrum/gui/qml/qetransactionlistmodel.py index fdc9719e1..db4148069 100644 --- a/electrum/gui/qml/qetransactionlistmodel.py +++ b/electrum/gui/qml/qetransactionlistmodel.py @@ -21,7 +21,7 @@ class QETransactionListModel(QAbstractListModel): # define listmodel rolemap _ROLE_NAMES=('txid','fee_sat','height','confirmations','timestamp','monotonic_timestamp', 'incoming','value','balance','date','label','txpos_in_block','fee', - 'inputs','outputs','section','type','lightning','payment_hash','key') + 'inputs','outputs','section','type','lightning','payment_hash','key','complete') _ROLE_KEYS = range(Qt.UserRole, Qt.UserRole + len(_ROLE_NAMES)) _ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES])) _ROLE_RMAP = dict(zip(_ROLE_NAMES, _ROLE_KEYS)) @@ -54,7 +54,7 @@ class QETransactionListModel(QAbstractListModel): self.endResetModel() def tx_to_model(self, tx): - #self._logger.debug(str(tx)) + self._logger.debug(str(tx)) item = tx item['key'] = item['txid'] if 'txid' in item else item['payment_hash'] @@ -92,6 +92,13 @@ class QETransactionListModel(QAbstractListModel): item['section'] = 'older' item['date'] = self.format_date_by_section(item['section'], datetime.fromtimestamp(item['timestamp'])) + + if 'txid' in item: + tx = self.wallet.get_input_tx(item['txid']) + item['complete'] = tx.is_complete() + #else: + #item['complete'] = True + return item def format_date_by_section(self, section, date):