<?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/. -->

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/content/blist.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/blist.css" type="text/css"?>
<?xul-overlay href="chrome://instantbird/content/menus.xul"?>

<!DOCTYPE window [
  <!ENTITY % instantbirdDTD SYSTEM "chrome://instantbird/locale/instantbird.dtd">
  <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
  %instantbirdDTD;
  %brandDTD;
]>

<window
  id     = "blistWindow"
  windowtype="Messenger:blist"
  title  = "&brandShortName;"
  width  = "200"
  persist= "width height screenX screenY storeScreenX storeScreenY"
#ifndef XP_MACOSX
  onclose= "event.preventDefault(); goQuitApplication();"
#endif
  onblur = "buddyList.onblur();"
  xmlns:html="http://www.w3.org/1999/xhtml"
  xmlns  = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type="application/javascript" src="chrome://instantbird/content/utilities.js"/>
  <script type="application/javascript" src="chrome://instantbird/content/blist.js"/>

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

#include menus.xul.inc

#ifdef XP_MACOSX
  <commandset id="blistCommands">
    <command id="cmd_close" oncommand="window.close();"/>
  </commandset>

  <keyset id="blistKeys">
    <key id="key_close" key="w" modifiers="accel" command="cmd_close"/>
  </keyset>

#endif
  <popupset id="mainPopupSet">
    <tooltip id="imTooltip" type="im"
             onpopupshowing="return !('_droptarget' in window);"/>

    <menupopup id="buddyListContextMenu"
               onpopupshowing="if (event.target != this) return true; gBuddyListContextMenu = new buddyListContextMenu(this); return gBuddyListContextMenu.shouldDisplay;"
               onpopuphiding="if (event.target == this) { gBuddyListContextMenu = null; }">
      <menuitem id="context-openconversation"
                label="&openConversationCmd.label;"
                accesskey="&openConversationCmd.accesskey;"
                oncommand="gBuddyListContextMenu.openConversation();"/>
      <menuitem id="context-show-conversation"
                label="&showConversationCmd.label;"
                accesskey="&showConversationCmd.accesskey;"
                oncommand="gBuddyListContextMenu.openConversation();"/>
      <menuitem id="context-showlogs"
                label="&showLogsCmd.label;"
                accesskey="&showLogsCmd.accesskey;"
                oncommand="gBuddyListContextMenu.showLogs();"/>
      <menuseparator id="context-close-conversation-separator"/>
      <menuitem id="context-close-conversation"
                label="&closeConversationCmd.label;"
                accesskey="&closeConversationCmd.accesskey;"
                oncommand="gBuddyListContextMenu.closeConversation();"/>
      <menuseparator id="context-edit-buddy-separator"/>
      <menuitem id="context-alias"
                label="&aliasCmd.label;"
                accesskey="&aliasCmd.accesskey;"
                oncommand="gBuddyListContextMenu.alias();"/>
      <menuitem id="context-detach"
                label="&detachCmd.label;"
                accesskey="&detachCmd.accesskey;"
                oncommand="gBuddyListContextMenu.detach();"/>
      <menuitem id="context-delete"
                label="&deleteCmd.label;"
                accesskey="&deleteCmd.accesskey;"
                oncommand="gBuddyListContextMenu.delete();"/>
      <menu id="context-tags"
            label="&tagsCmd.label;"
            accesskey="&tagsCmd.accesskey;"/>
      <menuitem id="context-hide-tag"
                label="&hideTagCmd.label;"
                accesskey="&hideTagCmd.accesskey;"
                oncommand="gBuddyListContextMenu.hideTag();"/>
      <menu id="context-visible-tags"
            label="&visibleTagsCmd.label;"
            accesskey="&visibleTagsCmd.accesskey;">
        <menupopup id="context-visible-tags-popup"
                   oncommand="gBuddyListContextMenu.visibleTags(event);"
                   onpopupshowing="gBuddyListContextMenu.visibleTagsPopupShowing();">
          <menuseparator id="context-other-contacts-tag-separator"/>
          <menuitem id="context-other-contacts-tag"
                    type="checkbox" checked="true" disabled="true"/>
        </menupopup>
      </menu>
      <menuseparator id="context-show-offline-buddies-separator"/>
      <menuitem id="context-show-offline-buddies"
                label="&showOfflineContactsCmd.label;"
                accesskey="&showOfflineContactsCmd.accesskey;"
                type="checkbox"
                oncommand="gBuddyListContextMenu.toggleShowOfflineBuddies();"/>
    </menupopup>
  </popupset>

  <toolbox id="mainToolbox">
    <toolbar id="statusArea">
      <stack id="statusImageStack">
        <!-- The box around the user icon is a workaround for bug 955673. -->
        <box id="userIconHolder">
          <image id="userIcon" role="button" popup="changeUserIconPanel"
                 aria-label="&userIcon.label;" tooltiptext="&userIcon.label;"/>
        </box>
        <panel id="changeUserIconPanel"
               type="arrow" align="center"
               onpopupshowing="buddyList.updateUserIconPanelItems();"
               onpopuphiding="buddyList.stopWebcamStream();">
          <deck id="userIconPanel">
            <vbox class="userIconPanelMenu">
              <stack id="userIconPanelStack" flex="1">
                <image id="userIconPanelImage"/>
                <toolbarbutton id="userIconPanelImageRemove"
                               tooltiptext="&removeIconCmd.label;"
                               oncommand="buddyList.removeUserIcon();"/>
              </stack>
              <toolbarbutton id="selectFileButton"
                             class="userIconPanelButton UIPanelOneButton"
                             label="&selectFileCmd.label;"
                             accesskey="&selectFileCmd.accesskey;"
                             flex="1"
                             oncommand="buddyList.chooseUserIcon();"/>
              <toolbarbutton id="takePictureButton"
                             class="userIconPanelButton UIPanelOneButton"
                             label="&takePictureCmd.label;"
                             accesskey="&takePictureCmd.accesskey;"
                             disabled="true" flex="1"
                             oncommand="buddyList.takePictureButton();"/>
            </vbox>
            <vbox class="userIconPanelMenu">
              <box id="webcamOverflow">
                <html:video id="webcamVideo"/>
              </box>
              <html:canvas id="userIconCanvas" width="160" height="160"/>
              <hbox class="takePictureButtons">
                <button id="captureBackButton" class="userIconPanelButton"
                        label="&captureBackCmd.label;"
                        accesskey="&captureBackCmd.accesskey;"
                        flex="1"
                        oncommand="buddyList.captureBackButton();"/>
                <button id="captureButton" class="userIconPanelButton"
                        label="&captureCmd.label;"
                        accesskey="&captureCmd.accesskey;"
                        disabled="true" flex="1"
                        oncommand="buddyList.takePicture();"/>
              </hbox>
            </vbox>
            <vbox class="userIconPanelMenu">
              <image id="webcamPhoto"/>
              <hbox class="takePictureButtons">
                <button id="retakeButton" class="userIconPanelButton"
                        label="&retakeCmd.label;"
                        accesskey="&retakeCmd.accesskey;"
                        flex="1"
                        oncommand="buddyList.retake();"/>
                <button id="setIconButton" class="userIconPanelButton"
                        label="&setIconCmd.label;"
                        accesskey="&setIconCmd.accesskey;"
                        flex="1"
                        oncommand="buddyList.setWebcamImage();"/>
              </hbox>
            </vbox>
          </deck>
        </panel>
        <button type="menu" id="statusTypeIcon" status="available">
          <menupopup id="setStatusTypeMenupopup"
                     onpopupshown="buddyList.onStatusTypePopupShown();"
                     oncommand="buddyList.editStatus(event);">
            <menuitem id="statusTypeAvailable" label="&available;"
                      status="available" class="menuitem-iconic"
                      accesskey="&available.accesskey;"/>
            <menuitem id="statusTypeUnavailable" label="&unavailable;"
                      status="unavailable" class="menuitem-iconic"
                      accesskey="&unavailable.accesskey;"/>
            <menuseparator id="statusTypeOfflineSeparator"/>
            <menuitem id="statusTypeOffline" label="&offline;"
                      status="offline" class="menuitem-iconic"
                      accesskey="&offline.accesskey;"/>
          </menupopup>
        </button>
      </stack>
      <stack id="displayNameAndstatusMessageStack" flex="1">
        <vbox flex="1" pack="center">
          <label id="displayName" role="button"
                 onclick="buddyList.displayNameClick();"
                 onkeypress="buddyList.displayNameKeyPress(event);"/>
        </vbox>
        <label id="statusMessage" crop="end" value=""
               aria-haspopup="true" role="button"
               onclick="buddyList.statusMessageClick(event);"
               onkeypress="buddyList.statusMessageKeyPress(event);"/>
      </stack>
    </toolbar>
  </toolbox>

  <notificationbox id="buddyListMsg" flex="1" listedConvCount="0"
                   context="buddyListContextMenu">
    <label id="convsHeader" value="&convsHeader.label;"
           control="convlistbox"
           crop="end" class="listboxHeader"/>
    <richlistbox id="convlistbox"
                 onkeypress="buddyList.keyPress(event);"
                 onselect="buddyList.listboxSelect(event);"
                 tooltip="imTooltip"/>
    <label id="contactsHeader" value="&contactsHeader.label;"
           control="buddylistbox"
           crop="end" class="listboxHeader"/>
    <richlistbox id="buddylistbox"
                 onkeypress="buddyList.keyPress(event);"
                 onfocus="buddyList.buddylistboxFocus();"
                 onselect="buddyList.listboxSelect(event);"
                 tooltip="imTooltip"/>
    <richlistbox id="dummylistbox">
      <contact id="dummyContact" displayname="&dummyContact.label;"
               state="visible" status="unknown"/>
    </richlistbox>
    <spacer id="listSpacer" flex="1"
            onclick='document.getElementById("buddylistbox").focus();'/>
  </notificationbox>
</window>
