Bug 1265126 - fix printing of compose window and special tabs by using PrintUtils.printWindow(). r=jorgk
authoraceman <acelists@atlas.sk>
Sat, 16 Apr 2016 11:18:00 +0200
changeset 25518 063b70df9e016a106a50050e10eb8c59eddfb7c2
parent 25517 c2fcaef65a804f806f3551bca1537439c6ec4ad2
child 25519 398d0dcc371b649081177915bcfa6265044953de
push id300
push userclokep@gmail.com
push dateMon, 01 Aug 2016 16:37:12 +0000
reviewersjorgk
bugs1265126
Bug 1265126 - fix printing of compose window and special tabs by using PrintUtils.printWindow(). r=jorgk
mail/base/content/specialTabs.js
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -420,17 +420,18 @@ var contentTabBaseType = {
         break;
       case "cmd_findPrevious":
         aTab.findbar.onFindAgainCommand(true);
         break;
       case "cmd_printSetup":
         PrintUtils.showPageSetup();
         break;
       case "cmd_print":
-        PrintUtils.print();
+        let browser = this.getBrowser(aTab);
+        PrintUtils.printWindow(browser.outerWindowID, browser);
         break;
       // XXX print preview not currently supported - bug 497994 to implement.
       //case "cmd_printpreview":
       //  PrintUtils.printPreview();
       //  break;
       case "cmd_stop":
         aTab.browser.stop();
         break;
@@ -1143,17 +1144,18 @@ var specialTabs = {
           break;
         case "cmd_fullZoomToggle":
           ZoomManager.toggleZoom();
           break;
         case "cmd_printSetup":
           PrintUtils.showPageSetup();
           break;
         case "cmd_print":
-          PrintUtils.print();
+          let browser = this.getBrowser(aTab);
+          PrintUtils.printWindow(browser.outerWindowID, browser);
           break;
         // XXX print preview not currently supported - bug 497994 to implement.
         //case "cmd_printpreview":
         //  PrintUtils.printPreview();
         //  break;
       }
     },
     getBrowser: function getBrowser(aTab) {
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -1592,17 +1592,18 @@ function DoCommandClose()
   }
 
   return false;
 }
 
 function DoCommandPrint()
 {
   try {
-    PrintUtils.print();
+    let editor = GetCurrentEditorElement();
+    PrintUtils.printWindow(editor.outerWindowID, editor);
   } catch(ex) {dump("#PRINT ERROR: " + ex + "\n");}
 }
 
 function DoCommandPrintPreview()
 {
   try {
     PrintUtils.printPreview(PrintPreviewListener);
     } catch(ex) { Components.utils.reportError(ex); }