<?xml version="1.0"?>
<!-- -*- Mode: Java; tab-width: 4; 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 % chatDTD SYSTEM "chrome://messenger/locale/preferences/chat.dtd">
%brandDTD;
%chatDTD;
]>

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

  <prefpane id="paneChat" onpaneload="gChatPane.init();">
    <script type="application/javascript" src="chrome://messenger/content/preferences/chat.js"/>

    <preferences id="chatPreferences">
      <preference id="messenger.startup.action"            name="messenger.startup.action"     type="int"/>
      <preference id="purple.conversations.im.send_typing" name="purple.conversations.im.send_typing" type="bool"/>
      <preference id="messenger.status.reportIdle"         name="messenger.status.reportIdle"         type="bool"
                  onchange="gChatPane.updateDisabledState();"/>
      <preference id="messenger.status.timeBeforeIdle"     name="messenger.status.timeBeforeIdle"     type="int"/>
      <preference id="messenger.status.awayWhenIdle"       name="messenger.status.awayWhenIdle"       type="bool"
                  onchange="gChatPane.updateMessageDisabledState();"/>
      <preference id="messenger.status.defaultIdleAwayMessage" name="messenger.status.defaultIdleAwayMessage" type="wstring"/>
      <preference id="purple.logging.log_chats"            name="purple.logging.log_chats"            type="bool"/>
      <preference id="purple.logging.log_ims"              name="purple.logging.log_ims"              type="bool"/>
      <preference id="purple.logging.log_system"           name="purple.logging.log_system"           type="bool"/>
      <preference id="pref.privacy.disable_button.view_passwords" name="pref.privacy.disable_button.view_passwords" type="bool"/>
      <preference id="mail.chat.show_desktop_notifications" name="mail.chat.show_desktop_notifications" type="bool"/>
      <preference id="mail.chat.play_sound" name="mail.chat.play_sound" type="bool"/>
      <preference id="mail.chat.play_sound.type" name="mail.chat.play_sound.type" type="int"/>
      <preference id="mail.chat.play_sound.url" name="mail.chat.play_sound.url" type="string"/>
    </preferences>

    <broadcaster id="idleReportingEnabled"/>

    <!-- Startup -->
    <hbox align="center">
      <label value="&startupAction.label;" accesskey="&startupAction.accesskey;"
             control="messengerStartupAction"/>
      <menulist id="messengerStartupAction" preference="messenger.startup.action">
        <menupopup>
          <menuitem label="&startupOffline.label;"     value="0"/>
          <menuitem label="&startupConnectAuto.label;" value="1"/>
        </menupopup>
      </menulist>
    </hbox>
    <separator/>

    <!-- Status -->
    <hbox align="center">
      <checkbox id="reportIdle" label="&reportIdleAfter.label;"
                accesskey="&reportIdleAfter.accesskey;"
                preference="messenger.status.reportIdle"/>
      <textbox id="timeBeforeAway" type="number" min="1" max="720"
               observes="idleReportingEnabled"
               preference="messenger.status.timeBeforeIdle"
               onsyncfrompreference="var elt = document.getElementById(this.getAttribute('preference'));
                                     return (elt.instantApply ? elt.valueFromPreferences : elt.value) / 60;"
               onsynctopreference="return this.value * 60;"/>
      <label value="&idleTime;" control="timeBeforeAway"/>
    </hbox>
    <vbox class="indent">
      <checkbox id="autoAway" label="&andSetStatusToAway.label;"
                observes="idleReportingEnabled"
                accesskey="&andSetStatusToAway.accesskey;"
                preference="messenger.status.awayWhenIdle"/>
      <textbox id="defaultIdleAwayMessage" class="indent"
               observes="idleReportingEnabled"
               preference="messenger.status.defaultIdleAwayMessage"/>
    </vbox>
    <separator/>
    <checkbox id="sendTyping" label="&sendTyping.label;"
              accesskey="&sendTyping.accesskey;"
              preference="purple.conversations.im.send_typing"/>
    <groupbox>
      <caption label="&chatNotifications.label;"/>
      <checkbox id="desktopChatNotifications" label="&desktopChatNotifications.label;"
              accesskey="&desktopChatNotifications.accesskey;"
              preference="mail.chat.show_desktop_notifications"/>
      <hbox align="center">
        <checkbox id="chatNotification" accesskey="&chatSound.accesskey;"
                  preference="mail.chat.play_sound" label="&chatSound.label;"
                  oncommand="gChatPane.updatePlaySound();" flex="1"/>
        <button id="playChatSound" label="&play.label;" accesskey="&play.accesskey;"
                oncommand="gChatPane.previewSound();"/>
      </hbox>
      <radiogroup id="chatSoundType" class="indent"
                  preference="mail.chat.play_sound.type" orient="vertical"
                  oncommand="gChatPane.updatePlaySound();"
                  aria-labelledby="chatNotification">
        <radio id="chatSoundSystemSound" value="0" label="&systemSound.label;"
               accesskey="&systemSound.accesskey;"/>
        <radio id="chatSoundCustom" value="1" label="&customsound.label;"
               accesskey="&customsound.accesskey;"/>
        <hbox class="indent">
          <filefield id="chatSoundUrlLocation" flex="1" preference="mail.chat.play_sound.url"
                     preference-editable="true"
                     onsyncfrompreference="return gChatPane.readSoundLocation();" aria-labelledby="chatSoundCustom"/>
          <button id="browseForChatSound" label="&browse.label;"
                  accesskey="&browse.accesskey;" oncommand="gChatPane.browseForSoundFile();">
            <observes element="chatSoundUrlLocation" attribute="disabled"/>
          </button>
        </hbox>
      </radiogroup>
    </groupbox>
  </prefpane>
</overlay>
