Bug 690644 - Removal of the options to specify defaults for background and text colors in a draft
authorRyan <palswim+mozilla.org@palswim.net>
Thu, 19 Oct 2017 12:32:22 -0700
changeset 22883 6097b4c6226362a65b7bb515997b8d4453e96a20
parent 22873 c6b8fc410a900a22f0d54f5f10934a06ffc8ee6b
push id123
push userbmo:palswim@palswim.net
push dateThu, 19 Oct 2017 19:34:45 +0000
bugs690644
Bug 690644 - Removal of the options to specify defaults for background and text colors in a message; r?mkmelin+mozilla@iki.fi Changed the Thunderbird Composition preferences UI section to remove the options about setting the default background and text colors in a message. Left the options intact and added new "msgcompose.default_colors" options, which defaults to "true", which tells Thunderbird not to use the default colors, but instead set no text or background color in a new message. The user can change this in a message-specific way in the "Format > Page Colors and Background..." dialog in the message composition window. MozReview-Commit-ID: De4YF6Esezx
mail/components/compose/content/MsgComposeCommands.js
mail/components/preferences/compose.js
mail/components/preferences/compose.xul
mail/locales/en-US/chrome/messenger/preferences/compose.dtd
mailnews/mailnews.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5258,29 +5258,31 @@ function loadHTMLMsgPrefs()
 
   try {
     fontSize = getPref("msgcompose.font_size");
     EditorSetFontSize(fontSize);
   } catch (e) {}
 
   var bodyElement = GetBodyElement();
 
+  var useDefault = getPref("msgcompose.default_colors");
+
   try {
-    textColor = getPref("msgcompose.text_color");
+    textColor = (useDefault ? "" : getPref("msgcompose.text_color"));
     if (!bodyElement.getAttribute("text"))
     {
     bodyElement.setAttribute("text", textColor);
     gDefaultTextColor = textColor;
     document.getElementById("cmd_fontColor").setAttribute("state", textColor);
     onFontColorChange();
     }
   } catch (e) {}
 
   try {
-    bgColor = getPref("msgcompose.background_color");
+    bgColor = (useDefault ? "" : getPref("msgcompose.background_color"));
     if (!bodyElement.getAttribute("bgcolor"))
     {
     bodyElement.setAttribute("bgcolor", bgColor);
     gDefaultBackgroundColor = bgColor;
     document.getElementById("cmd_backgroundColor").setAttribute("state", bgColor);
     onBackgroundColorChange();
     }
   } catch (e) {}
old mode 100644
new mode 100755
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -215,24 +215,16 @@ var gComposePane = {
      // work around that with some try/catch exception handling
      try {
        document.getElementById('msgcompose.font_face').reset();
      } catch (ex) {}
 
      try {
        document.getElementById('msgcompose.font_size').reset();
      } catch (ex) {}
-
-     try {
-       document.getElementById('msgcompose.text_color').reset();
-     } catch (ex) {}
-
-     try {
-       document.getElementById('msgcompose.background_color').reset();
-     } catch (ex) {}
   },
 
   startupDirListener: {
     inited: false,
     domain: "mail.addr_book.view.startupURI",
     observe: function(subject, topic, prefName) {
       if (topic != "nsPref:changed")
         return;
--- a/mail/components/preferences/compose.xul
+++ b/mail/components/preferences/compose.xul
@@ -39,18 +39,16 @@
       <preference id="ldap_2.autoComplete.directoryServer" name="ldap_2.autoComplete.directoryServer" type="string"/>
       <preference id="pref.ldap.disable_button.edit_directories"
                   name="pref.ldap.disable_button.edit_directories" type="bool"/>
       <preference id="mail.collect_email_address_outgoing" name="mail.collect_email_address_outgoing" type="bool"/>
       <preference id="mail.collect_addressbook" name="mail.collect_addressbook" type="string"/>
       <preference id="spellchecker.dictionary"  name="spellchecker.dictionary"   type="unichar"/>
       <preference id="msgcompose.font_face"      name="msgcompose.font_face" type="string"/>
       <preference id="msgcompose.font_size"      name="msgcompose.font_size" type="string"/>
-      <preference id="msgcompose.text_color"     name="msgcompose.text_color" type="string"/>
-      <preference id="msgcompose.background_color" name="msgcompose.background_color" type="string"/>
       <preference id="mail.compose.attachment_reminder"
                   name="mail.compose.attachment_reminder"
                   type="bool"/>
       <preference id="mail.compose.default_to_paragraph"
                   name="mail.compose.default_to_paragraph"
                   type="bool"/>
     </preferences>
 
@@ -145,33 +143,25 @@
                   <menuitem value="xx-large" label="&size-hugeCmd.label;"/>
                 </menupopup>
               </menulist>
             </hbox>
 
             <separator class="thin"/>
 
             <hbox align="center">
-              <label control="textColorButton" value="&fontColor.label;" accesskey="&fontColor.accesskey;"/>
-              <colorpicker type="button" id="textColorButton" preference="msgcompose.text_color"/>
-              <separator orient="vertical" class="thin"/>
-              <label control="backgroundColorButton" value="&bgColor.label;" accesskey="&bgColor.accesskey;"/>
-              <colorpicker type="button" id="backgroundColorButton" preference="msgcompose.background_color"/>
-              <spacer flex="1"/>
-              <button label="&restoreHTMLDefaults.label;" accesskey="&restoreHTMLDefaults.accesskey;"
-                      oncommand="gComposePane.restoreHTMLDefaults();"/>
-            </hbox>
-
-            <separator class="thin"/>
-
-            <hbox align="center">
               <checkbox id="defaultToParagraph"
                         label="&defaultToParagraph.label;"
                         accesskey="&defaultToParagraph.accesskey;"
                         preference="mail.compose.default_to_paragraph"/>
+              <spacer flex="1"/>
+              <button id="restoreHTMLDefaultsButton"
+                      label="&restoreHTMLDefaults.label;"
+                      accesskey="&restoreHTMLDefaults.accesskey;"
+                      oncommand="gComposePane.restoreHTMLDefaults();"/>
             </hbox>
           </groupbox>
 
           <hbox align="center">
             <description flex="1">&sendOptionsDescription.label;</description>
             <button label="&sendOptions.label;"
                     accesskey="&sendOptions.accesskey;"
                     oncommand="gComposePane.sendOptionsDialog();"/>
--- a/mail/locales/en-US/chrome/messenger/preferences/compose.dtd
+++ b/mail/locales/en-US/chrome/messenger/preferences/compose.dtd
@@ -15,16 +15,18 @@
 <!ENTITY addExtension.label                   "add extension to file name">
 <!ENTITY addExtension.accesskey               "e">
 
 <!ENTITY htmlComposeHeader.label              "HTML">
 <!ENTITY font.label                           "Font:">
 <!ENTITY font.accesskey                       "n">
 <!ENTITY size.label                           "Size:">
 <!ENTITY size.accesskey                       "z">
+<!ENTITY colorDefaults.label                  "Use Reader's default colors (do not set colors)">
+<!ENTITY colorDefaults.accesskey              "D">
 <!ENTITY fontColor.label                      "Text Color:">
 <!ENTITY fontColor.accesskey                  "T">
 <!ENTITY bgColor.label                        "Background Color:">
 <!ENTITY bgColor.accesskey                    "B">
 <!ENTITY restoreHTMLDefaults.label            "Restore Defaults">
 <!ENTITY restoreHTMLDefaults.accesskey        "R">
 <!ENTITY defaultToParagraph.label             "Use Paragraph format instead of Body Text by default">
 <!ENTITY defaultToParagraph.accesskey         "P">
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -790,16 +790,17 @@ pref("mailnews.display_reply_tag_colors_
 
 //default null headers
 //example "X-Warn: XReply", list of hdrs separated by ": "
 pref("mailnews.customHeaders", "");
 
 // default msg compose font prefs
 pref("msgcompose.font_face",                "");
 pref("msgcompose.font_size",                "medium");
+pref("msgcompose.default_colors",           true);
 pref("msgcompose.text_color",               "#000000");
 pref("msgcompose.background_color",         "#FFFFFF");
 
 // When there is no disclosed recipients (only bcc), we should address the message to empty group
 // to prevent some mail server to disclose the bcc recipients
 pref("mail.compose.add_undisclosed_recipients", true);
 
 pref("mail.compose.dontWarnMail2Newsgroup", false);