Bug 1244430 - Disable text encoding menu when no message displayed. r=aceman, a=jorgk
authorJorg K
Sat, 30 Jan 2016 23:16:14 +0100
changeset 26745 0a13d74f0643683502d9d66a67f130ea6296914b
parent 26744 c608661fb128a3dd1c2f45855f0cc0d635fa464c
child 26746 e50dbfeee51dd89901415c1b8ed9069fd70b8427
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, jorgk
bugs1244430
Bug 1244430 - Disable text encoding menu when no message displayed. r=aceman, a=jorgk
mail/base/content/mailWindowOverlay.js
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -260,16 +260,23 @@ function view_init()
           .setAttribute("checked", viewAttachmentInline);
 
   let viewAttachmentInlineMenu =
     document.getElementById("appmenu_viewAttachmentsInlineMenuitem");
   if (viewAttachmentInlineMenu)
     viewAttachmentInlineMenu.setAttribute("checked", viewAttachmentInline);
 
   document.commandDispatcher.updateCommands('create-menu-view');
+
+  // Disable the charset item if there's nothing to enable
+  document.getElementById("charsetMenu")
+          .setAttribute("disabled", !gMessageDisplay.displayedMessage);
+  let appmenuCharset = document.getElementById("appmenu_charsetMenu");
+  if (appmenuCharset)
+    appmenuCharset.setAttribute("disabled", !gMessageDisplay.displayedMessage);
 }
 
 function InitViewLayoutStyleMenu(event)
 {
   var paneConfig = Services.prefs.getIntPref("mail.pane_config.dynamic");
   var layoutStyleMenuitem = event.target.childNodes[paneConfig];
   if (layoutStyleMenuitem)
     layoutStyleMenuitem.setAttribute("checked", "true");