Bug 677905 - Add menuitem to "show all body parts" (followup to
bug 564423, port
bug 602718) r=IanN sr=Mnyromyr ui-r=Neil
--- a/suite/locales/en-US/chrome/mailnews/messenger.dtd
+++ b/suite/locales/en-US/chrome/mailnews/messenger.dtd
@@ -247,16 +247,18 @@
<!ENTITY bodyMenu.label "Message Body As">
<!ENTITY bodyMenu.accesskey "B">
<!ENTITY bodyAllowHTML.label "Original HTML">
<!ENTITY bodyAllowHTML.accesskey "H">
<!ENTITY bodySanitized.label "Simple HTML">
<!ENTITY bodySanitized.accesskey "S">
<!ENTITY bodyAsPlaintext.label "Plain Text">
<!ENTITY bodyAsPlaintext.accesskey "P">
+<!ENTITY bodyAllParts.label "All Body Parts">
+<!ENTITY bodyAllParts.accesskey "A">
<!ENTITY bodyMenuFeed.label "Feed Message Body As">
<!ENTITY bodyMenuFeed.accesskey "B">
<!ENTITY viewFeedWebPage.label "Web Page">
<!ENTITY viewFeedWebPage.accesskey "W">
<!ENTITY viewFeedSummary.label "Summary">
<!ENTITY viewFeedSummary.accesskey "m">
<!ENTITY viewFeedSummaryFeedPropsPref.label "Default Format">
--- a/suite/mailnews/mailWindowOverlay.js
+++ b/suite/mailnews/mailWindowOverlay.js
@@ -1,9 +1,10 @@
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 sw=2 sts=2 et :*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
@@ -464,17 +465,18 @@ function InitViewHeadersMenu()
function InitViewBodyMenu()
{
var html_as = 0;
var prefer_plaintext = false;
var disallow_classes = 0;
var isFeed = gFolderDisplay.selectedMessageIsFeed;
const defaultIDs = ["bodyAllowHTML",
"bodySanitized",
- "bodyAsPlaintext"];
+ "bodyAsPlaintext",
+ "bodyAllParts"];
const rssIDs = ["bodyFeedSummaryAllowHTML",
"bodyFeedSummarySanitized",
"bodyFeedSummaryAsPlaintext"];
var menuIDs = isFeed ? rssIDs : defaultIDs;
try
{
// Get prefs
if (isFeed) {
@@ -496,26 +498,35 @@ function InitViewBodyMenu()
catch (ex)
{
dump("failed to get the body plaintext vs. HTML prefs\n");
}
var AllowHTML_menuitem = document.getElementById(menuIDs[0]);
var Sanitized_menuitem = document.getElementById(menuIDs[1]);
var AsPlaintext_menuitem = document.getElementById(menuIDs[2]);
+ var AllBodyParts_menuitem;
+ if (!isFeed) {
+ AllBodyParts_menuitem = document.getElementById(menuIDs[3]);
+ AllBodyParts_menuitem.hidden =
+ !pref.getBoolPref("mailnews.display.show_all_body_parts_menu");
+ }
if (!prefer_plaintext && !html_as && !disallow_classes &&
AllowHTML_menuitem)
AllowHTML_menuitem.setAttribute("checked", true);
else if (!prefer_plaintext && html_as == 3 && disallow_classes > 0 &&
Sanitized_menuitem)
Sanitized_menuitem.setAttribute("checked", true);
else if (prefer_plaintext && html_as == 1 && disallow_classes > 0 &&
AsPlaintext_menuitem)
AsPlaintext_menuitem.setAttribute("checked", true);
+ else if (!prefer_plaintext && html_as == 4 && !disallow_classes &&
+ AllBodyParts_menuitem)
+ AllBodyParts_menuitem.setAttribute("checked", true);
// else (the user edited prefs/user.js) check none of the radio menu items
if (isFeed) {
AllowHTML_menuitem.hidden = !gShowFeedSummary;
Sanitized_menuitem.hidden = !gShowFeedSummary;
AsPlaintext_menuitem.hidden = !gShowFeedSummary;
document.getElementById("viewFeedSummarySeparator").hidden = !gShowFeedSummary;
}
@@ -2007,16 +2018,25 @@ function MsgBodyAsPlaintext()
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", true);
gPrefBranch.setIntPref("mailnews.display.html_as", 1);
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers",
disallow_classes_no_html);
ReloadMessage();
return true;
}
+function MsgBodyAllParts()
+{
+ gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", false);
+ gPrefBranch.setIntPref("mailnews.display.html_as", 4);
+ gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers", 0);
+ ReloadMessage();
+ return true;
+}
+
function MsgFeedBodyRenderPrefs(plaintext, html, mime)
{
gPrefBranch.setBoolPref("rss.display.prefer_plaintext", plaintext);
gPrefBranch.setIntPref("rss.display.html_as", html);
gPrefBranch.setIntPref("rss.display.disallow_mime_handlers", mime);
// Reload only if showing rss summary; menuitem hidden if web page..
ReloadMessage();
}
--- a/suite/mailnews/mailWindowOverlay.xul
+++ b/suite/mailnews/mailWindowOverlay.xul
@@ -1283,16 +1283,22 @@
accesskey="&bodySanitized.accesskey;"
oncommand="MsgBodySanitized()"/>
<menuitem id="bodyAsPlaintext"
type="radio"
name="bodyPlaintextVsHTMLPref"
label="&bodyAsPlaintext.label;"
accesskey="&bodyAsPlaintext.accesskey;"
oncommand="MsgBodyAsPlaintext()"/>
+ <menuitem id="bodyAllParts"
+ type="radio"
+ name="bodyPlaintextVsHTMLPref"
+ label="&bodyAllParts.label;"
+ accesskey="&bodyAllParts.accesskey;"
+ oncommand="MsgBodyAllParts();"/>
</menupopup>
</menu>
<menu id="viewFeedSummary"
label="&bodyMenuFeed.label;"
accesskey="&bodyMenuFeed.accesskey;">
<menupopup id="viewFeedSummaryPopupMenu"
onpopupshowing="InitViewBodyMenu()">
<menuitem id="bodyFeedSummaryAllowHTML"