Bug 1591364 - Fix address book default startup directory in preferences panel. r=mkmelin a=jorgk
authorAlessandro Castellani <alessandro@thunderbird.net>
Wed, 30 Oct 2019 10:21:51 +0100
changeset 37236 a280ae7d00bafe5028188d736de36ee19f094178
parent 37235 d0011f2559e5723a8762e7aafd33b703eb1191be
child 37237 59f2278c050d8c7ad0d6fc8ac8b76e6cbaaca5ad
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersmkmelin, jorgk
bugs1591364
Bug 1591364 - Fix address book default startup directory in preferences panel. r=mkmelin a=jorgk
mail/components/preferences/compose.inc.xul
mail/components/preferences/compose.js
--- a/mail/components/preferences/compose.inc.xul
+++ b/mail/components/preferences/compose.inc.xul
@@ -205,17 +205,17 @@
                   preference="mail.collect_addressbook"
                   localonly="true"
                   writable="true"
                   flex="1"/>
       </hbox>
 
       <hbox align="center" pack="start">
         <label value="&showAsDefault.label;" accesskey="&showAsDefault.accesskey;"
-                control="defaultStartupDirList"/>
+               control="defaultStartupDirList"/>
         <menulist is="menulist-addrbooks" id="defaultStartupDirList"
                   oncommand="gComposePane.setDefaultStartupDir(this.value);"
                   none="&showAsDefaultLast.label;"
                   alladdressbooks="true"
                   mailinglists="true"
                   flex="1"/>
       </hbox>
     </groupbox>
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -166,27 +166,17 @@ var gComposePane = {
     }
 
     let dirList = document.getElementById("defaultStartupDirList");
     if (Services.prefs.getBoolPref("mail.addr_book.view.startupURIisDefault")) {
       // Some directory is the default.
       let startupURI = Services.prefs.getCharPref(
         "mail.addr_book.view.startupURI"
       );
-      let dirItem = dirList.querySelector(
-        `menupopup menuitem[value="${startupURI}"]`
-      );
-      // It may happen that the stored URI is not in the list.
-      // In that case select the "none" value and let the AB code clear out
-      // the invalid value, unless the user selects something here.
-      if (dirItem) {
-        dirList.selectedItem = dirItem;
-      } else {
-        dirList.value = "";
-      }
+      dirList.value = startupURI;
     } else {
       // Choose item meaning there is no default startup directory any more.
       dirList.value = "";
     }
   },
 
   setButtonColors() {
     document.getElementById("textColorButton").value = Preferences.get(