From 1bbf8c48868efb87baab7ae71721f2c9ad408e65 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 20 Jan 2014 04:05:36 -0500
Subject: [PATCH] - Make search scope selectable in UI - Disable thread mode when searching over multiple folders - Encode UID values for HTML message row identifiers

---
 skins/larry/ui.js |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 44fc727..2030b05 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -41,6 +41,7 @@
   this.show_popup = show_popup;
   this.add_popup = add_popup;
   this.set_searchmod = set_searchmod;
+  this.set_searchscope = set_searchscope;
   this.show_uploadform = show_uploadform;
   this.show_header_row = show_header_row;
   this.hide_header_row = hide_header_row;
@@ -731,11 +732,10 @@
    */
   function switch_view_mode(mode)
   {
-    if (rcmail.env.threading != (mode == 'thread'))
-      rcmail.set_list_options(null, undefined, undefined, mode == 'thread' ? 1 : 0);
-
-    $('#maillistmode, #mailthreadmode').removeClass('selected');
-    $('#mail'+mode+'mode').addClass('selected');
+    if (!$('#mail'+mode+'mode').hasClass('disabled')) {
+      $('#maillistmode, #mailthreadmode').removeClass('selected');
+      $('#mail'+mode+'mode').addClass('selected');
+    }
   }
 
 
@@ -761,11 +761,15 @@
         obj = popups['searchmenu'],
         list = $('input:checkbox[name="s_mods[]"]', obj),
         mbox = rcmail.env.mailbox,
-        mods = rcmail.env.search_mods;
+        mods = rcmail.env.search_mods,
+        scope = rcmail.env.search_scope || 'base';
 
       if (rcmail.env.task == 'mail') {
+        if (scope == 'all')
+          mbox = '*';
         mods = mods[mbox] ? mods[mbox] : mods['*'];
         all = 'text';
+        $('#s_scope_'+scope).prop('checked', true);
       }
       else {
         all = '*';
@@ -896,7 +900,11 @@
   {
     var all, m, task = rcmail.env.task,
       mods = rcmail.env.search_mods,
-      mbox = rcmail.env.mailbox;
+      mbox = rcmail.env.mailbox,
+      scope = $('input[name="s_scope"]:checked').val();
+
+    if (scope == 'all')
+      mbox = '*';
 
     if (!mods)
       mods = {};
@@ -937,6 +945,11 @@
     });
   }
 
+  function set_searchscope(elem)
+  {
+    rcmail.env.search_scope = elem.value;
+  }
+
   function push_contactgroup(p)
   {
     // lets the contacts list swipe to the left, nice!

--
Gitblit v1.9.1