Bug 445011 – Migrate MailNews Return Receipts to the new prefwindow
authorIan Neal <iann_cvs@blueyonder.co.uk>
Fri, 01 Aug 2008 23:55:29 +0100
changeset 53 74b5b7c1efcea0241c59b7168b2239d625d8e90a
parent 52 4a777e17bf3005264042c2000f537b3bd284f715
child 54 647ef8ec48969c4490302ba963c924b67facc8fe
push idunknown
push userunknown
push dateunknown
bugs445011
Bug 445011 – Migrate MailNews Return Receipts to the new prefwindow p=me r/sr=neil
mailnews/base/prefs/resources/content/mailPrefsOverlay.xul
mailnews/base/prefs/resources/content/pref-receipts.js
mailnews/base/prefs/resources/content/pref-receipts.xul
--- a/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul
+++ b/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul
@@ -71,16 +71,21 @@
                   prefpane="viewing_messages_pane"
                   url="chrome://messenger/content/pref-viewing_messages.xul"
                   helpTopic="mail_prefs_display"/>
         <treeitem id="tagsItem"
                   label="&tags.label;"
                   prefpane="tags_pane"
                   url="chrome://messenger/content/pref-tags.xul"
                   helpTopic="mail-prefs-tags"/>
+        <treeitem id="receiptsItem"
+                  label="&return.label;"
+                  prefpane="receipts_pane"
+                  url="chrome://messenger/content/pref-receipts.xul"
+                  helpTopic="mail-prefs-receipts"/>
         <treeitem id="offlineItem"
                   label="&offline.label;"
                   prefpane="offline_pane"
                   url="chrome://messenger/content/pref-offline.xul"
                   helpTopic="mail_prefs_offline"/>
       </treechildren>
     </treeitem>
   </treechildren>
@@ -125,17 +130,17 @@
         </treeitem>
         <treeitem id="mailtagspref">
           <treerow>
             <treecell label="(Migrated: &tags.label;)"/>
           </treerow>
         </treeitem>
         <treeitem>
           <treerow>
-            <treecell url="chrome://messenger/content/pref-receipts.xul" label="&return.label;"/>
+            <treecell label="(Migrated: &return.label;)"/>
           </treerow>
         </treeitem>
         <treeitem>
           <treerow>
             <treecell url="chrome://messenger/content/pref-character_encoding.xul" label="&characterEncoding.label;"/> 
           </treerow>
         </treeitem>
         <treeitem>
--- a/mailnews/base/prefs/resources/content/pref-receipts.js
+++ b/mailnews/base/prefs/resources/content/pref-receipts.js
@@ -30,45 +30,31 @@
  * 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 ***** */
 
-var receiptSend;
-var notInToCcPref;
-var notInToCcLabel;
-var outsideDomainPref;
-var outsideDomainLabel;
-var otherCasesPref;
-var otherCasesLabel;
+var gNotInToCcLabel;
+var gOutsideDomainLabel;
+var gOtherCasesLabel;
 
-function Startup() {
-  receiptSend = document.getElementById("receiptSend");
-  notInToCcPref = document.getElementById("notInToCcPref");
-  notInToCcLabel = document.getElementById("notInToCcLabel");
-  outsideDomainPref = document.getElementById("outsideDomainPref");
-  outsideDomainLabel = document.getElementById("outsideDomainLabel");
-  otherCasesPref = document.getElementById("otherCasesPref");
-  otherCasesLabel = document.getElementById("otherCasesLabel");
+function Startup()
+{
+  gNotInToCcLabel = document.getElementById("notInToCcLabel");
+  gOutsideDomainLabel = document.getElementById("outsideDomainLabel");
+  gOtherCasesLabel = document.getElementById("otherCasesLabel");
 
-  EnableDisableAllowedReceipts();
-        
-  return true;
+  var value = document.getElementById("mail.mdn.report.enabled").value;
+  EnableDisableAllowedReceipts(value);
 }
 
-function EnableDisableAllowedReceipts() {
-  var prefWindow = parent.hPrefWindow;
-  var notInToCcLocked = prefWindow.getPrefIsLocked("mail.mdn.report.not_in_to_cc");
-  var outsideDomainLocked = prefWindow.getPrefIsLocked("mail.mdn.report.outside_domain");
-  var otherCasesLocked = prefWindow.getPrefIsLocked("mail.mdn.report.other");
-
-  var disableAll = receiptSend && (receiptSend.getAttribute("value") == "false");
-  notInToCcPref.disabled = disableAll || notInToCcLocked;
-  notInToCcLabel.disabled = disableAll;
-  outsideDomainPref.disabled = disableAll || outsideDomainLocked;
-  outsideDomainLabel.disabled = disableAll;
-  otherCasesPref.disabled = disableAll || otherCasesLocked;
-  otherCasesLabel.disabled = disableAll;
-  return true;
+function EnableDisableAllowedReceipts(aEnable)
+{
+  EnableElementById("notInToCcPref", aEnable, false);
+  EnableElementById("outsideDomainPref", aEnable, false);
+  EnableElementById("otherCasesPref", aEnable, false);
+  gNotInToCcLabel.disabled = !aEnable;
+  gOutsideDomainLabel.disabled = !aEnable;
+  gOtherCasesLabel.disabled = !aEnable;
 }
--- a/mailnews/base/prefs/resources/content/pref-receipts.xul
+++ b/mailnews/base/prefs/resources/content/pref-receipts.xul
@@ -32,98 +32,139 @@
    - 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 ***** -->
 
 
 <?xml-stylesheet href="chrome://messenger/skin/prefPanels.css" type="text/css"?>
 
-<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
-<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
-
-<!DOCTYPE page SYSTEM "chrome://messenger/locale/pref-receipts.dtd">
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://messenger/content/pref-receipts.xul');"
-      headertitle="&pref.receipts.title;">
+<!DOCTYPE overlay SYSTEM "chrome://messenger/locale/pref-receipts.dtd">
 
-  <script type="application/x-javascript">
-  <![CDATA[
-    var _elementIDs = ["alwaysRequest", "receiptFolder", "receiptSend", "notInToCcPref", "outsideDomainPref", "otherCasesPref"];
-    ]]>
-  </script>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <prefpane id="receipts_pane"
+            label="&pref.receipts.title;"
+            script="chrome://messenger/content/pref-receipts.js">
+    <preferences id="receipts_preferences">
+      <preference id="mail.receipt.request_return_receipt_on"
+                  name="mail.receipt.request_return_receipt_on"
+                  type="bool"/>
+      <preference id="mail.incorporate.return_receipt"
+                  name="mail.incorporate.return_receipt"
+                  type="int"/>
+      <preference id="mail.mdn.report.enabled"
+                  name="mail.mdn.report.enabled"
+                  type="bool"
+                  onchange="EnableDisableAllowedReceipts(this.value);"/>
+      <preference id="mail.mdn.report.not_in_to_cc"
+                  name="mail.mdn.report.not_in_to_cc"
+                  type="int"/>
+      <preference id="mail.mdn.report.outside_domain"
+                  name="mail.mdn.report.outside_domain"
+                  type="int"/>
+      <preference id="mail.mdn.report.other"
+                  name="mail.mdn.report.other"
+                  type="int"/>
+    </preferences>
 
-  <script type="application/x-javascript" src="chrome://messenger/content/pref-receipts.js"/>
-
+    <groupbox>
+      <caption label="&prefReceipts.caption;"/>
 
-  <groupbox>
-    <caption label="&prefReceipts.caption;"/>
-
-    <vbox id="returnReceiptSettings" align="start">
-      <checkbox id="alwaysRequest" label="&requestReceipt.label;"
-                prefstring="mail.receipt.request_return_receipt_on"
-                accesskey="&requestReceipt.accesskey;"/>
+      <vbox id="returnReceiptSettings" align="start">
+        <checkbox id="alwaysRequest"
+                  label="&requestReceipt.label;"
+                  accesskey="&requestReceipt.accesskey;"
+                  preference="mail.receipt.request_return_receipt_on"/>
 
-      <vbox id="receiptArrive">
-        <label control="receiptFolder">&receiptArrive.label;</label>
-        <radiogroup id="receiptFolder" prefstring="mail.incorporate.return_receipt">
-          <radio value="0" label="&leaveIt.label;" accesskey="&leaveIt.accesskey;"/>
-          <radio value="1" label="&moveToSent.label;" accesskey="&moveToSent.accesskey;"/> 
-        </radiogroup>
-      </vbox>
+        <vbox id="receiptArrive">
+          <label control="receiptFolder">&receiptArrive.label;</label>
+          <radiogroup id="receiptFolder"
+                      preference="mail.incorporate.return_receipt">
+            <radio value="0"
+                   label="&leaveIt.label;"
+                   accesskey="&leaveIt.accesskey;"/>
+            <radio value="1"
+                   label="&moveToSent.label;"
+                   accesskey="&moveToSent.accesskey;"/>
+          </radiogroup>
+        </vbox>
 
-      <vbox id="receiptRequest">
-        <label control="receiptSend">&requestMDN.label;</label>
-        <radiogroup id="receiptSend" preftype="bool" prefstring="mail.mdn.report.enabled" oncommand="EnableDisableAllowedReceipts();">
-          <radio value="false" label="&never.label;" accesskey="&never.accesskey;"/>
-          <radio value="true" label="&returnSome.label;" accesskey="&returnSome.accesskey;"/> 
-        </radiogroup>
+        <vbox id="receiptRequest">
+          <label control="receiptSend">&requestMDN.label;</label>
+          <radiogroup id="receiptSend"
+                      preference="mail.mdn.report.enabled">
+            <radio value="false"
+                   label="&never.label;"
+                   accesskey="&never.accesskey;"/>
+            <radio value="true"
+                   label="&returnSome.label;"
+                   accesskey="&returnSome.accesskey;"/>
+          </radiogroup>
 
-        <hbox id="receiptSendIf" class="indent">
-          <grid>
-            <columns><column/><column/></columns>
-            <rows>
-              <row align="center">
-                <label id="notInToCcLabel" accesskey="&notInToCc.accesskey;" 
-                       control="notInToCcPref" value="&notInToCc.label;"/>
-                <menulist id="notInToCcPref" prefstring="mail.mdn.report.not_in_to_cc">
-                  <menupopup>
-                    <menuitem value="0" label="&neverSend.label;"/>
-                    <menuitem value="1" label="&alwaysSend.label;"/>
-                    <menuitem value="2" label="&askMe.label;"/>
-                  </menupopup>
-                </menulist>
-              </row>
-              <row align="center">
-                <label id="outsideDomainLabel" accesskey="&outsideDomain.accesskey;"
-                       control="outsideDomainPref" value="&outsideDomain.label;"/>
-                <menulist id="outsideDomainPref" prefstring="mail.mdn.report.outside_domain">
-                  <menupopup>
-                    <menuitem value="0" label="&neverSend.label;"/>
-                    <menuitem value="1" label="&alwaysSend.label;"/>
-                    <menuitem value="2" label="&askMe.label;"/>
-                  </menupopup>
-                </menulist>
-              </row>
-              <row align="center">
-                <label id="otherCasesLabel" accesskey="&otherCases.accesskey;" control="otherCasesPref"
-                       value="&otherCases.label;"/>
-                <menulist id="otherCasesPref" prefstring="mail.mdn.report.other">
-                  <menupopup>
-                    <menuitem value="0" label="&neverSend.label;"/>
-                    <menuitem value="1" label="&alwaysSend.label;"/>
-                    <menuitem value="2" label="&askMe.label;"/>
-                  </menupopup>
-                </menulist>
-              </row>
-            </rows>
-          </grid>
-        </hbox>
+          <hbox id="receiptSendIf" class="indent">
+            <grid>
+              <columns>
+                <column/>
+                <column/>
+              </columns>
+              <rows>
+                <row align="center">
+                  <label id="notInToCcLabel"
+                         accesskey="&notInToCc.accesskey;"
+                         control="notInToCcPref"
+                         value="&notInToCc.label;"/>
+                  <menulist id="notInToCcPref"
+                            preference="mail.mdn.report.not_in_to_cc">
+                    <menupopup>
+                      <menuitem value="0"
+                                label="&neverSend.label;"/>
+                      <menuitem value="1"
+                                label="&alwaysSend.label;"/>
+                      <menuitem value="2"
+                                label="&askMe.label;"/>
+                    </menupopup>
+                  </menulist>
+                </row>
+                <row align="center">
+                  <label id="outsideDomainLabel"
+                         accesskey="&outsideDomain.accesskey;"
+                         control="outsideDomainPref"
+                         value="&outsideDomain.label;"/>
+                  <menulist id="outsideDomainPref"
+                            preference="mail.mdn.report.outside_domain">
+                    <menupopup>
+                      <menuitem value="0"
+                                label="&neverSend.label;"/>
+                      <menuitem value="1"
+                                label="&alwaysSend.label;"/>
+                      <menuitem value="2"
+                                label="&askMe.label;"/>
+                    </menupopup>
+                  </menulist>
+                </row>
+                <row align="center">
+                  <label id="otherCasesLabel"
+                         accesskey="&otherCases.accesskey;"
+                         control="otherCasesPref"
+                         value="&otherCases.label;"/>
+                  <menulist id="otherCasesPref"
+                            preference="mail.mdn.report.other">
+                    <menupopup>
+                      <menuitem value="0"
+                                label="&neverSend.label;"/>
+                      <menuitem value="1"
+                                label="&alwaysSend.label;"/>
+                      <menuitem value="2"
+                                label="&askMe.label;"/>
+                    </menupopup>
+                  </menulist>
+                </row>
+              </rows>
+            </grid>
+          </hbox>
+
+        </vbox>
 
       </vbox>
 
-    </vbox>
-
-  </groupbox>
-
-</page>
-
+    </groupbox>
+  </prefpane>
+</overlay>