Add To to the list of quicksearch criteria
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 17 Sep 2009 21:13:42 +0000 (15:13 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 17 Sep 2009 21:15:11 +0000 (15:15 -0600)
imp/js/DimpBase.js
imp/lib/Views/ListMessages.php
imp/templates/index/index-dimp.inc

index eb770d0..fd622a1 100644 (file)
@@ -788,6 +788,7 @@ var DimpBase = {
         case 'ctx_qsearchopts_all':
         case 'ctx_qsearchopts_body':
         case 'ctx_qsearchopts_from':
+        case 'ctx_qsearchopts_to':
         case 'ctx_qsearchopts_subject':
             DIMP.conf.qsearchfield = id.substring(16);
             this._updatePrefs('dimp_qsearch_field', DIMP.conf.qsearchfield);
index 8105947..2df2699 100644 (file)
@@ -32,17 +32,26 @@ class IMP_Views_ListMessages
             /* Create the search query. */
             $query = new Horde_Imap_Client_Search_Query();
 
-            switch ($GLOBALS['prefs']->getValue('dimp_qsearch_field')) {
+            $field = $GLOBALS['prefs']->getValue('dimp_qsearch_field');
+            switch ($field) {
             case 'body':
                 $query->text($args['qsearch'], true);
                 break;
 
             case 'from':
-                $query->headerText('From', $args['qsearch']);
+            case 'subject':
+                $query->headerText($field, $args['qsearch']);
                 break;
 
-            case 'subject':
-                $query->headerText('Subject', $args['qsearch']);
+            case 'to':
+                $query2 = new Horde_Imap_Client_Search_Query();
+                $query2->headerText('cc', $args['qsearch']);
+
+                $query3 = new Horde_Imap_Client_Search_Query();
+                $query3->headerText('bcc', $args['qsearch']);
+
+                $query->headerText('to', $args['qsearch']);
+                $query->orSearch(array($query2, $query3));
                 break;
 
             case 'all':
index e84524c..0b4d2e0 100644 (file)
@@ -451,6 +451,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
  <a id="ctx_qsearchopts_all"><?php echo _("Entire Message") ?></a>
  <a id="ctx_qsearchopts_body"><?php echo _("Body") ?></a>
  <a id="ctx_qsearchopts_from"><?php echo _("From") ?></a>
+ <a id="ctx_qsearchopts_to"><?php echo _("To") ?></a>
  <a id="ctx_qsearchopts_subject"><?php echo _("Subject") ?></a>
 </div>
 <?php endif; ?>