<?xml version="1.0"?>

<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % advancedDTD SYSTEM "chrome://messenger/locale/preferences/advanced.dtd">
%brandDTD;
%advancedDTD;
<!ENTITY % searchIntegrationMacDTD SYSTEM "chrome://messenger/locale/searchIntegrationMac.dtd" >
%searchIntegrationMacDTD;
]>

<overlay id="AdvancedPaneOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <prefpane id="paneAdvanced" onpaneload="gAdvancedPane.init();">
    <script type="application/javascript" src="chrome://messenger/content/preferences/advanced.js"/>
    <script type="application/javascript" src="chrome://communicator/content/utilityOverlay.js"/>

    <preferences id="advancedPreferences">
      <preference id="mail.preferences.advanced.selectedTabIndex"
                  name="mail.preferences.advanced.selectedTabIndex" type="int"/>
      <!-- General tab -->

      <preference id="general.autoScroll"
                  name="general.autoScroll"
                  type="bool"/>
      <preference id="general.smoothScroll"
                  name="general.smoothScroll"
                  type="bool"/>

      <preference id="mailnews.database.global.indexer.enabled" 
                  name="mailnews.database.global.indexer.enabled" 
                  type="bool"/>

      <preference id="toolkit.telemetry.enabled"
                  name="toolkit.telemetry.enabled"
                  onchange="gAdvancedPane.telemetryEnabledChanged(event);"
                  type="bool"/>
      <preference id="toolkit.telemetry.prompted"
                  name="toolkit.telemetry.prompted"
                  type="int"/>
      <preference id="toolkit.telemetry.rejected"
                  name="toolkit.telemetry.rejected"
                  type="bool"/>

      <preference id="mail.shell.checkDefaultClient"
                  name="mail.shell.checkDefaultClient"
                  type="bool"/>
      <preference id="pref.general.disable_button.default_mail"
                  name="pref.general.disable_button.default_mail"
                  type="bool"/>
      <!-- Keep one id, so that we don't have to do platform specific stuff later -->
      <preference id="searchintegration.enable"
                  name="mail.spotlight.enable"
                  type="bool"/>

      <!-- Display & Reading tab -->
      <preference id="mail.showCondensedAddresses" name="mail.showCondensedAddresses" type="bool"/>
      <preference id="mailnews.mark_message_read.auto"
                  name="mailnews.mark_message_read.auto" type="bool"/>
      <preference id="mailnews.mark_message_read.delay"
                  name="mailnews.mark_message_read.delay" type="bool"
                  onchange="gAdvancedPane.updateMarkAsReadTextbox(this.value);"/>
      <preference id="mailnews.mark_message_read.delay.interval"
                  name="mailnews.mark_message_read.delay.interval" type="int"/>
      <preference id="mail.openMessageBehavior" name="mail.openMessageBehavior" type="int"/>
      <preference id="mail.close_message_window.on_delete" 
                  name="mail.close_message_window.on_delete" type="bool"/>
      <!-- Network tab -->
      <preference id="mail.prompt_purge_threshhold"
                  name="mail.prompt_purge_threshhold" type="bool"/>
      <preference id="mail.purge_threshhold_mb"
                  name="mail.purge_threshhold_mb" type="int"/>
      <preference id="browser.cache.disk.capacity"
                  name="browser.cache.disk.capacity" type="int"/>
      <!-- Update tab -->
      <preference id="app.update.enabled" name="app.update.enabled" type="bool"
                  onchange="gAdvancedPane.updateAppUpdateItems();
                            gAdvancedPane.updateAutoItems();
                            gAdvancedPane.updateModeItems();"/>
      <preference id="app.update.auto" name="app.update.auto" type="bool"
                  onchange="gAdvancedPane.updateAutoItems(); gAdvancedPane.updateModeItems();"/>
      <preference id="app.update.mode" name="app.update.mode" type="int"
                  onchange="gAdvancedPane.updateModeItems();"/>
      <preference id="app.update.disable_button.showUpdateHistory"
                  name="app.update.disable_button.showUpdateHistory"
                  type="bool"/>

      <preference id="extensions.update.enabled" name="extensions.update.enabled" type="bool"
                  onchange="gAdvancedPane.updateAddonUpdateUI();"/>
      <!-- Certificates tab -->
      <preference id="security.default_personal_cert"
                  name="security.default_personal_cert"
                  type="string"/>
      <preference id="security.disable_button.openCertManager"
                  name="security.disable_button.openCertManager"
                  type="bool"/>
      <preference id="security.disable_button.openDeviceManager"
                  name="security.disable_button.openDeviceManager"
                  type="bool"/>
    </preferences>

    <stringbundle id="bundlePreferences" src="chrome://messenger/locale/preferences/preferences.properties"/>
    <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>

    <commandset id="networkTabCommandSet">
      <command id="cmd_toggleCompact"
               oncommand="gAdvancedPane.updateCompactOptions();"/>
    </commandset>

    <tabbox id="advancedPrefs" flex="1" onselect="gAdvancedPane.tabSelectionChanged();">
      <tabs>
        <tab id="generalTab" label="&itemGeneral.label;"/>
        <tab label="&itemDisplay.label;"/>
        <tab id="networkingTab" label="&itemNetworking.label;"/>
        <tab label="&itemUpdate.label;"/>
        <tab label="&itemCertificates.label;"/>
      </tabs>

      <tabpanels flex="1">
        <!-- General -->
        <tabpanel orient="vertical">
          <hbox align="center">
            <description flex="1">&returnReceiptsInfo.label;</description>
            <button id="showReturnReceipts"
                    label="&showReturnReceipts.label;"
                    accesskey="&showReturnReceipts.accesskey;"
                    oncommand="gAdvancedPane.showReturnReceipts();"/>
          </hbox>

          <!-- Scrolling -->
          <groupbox id="scrollingGroup">
            <caption label="&scrolling.label;"/>

            <checkbox id="useAutoScroll"
                      label="&useAutoScroll.label;"
                      accesskey="&useAutoScroll.accesskey;"
                      preference="general.autoScroll"/>
            <checkbox id="useSmoothScrolling"
                      label="&useSmoothScrolling.label;"
                      accesskey="&useSmoothScrolling.accesskey;"
                      preference="general.smoothScroll"/>
          </groupbox>

          <groupbox id="systemDefaultsGroup" orient="vertical">
            <caption label="&systemIntegration.label;"/>
            <hbox id="checkDefaultBox" align="center" flex="1">
              <checkbox id="alwaysCheckDefault"
                        preference="mail.shell.checkDefaultClient"
                        label="&alwaysCheckDefault.label;"
                        accesskey="&alwaysCheckDefault.accesskey;" flex="1"/>
              <button id="checkDefaultButton" label="&checkDefaultsNow.label;"
                      accesskey="&checkDefaultsNow.accesskey;"
                      oncommand="gAdvancedPane.checkDefaultNow();"
                      preference="pref.general.disable_button.default_mail"/>
            </hbox>
            <hbox id="searchIntegrationContainer">
              <checkbox id="searchIntegration"
                        preference="searchintegration.enable"
                        label="&searchIntegration.label;"
                        accesskey="&searchIntegration.accesskey;"/>
            </hbox>
          </groupbox>
          <groupbox>
            <caption label="&configEditDesc.label;"/>
            <vbox>
              <hbox>
                <checkbox id="enableGloda"
                          preference="mailnews.database.global.indexer.enabled"
                          label="&enableGlodaSearch.label;"
                          accesskey="&enableGlodaSearch.accesskey;"/>
              </hbox>
              <hbox>
                <checkbox id="submitTelemetry"
                          preference="toolkit.telemetry.enabled"
                          label="&submitTelemetry.label;"
                          accesskey="&submitTelemetry.accesskey;"/>
              </hbox>
              <hbox class="indent">
                <label id="telemetryInfoLink"
                       class="text-link"
                       onclick="if (event.button == 0) openPrivacyPolicy('tab');"
                       value="&telemetryInfoLink.label;" />

              </hbox>
            </vbox>
            <vbox>
              <hbox pack="end">
                <button id="configEditor" label="&configEdit.label;"
                        accesskey="&configEdit.accesskey;"
                        oncommand="gAdvancedPane.showConfigEdit();"/>
              </hbox>
            </vbox>
          </groupbox>
        </tabpanel>

        <!-- Reading and Display -->
        <tabpanel orient="vertical">
          <groupbox>
            <caption label="&reading.caption;"/>

            <vbox>
              <hbox>
                <checkbox id="automaticallyMarkAsRead"
                          preference="mailnews.mark_message_read.auto"
                          label="&autoMarkAsRead.label;"
                          accesskey="&autoMarkAsRead.accesskey;"
                          oncommand="gAdvancedPane.updateMarkAsReadOptions(this.checked)"/>
              </hbox>

              <radiogroup id="markAsReadAutoPreferences" orient="vertical"
                          class="indent"
                          preference="mailnews.mark_message_read.delay">
                <radio id="mark_read_immediately" value="false"
                       label="&markAsReadNoDelay.label;"
                       accesskey="&markAsReadNoDelay.accesskey;"/>
                <hbox align="center">
                  <radio id="markAsReadAfterDelay" value="true"
                         label="&markAsReadDelay.label;"
                         accesskey="&markAsReadDelay.accesskey;"/>
                  <textbox id="markAsReadDelay" size="2"
                           type="number" max="2147483"
                           preference="mailnews.mark_message_read.delay.interval"
                           aria-labelledby="markAsReadAfterDelay markAsReadDelay secondsLabel"/>
                  <label id="secondsLabel" value="&secondsLabel.label;"/>
                </hbox>
              </radiogroup>
            </vbox>

            <vbox>
              <hbox>
                <label value="&openMsgIn.label;"
                       control="mailOpenMessageBehavior"/>
              </hbox>

              <hbox>
                <radiogroup id="mailOpenMessageBehavior" class="indent"
                            preference="mail.openMessageBehavior"
                            orient="horizontal">
                  <radio id="newTab" value="2" label="&openMsgInNewTab.label;"
                         accesskey="&openMsgInNewTab.accesskey;"/>
                  <radio id="newWindow" value="0" label="&reuseExpRadio0.label;"
                         accesskey="&reuseExpRadio0.accesskey;"/>
                  <radio id="existingWindow" value="1"
                         label="&reuseExpRadio1.label;"
                         accesskey="&reuseExpRadio1.accesskey;"/>
                </radiogroup>
              </hbox>
              <hbox>
                <checkbox id="closeMsgOnMoveOrDelete"
                          label="&closeMsgOnMoveOrDelete.label;"
                          accesskey="&closeMsgOnMoveOrDelete.accesskey;"
                          preference="mail.close_message_window.on_delete"/>
              </hbox>
            </vbox>

          </groupbox>

          <groupbox>
            <caption label="&display.caption;"/>

            <hbox>
              <checkbox id="showCondensedAddresses"
                        label="&showCondensedAddresses.label;"
                        accesskey="&showCondensedAddresses.accesskey;"
                        preference="mail.showCondensedAddresses"/>
            </hbox>
          </groupbox>

        </tabpanel>

        <tabpanel orient="vertical">
          <!-- Networking & Disk Space -->
          <groupbox>
            <caption label="&connectionsInfo.caption;"/>
            <hbox align="center">
              <description flex="1" control="catProxiesButton">&proxiesConfigure.label;</description>
              <button id="catProxiesButton" icon="network" label="&showSettings.label;"
                      accesskey="&showSettings.accesskey;"
                      oncommand="gAdvancedPane.showConnections();"/>
            </hbox>
          </groupbox>

          <groupbox>
            <caption label="&offlineInfo.caption;"/>
            <hbox align="center">
              <description flex="1" control="offlineSettingsButton">&offlineInfo.label;</description>
              <button id="offlineSettingsButton" label="&showOffline.label;"
                      accesskey="&showOffline.accesskey;"
                      oncommand="gAdvancedPane.showOffline();"/>
            </hbox>
          </groupbox>

          <groupbox>
            <caption label="&Diskspace;"/>
            <hbox align="center">
              <label id="useCacheBefore" control="cacheSize"
                     accesskey="&useCacheBefore.accesskey;" value="&useCacheBefore.label;"/>
              <textbox id="cacheSize" type="number" size="4" max="1024"
                       preference="browser.cache.disk.capacity"
                       onsyncfrompreference="return gAdvancedPane.readCacheSize();"
                       onsynctopreference="return gAdvancedPane.writeCacheSize();"
                       aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
              <label id="useCacheAfter" flex="1">&useCacheAfter.label;</label>
              <button id="clearCacheButton" icon="clear"
                      label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
                      oncommand="gAdvancedPane.clearCache();"/>
            </hbox>
            <hbox align="center">
                <checkbox id="offlineCompactFolder"
                          label="&offlineCompactFolders.label;"
                          accesskey="&offlineCompactFolders.accesskey;"
                          command="cmd_toggleCompact"
                          aria-labelledby="offlineCompactFolder offlineCompactFolderMin compactFolderMB"
                          preference="mail.prompt_purge_threshhold"/>
                <textbox id="offlineCompactFolderMin" size="4" value="20"
                         type="number" min="1" max="2048" increment="10"
                         preference="mail.purge_threshhold_mb"
                         aria-labelledby="offlineCompactFolder offlineCompactFolderMin compactFolderMB"/>
                <label id="compactFolderMB" value="&offlineCompactFoldersMB.label;"/>
            </hbox>
          </groupbox>
        </tabpanel>

        <!-- Update -->

        <tabpanel orient="vertical" align="start">
          <label control="autoUpdateGroup">&autoCheck.label;</label>
          <vbox class="indent" id="autoUpdateGroup" role="group">
            <checkbox id="enableAppUpdate"
                      label="&enableAppUpdate.label;"
                      accesskey="&enableAppUpdate.accesskey;"
                      preference="app.update.enabled"/>
            <checkbox id="enableAddonUpdate"
                      label="&enableAddonsUpdate.label;"
                      accesskey="&enableAddonsUpdate.accesskey;"
                      preference="extensions.update.enabled"/>
          </vbox>
          <separator/>
          <label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label>
          <radiogroup id="updateMode" class="indent"
                      preference="app.update.auto">
            <radio id="ask" value="false"
                   label="&modeAskMe.label;"
                   accesskey="&modeAskMe.accesskey;"/>
            <radio id="automatic" value="true"
                   label="&modeAutomatic.label;"
                   accesskey="&modeAutomatic.accesskey;"/>
            <hbox class="indent">
              <checkbox id="warnIncompatible"
                        label="&modeAutoAddonWarn.label;" accesskey="&modeAutoAddonWarn.accesskey;"
                        preference="app.update.mode"
                        onsyncfrompreference="return gAdvancedPane.addonWarnSyncFrom();"
                        onsynctopreference="return gAdvancedPane.addonWarnSyncTo();"/>
            </hbox>
          </radiogroup>
          <separator/>
          <hbox>
            <button id="showUpdateHistory"
                    label="&showUpdates.label;" accesskey="&showUpdates.accesskey;"
                    preference="app.update.disable_button.showUpdateHistory"
                    oncommand="gAdvancedPane.showUpdates();"/>
          </hbox>

        </tabpanel>

        <!-- Certificates -->
        <tabpanel orient="vertical">
          <description id="CertSelectionDesc" control="certSelection">&certSelection.description;</description>

          <!--
            The values on these radio buttons may look like l12y issues, but
            they're not - this preference uses *those strings* as its values.
            I KID YOU NOT.
          -->
          <radiogroup id="certSelection" class="indent"
                      orient="horizontal" preftype="string"
                      preference="security.default_personal_cert"
                      aria-labelledby="CertGroupCaption CertSelectionDesc">
            <radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
                    value="Select Automatically"/>
            <radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
                    value="Ask Every Time"/>
          </radiogroup>

          <separator/>

          <hbox>
            <button id="viewCertificatesButton"
                    label="&viewCertificates.label;"
                    accesskey="&viewCertificates.accesskey;"
                    oncommand="gAdvancedPane.showCertificates();"
                    preference="security.disable_button.openCertManager"/>
            <button id="verificationButton"
                    label="&validation.label;" accesskey="&validation.accesskey;"
                    oncommand="gAdvancedPane.showOCSP();"/>
            <button id="viewSecurityDevicesButton"
                    label="&viewSecurityDevices.label;"
                    accesskey="&viewSecurityDevices.accesskey;"
                    oncommand="gAdvancedPane.showSecurityDevices();"
                    preference="security.disable_button.openDeviceManager"/>
          </hbox>
        </tabpanel>
      </tabpanels>
    </tabbox>
    <separator/>
  </prefpane>
</overlay>
