From c833ed4053106c9df58b84a441cc4509cda45a38 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 06 May 2010 05:57:39 -0400
Subject: [PATCH] - Fix listupdate event doesn't trigger on search response (#1486708)

---
 CHANGELOG                   |    1 +
 program/steps/mail/mark.inc |   12 ++++++------
 program/js/app.js           |   17 ++++++++---------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ec75093..ae3f8e5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix listupdate event doesn't trigger on search response (#1486708)
 - Fix select_all_mode value after selecting a message (#1486720)
 - Set focus to editor on reply in HTML mode (#1486632)
 - Fix composing in HTML jumps cursor to body instead of recipients (#1486674)
diff --git a/program/js/app.js b/program/js/app.js
index d962218..ec7ec45 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4237,13 +4237,13 @@
 
       // set image according to button state
       if (obj && button.type=='image' && button[state]) {
-        button.status = state;        
+        button.status = state;
         obj.src = button[state];
       }
       // set class name according to button state
       else if (obj && typeof(button[state])!='undefined') {
-        button.status = state;        
-        obj.className = button[state];        
+        button.status = state;
+        obj.className = button[state];
       }
       // disable/enable input buttons
       if (obj && button.type=='input') {
@@ -4833,21 +4833,20 @@
       case 'search':
       case 'list':
         if (this.task == 'mail') {
-          if (this.message_list && (response.action == 'list' || response.action == 'search')) {
-            this.msglist_select(this.message_list);
-            this.expand_threads();
-          }
           this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0));
           this.enable_command('purge', this.purge_mailbox_test());
           this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount);
 
-          if (response.action == 'list')
+          if (response.action == 'list' || response.action == 'search') {
+            this.msglist_select(this.message_list);
+            this.expand_threads();
             this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount });
+          }
         }
         else if (this.task == 'addressbook') {
           this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0));
 
-          if (response.action == 'list') {
+          if (response.action == 'list' || response.action == 'search') {
             this.enable_command('group-create', this.env.address_sources[this.env.source].groups);
             this.enable_command('group-rename', 'group-delete', this.env.address_sources[this.env.source].groups && this.env.group);
             this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount });
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 1a2838c..ae8f0e3 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -42,7 +42,7 @@
   }
 
   $marked = $IMAP->set_flag($uids, $flag);
-  
+
   if ($marked == -1) {
     // send error message
     if ($_POST['_from'] != 'show')
@@ -55,7 +55,7 @@
   if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) {
     $ruids = get_input_value('_ruid', RCUBE_INPUT_POST);
     $read = $IMAP->set_flag($ruids, 'SEEN');
-    
+
     if ($read != -1 && !$CONFIG['skip_deleted'])
       $OUTPUT->command('flag_deleted_as_read', $ruids);
   }
@@ -110,17 +110,17 @@
       if ($count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
         $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
         $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
-  
+
         $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order,
 	    $jump_back ? NULL : $count);
-      
+
         rcmail_js_message_list($a_headers, false, false);
       }
     }
   }
-  
+
   $OUTPUT->send();
 }
-  
+
 exit;
 ?>

--
Gitblit v1.9.1