temail: better workflow - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 2e6aa9067f45535fe0b5e28ce9b2de7f417613a1 DIR parent 860bfaa30af9103a128e6915bf2021f0889d90b4 HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 11 Jul 2015 13:57:15 +0200 email: better workflow Diffstat: M gui/qt/main_window.py | 3 ++- M plugins/email.py | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -712,8 +712,9 @@ class ElectrumWindow(QMainWindow): menu = QMenu() menu.addAction(_("Copy Address"), lambda: self.app.clipboard().setText(addr)) menu.addAction(_("Copy URI"), lambda: self.app.clipboard().setText(str(URI))) - menu.addAction(_("Save as BIP70 file"), lambda: self.export_payment_request(addr)).setEnabled(amount is not None) + menu.addAction(_("Export as BIP70 file"), lambda: self.export_payment_request(addr)).setEnabled(amount is not None) menu.addAction(_("Delete"), lambda: self.delete_payment_request(item)) + run_hook('receive_list_menu', menu, addr) menu.exec_(self.receive_list.viewport().mapToGlobal(position)) def save_payment_request(self): DIR diff --git a/plugins/email.py b/plugins/email.py t@@ -140,20 +140,25 @@ class Plugin(BasePlugin): self.win = gui.main_window self.win.connect(self.win, SIGNAL('email:new_invoice'), self.new_invoice) - self.send_button = EnterButton(_('Send'), self.send) - self.win.receive_buttons.insertWidget(1, self.send_button) - - def send(self): - addr = str(self.win.receive_address_e.text()) - message = unicode(self.win.receive_message_e.text()) - payment_request = self.win.save_payment_request() - if not payment_request: + #self.send_button = EnterButton(_('Send'), self.send) + #self.win.receive_buttons.insertWidget(1, self.send_button) + + @hook + def receive_list_menu(self, menu, addr): + menu.addAction(_("Send via e-mail"), lambda: self.send(addr)) + + def send(self, addr): + from electrum import paymentrequest + r = self.wallet.receive_requests.get(addr) + message = r.get('memo', '') + pr, requestor = paymentrequest.make_request(self.config, r) + if not pr: return recipient, ok = QtGui.QInputDialog.getText(self.win, 'Send request', 'Send request to:') if not ok: return recipient = str(recipient) - payload = payment_request.SerializeToString() + payload = pr.SerializeToString() self.print_error('sending mail to', recipient) try: self.processor.send(recipient, message, payload)