Bug 611458 - Add Ability to Print Summary of Collapsed Threads in Message Pane r=squib
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -334,17 +334,16 @@ var DefaultController =
case "button_replylist":
case "cmd_forward":
case "button_forward":
case "cmd_forwardInline":
case "cmd_forwardAttachment":
case "cmd_editAsNew":
case "cmd_openMessage":
case "button_print":
- case "cmd_print":
case "cmd_viewPageSource":
case "cmd_reload":
case "cmd_applyFiltersToSelection":
let numSelected = GetNumSelectedMessages();
if (command == "cmd_applyFiltersToSelection")
{
var whichText = "valueMessage";
if (numSelected > 1)
@@ -353,36 +352,39 @@ var DefaultController =
goSetAccessKey(command, whichText + "AccessKey");
}
if (numSelected > 0)
{
if (!gFolderDisplay.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody))
return false;
// Check if we have a collapsed thread selected and are summarizing it.
- // If so, selectedIndices.length won't match numSelected. Also check
- // that we're not displaying a message, which handles the case
- // where we failed to summarize the selection and fell back to
+ // Also check that we're not displaying a message, which handles the
+ // case where we failed to summarize the selection and fell back to
// displaying a message.
- if (gFolderDisplay.selectedIndices.length != numSelected &&
- command != "cmd_applyFiltersToSelection" &&
- gDBView && gDBView.currentlyDisplayedMessage == nsMsgViewIndex_None)
+ if (!gMessageDisplay.singleMessageDisplay && command != "cmd_applyFiltersToSelection")
return false;
if (command == "cmd_reply" || command == "button_reply" ||
command == "cmd_replyall" ||command == "button_replyall")
return IsReplyEnabled();
if (command == "cmd_replylist" || command == "button_replylist")
return IsReplyListEnabled();
return true;
}
return false;
+ case "cmd_print":
+ // We can print both a single message and a thread summary
+ return (GetNumSelectedMessages() > 0);
case "cmd_printpreview":
- if (GetNumSelectedMessages() == 1)
+ if (!gMessageDisplay.singleMessageDisplay)
+ return false;
+ else if (GetNumSelectedMessages() == 1)
return gFolderDisplay.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody);
- return false;
+ else
+ return false;
case "cmd_printSetup":
case "cmd_viewAllHeader":
case "cmd_viewNormalHeader":
return true;
case "cmd_markAsFlagged":
case "button_file":
return GetNumSelectedMessages() > 0;
case "cmd_archive":
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -2220,18 +2220,22 @@ function PrintEnginePrintInternal(doPrin
window.openDialog("chrome://messenger/content/msgPrintEngine.xul", "",
"chrome,dialog=no,all,centerscreen",
messageList.length, messageList, statusFeedback,
doPrintPreview, msgType, window);
}
function PrintEnginePrint()
{
- return PrintEnginePrintInternal(false,
- Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);
+ if (gMessageDisplay.singleMessageDisplay)
+ return PrintEnginePrintInternal(false,
+ Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);
+ else
+ return document.getElementById("multimessage")
+ .contentWindow.print();
}
function PrintEnginePrintPreview()
{
return PrintEnginePrintInternal(true,
Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
}
--- a/mail/base/content/multimessageview.xhtml
+++ b/mail/base/content/multimessageview.xhtml
@@ -49,19 +49,21 @@
%startDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<link rel="stylesheet" media="screen" type="text/css"
href="chrome://messenger/skin/messageHeader.css"/>
- <link rel="stylesheet" media="screen" type="text/css"
+ <link rel="stylesheet" media="screen, print" type="text/css"
href="chrome://messenger/skin/multimessageview.css"/>
- <link rel="stylesheet" media="screen" type="text/css"
+ <link rel="stylesheet" media="print" type="text/css"
+ href="chrome://messenger/content/multimessageview_print.css"/>
+ <link rel="stylesheet" media="screen, print" type="text/css"
href="chrome://messenger/skin/tagColors.css"/>
<title>&window.title;</title>
<script type="application/javascript;version=1.8"><![CDATA[
Components.utils.import("resource:///modules/errUtils.js");
function adjustHeadingSize() {
let content = document.getElementById('content');
let heading = document.getElementById('heading');
let buttonbox = document.getElementById('buttonbox');
new file mode 100644
--- /dev/null
+++ b/mail/base/content/multimessageview_print.css
@@ -0,0 +1,49 @@
+/* ***** 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/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Thunderbird print stylesheet for the multimessage pane
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Jonathan Protzenko <jonathan.protzenko@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#buttonbox {
+ display: none;
+}
+
+.heading {
+ font-size: large;
+ margin-bottom: .3em;
+}
+
+#headingwrappertable {
+ position: static;
+}
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -93,16 +93,17 @@ messenger.jar:
content/messenger/threadPaneColumnPicker.xml (content/threadPaneColumnPicker.xml)
content/messenger/protovis-r2.6-modded.js (content/protovis-r2.6-modded.js)
#ifdef XP_MACOSX
content/messenger/macMenuOverlay.xul (content/macMenuOverlay.xul)
#endif
* content/messenger/baseMenuOverlay.xul (content/baseMenuOverlay.xul)
content/messenger/selectionsummaries.js (content/selectionsummaries.js)
content/messenger/multimessageview.css (content/multimessageview.css)
+ content/messenger/multimessageview_print.css (content/multimessageview_print.css)
content/messenger/sharedsummary.css (content/sharedsummary.css)
content/messenger/multimessageview.xhtml (content/multimessageview.xhtml)
content/messenger/glodaFacetTab.js (content/glodaFacetTab.js)
content/messenger/glodaFacetViewWrapper.xul (content/glodaFacetViewWrapper.xul)
content/messenger/glodaFacetView.xhtml (content/glodaFacetView.xhtml)
content/messenger/glodaFacetView.js (content/glodaFacetView.js)
content/messenger/glodaFacetView.css (content/glodaFacetView.css)
content/messenger/glodaFacetBindings.css (content/glodaFacetBindings.css)