<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!-- 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/. -->

<?xml-stylesheet href="chrome://chat/content/accounts.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/richlistbox.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/accounts.css" type="text/css"?>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://instantbird/content/menus.xul"?>
#endif

<!DOCTYPE window [
 <!ENTITY % accountsDTD SYSTEM "chrome://chat/locale/accounts.dtd">
 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
 %accountsDTD;
 %brandDTD;
#ifdef XP_MACOSX
 <!ENTITY % instantbirdDTD SYSTEM "chrome://instantbird/locale/instantbird.dtd">
 %instantbirdDTD;
#endif
]>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        id="accountManager"
        windowtype="Messenger:Accounts"
        title="&accounts.title;"
        height="300"
        width="&accountManager.width;"
        persist="width height screenX screenY">
  <script type="application/javascript" src="chrome://instantbird/content/accounts.js"/>
  <script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js" />
  <script type="application/javascript" src="chrome://global/content/nsTransferable.js" />

  <stringbundle id="accountsBundle" src="chrome://instantbird/locale/accounts.properties"/>

  <commandset id="accountsCommands">
    <command id="cmd_connect"
             accesskey="&account.connect.accesskey;"
             label="&account.connect.label;"
             oncommand="gAccountManager.connect()"/>
    <command id="cmd_disconnect"
             label="&account.disconnect.label;"
             accesskey="&account.disconnect.accesskey;"
             oncommand="gAccountManager.disconnect()"/>
    <command id="cmd_cancelReconnection"
             label="&account.cancelReconnection.label;"
             accesskey="&account.cancelReconnection.accesskey;"
             oncommand="gAccountManager.cancelReconnection()"/>
    <command id="cmd_copyDebugLog"
             label="&account.copyDebugLog.label;"
             accesskey="&account.copyDebugLog.accesskey;"
             oncommand="gAccountManager.copyDebugLog();"/>
    <command id="cmd_showDebugLog"
             label="&account.showDebugLog.label;"
             accesskey="&account.showDebugLog.accesskey;"
             oncommand="gAccountManager.showDebugLog();"/>
    <command id="cmd_moveup"
             label="&account.moveup.label;"
             oncommand="gAccountManager.moveCurrentItem(-1)"/>
    <command id="cmd_movedown"
             label="&account.movedown.label;"
             oncommand="gAccountManager.moveCurrentItem(1)"/>
    <command id="cmd_delete"
             label="&account.delete.label;"
             accesskey="&account.delete.accesskey;"
             oncommand="gAccountManager.delete()"/>
    <command id="cmd_edit"
             label="&account.edit.label;"
             accesskey="&account.edit.accesskey;"
             oncommand="gAccountManager.edit()"/>
    <command id="cmd_new"
             label="&accountManager.newAccount.label;"
             accesskey="&accountManager.newAccount.accesskey;"
             oncommand="gAccountManager.new()"/>
    <command id="cmd_close"
             label="&accountManager.close.label;"
             accesskey="&accountManager.close.accesskey;"
             oncommand="gAccountManager.close()"/>
  </commandset>

  <keyset id="accountsKeys">
    <key id="key_close1" key="w" modifiers="accel" command="cmd_close"/>
    <key id="key_close2" keycode="VK_ESCAPE" command="cmd_close"/>
    <key id="key_close3" command="cmd_close"
         key="&accountManager.close.commandkey;" modifiers="accel,shift"/>
  </keyset>

#ifdef XP_MACOSX
#include menus.xul.inc
#endif

  <broadcasterset>
    <broadcaster id="contextAccountsItems"/>
  </broadcasterset>

  <menupopup id="accountsContextMenu"
             onpopupshowing="gAccountManager.onContextMenuShowing()">
    <menuitem id="context_connect"
              command="cmd_connect"
              observes="contextAccountsItems"/>
    <menuitem id="context_disconnect"
              command="cmd_disconnect"
              observes="contextAccountsItems"/>
    <menuitem id="context_cancelReconnection"
              command="cmd_cancelReconnection"
              observes="contextAccountsItems"/>
    <menuitem id="context_copyDebugLog"
              command="cmd_copyDebugLog"/>
    <menuitem id="context_showDebugLog"
              command="cmd_showDebugLog"/>
    <menuseparator id="context_accountsItemsSeparator"
                   observes="contextAccountsItems"/>
    <menuitem command="cmd_new"/>
    <menuitem command="cmd_delete" observes="contextAccountsItems"/>
    <menuseparator observes="contextAccountsItems"/>
    <menuitem command="cmd_moveup" observes="contextAccountsItems"/>
    <menuitem command="cmd_movedown" observes="contextAccountsItems"/>
    <menuseparator observes="contextAccountsItems"/>
    <menuitem command="cmd_edit" observes="contextAccountsItems"/>
  </menupopup>

  <deck flex="1" id="accountsDesk" ondblclick="gAccountManager.new();">
    <vbox flex="1" id="noAccountScreen" align="center" pack="center">
      <hbox id="noAccountBox" align="top">
        <vbox id="noAccountInnerBox" flex="1">
          <label id="noAccountTitle" value="&accountManager.noAccount.title;"/>
          <description id="noAccountDesc">&accountManager.noAccount.description;</description>
        </vbox>
      </hbox>
    </vbox>
    <notificationbox id="accountsNotificationBox" flex="1">
      <richlistbox id="accountlist" flex="1" context="accountsContextMenu"
                   onselect="gAccountManager.onAccountSelect();"
                   ondragstart="nsDragAndDrop.startDrag(event, gAMDragAndDrop);"
                   ondragover="nsDragAndDrop.dragOver(event, gAMDragAndDrop);"
                   ondragend="gAMDragAndDrop.cleanBorders(true);"
                   ondrop="nsDragAndDrop.drop(event, gAMDragAndDrop);"/>
    </notificationbox>
  </deck>
  <windowdragbox id="bottombuttons" align="center">
    <button id="newaccount" command="cmd_new"/>
    <spacer flex="1"/>
    <button id="close" command="cmd_close"/>
  </windowdragbox>
</window>
