summaryrefslogtreecommitdiffstats
path: root/toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs')
-rw-r--r--toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs168
1 files changed, 76 insertions, 92 deletions
diff --git a/toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs b/toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs
index f00df0b40b..f38d89f88f 100644
--- a/toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs
+++ b/toolkit/components/satchel/megalist/aggregator/datasources/AddressesDataSource.sys.mjs
@@ -56,103 +56,87 @@ export class AddressesDataSource extends DataSourceBase {
constructor(...args) {
super(...args);
- this.formatMessages(
- "addresses-section-label",
- "address-name-label",
- "address-phone-label",
- "address-email-label",
- "command-copy",
- "addresses-disabled",
- "command-delete",
- "command-edit",
- "addresses-command-create"
- ).then(
- ([
- headerLabel,
- nameLabel,
- phoneLabel,
- emailLabel,
- copyLabel,
- addressesDisabled,
- deleteLabel,
- editLabel,
- createLabel,
- ]) => {
- const copyCommand = { id: "Copy", label: copyLabel };
- const editCommand = { id: "Edit", label: editLabel };
- const deleteCommand = { id: "Delete", label: deleteLabel };
- this.#addressesDisabledMessage = addressesDisabled;
- this.#header = this.createHeaderLine(headerLabel);
- this.#header.commands.push({ id: "Create", label: createLabel });
-
- let self = this;
-
- function prototypeLine(label, key, options = {}) {
- return self.prototypeDataLine({
- label: { value: label },
- value: {
- get() {
- return this.editingValue ?? this.record[key];
- },
+ this.localizeStrings({
+ headerLabel: "addresses-section-label",
+ nameLabel: "address-name-label",
+ phoneLabel: "address-phone-label",
+ emailLabel: "address-email-label",
+ addressesDisabled: "addresses-disabled",
+ }).then(strings => {
+ const copyCommand = { id: "Copy", label: "command-copy" };
+ const editCommand = { id: "Edit", label: "command-edit" };
+ const deleteCommand = { id: "Delete", label: "command-delete" };
+ this.#addressesDisabledMessage = strings.addressesDisabled;
+ this.#header = this.createHeaderLine(strings.headerLabel);
+ this.#header.commands.push({
+ id: "Create",
+ label: "addresses-command-create",
+ });
+
+ let self = this;
+
+ function prototypeLine(label, key, options = {}) {
+ return self.prototypeDataLine({
+ label: { value: label },
+ value: {
+ get() {
+ return this.editingValue ?? this.record[key];
},
- commands: {
- value: [copyCommand, editCommand, "-", deleteCommand],
+ },
+ commands: {
+ value: [copyCommand, editCommand, "-", deleteCommand],
+ },
+ executeEdit: {
+ value() {
+ this.editingValue = this.record[key] ?? "";
+ this.refreshOnScreen();
},
- executeEdit: {
- value() {
- this.editingValue = this.record[key] ?? "";
- this.refreshOnScreen();
- },
+ },
+ executeSave: {
+ async value(value) {
+ if (await updateAddress(this.record, key, value)) {
+ this.executeCancel();
+ }
},
- executeSave: {
- async value(value) {
- if (await updateAddress(this.record, key, value)) {
- this.executeCancel();
- }
- },
- },
- ...options,
- });
- }
-
- this.#namePrototype = prototypeLine(nameLabel, "name", {
- start: { value: true },
+ },
+ ...options,
});
- this.#organizationPrototype = prototypeLine(
- "Organization",
- "organization"
- );
- this.#streetAddressPrototype = prototypeLine(
- "Street Address",
- "street-address"
- );
- this.#addressLevelThreePrototype = prototypeLine(
- "Neighbourhood",
- "address-level3"
- );
- this.#addressLevelTwoPrototype = prototypeLine(
- "City",
- "address-level2"
- );
- this.#addressLevelOnePrototype = prototypeLine(
- "Province",
- "address-level1"
- );
- this.#postalCodePrototype = prototypeLine("Postal Code", "postal-code");
- this.#countryPrototype = prototypeLine("Country", "country");
- this.#phonePrototype = prototypeLine(phoneLabel, "tel");
- this.#emailPrototype = prototypeLine(emailLabel, "email", {
- end: { value: true },
- });
-
- Services.obs.addObserver(this, "formautofill-storage-changed");
- Services.prefs.addObserver(
- "extensions.formautofill.addresses.enabled",
- this
- );
- this.#reloadDataSource();
}
- );
+
+ this.#namePrototype = prototypeLine(strings.nameLabel, "name", {
+ start: { value: true },
+ });
+ this.#organizationPrototype = prototypeLine(
+ "Organization",
+ "organization"
+ );
+ this.#streetAddressPrototype = prototypeLine(
+ "Street Address",
+ "street-address"
+ );
+ this.#addressLevelThreePrototype = prototypeLine(
+ "Neighbourhood",
+ "address-level3"
+ );
+ this.#addressLevelTwoPrototype = prototypeLine("City", "address-level2");
+ this.#addressLevelOnePrototype = prototypeLine(
+ "Province",
+ "address-level1"
+ );
+ this.#postalCodePrototype = prototypeLine("Postal Code", "postal-code");
+ this.#countryPrototype = prototypeLine("Country", "country");
+ this.#phonePrototype = prototypeLine(strings.phoneLabel, "tel");
+ this.#emailPrototype = prototypeLine(strings.emailLabel, "email", {
+ end: { value: true },
+ });
+
+ Services.obs.addObserver(this, "formautofill-storage-changed");
+ Services.prefs.addObserver(
+ "extensions.formautofill.addresses.enabled",
+ this
+ );
+ this.#reloadDataSource();
+ });
}
async #reloadDataSource() {