Class: Redwood::ComposeMode
- Inherits:
-
EditMessageMode
- Object
- Mode
- ScrollMode
- LineCursorMode
- EditMessageMode
- Redwood::ComposeMode
- Defined in:
- lib/sup/modes/compose-mode.rb
Constant Summary
Constants inherited from EditMessageMode
EditMessageMode::FORCE_HEADERS, EditMessageMode::MULTI_HEADERS, EditMessageMode::NON_EDITABLE_HEADERS
Constants inherited from ScrollMode
Instance Attribute Summary
Attributes inherited from EditMessageMode
Attributes inherited from LineCursorMode
Attributes inherited from ScrollMode
#botline, #leftcol, #status, #topline
Attributes inherited from Mode
Class Method Summary collapse
Instance Method Summary collapse
- #edit_message ⇒ Object
-
#initialize(opts = {}) ⇒ ComposeMode
constructor
A new instance of ComposeMode.
Methods inherited from EditMessageMode
#[], #attach_file, #delete_attachment, #edit_cc, #edit_message_or_field, #edit_subject, #edit_to, #handle_new_text, #killable?, #lines
Methods inherited from LineCursorMode
Methods inherited from ScrollMode
#at_bottom?, #at_top?, #cancel_search!, #col_left, #col_right, #continue_search_in_buffer, #draw, #ensure_mode_validity, #in_search?, #jump_to_col, #jump_to_end, #jump_to_left, #jump_to_line, #jump_to_start, #line_down, #line_up, #page_down, #page_up, #resize, #rightcol, #search_goto_line, #search_in_buffer, #search_start_line
Methods inherited from Mode
#blur, #cancel_search!, #cleanup, #draw, #focus, #handle_input, #help_text, #in_search?, #killable?, load_all_modes, make_name, #name, register_keymap, #resize, #resolve_input, #save_to_file, #status
Constructor Details
#initialize(opts = {}) ⇒ ComposeMode
Returns a new instance of ComposeMode.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/sup/modes/compose-mode.rb', line 4 def initialize opts={} header = {} header["From"] = (opts[:from] || AccountManager.default_account).full_address header["To"] = opts[:to].map { |p| p.full_address }.join(", ") if opts[:to] header["To"] = opts[:to].map { |p| p.full_address }.join(", ") if opts[:to] header["Cc"] = opts[:cc].map { |p| p.full_address }.join(", ") if opts[:cc] header["Bcc"] = opts[:bcc].map { |p| p.full_address }.join(", ") if opts[:bcc] header["Subject"] = opts[:subj] if opts[:subj] super :header => header, :body => (opts[:body] || []) end |
Class Method Details
.spawn_nicely(opts = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sup/modes/compose-mode.rb', line 22 def self.spawn_nicely opts={} to = opts[:to] || BufferManager.ask_for_contacts(:people, "To: ") or return cc = opts[:cc] || BufferManager.ask_for_contacts(:people, "Cc: ") or return if $config[:ask_for_cc] bcc = opts[:bcc] || BufferManager.ask_for_contacts(:people, "Bcc: ") or return if $config[:ask_for_bcc] subj = opts[:subj] || BufferManager.ask(:subject, "Subject: ") or return if $config[:ask_for_subject] mode = ComposeMode.new :from => opts[:from], :to => to, :cc => cc, :bcc => bcc, :subj => subj BufferManager.spawn "New Message", mode mode. end |
Instance Method Details
#edit_message ⇒ Object
16 17 18 19 20 |
# File 'lib/sup/modes/compose-mode.rb', line 16 def edited = super BufferManager.kill_buffer self.buffer unless edited edited end |