From 7910c0ff55edcb9ed973abd680489b9e0f28d0cb Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 03 Mar 2010 07:11:04 -0500
Subject: [PATCH] Remember search modifiers in user prefs (#1486146) + bring back the old defaults

---
 skins/default/functions.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/skins/default/functions.js b/skins/default/functions.js
index 28af2e7..3a295de 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -161,12 +161,12 @@
   if (show && ref) {
     var pos = $(ref).offset();
     this.searchmenu.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
+    this.searchmenu.find(":checked").attr('checked', false);
 
     if (rcmail.env.search_mods) {
-      for (var n in rcmail.env.search_mods) {
-        box = rcube_find_object('s_mod_' + n);
-        box.checked = 'checked';
-      }
+      var search_mods = rcmail.env.search_mods[rcmail.env.mailbox] ? rcmail.env.search_mods[rcmail.env.mailbox] : rcmail.env.search_mods['*'];
+      for (var n in search_mods)
+        $('#s_mod_' + n).attr('checked', true);
     }
   }
   this.searchmenu[show?'show':'hide']();
@@ -177,10 +177,13 @@
   if (!rcmail.env.search_mods)
     rcmail.env.search_mods = new Object();
   
+  if (!rcmail.env.search_mods[rcmail.env.mailbox])
+    rcmail.env.search_mods[rcmail.env.mailbox] = rcube_clone_object(rcmail.env.search_mods['*']);
+  
   if (!elem.checked)
-    delete(rcmail.env.search_mods[elem.value]);
+    delete(rcmail.env.search_mods[rcmail.env.mailbox][elem.value]);
   else
-    rcmail.env.search_mods[elem.value] = elem.value;
+    rcmail.env.search_mods[rcmail.env.mailbox][elem.value] = elem.value;
 },
 
 body_mouseup: function(evt, p)

--
Gitblit v1.9.1