Class: Redwood::ContactListMode
Constant Summary
collapse
- LOAD_MORE_CONTACTS_NUM =
100
Instance Attribute Summary
#curpos
Attributes inherited from ScrollMode
#botline, #leftcol, #status, #topline
Attributes inherited from Mode
#buffer
Instance Method Summary
collapse
#alias_contact
#cleanup, #draw
Methods inherited from ScrollMode
#at_bottom?, #at_top?, #cancel_search!, #col_jump, #col_left, #col_right, #continue_search_in_buffer, #draw, #ensure_mode_validity, #half_page_down, #half_page_up, #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_goto_pos, #search_in_buffer, #search_start_line
Methods inherited from Mode
#blur, #cancel_search!, #cleanup, #draw, #focus, #handle_input, #help_text, #in_search?, keymap, keymaps, #killable?, load_all_modes, make_name, #name, #pipe_to_process, register_keymap, #resize, #resolve_input, #save_to_file, #status, #unsaved?
Constructor Details
#initialize(mode = :regular) ⇒ ContactListMode
Returns a new instance of ContactListMode.
30
31
32
33
34
35
36
|
# File 'lib/sup/modes/contact_list_mode.rb', line 30
def initialize mode=:regular
@mode = mode
@tags = Tagger.new self, "contact"
@num = nil
@text = []
super()
end
|
Instance Method Details
46
|
# File 'lib/sup/modes/contact_list_mode.rb', line 46
def [] i; @text[i]; end
|
39
40
41
42
43
|
# File 'lib/sup/modes/contact_list_mode.rb', line 39
def alias
p = @contacts[curpos] or return
alias_contact p
update
end
|
#apply_to_tagged ⇒ Object
60
|
# File 'lib/sup/modes/contact_list_mode.rb', line 60
def apply_to_tagged; @tags.apply_to_tagged; end
|
45
|
# File 'lib/sup/modes/contact_list_mode.rb', line 45
def lines; @text.length; end
|
#load_more(num = LOAD_MORE_CONTACTS_NUM) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/sup/modes/contact_list_mode.rb', line 62
def load_more num=LOAD_MORE_CONTACTS_NUM
@num += num
load
update
BufferManager.flash "Added #{num.pluralize 'contact'}."
end
|
#multi_search(people) ⇒ Object
83
84
85
86
87
|
# File 'lib/sup/modes/contact_list_mode.rb', line 83
def multi_search people
mode = PersonSearchResultsMode.new people
BufferManager.spawn "search for #{people.map { |p| p.name }.join(', ')}", mode
mode.load_threads :num => mode.buffer.content_height
end
|
#multi_select(people) ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/sup/modes/contact_list_mode.rb', line 69
def multi_select people
case @mode
when :regular
mode = ComposeMode.new :to => people
BufferManager.spawn "new message", mode
mode.edit_message
end
end
|
#multi_toggle_tagged(threads) ⇒ Object
55
56
57
58
|
# File 'lib/sup/modes/contact_list_mode.rb', line 55
def multi_toggle_tagged threads
@tags.drop_all_tags
update
end
|
94
95
96
97
98
|
# File 'lib/sup/modes/contact_list_mode.rb', line 94
def reload
@tags.drop_all_tags
@num = nil
load
end
|
89
90
91
92
|
# File 'lib/sup/modes/contact_list_mode.rb', line 89
def search
p = @contacts[curpos] or return
multi_search [p]
end
|
78
79
80
81
|
# File 'lib/sup/modes/contact_list_mode.rb', line 78
def select
p = @contacts[curpos] or return
multi_select [p]
end
|
#toggle_tagged ⇒ Object
48
49
50
51
52
53
|
# File 'lib/sup/modes/contact_list_mode.rb', line 48
def toggle_tagged
p = @contacts[curpos] or return
@tags.toggle_tag_for p
update_text_for_line curpos
cursor_down
end
|