зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1367322 - Preferences search support for address autofill. r=evanxd,lchang
MozReview-Commit-ID: 8r0BhqAPC0A --HG-- extra : rebase_source : 5d5e13e4d6ba524ad9538e3c516934f35e19e1a0
This commit is contained in:
Родитель
129f82de1d
Коммит
2ca9e14e1f
|
@ -22,7 +22,12 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
const {ENABLED_AUTOFILL_ADDRESSES_PREF, ENABLED_AUTOFILL_CREDITCARDS_PREF} = FormAutofillUtils;
|
||||
const {
|
||||
ENABLED_AUTOFILL_ADDRESSES_PREF,
|
||||
ENABLED_AUTOFILL_CREDITCARDS_PREF,
|
||||
MANAGE_ADDRESSES_KEYWORDS,
|
||||
EDIT_ADDRESS_KEYWORDS,
|
||||
} = FormAutofillUtils;
|
||||
// Add credit card enabled flag in telemetry environment for recording the number of
|
||||
// users who disable/enable the credit card autofill feature.
|
||||
|
||||
|
@ -68,6 +73,9 @@ FormAutofillPreferences.prototype = {
|
|||
let addressAutofillCheckbox = document.createElementNS(XUL_NS, "checkbox");
|
||||
let addressAutofillLearnMore = document.createElementNS(XUL_NS, "label");
|
||||
let savedAddressesBtn = document.createElementNS(XUL_NS, "button");
|
||||
// Wrappers are used to properly compute the search tooltip positions
|
||||
let savedAddressesBtnWrapper = document.createElementNS(XUL_NS, "hbox");
|
||||
|
||||
savedAddressesBtn.className = "accessory-button";
|
||||
addressAutofillLearnMore.className = "learnMore text-link";
|
||||
|
||||
|
@ -81,6 +89,10 @@ FormAutofillPreferences.prototype = {
|
|||
|
||||
addressAutofillLearnMore.setAttribute("href", learnMoreURL);
|
||||
|
||||
// Add preferences search support
|
||||
savedAddressesBtn.setAttribute("searchkeywords", MANAGE_ADDRESSES_KEYWORDS.concat(EDIT_ADDRESS_KEYWORDS)
|
||||
.map(key => this.bundle.GetStringFromName(key)).join("\n"));
|
||||
|
||||
// Manually set the checked state
|
||||
if (FormAutofillUtils.isAutofillAddressesEnabled) {
|
||||
addressAutofillCheckbox.setAttribute("checked", true);
|
||||
|
@ -92,7 +104,8 @@ FormAutofillPreferences.prototype = {
|
|||
addressAutofill.appendChild(addressAutofillCheckboxGroup);
|
||||
addressAutofillCheckboxGroup.appendChild(addressAutofillCheckbox);
|
||||
addressAutofillCheckboxGroup.appendChild(addressAutofillLearnMore);
|
||||
addressAutofill.appendChild(savedAddressesBtn);
|
||||
addressAutofill.appendChild(savedAddressesBtnWrapper);
|
||||
savedAddressesBtnWrapper.appendChild(savedAddressesBtn);
|
||||
|
||||
this.refs = {
|
||||
formAutofillGroup,
|
||||
|
|
|
@ -21,6 +21,11 @@ const CREDITCARDS_COLLECTION_NAME = "creditCards";
|
|||
const ENABLED_AUTOFILL_ADDRESSES_PREF = "extensions.formautofill.addresses.enabled";
|
||||
const AUTOFILL_CREDITCARDS_AVAILABLE_PREF = "extensions.formautofill.creditCards.available";
|
||||
const ENABLED_AUTOFILL_CREDITCARDS_PREF = "extensions.formautofill.creditCards.enabled";
|
||||
const MANAGE_ADDRESSES_KEYWORDS = ["manageAddressesTitle", "addNewAddressTitle"];
|
||||
const EDIT_ADDRESS_KEYWORDS = [
|
||||
"givenName", "additionalName", "familyName", "organization", "streetAddress",
|
||||
"state", "province", "city", "country", "zip", "postalCode", "email", "tel",
|
||||
];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -34,6 +39,8 @@ this.FormAutofillUtils = {
|
|||
CREDITCARDS_COLLECTION_NAME,
|
||||
ENABLED_AUTOFILL_ADDRESSES_PREF,
|
||||
ENABLED_AUTOFILL_CREDITCARDS_PREF,
|
||||
MANAGE_ADDRESSES_KEYWORDS,
|
||||
EDIT_ADDRESS_KEYWORDS,
|
||||
|
||||
_fieldNameInfo: {
|
||||
"name": "name",
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
</fieldset>
|
||||
<div id="controls-container">
|
||||
<button id="remove" disabled="disabled" data-localization="remove"/>
|
||||
<button id="add" data-localization="add"/>
|
||||
<!-- Wrapper is used to properly compute the search tooltip position -->
|
||||
<div>
|
||||
<button id="add" data-localization="add"/>
|
||||
</div>
|
||||
<button id="edit" disabled="disabled" data-localization="edit"/>
|
||||
</div>
|
||||
<script type="application/javascript">
|
||||
|
|
|
@ -271,6 +271,9 @@ class ManageRecords {
|
|||
class ManageAddresses extends ManageRecords {
|
||||
constructor(elements) {
|
||||
super("addresses", elements);
|
||||
elements.add.setAttribute("searchkeywords", FormAutofillUtils.EDIT_ADDRESS_KEYWORDS
|
||||
.map(key => FormAutofillUtils.stringBundle.GetStringFromName(key))
|
||||
.join("\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче