lib/sup/modes/thread-view-mode.rb in sup-0.0.2 vs lib/sup/modes/thread-view-mode.rb in sup-0.0.3
- old
+ new
@@ -44,12 +44,14 @@
latest = m
end
end
@state[latest] = :open if @state[latest] == :closed
- regen_chunks
- regen_text
+ BufferManager.say "Loading message bodies..." do
+ regen_chunks
+ regen_text
+ end
end
def draw_line ln, opts={}
if ln == curpos
super ln, :highlight => true
@@ -139,10 +141,11 @@
def edit_message
return unless(m = @message_lines[curpos])
if m.is_draft?
mode = ResumeMode.new m
BufferManager.spawn "Edit message", mode
+ mode.edit
else
BufferManager.flash "Not a draft message!"
end
end
@@ -208,12 +211,10 @@
if m && m.has_label?(:unread)
m.remove_label :unread
UpdateManager.relay :read, m
end
end
-
- Redwood::log "releasing chunks and text from \"#{buffer.title}\""
@messages = @chunks = @text = nil
end
private
@@ -279,26 +280,26 @@
case state
when :open
[[prefix_widget, widget, imp_widget,
[:message_patina_color,
- "#{m.from ? m.from.mediumname : '?'} to #{m.to.map { |l| l.shortname }.join(', ')} #{m.date.to_nice_s} (#{m.date.to_nice_distance_s})"]]]
+ "#{m.from ? m.from.mediumname : '?'} to #{m.recipients.map { |l| l.shortname }.join(', ')} #{m.date.to_nice_s} (#{m.date.to_nice_distance_s})"]]]
# (m.to.empty? ? [] : [[[:message_patina_color, prefix + " To: " + m.recipients.map { |x| x.mediumname }.join(", ")]]]) +
when :closed
[[prefix_widget, widget, imp_widget,
[:message_patina_color,
"#{m.from ? m.from.mediumname : '?'}, #{m.date.to_nice_s} (#{m.date.to_nice_distance_s}) #{m.snippet}"]]]
when :detailed
labels = m.labels# - @hidden_labels
x = [[prefix_widget, widget, imp_widget, [:message_patina_color, "From: #{m.from ? m.from.longname : '?'}"]]] +
((m.to.empty? ? [] : break_into_lines(" To: ", m.to.map { |x| x.longname })) +
- (m.cc.empty? ? [] : break_into_lines(" Cc: ", m.cc.map { |x| x.longname })) +
- (m.bcc.empty? ? [] : break_into_lines(" Bcc: ", m.bcc.map { |x| x.longname })) +
- [" Date: #{m.date.strftime DATE_FORMAT} (#{m.date.to_nice_distance_s})"] +
- [" Subject: #{m.subj}"] +
- [(parent ? " In reply to: #{parent.from.mediumname}'s message of #{parent.date.strftime DATE_FORMAT}" : nil)] +
- [labels.empty? ? nil : " Labels: #{labels.join(', ')}"]
- ).flatten.compact.map { |l| [[:message_patina_color, prefix + " " + l]] }
+ (m.cc.empty? ? [] : break_into_lines(" Cc: ", m.cc.map { |x| x.longname })) +
+ (m.bcc.empty? ? [] : break_into_lines(" Bcc: ", m.bcc.map { |x| x.longname })) +
+ [" Date: #{m.date.strftime DATE_FORMAT} (#{m.date.to_nice_distance_s})"] +
+ [" Subject: #{m.subj}"] +
+ [(parent ? " In reply to: #{parent.from.mediumname}'s message of #{parent.date.strftime DATE_FORMAT}" : nil)] +
+ [labels.empty? ? nil : " Labels: #{labels.join(', ')}"]
+ ).flatten.compact.map { |l| [[:message_patina_color, prefix + " " + l]] }
#raise x.inspect
x
end
end