diff options
author | Kazuo Teramoto <kaz.rag@gmail.com> | 2012-07-24 18:00:15 -0300 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-08-01 22:01:21 +0100 |
commit | d630ba316bd984a18c918730c14d45d2a634f17c (patch) | |
tree | fd774195e76fed8a31edf6461e5c44df292845db | |
parent | f050a250526dfc38336150518819aa2d7bfadd72 (diff) |
Ask the user to close an unsent envelope buffer
This prevent accidentally closing an alot.buffers.EnvelopeBuffer and
losing the buffer content.
cf issue #453
-rw-r--r-- | alot/commands/globals.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index d7a4cee1..43f58a91 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -339,9 +339,17 @@ class BufferCloseCommand(Command): self.buffer = buffer Command.__init__(self, **kwargs) + @inlineCallbacks def apply(self, ui): if self.buffer == None: self.buffer = ui.current_buffer + + if (isinstance(self.buffer, buffers.EnvelopeBuffer) and + not self.buffer.envelope.sent_time): + if (yield ui.choice('close without sending?', select='yes', + cancel='no', msg_position='left')) == 'no': + return + if len(ui.buffers) == 1: if settings.get('quit_on_last_bclose'): logging.info('closing the last buffer, exiting') |