<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"?>

<!--
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "MPL"); you may not use this file
 * except in compliance with the MPL. You may obtain a copy of
 * the MPL at http://www.mozilla.org/MPL/
 *
 * Software distributed under the MPL is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the MPL for the specific language governing
 * rights and limitations under the MPL.
 *
 * The Original Code is Enigmail.
 *
 * The Initial Developer of the Original Code is Patrick Brunschwig.
 * Portions created by Patrick Brunschwig <patrick@enigmail.net> are
 * Copyright (C) 2004 Patrick Brunschwig. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 * ***** END LICENSE BLOCK ***** *
-->


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

<!DOCTYPE window [
  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
   %brandDTD;
  <!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
  %enigMailDTD;
  <!ENTITY % utilDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
   %utilDTD;
]>

<window id="enigmailKeyManager"
        title="&enigmail.keyMan.title;"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="enigmailKeyManagerLoad();"
        height="450"
        width="700"
        windowtype="enigmail:KeyManager"
        persist="screenX screenY width height">

  <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
  <script type="application/x-javascript" src="chrome://enigmail/content/enigmailCommon.js"/>
  <script type="application/x-javascript" src="chrome://enigmail/content/enigmailKeyManager.js"/>

  <commandset id="tasksCommands"/>

  <command id="cmd_close" oncommand="window.close()"/>
  <command id="cmd_quit"/>
  <command id="cmd_enigmailDeleteKey" oncommand="enigmailDeleteKey()"/>

  <keyset id="winKeys">
    <key id="key_selectAll" key="&enigmail.keyMan.selectAll.key;"
         oncommand="enigmailSelectAllKeys()" modifiers="accel"/>
    <key id="key_enigDelete"
         keycode="VK_DELETE"
         command="cmd_enigmailDeleteKey"/>
    <key id="key_close"/>
    <key id="key_quit"/>
  </keyset>

  <broadcasterset>
    <broadcaster id="bcNoKey" disabled="false"/>
    <broadcaster id="bcSignKey" disabled="false"/>
    <broadcaster id="bcSetTrust" disabled="false"/>
    <broadcaster id="bcViewSig" disabled="false"/>
    <broadcaster id="bcViewPhoto" disabled="false"/>
    <broadcaster id="bcEditKey" disabled="false"/>
    <broadcaster id="bcRevoke" disabled="false"/>
    <broadcaster id="bcOneKey" disabled="false"/>
    <broadcaster id="bcDeleteKey" disabled="false"/>
    <broadcaster id="bcClipbrd" disabled="false"/>
    <broadcaster id="bcEnableKey" disabled="false" label=""/>
  </broadcasterset>

  <menubar id="main-menubar" grippyhidden="true">
    <menu label="&enigmail.keyMan.fileMenu.label;"
          id="menu_File"
          accesskey="&enigmail.keyMan.fileMenu.accesskey;">
      <menupopup id="menu_FilePopup" onpopupshowing="enigmailKeyMenu()">

        <menuitem label="&enigmail.keyMan.importFromFile.label;"
          id="importFromFile"
          accesskey="&enigmail.keyMan.importFromFile.accesskey;"
          oncommand="enigmailImportKeysFromFile()"/>
        <menuitem label="&enigmail.keyMan.exportToFile.label;"
          id="exportKey"
          observes="bcNoKey"
          accesskey="&enigmail.keyMan.exportToFile.accesskey;"
          oncommand="enigmailExportKeys()"/>

        <menuitem label="&enigmail.keyMan.sendKeys.label;"
          id="sendKey"
          observes="bcNoKey"
          accesskey="&enigmail.keyMan.sendKeys.accesskey;"
          oncommand="enigCreateKeyMsg()"/>

        <menuitem label="&enigmail.keyMan.createMail.label;"
          id="createMail"
          observes="bcNoKey"
          accesskey="&enigmail.keyMan.createMail.accesskey;"
          oncommand="createNewMail()"/>

        <menuseparator/>

        <menuitem label="&enigmail.adminSmartCard.label;"
                id="cardData"
                accesskey="&enigmail.adminSmartCard.accesskey;"
                oncommand="EngmailCardDetails()"/>

        <menuseparator/>

        <menuitem label="&enigmail.keyMan.reload.label;"
                id="refreshKeys"
                accesskey="&enigmail.keyMan.reload.accesskey;"
                oncommand="enigmailRefreshKeys();"/>

        <menuseparator/>

        <!-- add Close and Exit menu items -->
        <menuitem id="menu_close"/>
      </menupopup>
    </menu>

    <menu label="&enigmail.keyMan.editMenu.label;"
          accesskey="&enigmail.keyMan.editMenu.accesskey;">
      <menupopup onpopupshowing="enigmailKeyMenu()">

				<menuitem label="&enigmail.keyMan.importFromClipbrd.label;"
									id="importFromClipbrd"
									observes="bcClipbrd"
									accesskey="&enigmail.keyMan.importFromClipbrd.accesskey;"
									oncommand="enigmailImportFromClipbrd()"/>
				<menuitem label="&enigmail.keyMan.copyToClipbrd.label;"
									id="copyToClipbrd"
									observes="bcNoKey"
									accesskey="&enigmail.keyMan.copyToClipbrd.accesskey;"
									oncommand="enigmailCopyToClipbrd()"/>

        <menuseparator/>

        <menuitem label="&enigmail.keyMan.sign.label;"
                  id="signKey"
                  observes="bcSignKey"
                  accesskey="&enigmail.keyMan.sign.accesskey;"
                  oncommand="enigSignKey()"/>
        <menuitem label="&enigmail.keyMan.setTrust.label;"
                  id="setTrust"
                  observes="bcNoKey"
                  accesskey="&enigmail.keyMan.setTrust.accesskey;"
                  oncommand="enigEditKeyTrust()"/>

        <menuseparator/>

        <menuitem id="enableKey"
          observes="bcEnableKey"
          accesskey="&enigmail.keyMan.enableKey.accesskey;"
          oncommand="enigmailEnableKey()"/>
        <menuitem label="&enigmail.keyMan.revokeKey.label;"
          id="revokeKey"
          observes="bcRevoke"
          accesskey="&enigmail.keyMan.revokeKey.accesskey;"
          oncommand="enigmailRevokeKey()"/>

        <menuitem label="&enigmail.keyMan.delKey.label;"
          id="deleteKey"
          key="key_enigDelete"
          observes="bcNoKey"
          accesskey="&enigmail.keyMan.delKey.accesskey;"
          oncommand="enigmailDeleteKey()"/>

        <menuseparator/>

        <menuitem id="manageUid"
                  label="&enigmail.keyMan.manageUid.label;"
                  observes="bcOneKey"
                  accesskey="&enigmail.keyMan.manageUid.accesskey;"
                  oncommand="enigmailManageUids()"/>

        <menuitem id="changeExpiry"
                  label="&enigmail.keyMan.changeExpiry.label;"
                  observes="bcOneKey"
                  accesskey="&enigmail.keyMan.changeExpiry.accesskey;"
                  oncommand="enigEditKeyExpiry()"/>

        <menuitem id="changePwd"
                  label="&enigmail.keyMan.changePwd.label;"
                  observes="bcEditKey"
                  accesskey="&enigmail.keyMan.changePwd.accesskey;"
                  oncommand="enigmailChangePwd()"/>

        <menuitem id="addPhoto"
                  label="&enigmail.keyMan.addPhoto.label;"
                  observes="bcRevoke"
                  accesskey="&enigmail.keyMan.addPhoto.accesskey;"
                  oncommand="enigmailAddPhoto()"/>

        <menuitem id="addToRule"
                  label="&enigmail.keyMan.addToPRRule.label;"
                  observes="bcSignKey"
                  oncommand="addToPRRule()"/>

        <menuseparator/>

        <menuitem id="selectAll"
                  label="&enigmail.keyMan.selectAll.label;"
                  accesskey="&enigmail.keyMan.selectAll.accesskey;"
                  oncommand="enigmailSelectAllKeys()"
                  key="key_selectAll"/>

      </menupopup>
    </menu>

      <menu id="viewMenu"
        label="&enigmail.keyMan.viewMenu.label;"
        accesskey="&enigmail.keyMan.viewMenu.accesskey;">
      <menupopup onpopupshowing="enigmailKeyMenu()"> <!-- view menu -->
        <menuitem label="&enigmail.keyMan.viewSig.label;"
                  id="viewSig"
                  observes="bcViewSig"
                  accesskey="&enigmail.keyMan.viewSig.accesskey;"
                  oncommand="enigmailListSig()"/>
        <menuitem label="&enigmail.keyMan.viewPhoto.label;"
                  id="viewPhoto"
                  observes="bcViewPhoto"
                  accesskey="&enigmail.keyMan.showPhoto.accesskey;"
                  oncommand="enigShowPhoto()"/>
        <menuitem label="&enigmail.keyMan.keyProps.label;"
                  id="keyDetails"
                  observes="bcOneKey"
                  accesskey="&enigmail.keyMan.keyDetails.accesskey;"
                  oncommand="enigmailKeyDetails()"/>
        <menuseparator/>
        <menuitem label="&enigmail.keyMan.showInvalidKeys.label;"
                  id="showInvalidKeys"
                  type="checkbox"
                  checked="true"
                  persist="checked"
                  accesskey="&enigmail.keyMan.showInvalidKeys.accesskey;"
                  oncommand="enigApplyFilter()"/>
        <menuitem label="&enigmail.keyMan.showUntrustedKeys.label;"
                  id="showUntrustedKeys"
                  type="checkbox"
                  checked="true"
                  persist="checked"
                  accesskey="&enigmail.keyMan.showUntrustedKeys.accesskey;"
                  oncommand="enigApplyFilter()"/>
        <menuitem label="&enigmail.keyMan.showOthersKeys.label;"
                  id="showOthersKeys"
                  type="checkbox"
                  checked="true"
                  persist="checked"
                  accesskey="&enigmail.keyMan.showOthersKeys.accesskey;"
                  oncommand="enigApplyFilter()"/>

			</menupopup>
		</menu>

		<menu id="keyserverMenu"
					label="&enigmail.keyMan.keyserverMenu.label;"
					accesskey="&enigmail.keyMan.keyserverMenu.accesskey;">
			<menupopup onpopupshowing="enigmailKeyMenu()"> <!-- keyserverMenu menu -->

				<menuitem label="&enigmail.keyMan.refreshSelKeys.label;"
									id="refreshKey"
									observes="bcNoKey"
									accesskey="&enigmail.keyMan.refreshSelKeys.accesskey;"
									oncommand="enigmailReceiveKey()"/>
				<menuitem label="&enigmail.keyMan.importFromServer.label;"
									id="importFromServer"
									accesskey="&enigmail.keyMan.importFromServer.accesskey;"
									oncommand="enigmailSearchKey()"/>
				<menuitem label="&enigmail.keyMan.uploadToServer.label;"
									id="uploadToServer"
									observes="bcNoKey"
									accesskey="&enigmail.keyMan.uploadToServer.accesskey;"
									oncommand="enigmailUploadKeys()"/>
        <menuseparator/>
				<menuitem label="&enigmail.keyMan.refreshAllKeys.label;"
									id="refreshAllKeys"
									accesskey="&enigmail.keyMan.refreshAllKeys.accesskey;"
									oncommand="enigmailRefreshAllKeys()"/>
				<menuitem label="&enigmail.keyMan.downloadContactKeys.label;"
				          accesskey="&enigmail.keyMan.downloadContactKeys.accesskey;"
									id="downloadContactKeys"
									oncommand="enigmailDownloadContactKeys()"/>
			</menupopup>
		</menu>

		<menu id="generateMenu"
					label="&enigmail.keyMan.generateMenu.label;"
					accesskey="&enigmail.keyMan.generateMenu.accesskey;">
			<menupopup onpopupshowing="enigmailKeyMenu()"> <!-- generate menu -->
        <menuitem label="&enigmail.keyMan.generate.label;"
                  id="genKey"
                  accesskey="&enigmail.keyMan.generate.accesskey;"
                  oncommand="EnigKeygen(); enigmailRefreshKeys();"/>
        <menuitem label="&enigmail.keyMan.genRevoke.label;"
                  id="revokationCertificate"
                  observes="bcRevoke"
                  accesskey="&enigmail.keyMan.genRevoke.accesskey;"
                  oncommand="enigCreateRevokeCert()"/>
			</menupopup>
		</menu>

  </menubar>

  <popupset>
    <menupopup id="ctxmenu"
           onpopupshowing="enigmailKeyMenu();">
			<menuitem label="&enigmail.keyMan.ctxCopyToClipbrd.label;"
								id="ctxCopyToClipbrd"
								oncommand="enigmailCopyToClipbrd()"/>
			<menuitem label="&enigmail.keyMan.ctxExportToFile.label;"
								id="ctxExport"
								oncommand="enigmailExportKeys()"/>
			<menuitem label="&enigmail.keyMan.sendKeys.label;"
								id="ctxSendKey"
								oncommand="enigCreateKeyMsg()"/>

      <menuseparator/>

			<menuitem label="&enigmail.keyMan.ctxUploadToServer.label;"
								id="ctxUpload"
								oncommand="enigmailUploadKeys()"/>
      <menuitem label="&enigmail.keyMan.ctxRefreshKey.label;"
			          id="ctxRefreshKey"
                oncommand="enigmailReceiveKey()"/>

      <menuseparator/>

      <menuitem id="ctxSign" observes="bcSignKey" label="&enigmail.keyMan.sign.label;" oncommand="enigSignKey()"/>
      <menuitem id="ctxTrust" label="&enigmail.keyMan.setTrust.label;" oncommand="enigEditKeyTrust()"/>
      <menuitem id="ctxAddToRule" observes="bcSignKey" label="&enigmail.keyMan.addToPRRule.label;" oncommand="addToPRRule()"/>

			<menuseparator/>


			<menuitem id="ctxEnableKey" observes="bcEnableKey" oncommand="enigmailEnableKey()"/>
			<menuitem id="ctxRevokeKey" observes="bcRevoke" label="&enigmail.keyMan.revokeKey.label;" oncommand="enigmailRevokeKey()"/>
			<menuitem id="ctxDeleteKey" label="&enigmail.keyMan.delKey.label;" oncommand="enigmailDeleteKey()"/>

      <menuseparator/>

      <menuitem id="ctxManageUid" observes="bcOneKey" label="&enigmail.keyMan.manageUid.label;" oncommand="enigmailManageUids()"/>
      <menuitem id="ctxChangeExpiry" observes="bcEditKey" label="&enigmail.keyMan.changeExpiry.label;" oncommand="enigEditKeyExpiry()"/>
      <menuitem id="ctxChangePwd" observes="bcEditKey" label="&enigmail.keyMan.changePwd.label;" oncommand="enigmailChangePwd()"/>
      <menuitem id="ctxRevokationCert" observes="bcRevoke" label="&enigmail.keyMan.ctxGenRevoke.label;" oncommand="enigCreateRevokeCert()"/>
      <menuitem id="ctxAddPhoto" observes="bcRevoke" label="&enigmail.keyMan.addPhoto.label;" oncommand="enigmailAddPhoto()"/>

			<menuseparator/>

      <menuitem id="ctxViewSig" observes="bcViewSig" label="&enigmail.keyMan.ctxViewSig.label;" oncommand="enigmailListSig()"/>
      <menuitem id="ctxViewPhoto" observes="bcViewPhoto" label="&enigmail.keyMan.ctxViewPhoto.label;" oncommand="enigShowPhoto()"/>
      <menuitem id="ctxDetails" observes="bcViewSig" label="&enigmail.keyMan.keyProps.label;"
								oncommand="enigmailKeyDetails()"/>
    </menupopup>
  </popupset>

  <hbox flex="0" align="center">
    <label value="&enigmail.keyMan.filter.label;" control="filterKey"/>
    <textbox id="filterKey" size="30"
             type="search"
             timeout="500"
             oncommand="onSearchInput();"/>
    <separator orient="vertical"/>
    <checkbox label="&enigmail.keyMan.showAllKeys.label;"
          checked="false"
          id="showAllKeys"
          accesskey="&enigmail.keyMan.showAllKeys.accesskey;"
          oncommand="enigmailToggleShowAll(this)"/>

  </hbox>

  <tooltip id="emptyTree" label="&enigmail.keyMan.emptyTree.tooltip;" noautohide="true"/>
  <tooltip id="nothingFound" label="&enigmail.keyMan.nothingFound.tooltip;" noautohide="true"/>
  <tooltip id="pleaseWait" label="&enigmail.keyMan.pleaseWait.tooltip;" noautohide="true"/>

  <groupbox width="700px" flex="1">
    <hbox flex="1">
      <tree id="pgpKeyList" flex="1"
        enableColumnDrag="true"
        seltype="multiple"
        persist="sortDirection sortResource"
        sortDirection="ascending"
        sortResource="enigUserNameCol"
        hidecolumnpicker="false">

        <treecols>
          <treecol id="enigUserNameCol" primary="true"
                  flex="1"
                  class="sortDirectionIndicator"
                  onclick="sortTree(this)"
                  label="&enigmail.keyMan.userId.label;"
                  persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="keyCol" style="width:90px"
                   label="&enigmail.keyId.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="typeCol" style="width:70px"
                   label="&enigmail.keyMan.keyType.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   hidden="true"
                   persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="validityCol" style="width:70px"
                   label="&enigmail.keyMan.calcTrust.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   hidden="true"
                   persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="trustCol" style="width:70px"
                   label="&enigmail.keyMan.ownerTrust.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   hidden="true"
                   persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="expCol" style="width:70px"
                   label="&enigmail.keyExpiry.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   hidden="true"
                   persist="width ordinal hidden"/>
          <splitter class="tree-splitter"/>
          <treecol id="fprCol" style="width:70px"
                   label="&enigmail.keyMan.fingerprint.label;"
                   flex="0"
                   class="sortDirectionIndicator"
                   onclick="sortTree(this)"
                   hidden="true"
                   persist="width ordinal hidden"/>
        </treecols>

        <treechildren id="pgpKeyListChildren" properties=""
                      context="ctxmenu"/>

      </tree>
    </hbox>
  </groupbox>

	<hbox id="statusLine">
		<label id="statusText" value=" "/>
		<progressmeter id="progressBar" mode="undetermined" value="0" collapsed="true"/>
		<description id="cancelBox" collapsed="true">
			<a class="enigmailLink" href=""
			   id="cancelButton" onclick="enigSendKeyCancel()">&enigmail.keyMan.stopTransfer.label;</a>
		</description>
	</hbox>
</window>
