URI: 
       task user before closing transaction window with unsaved transaction - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit c0e60ec93d1ba800c6d04685fe0016b33fe3a9f9
   DIR parent d9874ecb0169ddd6c66f382ecb79383042639b2e
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Wed, 25 Mar 2015 10:46:15 +0100
       
       ask user before closing transaction window with unsaved transaction
       
       Diffstat:
         M gui/qt/transaction_dialog.py        |      16 +++++++++++++---
         M plugins/cosigner_pool.py            |       9 +++++----
       
       2 files changed, 18 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py
       t@@ -47,6 +47,7 @@ class TxDialog(QDialog):
                tx_dict = tx.as_dict()
                self.parent = parent
                self.wallet = parent.wallet
       +        self.saved = True
        
                QDialog.__init__(self)
                self.setMinimumWidth(600)
       t@@ -78,14 +79,14 @@ class TxDialog(QDialog):
                b.clicked.connect(self.sign)
        
                self.broadcast_button = b = QPushButton(_("Broadcast"))
       -        b.clicked.connect(lambda: self.parent.broadcast_transaction(self.tx))
       +        b.clicked.connect(self.do_broadcast)
                b.hide()
        
                self.save_button = b = QPushButton(_("Save"))
                b.clicked.connect(self.save)
        
                self.cancel_button = b = QPushButton(_("Close"))
       -        b.clicked.connect(lambda: self.done(0))
       +        b.clicked.connect(self.close)
                b.setDefault(True)
        
                self.qr_button = b = QPushButton()
       t@@ -98,6 +99,15 @@ class TxDialog(QDialog):
                vbox.addLayout(Buttons(*self.buttons))
                self.update()
        
       +    def do_broadcast(self):
       +        self.parent.broadcast_transaction(self.tx)
       +        self.saved = True
       +
       +    def close(self):
       +        if not self.saved:
       +            if QMessageBox.question(self, _('Message'), _('This transaction is not saved. Close anyway?'), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.No:
       +                return
       +        self.done(0)
        
            def show_qr(self):
                text = self.tx.raw.decode('hex')
       t@@ -120,7 +130,7 @@ class TxDialog(QDialog):
                    with open(fileName, "w+") as f:
                        f.write(json.dumps(self.tx.as_dict(),indent=4) + '\n')
                    self.show_message(_("Transaction saved successfully"))
       -
       +            self.saved = True
        
        
            def update(self):
   DIR diff --git a/plugins/cosigner_pool.py b/plugins/cosigner_pool.py
       t@@ -29,6 +29,8 @@ from electrum import transaction
        from electrum.plugins import BasePlugin, hook
        from electrum.i18n import _
        
       +from electrum_gui.qt import transaction_dialog
       +
        import sys
        import traceback
        
       t@@ -188,7 +190,6 @@ class Plugin(BasePlugin):
        
                self.listener.clear()
                tx = transaction.Transaction.deserialize(message)
       -        self.win.show_transaction(tx)
       -
       -
       -
       +        d = transaction_dialog.TxDialog(tx, self.win)
       +        d.saved = False
       +        d.exec_()