<?xml version="1.0"?>

<!--  -*- Mode: xml; indent-tabs-mode: nil; -*-
   - 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://messenger/skin/addressbook/abContactsPanel.css" type="text/css"?>

<!DOCTYPE page [
<!ENTITY % abResultsPaneOverlayDTD SYSTEM "chrome://messenger/locale/addressbook/abResultsPaneOverlay.dtd" >
%abResultsPaneOverlayDTD;
<!ENTITY % abContactsPanelDTD SYSTEM "chrome://messenger/locale/addressbook/abContactsPanel.dtd" >
%abContactsPanelDTD;
]>

<page id="abContactsPanel"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      onload="AbPanelLoad();"
      onunload="AbPanelUnload();"
      selectedaddresses="true">

  <stringbundleset id="stringbundleset">
    <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
  </stringbundleset>

  <script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
  <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/addressbook.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abDragDrop.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abCommon.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abResultsPane.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abContactsPanel.js"/>

  <commandset id="CommandUpdate_AddressBook"
              commandupdater="true"
              events="focus,addrbook-select"
              oncommandupdate="CommandUpdate_AddressBook()">
    <command id="cmd_delete" oncommand="goDoCommand('cmd_delete');"/>
    <command id="cmd_properties" oncommand="goDoCommand('cmd_properties');"/>
  </commandset>

  <!-- These keys do not really run any command, but they are used to show
       the hotkeys at the corresponding menuitems -->
  <key id="key_delete" keycode="VK_DELETE"/>

  <menupopup id="cardProperties">
    <menuitem label="&deleteAddrBookCard.label;"
              accesskey="&deleteAddrBookCard.accesskey;"
              key="key_delete"
              command="cmd_delete"/>
    <menuitem label="&addrBookCardProperties.label;"
              accesskey="&addrBookCardProperties.accesskey;"
              command="cmd_properties"/>
    <menuseparator/>
    <menuitem label="&addtoToFieldMenu.label;"
              accesskey="&addtoToFieldMenu.accesskey;"
              oncommand="addSelectedAddresses('addr_to');"/>
    <menuitem label="&addtoCcFieldMenu.label;"
              accesskey="&addtoCcFieldMenu.accesskey;"
              oncommand="addSelectedAddresses('addr_cc');"/>
    <menuitem label="&addtoBccFieldMenu.label;"
              accesskey="&addtoBccFieldMenu.accesskey;"
              oncommand="addSelectedAddresses('addr_bcc');"/>
  </menupopup>

  <vbox id="results_box" flex="1">
    <separator class="thin"/>
    <label value="&addressbookPicker.label;" accesskey="&addressbookPicker.accesskey;" control="addressbookList"/>
    <hbox id="panel-bar" class="toolbar" align="center">
      <menulist id="addressbookList"
                oncommand="AddressBookMenuListChange();" flex="1"
                persist="value">
        <menupopup id="addressbookList-menupopup" class="addrbooksPopup"/>
      </menulist>
    </hbox>

    <separator class="thin"/>

    <vbox>
      <label value="&searchInput.label;" accesskey="&searchInput.accesskey;"
             control="peopleSearchInput"/>
      <textbox id="peopleSearchInput" flex="1" type="search" timeout="800"
               placeholder="&SearchNameOrEmail.label;" clickSelectsAll="true"
               oncommand="onEnterInSearchBar();"/>
    </vbox>

    <separator class="thin"/>

    <tree id="abResultsTree" flex="1" context="cardProperties" class="plain" sortCol="GeneratedName" persist="sortCol"
          onclick="contactsListOnClick(event);"
          onselect="this.view.selectionChanged(); document.commandDispatcher.updateCommands('addrbook-select');">
      <treecols>
        <!-- these column ids must match up to the mork column names, see nsIAddrDatabase.idl -->
        <treecol id="GeneratedName"
                 persist="hidden ordinal width sortDirection" flex="1" label="&GeneratedName.label;" primary="true"/>
        <splitter class="tree-splitter"/>
        <treecol id="addrbook"
                 persist="hidden ordinal width sortDirection" hidden="true"
                 flex="1" label="&Addrbook.label;"/>
        <splitter class="tree-splitter"/>
        <treecol id="PrimaryEmail"
                 persist="hidden ordinal width sortDirection" hidden="true"
                 flex="1" label="&PrimaryEmail.label;"/>
      </treecols>
      <treechildren ondraggesture="nsDragAndDrop.startDrag(event, abResultsPaneObserver);"/>
    </tree>

    <separator class="thin"/>

    <hbox>
      <spring flex="1"/>
      <grid>
        <columns>
          <column style="min-width: 10em"/>
        </columns>
        <rows>
          <row id="toButtonBox">
              <button id="toButton" label="&toButton.label;" accesskey="&toButton.accesskey;"
                      oncommand="addSelectedAddresses('addr_to')"/>
          </row>
          <row id="ccButtonBox">
              <button id="ccButton" label="&ccButton.label;" accesskey="&ccButton.accesskey;"
                      oncommand="addSelectedAddresses('addr_cc')"/>
          </row>
          <row id="bccButtonBox">
              <button id="bccButton" label="&bccButton.label;" accesskey="&bccButton.accesskey;"
                      oncommand="addSelectedAddresses('addr_bcc')"/>
          </row>
        </rows>
      </grid>
      <spring flex="1"/>
    </hbox>

    <separator class="thin"/>
  </vbox>
</page>
