Class: Redwood::InboxMode

Inherits:
ThreadIndexMode show all
Defined in:
lib/sup/modes/inbox-mode.rb

Constant Summary

Constants inherited from ThreadIndexMode

ThreadIndexMode::DATE_WIDTH, ThreadIndexMode::LOAD_MORE_THREAD_NUM, ThreadIndexMode::MIN_FROM_WIDTH

Constants inherited from ScrollMode

ScrollMode::COL_JUMP

Instance Attribute Summary

Attributes inherited from LineCursorMode

#curpos

Attributes inherited from ScrollMode

#botline, #leftcol, #topline

Attributes inherited from Mode

#buffer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ThreadIndexMode

#[], #actually_toggle_archived, #actually_toggle_deleted, #actually_toggle_spammed, #actually_toggle_starred, #apply_to_tagged, #cleanup, #contains_thread?, #edit_labels, #edit_message, #forward, #handle_add_update, #handle_delete_update, #handle_deleted_update, #handle_label_thread_update, #handle_label_update, #handle_read_update, #jump_to_next_new, #kill, #lines, #load_n_threads, #load_n_threads_background, #load_threads, #multi_edit_labels, #multi_kill, #multi_select, #multi_toggle_archived, #multi_toggle_deleted, #multi_toggle_new, #multi_toggle_spam, #multi_toggle_starred, #multi_toggle_tagged, #reload, #reply, #resize, #save, #select, #toggle_archived, #toggle_deleted, #toggle_new, #toggle_spam, #toggle_starred, #toggle_tagged, #toggle_tagged_all, #update

Methods inherited from LineCursorMode

#draw

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?, load_all_modes, make_name, #name, register_keymap, #resize, #resolve_input, #save_to_file

Constructor Details

#initializeInboxMode

Returns a new instance of InboxMode.



11
12
13
14
15
# File 'lib/sup/modes/inbox-mode.rb', line 11

def initialize
  super [:inbox, :sent], { :label => :inbox, :skip_killed => true }
  raise "can't have more than one!" if defined? @@instance
  @@instance = self
end

Class Method Details

.instanceObject

label-list-mode wants to be able to raise us if the user selects the “inbox” label, so we need to keep our singletonness around



23
# File 'lib/sup/modes/inbox-mode.rb', line 23

def self.instance; @@instance; end

Instance Method Details

#archiveObject



26
27
28
29
30
31
# File 'lib/sup/modes/inbox-mode.rb', line 26

def archive
  return unless cursor_thread
  cursor_thread.remove_label :inbox
  hide_thread cursor_thread
  regen_text
end

#handle_archived_update(sender, t) ⇒ Object



41
42
43
44
45
46
# File 'lib/sup/modes/inbox-mode.rb', line 41

def handle_archived_update sender, t
  if contains_thread? t
    hide_thread t
    regen_text
  end
end

#is_relevant?(m) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sup/modes/inbox-mode.rb', line 17

def is_relevant? m
  m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
end

#killable?Boolean

Returns:

  • (Boolean)


24
# File 'lib/sup/modes/inbox-mode.rb', line 24

def killable?; false; end

#multi_archive(threads) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/sup/modes/inbox-mode.rb', line 33

def multi_archive threads
  threads.each do |t|
    t.remove_label :inbox
    hide_thread t
  end
  regen_text
end

#statusObject



48
49
50
# File 'lib/sup/modes/inbox-mode.rb', line 48

def status
  super + "    #{Index.size} messages in index"
end