Bug 760644 - Add DSN option to composing Options menu.
authorEdmund Wong <ewong@pw-wspx.org>
Mon, 18 Jun 2012 09:24:11 +0800
changeset 10458 d4e85c946f4c1a427e8f9fcd1365e2b66213fd8f
parent 10457 e692284d13dcc2bc613ec9499a216f864d4aaa79
child 10459 cff415a502cb6bdea2eb994d00741ea9426a1665
push id7910
push userewong@pw-wspx.org
push dateMon, 18 Jun 2012 01:27:52 +0000
treeherdercomm-central@d4e85c946f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs760644
Bug 760644 - Add DSN option to composing Options menu.
suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd
suite/mailnews/compose/MsgComposeCommands.js
suite/mailnews/compose/messengercompose.xul
--- a/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd
+++ b/suite/locales/en-US/chrome/mailnews/compose/messengercompose.dtd
@@ -78,16 +78,19 @@
 <!ENTITY normalPriorityCmd.accesskey "n">
 <!ENTITY highPriorityCmd.label "High">
 <!ENTITY highPriorityCmd.accesskey "i">
 <!ENTITY highestPriorityCmd.label "Highest">
 <!ENTITY highestPriorityCmd.accesskey "H">
 
 <!ENTITY returnReceiptMenu.label "Return Receipt">
 <!ENTITY returnReceiptMenu.accesskey "t">
+<!ENTITY dsnMenu.label "Delivery Status Notification">
+<!ENTITY dsnMenu.accesskey "N">
+
 <!ENTITY outputFormatMenu.label "Format">
 <!ENTITY outputFormatMenu.accesskey  "f">
 <!ENTITY autoFormatCmd.label "Auto-Detect">
 <!ENTITY autoFormatCmd.accesskey "a">
 <!ENTITY plainTextFormatCmd.label "Plain Text Only">
 <!ENTITY plainTextFormatCmd.accesskey "p">
 <!ENTITY htmlFormatCmd.label "Rich Text (HTML) Only">
 <!ENTITY htmlFormatCmd.accesskey "r">
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -72,16 +72,17 @@ var gMsgHeadersToolbarElement;
 
 // i18n globals
 var gSendDefaultCharset;
 var gCharsetTitle;
 var gCharsetConvertManager;
 
 var gLastWindowToHaveFocus;
 var gReceiptOptionChanged;
+var gDSNOptionChanged;
 var gAttachVCardOptionChanged;
 
 var gMailSession;
 var gAutoSaveInterval;
 var gAutoSaveTimeout;
 var gAutoSaveKickedIn;
 var gEditingDraft;
 
@@ -111,16 +112,17 @@ function InitializeGlobalVariables()
   gMailSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService(Components.interfaces.nsIMsgMailSession);
   gHideMenus = false;
   // We are storing the value of the bool logComposePerformance inorder to avoid logging unnecessarily.
   if (sMsgComposeService)
     gLogComposePerformance = sMsgComposeService.logComposePerformance;
 
   gLastWindowToHaveFocus = null;
   gReceiptOptionChanged = false;
+  gDSNOptionChanged = false;
   gAttachVCardOptionChanged = false;
 }
 InitializeGlobalVariables();
 
 function ReleaseGlobalVariables()
 {
   gAccountManager = null;
   gCurrentIdentity = null;
@@ -1307,16 +1309,18 @@ function ComposeStartup(recycled, aParam
       if (!editorElement)
       {
         dump("Failed to get editor element!\n");
         return;
       }
 
       document.getElementById("returnReceiptMenu")
               .setAttribute("checked", gMsgCompose.compFields.returnReceipt);
+      document.getElementById("dsnMenu")
+              .setAttribute('checked', gMsgCompose.compFields.DSN);
       document.getElementById("cmd_attachVCard")
               .setAttribute("checked", gMsgCompose.compFields.attachVCard);
       document.getElementById("menu_inlineSpellCheck")
               .setAttribute("checked", getPref("mail.spellcheck.inline"));
 
       // If recycle, editor is already created
       if (!recycled)
       {
@@ -2196,16 +2200,28 @@ function ToggleReturnReceipt(target)
     if (msgCompFields)
     {
         msgCompFields.returnReceipt = ! msgCompFields.returnReceipt;
         target.setAttribute('checked', msgCompFields.returnReceipt);
         gReceiptOptionChanged = true;
     }
 }
 
+function ToggleDSN(target)
+{
+  var msgCompFields = gMsgCompose.compFields;
+
+  if (msgCompFields)
+  {
+    msgCompFields.DSN = !msgCompFields.DSN;
+    target.setAttribute('checked', msgCompFields.DSN);
+    gDSNOptionChanged = true;
+  }
+}
+
 function ToggleAttachVCard(target)
 {
   var msgCompFields = gMsgCompose.compFields;
   if (msgCompFields)
   {
     msgCompFields.attachVCard = ! msgCompFields.attachVCard;
     target.setAttribute('checked', msgCompFields.attachVCard);
     gAttachVCardOptionChanged = true;
@@ -2820,28 +2836,30 @@ function LoadIdentity(startup)
         if (!startup && prevIdentity && idKey != prevIdentity.key)
         {
           var prefstring = "mail.identity." + prevIdentity.key;
           RemoveDirectoryServerObserver(prefstring);
           var prevReplyTo = prevIdentity.replyTo;
           var prevCc = "";
           var prevBcc = "";
           var prevReceipt = prevIdentity.requestReturnReceipt;
+          var prevDSN = prevIdentity.requestDSN;
           var prevAttachVCard = prevIdentity.attachVCard;
 
           if (prevIdentity.doCc)
             prevCc += prevIdentity.doCcList;
 
           if (prevIdentity.doBcc)
             prevBcc += prevIdentity.doBccList;
 
           var newReplyTo = gCurrentIdentity.replyTo;
           var newCc = "";
           var newBcc = "";
           var newReceipt = gCurrentIdentity.requestReturnReceipt;
+          var newDSN = gCurrentIdentity.requestDSN;
           var newAttachVCard = gCurrentIdentity.attachVCard;
 
           if (gCurrentIdentity.doCc)
             newCc += gCurrentIdentity.doCcList;
 
           if (gCurrentIdentity.doBcc)
             newBcc += gCurrentIdentity.doBccList;
 
@@ -2851,16 +2869,24 @@ function LoadIdentity(startup)
           if (!gReceiptOptionChanged &&
               prevReceipt == msgCompFields.returnReceipt &&
               prevReceipt != newReceipt)
           {
             msgCompFields.returnReceipt = newReceipt;
             document.getElementById("returnReceiptMenu").setAttribute('checked',msgCompFields.returnReceipt);
           }
 
+          if (!gDSNOptionChanged &&
+              prevDSN == msgCompFields.DSN &&
+              prevDSN != newDSN)
+          {
+            msgCompFields.DSN = newDSN;
+            document.getElementById("dsnMenu").setAttribute('checked',msgCompFields.DSN);
+          }
+
           if (!gAttachVCardOptionChanged &&
               prevAttachVCard == msgCompFields.attachVCard &&
               prevAttachVCard != newAttachVCard)
           {
             msgCompFields.attachVCard = newAttachVCard;
             document.getElementById("cmd_attachVCard").setAttribute('checked',msgCompFields.attachVCard);
           }
 
--- a/suite/mailnews/compose/messengercompose.xul
+++ b/suite/mailnews/compose/messengercompose.xul
@@ -322,16 +322,22 @@
                         command="cmd_quoteMessage"/>
               <menuseparator id="menuOptionsAfterQuoteSeparator"/>
               <menuitem id="returnReceiptMenu"
                         type="checkbox"
                         label="&returnReceiptMenu.label;"
                         accesskey="&returnReceiptMenu.accesskey;"
                         checked="false"
                         oncommand="ToggleReturnReceipt(event.target)"/>
+              <menuitem id="dsnMenu"
+                        type="checkbox"
+                        label="&dsnMenu.label;"
+                        accesskey="&dsnMenu.accesskey;"
+                        checked="false"
+                        oncommand="ToggleDSN(event.target);"/>
               <menu id="outputFormatMenu"
                     label="&outputFormatMenu.label;"
                     accesskey="&outputFormatMenu.accesskey;"
                     command="cmd_outputFormat">
                 <menupopup id="outputFormatMenuPopup">
                   <menuitem id="format_auto"  type="radio" name="output_format" label="&autoFormatCmd.label;"      accesskey="&autoFormatCmd.accesskey;" checked="true"/>
                   <menuitem id="format_plain" type="radio" name="output_format" label="&plainTextFormatCmd.label;" accesskey="&plainTextFormatCmd.accesskey;"/>
                   <menuitem id="format_html"  type="radio" name="output_format" label="&htmlFormatCmd.label;"      accesskey="&htmlFormatCmd.accesskey;"/>