Bug 952735: Autocomplete does not work in address book for lists (and in other places). r=mconley, r=neil, r=philipp, a=Standard8
authorJens Müller <ich@tessarakt.de>
Sun, 22 Dec 2013 03:03:00 +0200
changeset 18829 503d3e03344139c2a7ba980538636ee35fcc1ece
parent 18828 c55875c06ef54497b0935077506f53758649e67b
child 18830 c82a2bbf3839d5ba269f58fb08693d124943fbbd
push idunknown
push userunknown
push dateunknown
reviewersmconley, neil, philipp, Standard8
bugs952735
Bug 952735: Autocomplete does not work in address book for lists (and in other places). r=mconley, r=neil, r=philipp, a=Standard8
calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
mail/components/addrbook/content/abEditListDialog.xul
mail/components/addrbook/content/abMailListDialog.xul
mailnews/addrbook/src/nsAbAutoCompleteSearch.js
mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
suite/mailnews/addrbook/abListOverlay.xul
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
@@ -33,16 +33,17 @@
           </xul:listcell>
           <xul:listcell class="addressingWidgetCell">
             <xul:textbox id="attendeeCol3#1"
                          anonid="input"
                          class="plain textbox-addressingWidget uri-element"
                          type="autocomplete"
                          flex="1"
                          autocompletesearch="addrbook ldap"
+                         autocompletesearchparam="{}"
                          timeout="300"
                          maxrows="4"
                          completedefaultindex="true"
                          forcecomplete="true"
                          minresultsforpopup="1"
                          onblur="if (this.localName == 'textbox') document.getBindingParent(this).onBlurInput(event);"
                          ignoreblurwhilesearching="true"
                          oninput="this.setAttribute('dirty', 'true');">
--- a/mail/components/addrbook/content/abEditListDialog.xul
+++ b/mail/components/addrbook/content/abEditListDialog.xul
@@ -52,17 +52,18 @@
     <label control="addressingWidget" value="&AddressTitle.label;"/>
     <spacer style="height:0.1em"/>
 
     <listbox id="addressingWidget" style="height: 15em;" onclick="awClickEmptySpace(event.target, true)">
       <listitem class="addressingWidgetItem" allowevents="true">
         <listcell class="addressingWidgetCell">
           <textbox id="addressCol1#1" class="plain textbox-addressingWidget uri-element"
                    type="autocomplete" flex="1"
-                   autocompletesearch="addrbook ldap" timeout="300" maxrows="4"
+                   autocompletesearch="addrbook ldap"
+                   autocompletesearchparam="{}" timeout="300" maxrows="4"
                    completedefaultindex="true" forcecomplete="true"
                    minresultsforpopup="3"
                    ontextentered="awRecipientTextCommand(eventParam, this)"
                    onkeypress="handleKeyPress(this, event);"
                    onkeydown="awRecipientKeyDown(event, this);"
                    onclick="awNotAnEmptyArea(event);">
             <image onclick="this.parentNode.select();" class="person-icon"/>
           </textbox>
--- a/mail/components/addrbook/content/abMailListDialog.xul
+++ b/mail/components/addrbook/content/abMailListDialog.xul
@@ -62,17 +62,18 @@
     <label control="addressingWidget" value="&AddressTitle.label;"/>
     <spacer style="height:0.1em"/>
 
     <listbox id="addressingWidget" style="height: 15em;" onclick="awClickEmptySpace(event.target, true)">
       <listitem class="addressingWidgetItem" allowevents="true">
         <listcell class="addressingWidgetCell">
           <textbox id="addressCol1#1" class="plain textbox-addressingWidget uri-element"
                    type="autocomplete" flex="1"
-                   autocompletesearch="addrbook ldap" timeout="300" maxrows="4"
+                   autocompletesearch="addrbook ldap"
+                   autocompletesearchparam="{}" timeout="300" maxrows="4"
                    completedefaultindex="true" forcecomplete="true"
                    minresultsforpopup="3"
                    ontextentered="awRecipientTextCommand(eventParam, this)"
                    onkeypress="handleKeyPress(this, event);"
                    onkeydown="awRecipientKeyDown(event, this);"
                    onclick="awNotAnEmptyArea(event);">
             <image onclick="this.parentNode.select();" class="person-icon"/>
           </textbox>
--- a/mailnews/addrbook/src/nsAbAutoCompleteSearch.js
+++ b/mailnews/addrbook/src/nsAbAutoCompleteSearch.js
@@ -337,17 +337,17 @@ nsAbAutoCompleteSearch.prototype = {
    *
    * It is expected that aSearchParam contains the identity (if any) to use
    * for determining if an address book should be autocompleted against.
    */
   startSearch: function startSearch(aSearchString, aSearchParam,
                                     aPreviousResult, aListener) {
     let params = JSON.parse(aSearchParam);
     var result = new nsAbAutoCompleteResult(aSearchString);
-    if (!this.applicableHeaders.has(params.type)) {
+    if (params.type && !this.applicableHeaders.has(params.type)) {
       result.searchResult = ACR.RESULT_IGNORED;
       aListener.onSearchResult(this, result);
       return;
     }
 
     // If the search string isn't value, or contains a comma, or the user
     // hasn't enabled autocomplete, then just return no matches / or the
     // result ignored.
@@ -423,17 +423,16 @@ nsAbAutoCompleteSearch.prototype = {
       var allABs = this._abManager.directories;
 
       // We're not going to bother searching sub-directories, currently the
       // architecture forces all cards that are in mailing lists to be in ABs as
       // well, therefore by searching sub-directories (aka mailing lists) we're
       // just going to find duplicates.
       while (allABs.hasMoreElements()) {
         var dir = allABs.getNext();
-
         if (dir instanceof Components.interfaces.nsIAbDirectory &&
             dir.useForAutocomplete(params.idKey)) {
           this._searchCards(searchQuery, dir, result);
           this._searchWithinEmails(emailSearchQuery, fullString, dir, result);
         }
       }
     }
 
--- a/mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
+++ b/mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
@@ -157,17 +157,17 @@ nsAbLDAPAutoCompleteSearch.prototype = {
     this._attributes = null;
   },
 
   // nsIAutoCompleteSearch
 
   startSearch: function startSearch(aSearchString, aParam,
                                     aPreviousResult, aListener) {
     let params = JSON.parse(aParam);
-    let applicable = this.applicableHeaders.has(params.type);
+    let applicable = !params.type || this.applicableHeaders.has(params.type);
     let idKey = params.idKey;
 
     this._result = new nsAbLDAPAutoCompleteResult(aSearchString);
     aSearchString = aSearchString.toLocaleLowerCase();
 
     // If the search string isn't value, or contains a comma, or the user
     // hasn't enabled autocomplete, then just return no matches / or the
     // result ignored.
--- a/suite/mailnews/addrbook/abListOverlay.xul
+++ b/suite/mailnews/addrbook/abListOverlay.xul
@@ -60,17 +60,18 @@
   <listbox id="addressingWidget" style="height: 15em;"
            onclick="awClickEmptySpace(event.target, true)">
     <listitem class="addressingWidgetItem" allowevents="true">
       <listcell class="addressingWidgetCell">
         <textbox id="addressCol1#1"
                  class="plain textbox-addressingWidget uri-element"
                  type="autocomplete"
                  flex="1"
-                 autocompletesearch="addrbook ldap" timeout="300" maxrows="4"
+                 autocompletesearch="addrbook ldap"
+                 autocompletesearchparam="{}" timeout="300" maxrows="4"
                  completedefaultindex="true" forcecomplete="true"
                  minresultsforpopup="3"
                  ontextentered="awRecipientTextCommand(eventParam, this)"
                  onkeypress="handleKeyPress(this, event);"
                  onkeydown="awRecipientKeyDown(event, this);"
                  onclick="awNotAnEmptyArea(event);">
           <image onclick="awNotAnEmptyArea(event)" class="person-icon"/>
         </textbox>