Bug 690644 - Don't specify background and text colors by default when composing a message. r=mkmelin DONTBUILD

This commit is contained in:
Ryan ext:(%20and%20Jorg%20K%20%3Cjorgk%40jorgk.com%3E) 2017-10-19 12:32:22 -07:00
Родитель e4df460a6e
Коммит d5425aa441
5 изменённых файлов: 55 добавлений и 15 удалений

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

@ -6281,26 +6281,23 @@ function AddRecipientsArray(aRecipientType, aAddressArray) {
}
function loadHTMLMsgPrefs() {
var fontFace;
var fontSize;
var textColor;
var bgColor;
try {
fontFace = getPref("msgcompose.font_face", true);
let fontFace = getPref("msgcompose.font_face", true);
doStatefulCommand("cmd_fontFace", fontFace);
} catch (e) {}
try {
fontSize = getPref("msgcompose.font_size");
let fontSize = getPref("msgcompose.font_size");
EditorSetFontSize(fontSize);
} catch (e) {}
var bodyElement = GetBodyElement();
let bodyElement = GetBodyElement();
let useDefault = getPref("msgcompose.default_colors");
try {
textColor = getPref("msgcompose.text_color");
if (!bodyElement.getAttribute("text")) {
let textColor = (useDefault ? "" : getPref("msgcompose.text_color"));
if ((!bodyElement.getAttribute("text")) && textColor) {
bodyElement.setAttribute("text", textColor);
gDefaultTextColor = textColor;
document.getElementById("cmd_fontColor").setAttribute("state", textColor);
@ -6309,8 +6306,8 @@ function loadHTMLMsgPrefs() {
} catch (e) {}
try {
bgColor = getPref("msgcompose.background_color");
if (!bodyElement.getAttribute("bgcolor")) {
let bgColor = (useDefault ? "" : getPref("msgcompose.background_color"));
if ((!bodyElement.getAttribute("bgcolor")) && bgColor) {
bodyElement.setAttribute("bgcolor", bgColor);
gDefaultBackgroundColor = bgColor;
document.getElementById("cmd_backgroundColor").setAttribute("state", bgColor);

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

@ -27,6 +27,7 @@
<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.default_colors" name="msgcompose.default_colors" type="bool"/>
<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"/>
@ -44,6 +45,8 @@
oncommand="gComposePane.updateAutosave();"/>
<command id="cmd_toggleAttachmentCheck"
oncommand="gComposePane.updateAttachmentCheck();"/>
<command id="cmd_toggleUseReaderDefaults"
oncommand="gComposePane.updateUseReaderDefaults();"/>
</commandset>
<tabbox id="composePrefs" flex="1" onselect="gComposePane.tabSelectionChanged();">
@ -135,13 +138,29 @@
<separator class="thin"/>
<hbox align="center">
<label control="textColorButton" value="&fontColor.label;" accesskey="&fontColor.accesskey;"/>
<checkbox id="useReaderDefaults"
label="&useReaderDefaults.label;"
accesskey="&useReaderDefaults.accesskey;"
preference="msgcompose.default_colors"
command="cmd_toggleUseReaderDefaults"/>
</hbox>
<hbox align="center" class="indent">
<label id="textColorLabel"
control="textColorButton"
value="&fontColor.label;"
accesskey="&fontColor.accesskey;"/>
<html:input type="color" id="textColorButton" preference="msgcompose.text_color"/>
<separator orient="vertical" class="thin"/>
<label control="backgroundColorButton" value="&bgColor.label;" accesskey="&bgColor.accesskey;"/>
<label id="backgroundColorLabel"
control="backgroundColorButton"
value="&bgColor.label;"
accesskey="&bgColor.accesskey;"/>
<html:input type="color" id="backgroundColorButton" preference="msgcompose.background_color"/>
</hbox>
<hbox align="center">
<spacer flex="1"/>
<button label="&restoreHTMLDefaults.label;" accesskey="&restoreHTMLDefaults.accesskey;"
<button label="&restoreHTMLDefaults.label;"
accesskey="&restoreHTMLDefaults.accesskey;"
oncommand="gComposePane.restoreHTMLDefaults();"/>
</hbox>

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

@ -19,6 +19,8 @@ var gComposePane = {
this.updateAutosave();
this.updateUseReaderDefaults();
this.updateAttachmentCheck();
this.updateEmailCollection();
@ -58,6 +60,18 @@ var gComposePane = {
document.getElementById("autoSave").checked);
},
updateUseReaderDefaults() {
let useReaderDefaultsChecked = document.getElementById("useReaderDefaults").checked;
this.enableElement(document.getElementById("textColorLabel"),
!useReaderDefaultsChecked);
this.enableElement(document.getElementById("backgroundColorLabel"),
!useReaderDefaultsChecked);
this.enableElement(document.getElementById("textColorButton"),
!useReaderDefaultsChecked);
this.enableElement(document.getElementById("backgroundColorButton"),
!useReaderDefaultsChecked);
},
updateAttachmentCheck() {
this.enableElement(document.getElementById("attachment_reminder_button"),
document.getElementById("attachment_reminder_label").checked);
@ -202,6 +216,11 @@ var gComposePane = {
document.getElementById("msgcompose.background_color").reset();
} catch (ex) {}
try {
document.getElementById("msgcompose.default_colors").reset();
} catch (ex) {}
this.updateUseReaderDefaults();
this.setButtonColors();
},

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

@ -20,6 +20,8 @@
<!ENTITY font.accesskey "n">
<!ENTITY size.label "Size:">
<!ENTITY size.accesskey "z">
<!ENTITY useReaderDefaults.label "Use reader's default colors">
<!ENTITY useReaderDefaults.accesskey "d">
<!ENTITY fontColor.label "Text Color:">
<!ENTITY fontColor.accesskey "T">
<!ENTITY bgColor.label "Background Color:">

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

@ -819,6 +819,9 @@ pref("mailnews.customHeaders", "");
// default msg compose font prefs
pref("msgcompose.font_face", "");
pref("msgcompose.font_size", "medium");
// If true, let the user agent use default colors (don't set text_color and
// background_color on the message body).
pref("msgcompose.default_colors", true);
pref("msgcompose.text_color", "#000000");
pref("msgcompose.background_color", "#FFFFFF");