diff --git a/electrum/gui/kivy/theming/light/delete.png b/electrum/gui/kivy/theming/light/delete.png new file mode 100644 index 000000000..02a7d58ba Binary files /dev/null and b/electrum/gui/kivy/theming/light/delete.png differ diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index be2fc81b9..75de262e4 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -393,6 +393,19 @@ class SendScreen(CScreen): else: self.app.tx_dialog(tx) + def clear_invoices_dialog(self): + invoices = self.app.wallet.get_invoices() + if not invoices: + return + def callback(c): + if c: + for req in invoices: + key = req['key'] + self.app.wallet.delete_invoice(key) + self.update() + n = len(invoices) + d = Question(_(f'Delete {n} invoices?'), callback) + d.open() class ReceiveScreen(CScreen): @@ -508,7 +521,8 @@ class ReceiveScreen(CScreen): key = req.get('rhash') or req['address'] self.app.wallet.delete_request(key) self.update() - d = Question(_('Delete all requests?'), callback) + n = len(requests) + d = Question(_(f'Delete {n} requests?'), callback) d.open() diff --git a/electrum/gui/kivy/uix/ui_screens/receive.kv b/electrum/gui/kivy/uix/ui_screens/receive.kv index 3d5a78389..74b17211f 100644 --- a/electrum/gui/kivy/uix/ui_screens/receive.kv +++ b/electrum/gui/kivy/uix/ui_screens/receive.kv @@ -134,7 +134,7 @@ size_hint: 1, None height: '48dp' IconButton: - icon: 'atlas://electrum/gui/kivy/theming/light/list' + icon: 'atlas://electrum/gui/kivy/theming/light/delete' size_hint: 0.5, None height: '48dp' on_release: Clock.schedule_once(lambda dt: s.clear_requests_dialog()) diff --git a/electrum/gui/kivy/uix/ui_screens/send.kv b/electrum/gui/kivy/uix/ui_screens/send.kv index 4047bfb0e..8b394be09 100644 --- a/electrum/gui/kivy/uix/ui_screens/send.kv +++ b/electrum/gui/kivy/uix/ui_screens/send.kv @@ -148,6 +148,10 @@ BoxLayout: size_hint: 1, None height: '48dp' + IconButton: + icon: 'atlas://electrum/gui/kivy/theming/light/delete' + size_hint: 0.5, 1 + on_release: Clock.schedule_once(lambda dt: s.clear_invoices_dialog()) IconButton: size_hint: 0.5, 1 on_release: s.do_save() @@ -158,7 +162,7 @@ on_release: s.do_paste() IconButton: id: qr - size_hint: 1, 1 + size_hint: 0.5, 1 on_release: Clock.schedule_once(lambda dt: app.scan_qr(on_complete=app.on_qr)) icon: 'atlas://electrum/gui/kivy/theming/light/camera' Button: diff --git a/electrum/wallet.py b/electrum/wallet.py index 72b7f3cea..497ce3d42 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -681,6 +681,8 @@ class Abstract_Wallet(AddressSynchronizer, ABC): item['status'] = self.lnworker.get_invoice_status(key) else: return + # unique handle + item['key'] = key return item def _get_relevant_invoice_keys_for_tx(self, tx: Transaction) -> Set[str]: