<?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://messenger/skin/searchDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/addressbook/abResultsPane.css" type="text/css"?>

<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>

<!DOCTYPE window [
<!ENTITY % abResultsPaneOverlayDTD SYSTEM "chrome://messenger/locale/addressbook
/abResultsPaneOverlay.dtd">
%abResultsPaneOverlayDTD;
<!ENTITY % SearchDialogDTD SYSTEM "chrome://messenger/locale/SearchDialog.dtd">
%SearchDialogDTD;
]>

<window id="searchAddressBookWindow"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="searchOnLoad();"
        onunload="searchOnUnload();"
        onclose="onSearchStop();"
        windowtype="mailnews:absearch"
        title="&abSearchDialogTitle.label;"
        style="width: 52em; height: 34em;"
        persist="screenX screenY width height sizemode">

  <stringbundleset id="stringbundleset">
    <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
    <stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
    <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
    <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
  </stringbundleset>

  <script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
  <script type="application/javascript" src="chrome://messenger/content/mailWindow.js"/>
  <script type="application/javascript" src="chrome://messenger/content/msgMail3PaneWindow.js"/>
  <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
  <script type="application/javascript" src="chrome://messenger/content/commandglue.js"/>
  <script type="application/javascript" src="chrome://messenger/content/ABSearchDialog.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abResultsPane.js"/>
  <script type="application/javascript" src="chrome://messenger/content/addressbook/abCommon.js"/>

  <keyset id="mailKeys">
    <key key="&closeCmd.key;" modifiers="accel" oncommand="onSearchStop(); closeWindow(true);"/>
    <key keycode="VK_ESCAPE" oncommand="onSearchStop(); closeWindow(true);"/>
  </keyset>

  <commandset id="AbCommands">
    <command id="cmd_properties" oncommand="onProperties();"/>
    <command id="cmd_compose" oncommand="onCompose();"/>
    <command id="cmd_deleteCard" oncommand="onDelete();"/>
  </commandset>

  <dummy class="usesMailWidgets"/>

    <vbox id="searchTerms" flex="3" persist="height">
      <vbox>
        <hbox align="center">
          <label value="&abSearchHeading.label;" accesskey="&abSearchHeading.accesskey;" control="abPopup"/>
          <menulist id="abPopup" oncommand="SelectDirectory(this.value);">
            <menupopup id="abPopup-menupopup" class="addrbooksPopup"/>
          </menulist>
          <spacer flex="10"/>
          <button id="search-button" oncommand="onSearchButton(event);" default="true"/>
        </hbox>
        <hbox align="center">
          <spacer flex="1"/>
          <button label="&resetButton.label;" oncommand="onAbSearchReset(event);" accesskey="&resetButton.accesskey;"/>
        </hbox>
      </vbox>

      <hbox flex="1">
        <vbox id="searchTermListBox" flex="1"/>
      </hbox>
    </vbox>

    <splitter id="gray_horizontal_splitter" collapse="after" persist="state"/>

    <vbox id="searchResults" flex="4" persist="height">
      <vbox id="searchResultListBox" flex="1" >
        <tree id="abResultsTree" flex="1" enableColumnDrag="true" class="plain"
              context="mailContext"
              onclick="AbResultsPaneOnClick(event);"
              onkeypress="AbResultsPaneKeyPress(event);"
              onselect="this.view.selectionChanged();"
              sortCol="GeneratedName"
              persist="sortCol">

          <treecols id="abResultsTreeCols">
          <!-- these column ids must match up to the mork column names, except for GeneratedName and ChatName, see nsIAddrDatabase.idl -->
          <treecol id="GeneratedName"
                   persist="hidden ordinal width sortDirection" flex="1" 
                   label="&GeneratedName.label;" primary="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="PrimaryEmail"
                   persist="hidden ordinal width sortDirection"  flex="1" label="&PrimaryEmail.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="ChatName"
                   hidden="true"
                   persist="hidden ordinal width sortDirection" flex="1" label="&ChatName.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="Company"
                   persist="hidden ordinal width sortDirection" flex="1" label="&Company.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="NickName"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&NickName.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="SecondEmail"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&SecondEmail.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="Department"
                   persist="hidden ordinal width sortDirection"  
                   hidden="true"
                   flex="1" label="&Department.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="JobTitle"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&JobTitle.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="CellularNumber"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&CellularNumber.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="PagerNumber"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&PagerNumber.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="FaxNumber"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&FaxNumber.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="HomePhone"
                   persist="hidden ordinal width sortDirection" 
                   hidden="true"
                   flex="1" label="&HomePhone.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="WorkPhone"
                   persist="hidden ordinal width sortDirection"
                   flex="1" label="&WorkPhone.label;"/>

          <!-- LOCALIZATION NOTE: _PhoneticName may be enabled for Japanese builds. -->
          <!--
            <treecol id="_PhoneticName"
                     persist="hidden ordinal width sortDirection" 
                     hidden="true"
                     flex="1" label="&_PhoneticName.label;"/>
            <splitter class="tree-splitter"/>
           -->

          </treecols>
          <treechildren ondraggesture="nsDragAndDrop.startDrag(event, abResultsPaneObserver);"/>
        </tree>
      </vbox>
      <hbox align="start">
        <button label="&propertiesButton.label;"
                accesskey="&propertiesButton.accesskey;"
                command="cmd_properties"/>
        <button label="&composeButton.label;"
                accesskey="&composeButton.accesskey;"
                command="cmd_compose"/>
        <button label="&deleteCardButton.label;"
                accesskey="&deleteCardButton.accesskey;"
                command="cmd_deleteCard"/>
      </hbox>
    </vbox>

  <statusbar class="chromeclass-status" id="status-bar">
    <statusbarpanel id="statusText" crop="right" flex="1"/>
    <statusbarpanel class="statusbarpanel-progress" id="statusbar-progresspanel">
      <progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/>
    </statusbarpanel>
  </statusbar>

</window>
