<?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):
   -   Netscape Communications Corporation
   -   Blake Ross <blake@cs.stanford.edu>
   -   David Hyatt <hyatt@mozilla.org>
   -   Joe Hewitt <hewitt@netscape.com>
   -   Pierre Chanial <chanial@noos.fr>
   -   Dean Tessman <dean_tessman@hotmail.com>
   -
   - ***** END LICENSE BLOCK ***** -->

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

<!DOCTYPE dialog SYSTEM "chrome://autoproxy/locale/settings.dtd">

<dialog
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  title="&dialog.title;"
  id="aupPreferencesWindow"
  width="600"
  height="450"
  onload="init()"
  onunload="cleanUp()"
  ondialogaccept="applyChanges(); return true;"
  ondialogextra1="treeView.startEditor(true)"
  buttonlabelextra1="&add.label;..."
  buttonaccesskeyextra1="&add.accesskey;"
  ondialogextra2="addRuleGroup()"
  buttonlabelextra2="&addRuleGroup.label;"
  buttonaccesskeyextra2="&addRuleGroup.accesskey;"
  buttons="accept,cancel,extra1,extra2"
  persist="screenX screenY width height sizemode"
  windowtype="aup:settings">

<script type="application/x-javascript;version=1.7" src="utils.js"/>
<script type="application/x-javascript;version=1.7" src="settings.js"/>
<script type="application/x-javascript;version=1.7" src="findbar.js"/>

<keyset id="AutoProxyKeys">
  <key id="synchsubscription-key" key="t" modifiers="accel"/>
  <key id="synchsubscriptions-key" key="t" modifiers="accel,shift" command="synchsubscriptions-command"/>
  <key id="import-key" key="i" modifiers="accel" command="import-command"/>
  <key id="export-key" key="e" modifiers="accel" command="export-command"/>
  <key id="selectall-key" key="a" modifiers="accel" command="selectall-command"/>
  <key id="copy-key" key="c" modifiers="accel" command="copy-command"/>
  <key id="cut-key" key="x" modifiers="accel" command="cut-command"/>
  <key id="paste-key" key="v" modifiers="accel" command="paste-command"/>
  <key id="find-key" key="f" modifiers="accel" command="find-command"/>
  <key id="find-again-key" key="g" modifiers="accel" command="find-again-command"/>
  <key id="find-previous-key" key="g" modifiers="accel,shift" command="find-previous-command"/>
  <key id="find-again-key2" keycode="VK_F3" command="find-again-command"/>
  <key id="find-previous-key2" keycode="VK_F3" modifiers="shift" command="find-previous-command"/>
  <key id="edit-key" keycode="VK_ENTER"/>
  <key id="remove-key" keycode="VK_DELETE"/>
  <key id="addfilter-key" keycode="VK_INSERT"/>
  <key id="moveup-key" keycode="VK_UP" modifiers="accel"/>
  <key id="movedown-key" keycode="VK_DOWN" modifiers="accel"/>
  <key id="movegroupup-key" keycode="VK_UP" modifiers="accel,shift"/>
  <key id="movegroupdown-key" keycode="VK_DOWN" modifiers="accel,shift"/>
</keyset>

<commandset id="aupCommands">
  <command id="addsubscription-command" oncommand="editSubscription(null)"/>
  <command id="synchsubscriptions-command" oncommand="synchAllSubscriptions(false)"/>
  <command id="import-command" oncommand="importList()"/>
  <command id="export-command" oncommand="exportList()"/>
  <command id="selectall-command" oncommand="treeView.selection.selectAll()"/>
  <command id="copy-command" oncommand="copyToClipboard()"/>
  <command id="cut-command" oncommand="copyToClipboard(); removeFilters(false)"/>
  <command id="paste-command" oncommand="pasteFromClipboard()"/>
  <command id="remove-command" oncommand="removeFilters(true)"/>
  <command id="find-command" oncommand="E('findbar').startFind(E('findbar').FIND_NORMAL)"/>
  <command id="find-again-command" oncommand="E('findbar').onFindAgainCommand(false)"/>
  <command id="find-previous-command" oncommand="E('findbar').onFindAgainCommand(true)"/>
</commandset>

<popupset id="aupPopups">
  <menupopup id="listitem-context" onpopupshowing="return fillContext()">
    <menuitem id="context-synchsubscription" label="&context.synchsubscription.label;" oncommand="synchSubscription(event.shiftKey)" key="synchsubscription-key" />
    <menuitem id="context-editsubscription" label="&context.editsubscription.label;..." oncommand="ruleGroupSettings()" key="edit-key"/>
    <menuitem id="context-edit" label="&context.edit.label;" oncommand="editFilter('filter')" key="edit-key"/>
    <menuitem id="context-resethitcount" label="&context.resethitcount.label;..." oncommand="resetHitCounts(false)"/>
    <menuitem id="context-moveup" label="&context.moveup.label;" oncommand="treeView.moveFilter(true)" key="moveup-key"/>
    <menuitem id="context-movedown" label="&context.movedown.label;" oncommand="treeView.moveFilter(false)" key="movedown-key"/>
    <menuseparator/>
    <menuitem id="context-cut" label="&cut.label;" accesskey="&cut.accesskey;" command="cut-command" key="cut-key"/>
    <menuitem id="context-copy" label="&copy.label;" accesskey="&copy.accesskey;" command="copy-command" key="copy-key"/>
    <menuitem id="context-paste" label="&paste.label;" accesskey="&paste.accesskey;" command="paste-command" key="paste-key"/>
    <menuitem id="context-remove" label="&remove.label;" accesskey="&remove.accesskey;" command="remove-command" key="remove-key"/>
    <menuitem id="context-enable" label="&context.enable.label;" oncommand="toggleDisabled()"/>
    <menuitem id="context-disable" label="&context.disable.label;" oncommand="toggleDisabled()"/>
    <menuseparator/>
    <menuitem id="context-movegroupup" label="&context.movegroupup.label;" oncommand="treeView.moveSubscription(true)" key="movegroupup-key"/>
    <menuitem id="context-movegroupdown" label="&context.movegroupdown.label;" oncommand="treeView.moveSubscription(false)" key="movegroupdown-key"/>
  </menupopup>
  <menupopup id="treecols-context" onpopupshowing="fillViewPopup('context-')"/>
  <tooltip id="tree-tooltip" onpopupshowing="return showTreeTooltip(event)"/>
</popupset>

<toolbox id="menuToolbox">
  <menubar id="menu" onpopupshowing="treeView.stopEditor(true, true);">
    <menu id="filters-menu" label="&filters.label;" accesskey="&filters.accesskey;">
      <menupopup id="filters-popup" onpopupshowing="fillFiltersPopup()">
        <menuitem id="addfilter" label="&add.label;..." accesskey="&add.accesskey;" key="addfilter-key" oncommand="treeView.startEditor(true)"/>
        <menuitem id="addRuleGroup" label="&addRuleGroup.label;" accesskey="&addRuleGroup.accesskey;" oncommand="addRuleGroup()"/>
        <menuseparator/>
        <menuitem id="addsubscription" label="&addsubscription.label;..." accesskey="&addsubscription.accesskey;" command="addsubscription-command"/>
        <menuitem id="synchsubscriptions" label="&synchsubscriptions.label;" accesskey="&synchsubscriptions.accesskey;" key="synchsubscriptions-key" command="synchsubscriptions-command"/>
        <menuseparator/>
        <menuitem id="import" label="&import.label;..." accesskey="&import.accesskey;" key="import-key" command="import-command"/>
        <menuitem id="export" label="&export.label;..." accesskey="&export.accesskey;" key="export-key" command="export-command"/>
        <menuitem id="clearall" label="&clearall.label;..." accesskey="&clearall.accesskey;" oncommand="clearList()"/>
        <menuseparator/>
        <menuitem id="resethitcounts" label="&resethitcounts.label;..." accesskey="&resethitcounts.accesskey;" oncommand="resetHitCounts(true)"/>
      </menupopup>
    </menu>

    <menu id="proxies-menu" label="&proxies.label;" accesskey="&proxies.accesskey;">
      <menupopup id="proxies-popup" >
        <menuitem id="editproxies" label="&editproxies.label;..." accesskey="&editproxies.accesskey;" oncommand="editProxyServer()"/>
        <menuitem id="chooseproxies" label="&chooseproxies.label;..." accesskey="&chooseproxies.accesskey;" oncommand="ruleGroupSettings()"/>
      </menupopup>
    </menu>

    <menu id="edit-menu" label="&edit.label;" accesskey="&edit.accesskey;">
      <menupopup id="edit-popup" onpopupshowing="fillContext()">
        <menuitem id="cut" label="&cut.label;" accesskey="&cut.accesskey;" command="cut-command" key="cut-key"/>
        <menuitem id="copy" label="&copy.label;" accesskey="&copy.accesskey;" command="copy-command" key="copy-key"/>
        <menuitem id="paste" label="&paste.label;" accesskey="&paste.accesskey;" command="paste-command" key="paste-key"/>
        <menuitem id="remove" label="&remove.label;" accesskey="&remove.accesskey;" command="remove-command" key="remove-key"/>
        <menuseparator/>
        <menuitem id="find" label="&menu.find.label;..." accesskey="&menu.find.accesskey;" command="find-command" key="find-key"/>
        <menuitem id="find-again" label="&menu.findagain.label;" accesskey="&menu.findagain.accesskey;" command="find-again-command" key="find-again-key"/>
      </menupopup>
    </menu>
    <menu id="view-menu" label="&view.label;" accesskey="&view.accesskey;">
      <menupopup id="view-popup" onpopupshowing="fillViewPopup('')">
        <menuitem id="view-filter" label="&filter.column;" accesskey="&filter.accesskey;" type="checkbox" disabled="true"/>
        <menuitem id="view-slow" label="&slow.column;" accesskey="&slow.accesskey;" type="checkbox" oncommand="toggleColumn('col-slow')"/>
        <menuitem id="view-enabled" label="&enabled.column;" accesskey="&enabled.accesskey;" type="checkbox" oncommand="toggleColumn('col-enabled')"/>
        <menuitem id="view-hitcount" label="&hitcount.column;" accesskey="&hitcount.accesskey;" type="checkbox" oncommand="toggleColumn('col-hitcount')"/>
        <menuitem id="view-lasthit" label="&lasthit.column;" accesskey="&lasthit.accesskey;" type="checkbox" oncommand="toggleColumn('col-lasthit')"/>
        <menuseparator/>
        <menu id="sort-menu" label="&sort.label;" accesskey="&sort.accesskey;">
          <menupopup id="sort-popup">
            <menuitem id="sort-none" label="&sort.none.label;" accesskey="&sort.none.accesskey;" type="radio" name="sortColumn" oncommand="sortBy(null)"/>
            <menuitem id="sort-filter" label="&filter.column;" accesskey="&filter.accesskey;" type="radio" name="sortColumn" oncommand="sortBy('col-filter')"/>
            <menuitem id="sort-slow" label="&slow.column;" accesskey="&slow.accesskey;" type="radio" name="sortColumn" oncommand="sortBy('col-slow')"/>
            <menuitem id="sort-enabled" label="&enabled.column;" accesskey="&enabled.accesskey;" type="radio" name="sortColumn" oncommand="sortBy('col-enabled')"/>
            <menuitem id="sort-hitcount" label="&hitcount.column;" accesskey="&hitcount.accesskey;" type="radio" name="sortColumn" oncommand="sortBy('col-hitcount')"/>
            <menuitem id="sort-lasthit" label="&lasthit.column;" accesskey="&lasthit.accesskey;" type="radio" name="sortColumn" oncommand="sortBy('col-lasthit')"/>
            <menuseparator/>
            <menuitem id="sort-asc" label="&sort.ascending.label;" accesskey="&sort.ascending.accesskey;" type="radio" name="sortOrder" oncommand="setSortOrder('ascending')"/>
            <menuitem id="sort-desc" label="&sort.descending.label;" accesskey="&sort.descending.accesskey;" type="radio" name="sortOrder" oncommand="setSortOrder('descending')"/>
          </menupopup>
        </menu>
      </menupopup>
    </menu>
    <menu id="options-menu" label="&options.label;" accesskey="&options.accesskey;">
      <menupopup id="options-popup" onpopupshowing="fillOptionsPopup()">
        <menuitem id="mode-auto" label="&mode.auto.label;" accesskey="&mode.auto.accesskey;" type="radio" oncommand="proxy.switchToMode('auto')"/>
        <menuitem id="mode-global" label="&mode.global.label;" accesskey="&mode.global.accesskey;" type="radio" oncommand="proxy.switchToMode('global')"/>
        <menuitem id="mode-disabled" label="&mode.disabled.label;" accesskey="&mode.disabled.accesskey;" type="radio" oncommand="proxy.switchToMode('disabled')"/>
        <menuseparator/>
        <menuitem id="showintoolbar" label="&showintoolbar.label;" accesskey="&showintoolbar.accesskey;" type="checkbox" oncommand="togglePref('showintoolbar')"/>
        <menuitem id="showinstatusbar" label="&showinstatusbar.label;" accesskey="&showinstatusbar.accesskey;" type="checkbox" oncommand="togglePref('showinstatusbar')"/>
        <menuseparator/>
        <menu label="&changeClickBehaviour.label;">
          <menupopup onpopupshowing="fillClickBehaviourPopup(event, true)">
            <menuitem label="&changeClickBehaviour_context;" oncommand="changeClickBehaver(0)" type="radio"/>
            <menuitem label="&changeClickBehaviour_proxyable;" oncommand="changeClickBehaver(1)" type="radio"/>
            <menuitem label="&changeClickBehaviour_preference;" oncommand="changeClickBehaver(2)" type="radio"/>
            <menuitem label="&changeClickBehaviour_proxyMode;" oncommand="changeClickBehaver(3)" type="radio"/>
            <menuitem label="&changeClickBehaviour_cycleProxy;" oncommand="changeClickBehaver(4)" type="radio"/>
            <menuitem label="&changeClickBehaviour_proxyMenu;" oncommand="changeClickBehaver(5)" type="radio"/>
          </menupopup>
        </menu>
      </menupopup>
    </menu>
    <menu id="help-menu" label="&help.label;" accesskey="&help.accesskey;">
      <menupopup id="help-popup">
        <menuitem id="gettingStartedLink" label="&gettingStarted.label;" accesskey="&gettingStarted.accesskey;" oncommand="aup.loadInBrowser('https://autoproxy.org/getting_started')"/>
        <menuitem id="faqLink" label="&faq.label;" accesskey="&faq.accesskey;" oncommand="aup.loadInBrowser('https://autoproxy.org/faq')"/>
        <menuitem id="filtersLink" label="&filterdoc.label;" accesskey="&filterdoc.accesskey;" oncommand="aup.loadInBrowser('https://autoproxy.org/rules')"/>
        <menuseparator/>
        <menuitem id="aboutAup" label="&about.label;..." accesskey="&about.accesskey;" oncommand="openAbout()"/>
      </menupopup>
    </menu>
  </menubar>
</toolbox>

<description id="introduction">
  &description;
</description>

<button id="applyButton" class="dialog-button" hidden="true" label="&apply.label;" accesskey="&apply.accesskey;" oncommand="applyChanges()"/>

<vbox id="listarea" flex="1">
  <stack id="listStack" flex="1">
    <tree id="list" persist="closedSubscriptions" flex="1" seltype="multiple" hidecolumnpicker="true" enableColumnDrag="true">
      <treecols context="treecols-context">
        <treecol id="col-filter" label="&filter.column;" primary="true" flex="10" persist="width ordinal sortDirection hidden"/>
        <splitter class="tree-splitter"/>
        <treecol id="col-slow" label="!" flex="0" width="16" persist="width ordinal sortDirection hidden"/>
        <splitter class="tree-splitter"/>
        <treecol id="col-enabled" label="&enabled.column;" flex="0" persist="width ordinal sortDirection hidden"/>
        <splitter class="tree-splitter"/>
        <treecol id="col-hitcount" label="&hitcount.column;" flex="0" persist="width ordinal sortDirection hidden"/>
        <splitter class="tree-splitter"/>
        <treecol id="col-lasthit" label="&lasthit.column;" hidden="true" flex="4" persist="width ordinal sortDirection hidden"/>
      </treecols>

      <treechildren tooltip="tree-tooltip" context="listitem-context" onclick="onListClick(event)" ondblclick="onListDblClick(event)" ondraggesture="onListDragGesture(event)"/>
    </tree>
    <hbox id="listEditorParent" align="center" hidden="true">
      <textbox id="listEditor" class="tree-input" flex="1"/>
      <image id="listEditorIcon" onclick="if (event.button == 0) treeView.stopEditor(false);" />
    </hbox>
  </stack>
  <findbar id="findbar"/>
</vbox>

<hbox>
  <hbox flex="1">
    <button dlgtype="extra1"/>
    <button dlgtype="extra2"/>
  </hbox>
  <hbox>
    <button dlgtype="cancel"/>
    <button dlgtype="accept"/>
  </hbox>
</hbox>
</dialog>
