Allow qsearch close icon to clear qsearch text
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 8 Oct 2009 17:51:33 +0000 (11:51 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 8 Oct 2009 18:02:50 +0000 (12:02 -0600)
imp/js/DimpBase.js

index 1220bc7..11eb484 100644 (file)
@@ -1360,7 +1360,6 @@ var DimpBase = {
             this.viewport.reload();
         } else {
             this.sfolder = this.folder;
-            $('qsearch_close').show();
             this.loadMailbox(DIMP.conf.qsearchid);
         }
     },
@@ -1370,12 +1369,13 @@ var DimpBase = {
     {
         var f = this.folder;
 
+        $('qsearch_close').hide();
+        if (!$('qsearch').hasClassName('qsearchFocus')) {
+            this._setQsearchText(true);
+        }
+
         if (this.isSearch()) {
-            $('qsearch_close').hide();
             DimpCore.DMenu.disable('qsearch_icon', true, false);
-            if (!$('qsearch').hasClassName('qsearchFocus')) {
-                this._setQsearchText(true);
-            }
             this.resetSelected();
             $('qsearch_input').show();
             if (!noload) {
@@ -1391,6 +1391,7 @@ var DimpBase = {
     {
         $('qsearch_input').setValue(d ? DIMP.text.search + ' (' + $('ctx_qsearchopts_' + DIMP.conf.qsearchfield).getText() + ')' : '');
         [ $('qsearch') ].invoke(d ? 'removeClassName' : 'addClassName', 'qsearchActive');
+        $('qsearch_close').hide();
     },
 
     _basicSearchCallback: function(r)
@@ -1504,6 +1505,12 @@ var DimpBase = {
                     e.stop();
                 }
                 break;
+
+            default:
+                if (elt.readAttribute('id') == 'qsearch_input') {
+                    $('qsearch_close').show();
+                }
+                break;
             }
 
             return;