]> git.cworth.org Git - sup/commitdiff
made the contact list load enough entries to fill the whole buffer, rather
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 5 Jan 2007 16:51:46 +0000 (16:51 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 5 Jan 2007 16:51:46 +0000 (16:51 +0000)
than just 10.

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@186 5c8cc53c-5e98-4d25-b20a-d8db53a31250

bin/sup
lib/sup/modes/contact-list-mode.rb

diff --git a/bin/sup b/bin/sup
index 28334b6a39afca53b1a1cb30687d3af145f429c9..3b4a34cc89faac3eea36d1d2e607f7337b121fc5 100644 (file)
--- a/bin/sup
+++ b/bin/sup
@@ -129,7 +129,8 @@ begin
         when :list_buffers
           bm.spawn_unless_exists("Buffer List") { BufferListMode.new }
         when :list_contacts
-          bm.spawn_unless_exists("Contact List") { ContactListMode.new }
+          b = bm.spawn_unless_exists("Contact List") { ContactListMode.new }
+          b.mode.load_more b.content_height
         when :search
           text = bm.ask :search, "query: "
           next unless text && text !~ /^\s*$/
@@ -162,7 +163,9 @@ begin
           when 1
             m = nil
             Index.each_id_by_date(:label => :draft) { |mid, builder| m = builder.call }
-            BufferManager.spawn "Edit message", ResumeMode.new(m)
+            r = ResumeMode.new(m)
+            BufferManager.spawn "Edit message", r
+            r.edit
           else
             b = BufferManager.spawn_unless_exists(:draft) do
               mode = LabelSearchResultsMode.new [:draft]
index 1a51d122f7716b53cdef9d4fcbeb28b7790128e0..fe10a2c434cbfc9afc20592f225bf25f4cc2ee11 100644 (file)
@@ -15,7 +15,7 @@ class ContactListMode < LineCursorMode
   def initialize mode = :regular
     @mode = mode
     @tags = Tagger.new self
-    reload
+    @num = 0
     super()
   end
 
@@ -37,10 +37,10 @@ class ContactListMode < LineCursorMode
   def apply_to_tagged; @tags.apply_to_tagged; end
 
   def load; regen_text; end
-  def load_more
-    @num += LOAD_MORE_CONTACTS_NUM
+  def load_more num=LOAD_MORE_CONTACTS_NUM
+    @num += num
     regen_text
-    BufferManager.flash "Loaded #{LOAD_MORE_CONTACTS_NUM} more contacts."
+    BufferManager.flash "Added #{num} contacts."
   end
 
   def multi_select people
@@ -70,7 +70,6 @@ class ContactListMode < LineCursorMode
 
   def reload
     @tags.drop_all_tags
-    @num = LOAD_MORE_CONTACTS_NUM
     load
   end