зеркало из https://github.com/mozilla/gecko-dev.git
bug 107877. default font prefs for msg compose. r=neil, brade, sr=sspitzer, jag.
This commit is contained in:
Родитель
6edbe07039
Коммит
13a42d51d1
|
@ -1038,6 +1038,8 @@ function initFontFaceMenu(menuPopup)
|
|||
}
|
||||
}
|
||||
|
||||
const kFixedFontFaceMenuItems = 7; // number of fixed font face menuitems
|
||||
|
||||
function initLocalFontFaceMenu(menuPopup)
|
||||
{
|
||||
if (!gLocalFonts)
|
||||
|
@ -1049,22 +1051,32 @@ function initLocalFontFaceMenu(menuPopup)
|
|||
.getService(Components.interfaces.nsIFontEnumerator);
|
||||
var localFontCount = { value: 0 }
|
||||
gLocalFonts = enumerator.EnumerateAllFonts(localFontCount);
|
||||
for (var i = 0; i < gLocalFonts.length; ++i)
|
||||
{
|
||||
if (gLocalFonts[i] != "")
|
||||
{
|
||||
var itemNode = document.createElementNS(XUL_NS, "menuitem");
|
||||
itemNode.setAttribute("label", gLocalFonts[i]);
|
||||
itemNode.setAttribute("value", gLocalFonts[i]);
|
||||
itemNode.setAttribute("type", "radio");
|
||||
itemNode.setAttribute("name", "2");
|
||||
itemNode.setAttribute("observes", "cmd_renderedHTMLEnabler");
|
||||
menuPopup.appendChild(itemNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e) { }
|
||||
}
|
||||
|
||||
var useRadioMenuitems = (menuPopup.parentNode.localName == "menu"); // don't do this for menulists
|
||||
if (menuPopup.childNodes.length == kFixedFontFaceMenuItems)
|
||||
{
|
||||
if (gLocalFonts.length == 0) {
|
||||
menuPopup.childNodes[kFixedFontFaceMenuItems - 1].hidden = true;
|
||||
}
|
||||
for (var i = 0; i < gLocalFonts.length; ++i)
|
||||
{
|
||||
if (gLocalFonts[i] != "")
|
||||
{
|
||||
var itemNode = document.createElementNS(XUL_NS, "menuitem");
|
||||
itemNode.setAttribute("label", gLocalFonts[i]);
|
||||
itemNode.setAttribute("value", gLocalFonts[i]);
|
||||
if (useRadioMenuitems) {
|
||||
itemNode.setAttribute("type", "radio");
|
||||
itemNode.setAttribute("name", "2");
|
||||
}
|
||||
itemNode.setAttribute("observes", "cmd_renderedHTMLEnabler");
|
||||
menuPopup.appendChild(itemNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1132,7 +1144,7 @@ function initFontSizeMenu(menuPopup)
|
|||
// note that no item is checked in the case of "mixed" selection
|
||||
children[mediumIndex].setAttribute("checked", !sizeWasFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onHighlightColorChange()
|
||||
{
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
<menuitem label="&fontHelveticaFont.label;" value="Helvetica, Arial, sans-serif"/>
|
||||
<menuitem label="&fontTimes.label;" value="Times New Roman, Times, serif"/>
|
||||
<menuitem label="&fontCourier.label;" value="Courier New, Courier, monospace"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
|
|
|
@ -2,16 +2,22 @@
|
|||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE page SYSTEM "chrome://messenger/locale/messengercompose/pref-composing_messages.dtd">
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % pref-composing_messagesDTD SYSTEM "chrome://messenger/locale/messengercompose/pref-composing_messages.dtd" >
|
||||
%pref-composing_messagesDTD;
|
||||
<!ENTITY % editorOverlayDTD SYSTEM "chrome://editor/locale/editorOverlay.dtd" >
|
||||
%editorOverlayDTD;
|
||||
]>
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="parent.initPanel('chrome://messenger/content/messengercompose/pref-composing_messages.xul');"
|
||||
onload="populateFonts();parent.initPanel('chrome://messenger/content/messengercompose/pref-composing_messages.xul');"
|
||||
headertitle="&pane.title;">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var _elementIDs = ["forwardMessageMode", "autoQuote", "replyOnTop", "spellCheckBeforeSend", "strictlyMime",
|
||||
"wrapLength", "sendDefaultCharsetList", "mailWarnOnSendAccelKey"];
|
||||
"wrapLength", "sendDefaultCharsetList", "mailWarnOnSendAccelKey",
|
||||
"FontSelect", "fontSizeSelect", "textColor", "backgroundColor"];
|
||||
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
observerService.notifyObservers(null, "charsetmenu-selected", "mailedit");
|
||||
|
||||
|
@ -20,9 +26,12 @@
|
|||
document.getElementById("spellCheckBeforeSend").hidden =
|
||||
!("@mozilla.org/spellchecker;1" in Components.classes);
|
||||
|
||||
getColorFromWellAndSetValue("textColorButton");
|
||||
getColorFromWellAndSetValue("backgroundColorButton");
|
||||
|
||||
doEnabling();
|
||||
}
|
||||
|
||||
|
||||
function doEnabling()
|
||||
{
|
||||
var quotebox = document.getElementById("thenBox");
|
||||
|
@ -36,6 +45,38 @@
|
|||
quotebox.lastChild.setAttribute("disabled","true");
|
||||
}
|
||||
}
|
||||
|
||||
function setColorWell(aPicker)
|
||||
{
|
||||
var colorRef = aPicker.nextSibling;
|
||||
colorRef.setAttribute( "value", aPicker.color );
|
||||
}
|
||||
|
||||
function getColorFromWellAndSetValue(aPickerId)
|
||||
{
|
||||
var picker = document.getElementById(aPickerId);
|
||||
var colorRef = picker.nextSibling;
|
||||
var color = colorRef.getAttribute("value");
|
||||
picker.color = color;
|
||||
return color;
|
||||
}
|
||||
|
||||
function populateFonts() {
|
||||
var fontsList = document.getElementById("FontSelect");
|
||||
try {
|
||||
var enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
|
||||
.getService(Components.interfaces.nsIFontEnumerator);
|
||||
var localFontCount = { value: 0 }
|
||||
var localFonts = enumerator.EnumerateAllFonts(localFontCount);
|
||||
for (var i = 0; i < localFonts.length; ++i) {
|
||||
if (localFonts[i] != "") {
|
||||
fontsList.appendItem(localFonts[i], localFonts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e) { }
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -109,6 +150,45 @@
|
|||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<groupbox align="start">
|
||||
<caption label="&defaultMessagesHeader.label;"/>
|
||||
<vbox>
|
||||
<hbox align="center">
|
||||
<label value="&font.label;"/>
|
||||
<menulist id="FontSelect" preftype="string" prefstring="msgcompose.font_face">
|
||||
<menupopup>
|
||||
<menuitem value="" label="&fontVarWidth.label;"/>
|
||||
<menuitem value="tt" label="&fontFixedWidth.label;"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="Helvetica, Arial, sans-serif" label="&fontHelveticaFont.label;"/>
|
||||
<menuitem value="Times New Roman, Times, serif" label="&fontTimes.label;"/>
|
||||
<menuitem value="Courier New, Courier, monospace" label="&fontCourier.label;"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<label value="&size.label;"/>
|
||||
<menulist id="fontSizeSelect" preftype="string" prefstring="msgcompose.font_size">
|
||||
<menupopup>
|
||||
<menuitem value="x-small" label="&size-x-smallCmd.label;"/>
|
||||
<menuitem value="small" label="&size-smallCmd.label;"/>
|
||||
<menuitem value="medium" label="&size-mediumCmd.label;"/>
|
||||
<menuitem value="large" label="&size-largeCmd.label;"/>
|
||||
<menuitem value="x-large" label="&size-x-largeCmd.label;"/>
|
||||
<menuitem value="xx-large" label="&size-xx-largeCmd.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<label value="&fontColor.label;"/>
|
||||
<colorpicker type="button" id="textColorButton" onchange="setColorWell(this)"/>
|
||||
<data id="textColor" preftype="color" prefstring="msgcompose.text_color" prefattribute="value" wsm_attributes="value"/>
|
||||
<label value="&bgColor.label;"/>
|
||||
<colorpicker type="button" id="backgroundColorButton" onchange="setColorWell(this)"/>
|
||||
<data id="backgroundColor" preftype="color" prefstring="msgcompose.background_color" prefattribute="value" wsm_attributes="value"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
||||
<!--
|
||||
<groupbox align="start">
|
||||
<caption label="&languages.label;"/>
|
||||
|
|
|
@ -66,4 +66,10 @@ Rights Reserved.
|
|||
<!ENTITY languagesTitle.label "Languages">
|
||||
<!ENTITY languagesText.label "Use the following character coding as the default for composing messages:">
|
||||
|
||||
<!ENTITY defaultMessagesHeader.label "Defaults for HTML Messages">
|
||||
<!ENTITY font.label "Font:">
|
||||
<!ENTITY size.label "Size:">
|
||||
<!ENTITY fontColor.label "Text:">
|
||||
<!ENTITY bgColor.label "Background:">
|
||||
|
||||
<!-- Tooltips -->
|
||||
|
|
|
@ -1103,6 +1103,11 @@ function ComposeFieldsReady(msgType)
|
|||
}
|
||||
CompFields2Recipients(gMsgCompose.compFields, gMsgCompose.type);
|
||||
SetComposeWindowTitle();
|
||||
|
||||
// need timeout for reply to work
|
||||
if (gMsgCompose.composeHTML)
|
||||
setTimeout("loadHTMLMsgPrefs();", 0);
|
||||
|
||||
enableEditableFields();
|
||||
AdjustFocus();
|
||||
}
|
||||
|
@ -1230,8 +1235,14 @@ function ComposeStartup(recycled, aParams)
|
|||
document.getElementById("insertMenu").setAttribute("hidden", true);
|
||||
document.getElementById("menu_showFormatToolbar").setAttribute("hidden", true);
|
||||
}
|
||||
|
||||
if (gMsgCompose.composeHTML) {
|
||||
var fontsList = document.getElementById("FontFacePopup");
|
||||
initLocalFontFaceMenu(fontsList);
|
||||
}
|
||||
|
||||
// Do setup common to Message Composer and Web Composer
|
||||
EditorSharedStartup();
|
||||
EditorSharedStartup();
|
||||
}
|
||||
|
||||
var msgCompFields = gMsgCompose.compFields;
|
||||
|
@ -1274,6 +1285,7 @@ function ComposeStartup(recycled, aParams)
|
|||
// Force color picker on toolbar to show document colors
|
||||
onFontColorChange();
|
||||
onBackgroundColorChange();
|
||||
// XXX todo: reset paragraph select to "Body Text"
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2828,3 +2840,44 @@ function SwitchElementFocus(event)
|
|||
SetMsgAddressingWidgetTreeElementFocus();
|
||||
}
|
||||
}
|
||||
|
||||
function loadHTMLMsgPrefs() {
|
||||
var pref = GetPrefs();
|
||||
|
||||
var fontFace;
|
||||
var fontSize;
|
||||
var textColor;
|
||||
var bgColor;
|
||||
|
||||
try {
|
||||
fontFace = pref.getCharPref("msgcompose.font_face");
|
||||
doStatefulCommand('cmd_fontFace', fontFace);
|
||||
EditorRemoveTextProperty("font","face");
|
||||
EditorSetTextProperty("font", "face", fontFace);
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
fontSize = pref.getCharPref("msgcompose.font_size");
|
||||
EditorSetFontSize(fontSize);
|
||||
} catch (e) {}
|
||||
|
||||
var bodyElement = GetBodyElement();
|
||||
|
||||
try {
|
||||
textColor = pref.getCharPref("msgcompose.text_color");
|
||||
bodyElement.setAttribute("text", textColor);
|
||||
gDefaultTextColor = textColor;
|
||||
document.getElementById("cmd_fontColor").setAttribute("state", textColor);
|
||||
onFontColorChange();
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
bgColor = pref.getCharPref("msgcompose.background_color");
|
||||
bodyElement.setAttribute("bgcolor", bgColor);
|
||||
gDefaultBackgroundColor = bgColor;
|
||||
document.getElementById("cmd_backgroundColor").setAttribute("state", bgColor);
|
||||
onBackgroundColorChange();
|
||||
} catch (e) {}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -509,6 +509,12 @@ pref("mailnews.fakeaccount.server", "");
|
|||
pref("mailnews.message_display.disable_remote_image", false);
|
||||
pref("mailnews.message_display.allow.plugins", true);
|
||||
|
||||
// default msg compose font prefs
|
||||
pref("msgcompose.font_face", "");
|
||||
pref("msgcompose.font_size", "medium");
|
||||
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);
|
||||
|
|
|
@ -509,6 +509,12 @@ pref("mailnews.fakeaccount.server", "");
|
|||
pref("mailnews.message_display.disable_remote_image", false);
|
||||
pref("mailnews.message_display.allow.plugins", true);
|
||||
|
||||
// default msg compose font prefs
|
||||
pref("msgcompose.font_face", "");
|
||||
pref("msgcompose.font_size", "medium");
|
||||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче