зеркало из https://github.com/mozilla/pjs.git
Move the "my domain" autocomplete suggestion to a separate JS component b=370306 r=Standard8 sr=bienvenu
This commit is contained in:
Родитель
154ae51e5d
Коммит
4b29e311eb
|
@ -78,7 +78,7 @@ var gCloseWindowAfterSave;
|
|||
var gIsOffline;
|
||||
var gSessionAdded;
|
||||
var gCurrentAutocompleteDirectory;
|
||||
var gAutocompleteSession;
|
||||
var gAutocompleteSearch;
|
||||
var gSetupLdapAutocomplete;
|
||||
var gLDAPSession;
|
||||
var gSavedSendNowKey;
|
||||
|
@ -126,7 +126,7 @@ function InitializeGlobalVariables()
|
|||
gIsOffline = gIOService.offline;
|
||||
gSessionAdded = false;
|
||||
gCurrentAutocompleteDirectory = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
gSetupLdapAutocomplete = false;
|
||||
gLDAPSession = null;
|
||||
gSavedSendNowKey = null;
|
||||
|
@ -152,7 +152,7 @@ function ReleaseGlobalVariables()
|
|||
gPromptService = null;
|
||||
gCurrentIdentity = null;
|
||||
gCurrentAutocompleteDirectory = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
gLDAPSession = null;
|
||||
gCharsetConvertManager = null;
|
||||
gMsgCompose = null;
|
||||
|
@ -2441,7 +2441,7 @@ function ReleaseAutoCompleteState()
|
|||
|
||||
gSessionAdded = false;
|
||||
gLDAPSession = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
}
|
||||
|
||||
function MsgComposeCloseWindow(recycleIt)
|
||||
|
@ -3018,9 +3018,9 @@ function LoadIdentity(startup)
|
|||
|
||||
AddDirectoryServerObserver(false);
|
||||
if (!startup) {
|
||||
if (!gAutocompleteSession)
|
||||
gAutocompleteSession = Components.classes["@mozilla.org/autocompleteSession;1?type=addrbook"].getService(Components.interfaces.nsIAbAutoCompleteSession);
|
||||
if (gAutocompleteSession)
|
||||
if (!gAutocompleteSearch)
|
||||
gAutocompleteSearch = Components.classes["@mozilla.org/autocomplete/search;1?name=mydomain"].getService(Components.interfaces.nsIAbAutoCompleteSearch);
|
||||
if (gAutocompleteSearch)
|
||||
setDomainName();
|
||||
if (getPref("mail.autoComplete.highlightNonMatches"))
|
||||
document.getElementById('addressCol2#1').highlightNonMatches = true;
|
||||
|
@ -3048,46 +3048,38 @@ function setDomainName()
|
|||
}
|
||||
|
||||
// If autocompleteToMyDomain is false the defaultDomain is emptied
|
||||
gAutocompleteSession.defaultDomain = defaultDomain;
|
||||
gAutocompleteSearch.defaultDomain = defaultDomain;
|
||||
}
|
||||
|
||||
function setupAutocomplete()
|
||||
{
|
||||
//Setup autocomplete session if we haven't done so already
|
||||
if (!gAutocompleteSession)
|
||||
if (!gAutocompleteSearch)
|
||||
gAutocompleteSearch = Components.classes["@mozilla.org/autocomplete/search;1?name=mydomain"].getService(Components.interfaces.nsIAbAutoCompleteSearch);
|
||||
if (gAutocompleteSearch)
|
||||
setDomainName();
|
||||
|
||||
var autoCompleteWidget = document.getElementById("addressCol2#1");
|
||||
// When autocompleteToMyDomain is off there is no default entry with the domain
|
||||
// appended so reduce the minimum results for a popup to 2 in this case.
|
||||
if (!gCurrentIdentity.autocompleteToMyDomain)
|
||||
autoCompleteWidget.minResultsForPopup = 2;
|
||||
|
||||
// if the pref is set to turn on the comment column, honor it here.
|
||||
// this element then gets cloned for subsequent rows, so they should
|
||||
// honor it as well
|
||||
//
|
||||
try
|
||||
{
|
||||
gAutocompleteSession = Components.classes["@mozilla.org/autocompleteSession;1?type=addrbook"].getService(Components.interfaces.nsIAbAutoCompleteSession);
|
||||
if (gAutocompleteSession)
|
||||
{
|
||||
setDomainName();
|
||||
if (getPref("mail.autoComplete.highlightNonMatches"))
|
||||
autoCompleteWidget.highlightNonMatches = true;
|
||||
|
||||
var autoCompleteWidget = document.getElementById("addressCol2#1");
|
||||
// When autocompleteToMyDomain is off there is no default entry with the domain
|
||||
// appended so reduce the minimum results for a popup to 2 in this case.
|
||||
if (!gCurrentIdentity.autocompleteToMyDomain)
|
||||
autoCompleteWidget.minResultsForPopup = 2;
|
||||
|
||||
// if the pref is set to turn on the comment column, honor it here.
|
||||
// this element then gets cloned for subsequent rows, so they should
|
||||
// honor it as well
|
||||
//
|
||||
try
|
||||
{
|
||||
if (getPref("mail.autoComplete.highlightNonMatches"))
|
||||
autoCompleteWidget.highlightNonMatches = true;
|
||||
|
||||
if (getPref("mail.autoComplete.commentColumn"))
|
||||
autoCompleteWidget.showCommentColumn = true;
|
||||
} catch (ex)
|
||||
{
|
||||
// if we can't get this pref, then don't show the columns (which is
|
||||
// what the XUL defaults to)
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
gAutocompleteSession = 1;
|
||||
}
|
||||
if (getPref("mail.autoComplete.commentColumn"))
|
||||
autoCompleteWidget.showCommentColumn = true;
|
||||
} catch (ex)
|
||||
{
|
||||
// if we can't get this pref, then don't show the columns (which is
|
||||
// what the XUL defaults to)
|
||||
}
|
||||
|
||||
if (!gSetupLdapAutocomplete)
|
||||
|
|
|
@ -665,6 +665,7 @@
|
|||
<textbox id="addressCol2#1" class="plain textbox-addressingWidget uri-element"
|
||||
aria-labelledby="addressCol1#1"
|
||||
type="autocomplete" flex="1"
|
||||
autocompletesearch="mydomain"
|
||||
searchSessions="addrbook" timeout="300" maxrows="4"
|
||||
autofill="true" autofillaftermatch="true" forcecomplete="true"
|
||||
minresultsforpopup="3" ignoreblurwhilesearching="true"
|
||||
|
|
|
@ -43,7 +43,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXTRA_COMPONENTS += src/nsAbLDAPAttributeMap.js
|
||||
EXTRA_COMPONENTS += src/nsAbAutoCompleteMyDomain.js src/nsAbLDAPAttributeMap.js
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
REQUIRES += mozldap necko
|
||||
|
|
|
@ -55,7 +55,7 @@ XPIDLSRCS = \
|
|||
nsIAddrDBListener.idl \
|
||||
nsIAddrDatabase.idl \
|
||||
nsIAbManager.idl \
|
||||
nsIAbAutoCompleteSession.idl \
|
||||
nsIAbAutoCompleteSearch.idl \
|
||||
nsIAbAddressCollecter.idl \
|
||||
nsIAddbookUrl.idl \
|
||||
nsIAbDirFactory.idl \
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Auto Complete My Domain.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Neil Rashbrook.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
function nsAbAutoCompleteMyDomain() {}
|
||||
|
||||
nsAbAutoCompleteMyDomain.prototype = {
|
||||
classDescription: "AbAutoCompleteMyDomain",
|
||||
contractID: "@mozilla.org/autocomplete/search;1?name=mydomain",
|
||||
classID: Components.ID("{5b259db2-e451-4de9-8a6f-cfba91402973}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Components.interfaces.nsIAutoCompleteSearch,
|
||||
Components.interfaces.nsIAbAutoCompleteSearch]),
|
||||
|
||||
defaultDomain: "",
|
||||
|
||||
startSearch: function(aString, aParam, aResult, aListener) {
|
||||
const ACR = Components.interfaces.nsIAutoCompleteResult;
|
||||
var address = this.defaultDomain && /^[^@,]+$/.test(aString) &&
|
||||
aString + "@" + this.defaultDomain;
|
||||
var result = {
|
||||
searchString: aString,
|
||||
searchResult: address ? ACR.RESULT_SUCCESS : ACR.RESULT_FAILURE,
|
||||
defaultIndex: -1,
|
||||
errorDescription: null,
|
||||
matchCount: address ? 1 : 0,
|
||||
getValueAt: function() { return address; },
|
||||
getCommentAt: function() { return null; },
|
||||
getStyleAt: function() { return "default-match"; },
|
||||
getImageAt: function() { return null; },
|
||||
removeValueAt: function() {}
|
||||
};
|
||||
aListener.onSearchResult(this, result);
|
||||
},
|
||||
|
||||
stopSearch: function() {}
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return XPCOMUtils.generateModule([nsAbAutoCompleteMyDomain]);
|
||||
}
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsAbAutoCompleteSession, nsIAbAutoCompleteSession, nsIAutoCompleteSession)
|
||||
NS_IMPL_ISUPPORTS1(nsAbAutoCompleteSession, nsIAutoCompleteSession)
|
||||
|
||||
nsAbAutoCompleteSession::nsAbAutoCompleteSession()
|
||||
{
|
||||
|
@ -131,27 +131,12 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
|||
const PRUnichar* pNotesStr,
|
||||
const PRUnichar* pDirName,
|
||||
PRUint32 aPopularityIndex,
|
||||
PRBool bIsMailList, PRBool pDefaultMatch,
|
||||
PRBool bIsMailList,
|
||||
nsIAutoCompleteResults* results)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUnichar* fullAddrStr = nsnull;
|
||||
|
||||
if (pDefaultMatch)
|
||||
{
|
||||
if (mDefaultDomain[0] == 0)
|
||||
return;
|
||||
|
||||
nsAutoString aStr(pDisplayNameStr);
|
||||
if (aStr.FindChar('@') == -1)
|
||||
{
|
||||
aStr.Append(PRUnichar('@'));
|
||||
aStr += mDefaultDomain;
|
||||
}
|
||||
fullAddrStr = ToNewUnicode(aStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mParser)
|
||||
{
|
||||
nsCString fullAddress;
|
||||
|
@ -199,7 +184,6 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
|||
else
|
||||
fullAddrStr = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
if (fullAddrStr && ! ItsADuplicate(fullAddrStr, aPopularityIndex, results))
|
||||
{
|
||||
|
@ -227,11 +211,7 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
|||
}
|
||||
}
|
||||
|
||||
// if this isn't a default match, set the class name so we can style
|
||||
// this cell with the local addressbook icon (or whatever)
|
||||
//
|
||||
rv = newItem->SetClassName(pDefaultMatch ? "default-match" :
|
||||
"local-abook");
|
||||
rv = newItem->SetClassName("local-abook");
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsAbAutoCompleteSession::AddToResult():"
|
||||
" newItem->SetClassName() failed\n");
|
||||
|
@ -247,7 +227,7 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
|
|||
|
||||
PRInt32 insertPosition = 0;
|
||||
|
||||
for (; insertPosition < nbrOfItems && !pDefaultMatch; insertPosition++)
|
||||
for (; insertPosition < nbrOfItems; insertPosition++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> currentItemParams;
|
||||
nsCOMPtr<nsIAutoCompleteItem> resultItem;
|
||||
|
@ -475,7 +455,7 @@ nsresult nsAbAutoCompleteSession::SearchCards(nsIAbDirectory* directory, nsAbAut
|
|||
AddToResult(pNickNameStr.get(), pDisplayNameStr.get(),
|
||||
pFirstNameStr.get(), pLastNameStr.get(),
|
||||
pEmailStr[i].get(), pNotesStr.get(),
|
||||
dirName.get(), popularityIndex, bIsMailList, PR_FALSE, results);
|
||||
dirName.get(), popularityIndex, bIsMailList, results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -650,7 +630,7 @@ nsresult nsAbAutoCompleteSession::SearchPreviousResults(nsAbAutoCompleteSearchSt
|
|||
AddToResult(param->mNickName, param->mDisplayName,
|
||||
param->mFirstName, param->mLastName,
|
||||
param->mEmailAddress, param->mNotes,
|
||||
param->mDirName, param->mPopularityIndex, param->mIsMailList, PR_FALSE,
|
||||
param->mDirName, param->mPopularityIndex, param->mIsMailList,
|
||||
results);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -738,18 +718,8 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnStartLookup(const PRUnichar *uSearchStr
|
|||
AutoCompleteStatus status = nsIAutoCompleteStatus::failed;
|
||||
if (NS_SUCCEEDED(rv) && results)
|
||||
{
|
||||
PRBool addedDefaultItem = PR_FALSE;
|
||||
|
||||
results->SetSearchString(uSearchString);
|
||||
results->SetDefaultItemIndex(-1);
|
||||
if (mDefaultDomain[0] != 0)
|
||||
{
|
||||
PRUnichar emptyStr = 0;
|
||||
AddToResult(&emptyStr, uSearchString, &emptyStr, &emptyStr,
|
||||
&emptyStr, &emptyStr, &emptyStr, 0 /* popularity index */, PR_FALSE,
|
||||
PR_TRUE, results);
|
||||
addedDefaultItem = PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
rv = results->GetItems(getter_AddRefs(array));
|
||||
|
@ -766,14 +736,7 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnStartLookup(const PRUnichar *uSearchStr
|
|||
else
|
||||
{
|
||||
status = nsIAutoCompleteStatus::matchFound;
|
||||
if (addedDefaultItem)
|
||||
{
|
||||
// If we have at least one REAL match then make it the default item. If we don't have any matches,
|
||||
// just the default domain, then don't install a default item index on the widget.
|
||||
results->SetDefaultItemIndex(nbrOfItems > 1 ? 1 : -1);
|
||||
}
|
||||
else
|
||||
results->SetDefaultItemIndex(0);
|
||||
results->SetDefaultItemIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -792,21 +755,6 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnAutoComplete(const PRUnichar *searchStr
|
|||
return OnStartLookup(searchString, previousSearchResult, listener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbAutoCompleteSession::GetDefaultDomain(PRUnichar * *aDefaultDomain)
|
||||
{
|
||||
if (!aDefaultDomain)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aDefaultDomain = ToNewUnicode(mDefaultDomain);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAbAutoCompleteSession::SetDefaultDomain(const PRUnichar * aDefaultDomain)
|
||||
{
|
||||
mDefaultDomain = aDefaultDomain;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAbAutoCompleteParam, nsISupports)
|
||||
|
||||
nsAbAutoCompleteSearchString::nsAbAutoCompleteSearchString(const PRUnichar *uSearchString)
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsStringGlue.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsIAbDirectory.h"
|
||||
#include "nsIAbAutoCompleteSession.h"
|
||||
#include "nsIAutoCompleteSession.h"
|
||||
#include "nsCRTGlue.h"
|
||||
|
||||
class nsIPrefBranch;
|
||||
|
@ -74,12 +74,11 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class nsAbAutoCompleteSession : public nsIAbAutoCompleteSession
|
||||
class nsAbAutoCompleteSession : public nsIAutoCompleteSession
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIAUTOCOMPLETESESSION
|
||||
NS_DECL_NSIABAUTOCOMPLETESESSION
|
||||
|
||||
nsAbAutoCompleteSession();
|
||||
virtual ~nsAbAutoCompleteSession();
|
||||
|
@ -93,12 +92,11 @@ protected:
|
|||
const PRUnichar* pEmailStr, const PRUnichar* pNotes,
|
||||
const PRUnichar* pDirName,
|
||||
PRUint32 aPopularityIndex, PRBool bIsMailList,
|
||||
PRBool pDefaultMatch, nsIAutoCompleteResults* results);
|
||||
nsIAutoCompleteResults* results);
|
||||
PRBool CheckEntry(nsAbAutoCompleteSearchString* searchStr, const PRUnichar* nickName,const PRUnichar* displayName,
|
||||
const PRUnichar* firstName, const PRUnichar* lastName, const PRUnichar* emailAddress);
|
||||
|
||||
nsCOMPtr<nsIMsgHeaderParser> mParser;
|
||||
nsString mDefaultDomain;
|
||||
|
||||
// how to process the comment column, if at all. this value
|
||||
// comes from "mail.autoComplete.commentColumn", or, if that
|
||||
|
|
|
@ -97,7 +97,7 @@ var gCloseWindowAfterSave;
|
|||
var gIsOffline;
|
||||
var gSessionAdded;
|
||||
var gCurrentAutocompleteDirectory;
|
||||
var gAutocompleteSession;
|
||||
var gAutocompleteSearch;
|
||||
var gSetupLdapAutocomplete;
|
||||
var gLDAPSession;
|
||||
var gSavedSendNowKey;
|
||||
|
@ -145,7 +145,7 @@ function InitializeGlobalVariables()
|
|||
gIsOffline = gIOService.offline;
|
||||
gSessionAdded = false;
|
||||
gCurrentAutocompleteDirectory = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
gSetupLdapAutocomplete = false;
|
||||
gLDAPSession = null;
|
||||
gSavedSendNowKey = null;
|
||||
|
@ -173,7 +173,7 @@ function ReleaseGlobalVariables()
|
|||
gPromptService = null;
|
||||
gCurrentIdentity = null;
|
||||
gCurrentAutocompleteDirectory = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
gLDAPSession = null;
|
||||
gCharsetConvertManager = null;
|
||||
gMsgCompose = null;
|
||||
|
@ -2463,7 +2463,7 @@ function ReleaseAutoCompleteState()
|
|||
|
||||
gSessionAdded = false;
|
||||
gLDAPSession = null;
|
||||
gAutocompleteSession = null;
|
||||
gAutocompleteSearch = null;
|
||||
}
|
||||
|
||||
function MsgComposeCloseWindow(recycleIt)
|
||||
|
@ -2924,9 +2924,9 @@ function LoadIdentity(startup)
|
|||
|
||||
AddDirectoryServerObserver(false);
|
||||
if (!startup) {
|
||||
if (!gAutocompleteSession)
|
||||
gAutocompleteSession = Components.classes["@mozilla.org/autocompleteSession;1?type=addrbook"].getService(Components.interfaces.nsIAbAutoCompleteSession);
|
||||
if (gAutocompleteSession)
|
||||
if (!gAutocompleteSearch)
|
||||
gAutocompleteSearch = Components.classes["@mozilla.org/autocomplete/search;1?name=mydomain"].getService(Components.interfaces.nsIAbAutoCompleteSearch);
|
||||
if (gAutocompleteSearch)
|
||||
setDomainName();
|
||||
if (sPrefs.getBoolPref("mail.autoComplete.highlightNonMatches"))
|
||||
document.getElementById('addressCol2#1').highlightNonMatches = true;
|
||||
|
@ -2956,41 +2956,36 @@ function setDomainName()
|
|||
}
|
||||
|
||||
// If autocompleteToMyDomain is false the defaultDomain is emptied
|
||||
gAutocompleteSession.defaultDomain = defaultDomain;
|
||||
gAutocompleteSearch.defaultDomain = defaultDomain;
|
||||
}
|
||||
|
||||
function setupAutocomplete()
|
||||
{
|
||||
//Setup autocomplete session if we haven't done so already
|
||||
if (!gAutocompleteSession) {
|
||||
gAutocompleteSession = Components.classes["@mozilla.org/autocompleteSession;1?type=addrbook"].getService(Components.interfaces.nsIAbAutoCompleteSession);
|
||||
if (gAutocompleteSession) {
|
||||
setDomainName();
|
||||
if (!gAutocompleteSearch)
|
||||
gAutocompleteSearch = Components.classes["@mozilla.org/autocomplete/search;1?name=mydomain"].getService(Components.interfaces.nsIAbAutoCompleteSearch);
|
||||
if (gAutocompleteSearch)
|
||||
setDomainName();
|
||||
|
||||
var autoCompleteWidget = document.getElementById("addressCol2#1");
|
||||
// When autocompleteToMyDomain is off, there is no default entry with the domain
|
||||
// appended, so reduce the minimum results for a popup to 2 in this case.
|
||||
if (!gCurrentIdentity.autocompleteToMyDomain)
|
||||
autoCompleteWidget.minResultsForPopup = 2;
|
||||
var autoCompleteWidget = document.getElementById("addressCol2#1");
|
||||
// When autocompleteToMyDomain is off, there is no default entry with the domain
|
||||
// appended, so reduce the minimum results for a popup to 2 in this case.
|
||||
if (!gCurrentIdentity.autocompleteToMyDomain)
|
||||
autoCompleteWidget.minResultsForPopup = 2;
|
||||
|
||||
// if the pref is set to turn on the comment column, honor it here.
|
||||
// this element then gets cloned for subsequent rows, so they should
|
||||
// honor it as well
|
||||
//
|
||||
try {
|
||||
if (sPrefs.getBoolPref("mail.autoComplete.highlightNonMatches"))
|
||||
autoCompleteWidget.highlightNonMatches = true;
|
||||
// if the pref is set to turn on the comment column, honor it here.
|
||||
// this element then gets cloned for subsequent rows, so they should
|
||||
// honor it as well
|
||||
//
|
||||
try {
|
||||
if (sPrefs.getBoolPref("mail.autoComplete.highlightNonMatches"))
|
||||
autoCompleteWidget.highlightNonMatches = true;
|
||||
|
||||
if (sPrefs.getIntPref("mail.autoComplete.commentColumn"))
|
||||
autoCompleteWidget.showCommentColumn = true;
|
||||
} catch (ex) {
|
||||
// if we can't get this pref, then don't show the columns (which is
|
||||
// what the XUL defaults to)
|
||||
}
|
||||
|
||||
} else {
|
||||
gAutocompleteSession = 1;
|
||||
}
|
||||
if (sPrefs.getIntPref("mail.autoComplete.commentColumn"))
|
||||
autoCompleteWidget.showCommentColumn = true;
|
||||
} catch (ex) {
|
||||
// if we can't get this pref, then don't show the columns (which is
|
||||
// what the XUL defaults to)
|
||||
}
|
||||
if (!gSetupLdapAutocomplete) {
|
||||
try {
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<textbox id="addressCol2#1" class="plain textbox-addressingWidget uri-element"
|
||||
aria-labelledby="addressCol1#1"
|
||||
type="autocomplete" flex="1"
|
||||
autocompletesearch="mydomain"
|
||||
searchSessions="addrbook" timeout="300" maxrows="4"
|
||||
autofill="true" autofillaftermatch="true" forcecomplete="true"
|
||||
minresultsforpopup="3" ignoreblurwhilesearching="true"
|
||||
|
|
|
@ -55,10 +55,10 @@
|
|||
this.ifSetAttribute("disableKeyNavigation", true);
|
||||
|
||||
// initialize the search sessions
|
||||
if (this.hasAttribute("searchSessions"))
|
||||
this.initSearchSessions();
|
||||
if (this.hasAttribute("autocompletesearch"))
|
||||
this.initAutoCompleteSearch();
|
||||
if (this.hasAttribute("searchSessions"))
|
||||
this.initSearchSessions();
|
||||
|
||||
// hack to work around lack of bottom-up constructor calling
|
||||
if ("initialize" in this.resultsPopup)
|
||||
|
|
Загрузка…
Ссылка в новой задаче