From c5d8db9f818dd622c8cd6f915a1b1ba7af51d4c6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 26 Apr 2009 13:07:27 -0400
Subject: [PATCH] Add javascript event 'insertrow'

---
 program/js/app.js |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index eed8861..6293392 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2574,7 +2574,7 @@
   this.ksearch_query_results = function(results, search)
   {
     // ignore this outdated search response
-    if (search != this.ksearch_value)
+    if (this.ksearch_value && search != this.ksearch_value)
       return;
       
     this.hide_message();
@@ -3459,6 +3459,9 @@
       if ((target_li = this.get_folder_li(name))) {
         $(target_li).removeClass('unfocused').addClass('selected');
       }
+      
+      // trigger event hook
+      this.triggerEvent('selectfolder', { folder:name, old:old });
     }
   };
 
@@ -3531,7 +3534,7 @@
         + (flags.unread ? ' unread' : '')
         + (flags.deleted ? ' deleted' : '')
         + (flags.flagged ? ' flagged' : '')
-	+ (this.message_list.in_selection(uid) ? ' selected' : '');
+        + (this.message_list.in_selection(uid) ? ' selected' : '');
 
     // for performance use DOM instead of jQuery here
     var row = document.createElement('TR');
@@ -3580,6 +3583,7 @@
       }
 
     this.message_list.insert_row(row, attop);
+    this.triggerEvent('insertrow', { uid:uid, row:row });
 
     // remove 'old' row
     if (attop && this.env.pagesize && this.message_list.rowcount > this.env.pagesize) {
@@ -3722,6 +3726,8 @@
     }
     
     this.contact_list.insert_row(row);
+    this.triggerEvent('insertrow', { cid:cid, row:row });
+    
     this.enable_command('export', (this.contact_list.rowcount > 0));
     };
 
@@ -3912,9 +3918,16 @@
             this.msglist_select(this.message_list);
           this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0));
           this.enable_command('purge', this.purge_mailbox_test());
+          
+          if (response.action == 'list')
+            this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount });
         }
-        else if (this.task == 'addressbook')
+        else if (this.task == 'addressbook') {
           this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0));
+          
+          if (response.action == 'list')
+            this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount });
+        }
         break;
     }
   };

--
Gitblit v1.9.1