Bug 528793 - Disable "Choose color for text" / "Choose color for background" icons when not in HTML edit mode in message composer. ui-r=bwinton, r=mkmelin
authoraceman <acelists@atlas.sk>
Mon, 04 Feb 2013 13:40:45 -0500
changeset 14789 95e659704cba43670dc9955a056cba55aad61134
parent 14788 ee851cfee5b635cdc4b1bc3e1a36911e89d5125f
child 14790 3c5f1a6215cfe0555e47f9d94d44c8532808e3b6
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton, mkmelin
bugs528793
Bug 528793 - Disable "Choose color for text" / "Choose color for background" icons when not in HTML edit mode in message composer. ui-r=bwinton, r=mkmelin
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/editorOverlay.xul
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -842,16 +842,18 @@ function updateComposeItems()
   try {
     // Edit Menu
     goUpdateCommand("cmd_rewrap");
 
     // Insert Menu
     if (gMsgCompose && gMsgCompose.composeHTML)
     {
       goUpdateCommand("cmd_renderedHTMLEnabler");
+      goUpdateCommand("cmd_fontColor");
+      goUpdateCommand("cmd_backgroundColor");
       goUpdateCommand("cmd_decreaseFont");
       goUpdateCommand("cmd_increaseFont");
       goUpdateCommand("cmd_bold");
       goUpdateCommand("cmd_italic");
       goUpdateCommand("cmd_underline");
       goUpdateCommand("cmd_ul");
       goUpdateCommand("cmd_ol");
       goUpdateCommand("cmd_indent");
--- a/mail/components/compose/content/editorOverlay.xul
+++ b/mail/components/compose/content/editorOverlay.xul
@@ -137,18 +137,18 @@
     <command id="cmd_indent"                          oncommand="goDoCommand('cmd_indent')"/>
     <command id="cmd_outdent"                         oncommand="goDoCommand('cmd_outdent')"/>
 
     <!-- the state attribute gets filled with the paragraph format before the command is exectued -->
     <command id="cmd_paragraphState"  state=""         oncommand="doStatefulCommand('cmd_paragraphState', event.target.value)"/>
     <command id="cmd_fontFace"        state=""         oncommand="doStatefulCommand('cmd_fontFace', event.target.value)"/>
 
     <!-- No "oncommand", use EditorSelectColor() to bring up color dialog -->
-    <command id="cmd_fontColor"       state=""/>
-    <command id="cmd_backgroundColor" state=""/>
+    <command id="cmd_fontColor"       state=""        disabled="false"/>
+    <command id="cmd_backgroundColor" state=""        disabled="false"/>
     <command id="cmd_highlight"       state="transparent"  oncommand="EditorSelectColor('Highlight', event);"/>
 
     <command id="cmd_fontSize"                         oncommand="goDoCommand('cmd_fontSize')"/>
     <command id="cmd_align"           state=""/>
 
     <command id="cmd_absPos"          state=""        oncommand="goDoCommand('cmd_absPos')"/>
     <command id="cmd_increaseZIndex"  state=""        oncommand="goDoCommand('cmd_increaseZIndex')"/>
     <command id="cmd_decreaseZIndex"  state=""        oncommand="goDoCommand('cmd_decreaseZIndex')"/>
@@ -923,23 +923,27 @@
 </toolbaritem>
 
 <toolbaritem id="color-buttons-container"
              class="formatting-button">
   <stack id="ColorButtons" align="center">
     <observes element="cmd_fontColor"       attribute="state" onbroadcast="onFontColorChange()"/>
     <observes element="cmd_backgroundColor" attribute="state" onbroadcast="onBackgroundColorChange()"/>
     <box class="color-button" id="BackgroundColorButton"
-         onclick="if (!gWindowLocked) { EditorSelectColor('', event); }"
+         onclick="if (!this.hasAttribute('disabled')) { EditorSelectColor('', event); }"
          tooltiptext="&BackgroundColorButton.tooltip;"
-         oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */"/>
+         oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */">
+      <observes element="cmd_backgroundColor" attribute="disabled"/>
+    </box>
     <box class="color-button" id="TextColorButton"
-         onclick="if (!gWindowLocked) { EditorSelectColor('Text', event); }"
+         onclick="if (!this.hasAttribute('disabled')) { EditorSelectColor('Text', event); }"
          tooltiptext="&TextColorButton.tooltip;"
-         oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */"/>
+         oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */">
+      <observes element="cmd_fontColor" attribute="disabled"/>
+    </box>
   </stack>
 </toolbaritem>
   <toolbarbutton id="HighlightColorButton"
                  class="formatting-button"
                  tooltiptext="&HighlightColorButton.tooltip;"
                  command="cmd_highlight">
     <observes element="cmd_highlight" attribute="state" onbroadcast="onHighlightColorChange()"/>
     <observes element="cmd_highlight" attribute="collapsed"/>