<?xml version="1.0"?>

<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is Adblock Plus.
   -
   - The Initial Developer of the Original Code is
   - Wladimir Palant.
   - Portions created by the Initial Developer are Copyright (C) 2006-2009
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -
   - ***** END LICENSE BLOCK ***** -->

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://autoproxy/skin/sidebar.css" type="text/css"?>

<!DOCTYPE page SYSTEM "chrome://autoproxy/locale/sidebar.dtd">

<page
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  id="aup-sidebar"
  onload="init()"
  onunload="cleanUp()">

  <script type="application/x-javascript;version=1.7" src="utils.js"/>
  <script type="application/x-javascript;version=1.7" src="sidebar.js"/>
  <script type="application/x-javascript;version=1.7" src="flasher.js"/>
  <script type="application/x-javascript;version=1.7" src="enableProxyOn.js"/>

  <keyset id="sidebarKeys">
    <key id="block-key" keycode="VK_ENTER"/>
    <key id="copy-key" modifiers="accel" key="C" command="copy-command"/>
    <key id="selectAll-key" modifiers="accel" key="A" command="selectAll-command"/>
  </keyset>

  <commandset id="sidebarCommands">
    <command id="copy-command" oncommand="copyToClipboard()" disabled="true"/>
    <command id="selectAll-command" oncommand="selectAll()"/>
  </commandset>

  <popupset id="sidebarPopups">
    <tooltip id="tooltip" orient="vertical" onpopupshowing="return fillInTooltip(event)">
      <description id="tooltipDummy"/>
      <hbox id="tooltipPreviewBox" pack="start">
        <image id="tooltipPreview" validate="never"/>
      </hbox>
      <grid>
        <columns>
          <column/>
          <column flex="1"/>
        </columns>
        <rows>
          <row id="tooltipAddressRow" align="top">
            <label value="&tooltip.address.label;"/>
            <vbox id="tooltipAddress"/>
          </row>
          <row id="tooltipTypeRow">
            <label value="&tooltip.type.label;"/>
            <description id="tooltipType" filtered="&tooltip.type.blocked;" whitelisted="&tooltip.type.whitelisted;"/>
          </row>
          <row id="tooltipSizeRow">
            <label value="&tooltip.size.label;"/>
            <description id="tooltipSize"/>
          </row>
          <row id="tooltipDocDomainRow">
            <label value="&tooltip.docDomain.label;"/>
            <description id="tooltipDocDomain"/>
          </row>
          <row id="tooltipFilterRow" align="top">
            <label value="&tooltip.filter.label;"/>
            <vbox id="tooltipFilter"/>
          </row>
          <row id="tooltipFilterSourceRow" align="top">
            <label value="&tooltip.filterSource.label;"/>
            <vbox id="tooltipFilterSource"/>
          </row>
        </rows>
      </grid>
    </tooltip>

    <menupopup id="context" onpopupshowing="return fillInContext(event)">
      <!--"Enable Proxy On" menu items will be insert here by JS-->
      <menuitem id="contextOpen" label="&context.open.label;" oncommand="openInTab(null)"/>
      <menuitem id="contextFlash" label="&context.flash.label;" oncommand="onSelectionChange()"/>
      <menuitem id="contextCopy" label="&context.copy.label;" command="copy-command" key="copy-key"/>
      <menuitem id="contextCopyFilter" label="&context.copyFilter.label;" oncommand="copyFilter()"/>
      <menuseparator id="contextSelectSep"/>
      <menuitem id="contextSelectAll" label="&context.selectAll.label;" command="selectAll-command" key="selectAll-key"/>
    </menupopup>
  </popupset>

  <hbox>
    <hbox align="center" flex="1">
      <label value="&search.label;" accesskey="&search.accesskey;" control="searchField"/>
      <textbox id="searchField" flex="1" type="timed" timeout="500" oncommand="treeView.setFilter(this.value)"/>
    </hbox>
    <description id="detachButton" value="&detach.label;" onclick="detach(true)"/>
    <description id="reattachButton" value="&reattach.label;" onclick="if (this.getAttribute('disabled') != 'true') detach(false)" hidden="true"/>
  </hbox>

  <tree id="list" flex="1" seltype="multiple" enableColumnDrag="true"
        defaultSort="state descending" persist="defaultSort">
    <treecols>
      <treecol id="address" label="&address.label;" flex="2" crop="center" persist="width ordinal sortDirection hidden"/>
      <splitter class="tree-splitter"/>
      <treecol id="filter" label="&filter.label;" flex="1" persist="width ordinal sortDirection hidden"/>
      <splitter class="tree-splitter"/>
      <treecol id="type" label="&type.label;" width="80" persist="width ordinal sortDirection hidden"/>
      <splitter class="tree-splitter"/>
      <treecol id="state" label="&state.label;" width="16" persist="width ordinal sortDirection hidden"/>
      <splitter class="tree-splitter"/>
      <treecol id="size" label="&size.label;" width="60" hidden="true" persist="width ordinal sortDirection hidden"/>
      <splitter class="tree-splitter"/>
      <treecol id="docDomain" label="&docDomain.label;" width="100" hidden="true" persist="width ordinal sortDirection hidden"/>
    </treecols>

    <treechildren tooltip="tooltip" context="context"
                  onclick="handleClick(event)"
                  noitemslabel="&noitems.label;"
                  whitelistedlabel="&whitelisted.label;"/>
  </tree>
</page>
