<?xml version="1.0"?>
<!-- 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">
%brandDTD;
<!ENTITY % prefDownloadDTD SYSTEM "chrome://communicator/locale/pref/pref-download.dtd">
%prefDownloadDTD;
]>

<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <prefpane id="download_pane"
            label="&pref.download.title;"
            script="chrome://communicator/content/pref/pref-download.js">

    <preferences>
      <preference id="browser.download.manager.behavior"
                  name="browser.download.manager.behavior"
                  type="int"/>
      <preference id="browser.download.manager.focusWhenStarting"
                  name="browser.download.manager.focusWhenStarting"
                  type="bool" inverted="true"/>
      <preference id="browser.download.useDownloadDir"
                  name="browser.download.useDownloadDir"
                  type="bool"/>
      <preference id="browser.download.dir"
                  name="browser.download.dir"
                  type="file"/>
      <preference id="browser.download.folderList"
                  name="browser.download.folderList"
                  type="int"
                  onchange="DisplayDownloadDirPref();"/>
      <preference id="browser.download.manager.retention"
                  name="browser.download.manager.retention"
                  type="int"/>
      <preference id="browser.download.finished_download_sound"
                  name="browser.download.finished_download_sound"
                  type="bool"
                  onchange="SetSoundEnabled(this.value);"/>
      <preference id="browser.download.manager.showAlertOnComplete"
                  name="browser.download.manager.showAlertOnComplete"
                  type="bool"/>
      <preference id="browser.download.finished_sound_url"
                  name="browser.download.finished_sound_url"
                  type="string"/>
    </preferences>

    <groupbox>
      <caption label="&downloadBehavior.label;"/>
      <radiogroup id="downloadBehavior"
                  preference="browser.download.manager.behavior">
        <radio value="2"
               label="&doNothing.label;"
               accesskey="&doNothing.accesskey;"/>
        <radio value="1"
               label="&openProgressDialog.label;"
               accesskey="&openProgressDialog.accesskey;"/>
        <radio value="0"
               label="&openDM.label;"
               accesskey="&openDM.accesskey;"/>
      </radiogroup>
      <checkbox id="focusWhenStarting"
                class="indent"
                preference="browser.download.manager.focusWhenStarting"
                label="&flashWhenOpen.label;"
                accesskey="&flashWhenOpen.accesskey;"/>
    </groupbox>

    <groupbox>
      <caption label="&downloadLocation.label;"/>
      <radiogroup id="saveWhere"
                  preference="browser.download.useDownloadDir"
                  onsyncfrompreference="return document.getElementById('download_pane').ReadUseDownloadDir();">
        <hbox id="saveToRow">
          <radio id="saveTo" value="true"
                 label="&saveTo.label;"
                 accesskey="&saveTo.accesskey;"
                 aria-labelledby="saveTo downloadFolder"/>
          <filefield id="downloadFolder" flex="1"
                     preference="browser.download.dir"
                     preference-editable="true"
                     aria-labelledby="saveTo"
                     onsyncfrompreference="document.getElementById('download_pane').DisplayDownloadDirPref();"/>
          <button id="chooseFolder" oncommand="ChooseFolder();"
                  label="&chooseDownloadFolder.label;"
                  accesskey="&chooseDownloadFolder.accesskey;"/>
        </hbox>
        <radio id="alwaysAsk" value="false"
               label="&alwaysAsk.label;"
               accesskey="&alwaysAsk.accesskey;"/>
      </radiogroup>
    </groupbox>

    <groupbox>
      <caption label="&downloadHistory.label;"/>
      <hbox align="center">
        <label value="&removeEntries.label;"
               accesskey="&removeEntries.accesskey;"
               control="downloadHistory"/>
        <menulist id="downloadHistory"
                  preference="browser.download.manager.retention">
          <menupopup>
            <menuitem value="0" label="&whenCompleted.label;"/>
            <menuitem value="1" label="&whenQuittingApp.label;"/>
            <menuitem value="2" label="&neverRemove.label;"/>
          </menupopup>
        </menulist>
      </hbox>
    </groupbox>

    <groupbox>
      <caption label="&finishedBehavior.label;"/>
      <hbox align="center">
        <checkbox id="finishedNotificationSound"
                  label="&playSound.label;"
                  preference="browser.download.finished_download_sound"
                  accesskey="&playSound.accesskey;"/>
        <checkbox id="finishedNotificationAlert"
                  label="&showAlert.label;"
                  preference="browser.download.manager.showAlertOnComplete"
                  accesskey="&showAlert.accesskey;"/>
      </hbox>

      <hbox align="center" class="indent">
        <filefield id="downloadSndURL"
                   flex="1"
                   preference="browser.download.finished_sound_url"
                   preference-editable="true"
                   onsyncfrompreference="return WriteSoundField(this, document.getElementById('download_pane').gSoundUrlPref.value);"/>
        <hbox align="center">
          <button id="downloadSndBrowse"
                  label="&browse.label;"
                  accesskey="&browse.accesskey;"
                  oncommand="SelectSound(gSoundUrlPref);">
            <observes element="downloadSndURL" attribute="disabled"/>
          </button>
          <button id="downloadSndPlay"
                  label="&playButton.label;"
                  accesskey="&playButton.accesskey;"
                  oncommand="PlaySound(gSoundUrlPref.value, false);"/>
        </hbox>
      </hbox>
    </groupbox>
  </prefpane>
</overlay>
