<?xml version="1.0"?>
<!-- -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
   - This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % composeDTD SYSTEM "chrome://messenger/locale/preferences/compose.dtd">
<!ENTITY % editorOverlayDTD SYSTEM "chrome://editor/locale/editorOverlay.dtd">
%brandDTD;
%composeDTD;
%editorOverlayDTD;
]>
  
<overlay id="ComposePaneOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <prefpane id="paneCompose" onpaneload="gComposePane.init();">
    <script type="application/javascript" src="chrome://messenger/content/preferences/compose.js"/>
    <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
    <script type="application/javascript" src="chrome://communicator/content/utilityOverlay.js"/>

    <stringbundle id="languageBundle" src="chrome://global/locale/languageNames.properties"/>
    <stringbundle id="regionBundle" src="chrome://global/locale/regionNames.properties"/>
    <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>

    <preferences id="composePreferences">
      <preference id="mail.preferences.compose.selectedTabIndex" name="mail.preferences.compose.selectedTabIndex" type="int"/>
      <preference id="mail.forward_message_mode" name="mail.forward_message_mode" type="int"/>     
      <preference id="mail.forward_add_extension" name="mail.forward_add_extension" type="bool"/>
      <preference id="mail.SpellCheckBeforeSend" name="mail.SpellCheckBeforeSend" type="bool"/>
      <preference id="mail.spellcheck.inline" name="mail.spellcheck.inline" type="bool"/>
      <preference id="mail.warn_on_send_accel_key" name="mail.warn_on_send_accel_key" type="bool"/>
      <preference id="mail.compose.autosave" name="mail.compose.autosave" type="bool"/>
      <preference id="mail.compose.autosaveinterval" name="mail.compose.autosaveinterval" type="int"/>
      <preference id="mail.enable_autocomplete" name="mail.enable_autocomplete" type="bool"/>
      <preference id="ldap_2.autoComplete.useDirectory"
                  name="ldap_2.autoComplete.useDirectory"
                  onchange="gComposePane.enableAutocomplete();" type="bool"/>
      <preference id="ldap_2.autoComplete.directoryServer" name="ldap_2.autoComplete.directoryServer" type="string"/>
      <preference id="pref.ldap.disable_button.edit_directories"
                  name="pref.ldap.disable_button.edit_directories" type="bool"/>
      <preference id="mail.collect_email_address_outgoing" name="mail.collect_email_address_outgoing" type="bool"/>
      <preference id="mail.collect_addressbook" name="mail.collect_addressbook" type="string"/>
      <preference id="spellchecker.dictionary"  name="spellchecker.dictionary"   type="unichar"/>
      <preference id="msgcompose.font_face"      name="msgcompose.font_face" type="string"/>
      <preference id="msgcompose.font_size"      name="msgcompose.font_size" type="string"/>
      <preference id="msgcompose.text_color"     name="msgcompose.text_color" type="string"/>
      <preference id="msgcompose.background_color" name="msgcompose.background_color" type="string"/>
      <preference id="mail.compose.attachment_reminder"
                  name="mail.compose.attachment_reminder"
                  type="bool"/>
    </preferences>

    <commandset id="compositionGeneralCommandSet">
      <command id="cmd_toggleAutosave"
               oncommand="gComposePane.updateAutosave();"/>
      <command id="cmd_toggleAttachmentCheck"
               oncommand="gComposePane.updateAttachmentCheck();"/>
    </commandset>

    <tabbox id="composePrefs" flex="1" onselect="gComposePane.tabSelectionChanged();">
      <tabs>
        <tab id="generalTab" label="&itemGeneral.label;"/>
        <tab id="addressingTab" label="&itemAutoComplete.label;"/>
        <tab label="&itemSpellCheck.label;"/>
      </tabs>

      <tabpanels flex="1">
        <tabpanel orient="vertical">
          <groupbox>
            <hbox align="center">
              <label value="&forwardMsg.label;" accesskey="&forwardMsg.accesskey;" control="forwardMessageMode"/>
              <menulist id="forwardMessageMode" preference="mail.forward_message_mode">
                <menupopup>
                  <menuitem value="2" label="&inline.label;"/>
                  <menuitem value="0" label="&asAttachment.label;"/>
                </menupopup>
              </menulist>
              <checkbox id="addExtension" label="&addExtension.label;" preference="mail.forward_add_extension"
                        accesskey="&addExtension.accesskey;"/>
            </hbox>

            <hbox align="center" pack="start">
              <checkbox id="autoSave" label="&autoSave.label;" preference="mail.compose.autosave"
                        accesskey="&autoSave.accesskey;" command="cmd_toggleAutosave"/>
              <textbox id="autoSaveInterval"
                       size="2" type="number" min="1" max="35790"
                       preference="mail.compose.autosaveinterval"
                       aria-labelledby="autoSave autoSaveInterval autoSaveEnd"/>
              <label id="autoSaveEnd" value="&autoSaveEnd.label;"/>
            </hbox>

            <checkbox id="mailWarnOnSendAccelKey" label="&warnOnSendAccelKey.label;"
                      preference="mail.warn_on_send_accel_key"
                      accesskey="&warnOnSendAccelKey.accesskey;"/>

            <hbox align="center">
              <checkbox id="attachment_reminder_label"
                        label="&attachmentReminder.label;"
                        accesskey="&attachmentReminder.accesskey;"
                        preference="mail.compose.attachment_reminder"
                        command="cmd_toggleAttachmentCheck"
                        flex="1"/>
              <button id="attachment_reminder_button"
                      label="&attachmentReminderOptions.label;"
                      accesskey="&attachmentReminderOptions.accesskey;"
                      oncommand="gComposePane.attachmentReminderOptionsDialog();"/>
            </hbox>

          </groupbox>

          <groupbox>
            <caption label="&htmlComposeHeader.label;"/>
            <hbox align="center">
              <label control="FontSelect" value="&font.label;" accesskey="&font.accesskey;"/>
              <menulist id="FontSelect" preference="msgcompose.font_face">
                <menupopup>
                  <menuitem value="" label="&fontVarWidth.label;"/>
                  <menuitem value="tt" label="&fontFixedWidth.label;"/>
                  <menuseparator/>
                  <menuitem value="Helvetica, Arial, sans-serif" label="&fontHelvetica.label;"/>
                  <menuitem value="Times New Roman, Times, serif" label="&fontTimes.label;"/>
                  <menuitem value="Courier New, Courier, monospace" label="&fontCourier.label;"/>
                  <menuseparator/>
                </menupopup>
              </menulist>
              
              <label control="fontSizeSelect" value="&size.label;" accesskey="&size.accesskey;"/>
              <menulist id="fontSizeSelect" preference="msgcompose.font_size">
                <menupopup>
                  <menuitem value="x-small" label="&size-x-smallCmd.label;"/>
                  <menuitem value="small"   label="&size-smallCmd.label;"/>
                  <menuitem value="medium"  label="&size-mediumCmd.label;"/>
                  <menuitem value="large"   label="&size-largeCmd.label;"/>
                  <menuitem value="x-large" label="&size-x-largeCmd.label;"/>
                  <menuitem value="xx-large" label="&size-xx-largeCmd.label;"/>
                </menupopup>
              </menulist>
            </hbox>

            <separator class="thin"/>

            <hbox align="center">
              <label control="textColorButton" value="&fontColor.label;" accesskey="&fontColor.accesskey;"/>
              <colorpicker type="button" id="textColorButton" preference="msgcompose.text_color"/>
              <separator orient="vertical" class="thin"/>
              <label control="backgroundColorButton" value="&bgColor.label;" accesskey="&bgColor.accesskey;"/>
              <colorpicker type="button" id="backgroundColorButton" preference="msgcompose.background_color"/>
              <spacer flex="1"/>
              <button label="&restoreHTMLDefaults.label;" accesskey="&restoreHTMLDefaults.accesskey;"
                      oncommand="gComposePane.restoreHTMLDefaults();"/>
            </hbox>
          </groupbox>
  
          <hbox align="center">
            <description flex="1">&sendOptionsDescription.label;</description>
            <button label="&sendOptions.label;" 
                    accesskey="&sendOptions.accesskey;"
                    oncommand="gComposePane.sendOptionsDialog();"/>
          </hbox>      
         </tabpanel>

         <tabpanel orient="vertical">
           <groupbox>
              <!-- Address Autocomplete -->
              <caption label="&addressingTitle.label;"/>

              <description>&autocompleteText.label;</description>

              <hbox align="center">
                <checkbox id="addressingAutocomplete" label="&addressingEnable.label;"
                          preference="mail.enable_autocomplete"
                          accesskey="&addressingEnable.accesskey;"/>
              </hbox>
    
              <hbox align="center">
                <checkbox id="autocompleteLDAP" label="&directories.label;" 
                          preference="ldap_2.autoComplete.useDirectory" 
                          accesskey="&directories.accesskey;"/>
                <menulist id="directoriesList" flex="1" aria-labelledby="autocompleteLDAP"
                          preference="ldap_2.autoComplete.directoryServer">
                  <menupopup id="directoriesListPopup" class="addrbooksPopup"
                             none="&directoriesNone.label;"
                             remoteonly="true" value="dirPrefId"/>
                </menulist>
                <button id="editButton" label="&editDirectories.label;" 
                        oncommand="gComposePane.editDirectories();"
                        preference="pref.ldap.disable_button.edit_directories"
                        accesskey="&editDirectories.accesskey;"/>
              </hbox>
            </groupbox>

            <separator class="thin"/>

            <hbox align="center" pack="start">
              <checkbox id="emailCollectionOutgoing" label="&emailCollectionPicker.label;"
                        accesskey="&emailCollectionPicker.accesskey;"
                        preference="mail.collect_email_address_outgoing"
                        oncommand="gComposePane.updateEmailCollection();"/>
              <menulist id="localDirectoriesList" flex="1"
                        preference="mail.collect_addressbook"
                        aria-labelledby="emailCollectionOutgoing">
                <menupopup id="abPopup-menupopup" class="addrbooksPopup"
                           localonly="true" writable="true"/>
              </menulist>
            </hbox>
         </tabpanel>

         <tabpanel orient="vertical">
            <checkbox id="spellCheckBeforeSend" label="&spellCheck.label;"
                      preference="mail.SpellCheckBeforeSend"
                      accesskey="&spellCheck.accesskey;"/>

            <checkbox id="inlineSpellCheck" label="&spellCheckInline.label;"
                      preference="mail.spellcheck.inline"
                      accesskey="&spellCheckInline1.accesskey;"/>

            <separator class="thin"/>

            <hbox align="center" pack="start">
              <label value ="&languagePopup.label;" control="languageMenuList" accesskey="&languagePopup.accessKey;"/>
              <menulist id="languageMenuList" preference="spellchecker.dictionary" flex="1">
                <menupopup onpopupshowing="gComposePane.initLanguageMenu();">
                  <!-- dynamic content populated by JS -->
                </menupopup>
              </menulist>
              <spacer flex="1"/>
            </hbox>

            <separator/>
            <hbox>
              <label id="downloadDictionaries" class="text-link"
                     onclick="if (event.button == 0) { openDictionaryList('tab'); }"
                     value="&downloadDictionaries.label;"/>
              <spacer flex="1"/>
            </hbox>
         </tabpanel>
       </tabpanels>
    </tabbox>  
    <separator/>
  </prefpane>
</overlay>
