summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-10-08 23:06:42 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-10-08 23:06:42 +0100
commitb0ea0764a69602f0d6a644b4068ad26538dc0a6e (patch)
tree589fe62888c9fda37086c6950282ebe035f02308 /alot
parent0afae07e5686b64004955a7e82c34688a6874991 (diff)
set/refine commands for envelope buffers
Diffstat (limited to 'alot')
-rw-r--r--alot/command.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/alot/command.py b/alot/command.py
index ea32be45..bd47a18b 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -982,6 +982,19 @@ class EnvelopeSetCommand(Command):
envelope.rebuild()
+class EnvelopeRefineCommand(Command):
+ """prompt to change current value of header field"""
+
+ def __init__(self, key='', **kwargs):
+ Command.__init__(self, **kwargs)
+ self.key = key
+
+ def apply(self, ui):
+ mail = ui.current_buffer.get_email()
+ value = mail.get(self.key, '')
+ ui.commandprompt('set %s %s' % (self.key, value))
+
+
class EnvelopeSendCommand(Command):
@defer.inlineCallbacks
def apply(self, ui):
@@ -1136,8 +1149,8 @@ COMMANDS = {
'attach': (EnvelopeAttachCommand, {}),
'send': (EnvelopeSendCommand, {}),
'reedit': (EnvelopeEditCommand, {}),
- 'subject': (EnvelopeSetCommand, {'key': 'Subject'}),
- 'to': (EnvelopeSetCommand, {'key': 'To'}),
+ 'refine': (EnvelopeRefineCommand, {}),
+ 'set': (EnvelopeSetCommand, {}),
},
'bufferlist': {
'closefocussed': (BufferCloseCommand, {'focussed': True}),
@@ -1248,15 +1261,18 @@ def interpret_commandline(cmdline, mode):
elif cmd == 'prompt':
return commandfactory(cmd, mode=mode, startstring=params)
elif cmd == 'refine':
- return commandfactory(cmd, mode=mode, query=params)
+ if mode == 'search':
+ return commandfactory(cmd, mode=mode, query=params)
+ elif mode == 'envelope':
+ return commandfactory(cmd, mode=mode, key=params)
+
elif cmd == 'retag':
return commandfactory(cmd, mode=mode, tagsstring=params)
- elif cmd == 'subject':
- return commandfactory(cmd, mode=mode, key='Subject', value=params)
elif cmd == 'shellescape':
return commandfactory(cmd, mode=mode, commandstring=params)
- elif cmd == 'to':
- return commandfactory(cmd, mode=mode, key='To', value=params)
+ elif cmd == 'set':
+ key, value = params.split(' ', 1)
+ return commandfactory(cmd, mode=mode, key=key, value=value)
elif cmd == 'toggletag':
return commandfactory(cmd, mode=mode, tags=params.split())
elif cmd == 'fold':