From f3704e18d89e4065cede8509256d7fbf483b7fe6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 04 Apr 2006 17:46:27 -0400
Subject: [PATCH] Added labels for nextpage/previouspage

---
 program/js/app.js |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 4713788..d2bf41e 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -122,7 +122,7 @@
           }
 
         // enable mail commands
-        this.enable_command('list', 'compose', 'add-contact', true);
+        this.enable_command('list', 'compose', 'add-contact', 'search', 'reset-search', true);
         
         if (this.env.action=='show')
           {
@@ -574,7 +574,11 @@
       // misc list commands
       case 'list':
         if (this.task=='mail')
+          {
+          if (this.env.search_request<0 || (this.env.search_request && props != this.env.mailbox))
+            this.reset_qsearch();
           this.list_mailbox(props);
+          }
         else if (this.task=='addressbook')
           this.list_contacts();
         break;
@@ -904,6 +908,22 @@
         this.add_contact(props);
         break;
       
+      // mail quicksearch
+      case 'search':
+        if (!props && this.gui_objects.qsearchbox)
+          props = this.gui_objects.qsearchbox.value;
+        if (props)
+          this.qsearch(escape(props), this.env.mailbox);
+        break;
+
+      // reset quicksearch        
+      case 'reset-search':
+        var s = this.env.search_request;
+        this.reset_qsearch();
+        
+        if (s)
+          this.list_mailbox(this.env.mailbox);
+        break;
 
       // ldap search
       case 'ldappublicsearch':
@@ -1368,6 +1388,10 @@
       this.env.current_page = page;
       this.clear_selection();
       }
+    
+    // also send search request to get the right messages
+    if (this.env.search_request)
+      add_url += '&_search='+this.env.search_request;
       
     if (this.env.mailbox!=mbox)
       this.select_mailbox(mbox);
@@ -1803,6 +1827,26 @@
       this.http_request('addcontact', '_address='+value);
     };
 
+  // send remote request to search mail
+  this.qsearch = function(value, mbox)
+    {
+    if (value && mbox)
+      {
+      this.clear_message_list();
+      this.set_busy(true, 'searching');
+      this.http_request('search', '_search='+value+'&_mbox='+mbox, true);
+      }
+    };
+
+  // reset quick-search form
+  this.reset_qsearch = function()
+    {
+    if (this.gui_objects.qsearchbox)
+      this.gui_objects.qsearchbox.value = '';
+      
+    this.env.search_request = null;
+    };
+    
 
   /*********************************************************/
   /*********     keyboard live-search methods      *********/

--
Gitblit v1.9.1