Bug 1574590 - Change MozMenulistAddrbooks CE to fix LDAP auto-complete and LDAP server pref. r=mkmelin

This commit is contained in:
Alessandro Castellani 2019-08-20 22:28:44 +02:00
Родитель 441acba760
Коммит 5355073fcb
3 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -27,7 +27,6 @@ if (!customElements.get("menulist")) {
}
this._directories = [];
this._value = this.getAttribute("value") || "URI";
this._rebuild();
@ -88,10 +87,22 @@ if (!customElements.get("menulist")) {
}, { once: true });
}
/**
* Returns the address book type based on the remoteonly attribute
* of the menulist.
*
* "URI" Local Address Book
* "dirPrefId" Remote LDAP Directory
*/
get _type() {
return this.getAttribute("remoteonly") ? "dirPrefId" : "URI";
}
disconnectedCallback() {
super.disconnectedCallback();
MailServices.ab.removeAddressBookListener(this.addressBookListener);
this._teardown();
}
_rebuild() {
@ -142,13 +153,14 @@ if (!customElements.get("menulist")) {
}
// Now create menuitems for all displayed directories.
let type = this._type;
for (let ab of this._directories) {
if (!ab) {
// Skip the empty members added above.
continue;
}
let listItem = this.appendItem(ab.dirName, ab.URI);
let listItem = this.appendItem(ab.dirName, ab[type]);
listItem.setAttribute("class", "menuitem-iconic abMenuItem");
// Style the items by type.
@ -168,8 +180,12 @@ if (!customElements.get("menulist")) {
// Attempt to select the persisted or otherwise first directory.
this.selectedIndex = this._directories.findIndex((d) => {
return d && d.URI == this._value;
return d && d[type] == this.value;
});
if (!this.selectedItem && this.menupopup.hasChildNodes()) {
this.selectedIndex = 0;
}
}
_teardown() {

Просмотреть файл

@ -187,7 +187,6 @@
preference="ldap_2.autoComplete.directoryServer"
none="&directoriesNone.label;"
remoteonly="true"
value="dirPrefId"
flex="1"/>
<button id="editButton" label="&editDirectories.label;"
oncommand="gComposePane.editDirectories();"

Просмотреть файл

@ -98,7 +98,6 @@
<menulist is="menulist-addrbooks" id="identity.directoryServer"
none="&directoriesNone.label;"
remoteonly="true"
value="dirPrefId"
wsm_persist="true"
preftype="string"
prefstring="mail.identity.%identitykey%.directoryServer"