Browse Source

email: better workflow

283
ThomasV 9 years ago
parent
commit
2e6aa9067f
  1. 3
      gui/qt/main_window.py
  2. 23
      plugins/email.py

3
gui/qt/main_window.py

@ -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):

23
plugins/email.py

@ -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)

Loading…
Cancel
Save