<?xml version="1.0"?>
<!--
 * ***** 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 Ramalingam Saravanan.
 * Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
 * Copyright (C) 2001 Ramalingam Saravanan. All Rights Reserved.
 *
 * Contributor(s):
 * Patrick Brunschwig <patrick@enigmail.net>
 *
 * 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 ***** *
-->

<?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"?>

<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
%enigMailDTD;
]>
<dialog id="enigmailPrefsAdv"
        title="&enigmail.preferences.label;"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="prefOnLoad();"
        ondialogaccept="return prefOnAccept();">

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

  <popupset>
    <tooltip id="prefs.overrideGpg.tooltip">
      <description>&enigmail.prefs.overrideGpg.tooltip;</description>
    </tooltip>
    <tooltip id="maxIdleMinutes.tooltip">
      <description>&enigmail.maxIdleMinutes.tooltip;</description>
    </tooltip>
    <tooltip id="userNoPassphrase.tooltip">
      <description>&enigmail.userNoPassphrase.tooltip;</description>
    </tooltip>
    <tooltip id="expertUser.tooltip">
      <description>&enigmail.expertUser.tooltip;</description>
    </tooltip>
    <tooltip id="basicUser.tooltip">
      <description>&enigmail.basicUser.tooltip;</description>
    </tooltip>
    <tooltip id="resetPrefs.tooltip">
      <description>&enigmail.resetPrefs.tooltip;</description>
    </tooltip>
    <tooltip id="wrapHtmlBeforeSend.tooltip">
      <description>&enigmail.wrapHtmlBeforeSend.tooltip;</description>
    </tooltip>
    <tooltip id="alwaysTrustSend.tooltip">
      <description>&enigmail.alwaysTrustSend.tooltip;</description>
    </tooltip>

    <!-- sending preferences: accepted keys -->
    <tooltip id="acceptedKeysValid.tooltip">
      <description>&enigmail.acceptedKeysValid.tooltip;</description>
    </tooltip>
    <tooltip id="acceptedKeysAll.tooltip">
      <description>&enigmail.acceptedKeysAll.tooltip;</description>
    </tooltip>

    <!-- sending preferences: auto send encrypted -->
    <tooltip id="autoSendEncryptedNever.tooltip">
      <description>&enigmail.autoSendEncryptedNever.tooltip;</description>
    </tooltip>
    <tooltip id="autoSendEncryptedIfKeys.tooltip">
      <description>&enigmail.autoSendEncryptedIfKeys.tooltip;</description>
    </tooltip>

    <!-- sending preferences: confirm before sending -->
    <tooltip id="confirmBeforeSendingNever.tooltip">
      <description>&enigmail.confirmBeforeSendingNever.tooltip;</description>
    </tooltip>
    <tooltip id="confirmBeforeSendingAlways.tooltip">
      <description>&enigmail.confirmBeforeSendingAlways.tooltip;</description>
    </tooltip>
    <tooltip id="confirmBeforeSendingIfEncrypted.tooltip">
      <description>&enigmail.confirmBeforeSendingIfEncrypted.tooltip;</description>
    </tooltip>
    <tooltip id="confirmBeforeSendingIfNotEncrypted.tooltip">
      <description>&enigmail.confirmBeforeSendingIfNotEncrypted.tooltip;</description>
    </tooltip>
    <tooltip id="confirmBeforeSendingIfRules.tooltip">
      <description>&enigmail.confirmBeforeSendingIfRules.tooltip;</description>
    </tooltip>

    <!-- keySel preferences -->
    <tooltip id="assignKeysByRules.tooltip">
      <description>&enigmail.assignKeysByRules.tooltip;</description>
    </tooltip>
    <tooltip id="assignKeysByEmailAddr.tooltip">
      <description>&enigmail.assignKeysByEmailAddr.tooltip;</description>
    </tooltip>
    <tooltip id="assignKeysManuallyIfMissing.tooltip">
      <description>&enigmail.assignKeysManuallyIfMissing.tooltip;</description>
    </tooltip>
    <tooltip id="assignKeysManuallyAlways.tooltip">
      <description>&enigmail.assignKeysManuallyAlways.tooltip;</description>
    </tooltip>

    <tooltip id="keepCryptoSettingsForReply.tooltip">
      <description>&enigmail.keepCryptoSettingsForReply.tooltip;</description>
    </tooltip>

    <tooltip id="doubleDashSeparator.tooltip">
      <description>&enigmail.doubleDashSeparator.tooltip;</description>
    </tooltip>

    <tooltip id="useGpgAgent.tooltip">
      <description>&enigmail.useGpgAgent.tooltip;</description>
    </tooltip>

    <tooltip id="noHushMailSupport.tooltip">
      <description>&enigmail.noHushMailSupport.tooltip;</description>
    </tooltip>

    <tooltip id="mime_parts_on_demand.tooltip">
      <description>&enigmail.mime_parts_on_demand.tooltip;</description>
    </tooltip>

    <tooltip id="disableSMIMEui.tooltip">
      <description>&enigmail.disableSMIMEui.tooltip;</description>
    </tooltip>

    <tooltip id="agentAdditionalParam.tooltip">
      <description>&enigmail.agentAdditionalParam.tooltip;</description>
    </tooltip>

    <tooltip id="resetRememberedValues.tooltip">
      <description>&enigmail.resetRememberedValues.tooltip;</description>
    </tooltip>
</popupset>

  <tabbox flex="1" style="margin:5px" id="prefTabs">
    <tabs id="prefTabBox">
      <tab id="basicTab"     label="&enigmail.basic.label;"/>
      <tab id="sendingTab"   label="&enigmail.sending.label;"/>
      <tab id="keySelTab"    label="&enigmail.keySel.label;" advanced="true"/>
      <tab id="advancedTab"  label="&enigmail.advanced.label;" advanced="true"/>
      <tab id="keyserverTab" label="&enigmail.keyserver.label;" advanced="true"/>
      <tab id="debugTab"     label="&enigmail.debug.label;" advanced="true"/>
    </tabs>

    <tabpanels flex="1" id="enigPrefTabPanel">
      <!-- "Basic" Tab -->
      <vbox id="basic" flex="1">
          <description class="enigmailPrefsTitle">&enigmail.basicPrefs.label;</description>
          <hbox>
            <groupbox orient="vertical" flex="1">
              <caption label="&enigmail.prefs.pathsTitle.label;"/>
              <hbox align="center">
                <label id="enigmailGpgPath" value="(error)"/>
              </hbox>
              <hbox align="center">
                <checkbox label="&enigmail.prefs.overrideGpg.label;"
                          tooltip="prefs.overrideGpg.tooltip"
                          id="enigOverrideGpg"
                          oncommand="enigActivateDependent(this, 'enigmail_agentPath enigmail_browsePath');"/>
                <textbox id="enigmail_agentPath" size="30" aria-labelledby="enigOverrideGpg"/>
                <button id="enigmail_browsePath"
                        label="&enigmail.browse.label;"
                  oncommand="enigLocateGpg();"/>
              </hbox>
            </groupbox>
          </hbox>
          <hbox>
            <groupbox orient="vertical" flex="1">
              <caption label="&enigmail.passwordSettings.label;"/>
              <hbox autostretch="never" align="center">
                <label control="maxIdleMinutes"
                       tooltip="maxIdleMinutes.tooltip"
                       value="&enigmail.maxIdleMinutesHead.label;" id="maxIdleMinutesHeadLabel"/>

                <textbox id="maxIdleMinutes"
                        aria-labelledby="maxIdleMinutesHeadLabel maxIdleMinutes maxIdleMinutesTailLabel"
                        type="number"
                        min="0" max="1440"
                        size="4"
                        maxlength="4"
                        pref="true"
                        preftype="int"
                        tooltip="maxIdleMinutes.tooltip"
                        prefstring="extensions.enigmail.maxIdleMinutes"/>

                <description tooltip="maxIdleMinutes.tooltip" id="maxIdleMinutesTailLabel">&enigmail.maxIdleMinutesTail.label;</description>
              </hbox>

              <checkbox id="enigmail_noPassphrase"
                      label="&enigmail.userNoPassphrase.label;"
                      tooltip="userNoPassphrase.tooltip"
                      pref="true"
                      preftype="bool"
                      prefstring="extensions.enigmail.noPassphrase"
                      prefattribute="checked"/>

            </groupbox>
          </hbox>

          <separator/>

          <hbox autostretch="never" align="center">
            <button id="enigmail_advancedUser"
                  label="&enigmail.expertUserMenus.label;"
                  oncommand="enigSwitchAdvancedMode(true)"
                  tooltip="expertUser.tooltip"/>

            <button id="enigmail_basicUser"
                  label="&enigmail.basicUserMenus.label;"
                  oncommand="enigSwitchAdvancedMode(false)"
                  tooltip="basicUser.tooltip"
                  hidden="true"/>
          </hbox>

          <separator/>

          <vbox autostretch="never" align="end">
            <hbox>
              <button id="resetPrefs"
                      label="&enigmail.resetPrefsButton.label;"
                      tooltip="resetPrefs.tooltip"
                      oncommand="resetPrefs();"/>
            </hbox>
          </vbox>

      </vbox>

      <!-- "Sending" Tab -->
      <vbox id="sending" flex="1">
        <description class="enigmailPrefsTitle">&enigmail.SendingPrefs.label;</description>

        <!-- sending preferences: choose between convenient and manual settings -->
        <hbox>
          <radiogroup id="enigmail_encryptionModel"
                      flex="1"
                      pref="true"
                      preftype="int"
                      prefstring="extensions.enigmail.encryptionModel">
            <radio id="encryptionModelConvenient"
                   value="0"
                   label="&enigmail.encryptionModelConvenient.label;"
                   oncommand="resetSendingPrefsConvenient();"/>
            <radio id="encryptionModelManually"
                   value="1"
                   label="&enigmail.encryptionModelManually.label;"
                   oncommand="resetSendingPrefsManually();"/>
          </radiogroup>
          <!-- sending preferences: help button for convenient settings -->
          <vbox align="end">
            <button id="sendingPrefsHelp"
                    label="&enigmail.help.label;"
                    oncommand="EnigHelpWindow('sendingPrefs');"/>
          </vbox>
        </hbox>

        <!-- elements for manual settings: -->
        <groupbox id="enigmail_pref_sending_manually">

          <!-- sending preferences: keep sign/enc settings for reply -->
          <checkbox id="enigmail_keepSettingsForReply"
                    tooltip="keepCryptoSettingsForReply.tooltip"
                    label="&enigmail.keepCryptoSettingsForReply.label;" />

          <!-- sending preferences: auto send encrypted -->
          <groupbox>
            <caption label="&enigmail.autoSendEncryptedOption.label;"/>
            <radiogroup id="enigmail_autoSendEncrypted"
                        pref="true"
                        preftype="int"
                        prefstring="extensions.enigmail.autoSendEncrypted">
              <radio id="autoSendEncryptedNever"
                    value="0"
                    label="&enigmail.autoSendEncryptedNever.label;"
                    tooltip="autoSendEncryptedNever.tooltip"/>
              <radio id="autoSendEncryptedIfKeys"
                    value="1"
                    label="&enigmail.autoSendEncryptedIfKeys.label;"
                    tooltip="autoSendEncryptedIfKeys.tooltip"/>
            </radiogroup>
          </groupbox>

          <!-- sending preferences: accepted keys -->
          <groupbox>
            <caption label="&enigmail.acceptedKeysOption.label;"/>
            <radiogroup id="enigmail_acceptedKeys"
                        pref="true"
                        preftype="int"
                        prefstring="extensions.enigmail.acceptedKeys">
              <radio id="acceptedKeysValid"
                    value="0"
                    label="&enigmail.acceptedKeysValid.label;"
                    tooltip="acceptedKeysValid.tooltip"/>
              <radio id="acceptedKeysAll"
                    value="1"
                    label="&enigmail.acceptedKeysAll.label;"
                    tooltip="acceptedKeysAll.tooltip"/>
            </radiogroup>
          </groupbox>

          <!-- options to confirm before sending -->
          <groupbox>
            <caption label="&enigmail.confirmBeforeSendingOption.label;"/>
            <radiogroup id="enigmail_confirmBeforeSending"
                        pref="true"
                        preftype="int"
                        prefstring="extensions.enigmail.confirmBeforeSending">

              <radio id="confirmBeforeSendingNever"
                    value="0"
                    label="&enigmail.confirmBeforeSendingNever.label;"
                    tooltip="confirmBeforeSendingNever.tooltip"/>

              <radio id="confirmBeforeSendingAlways"
                    value="1"
                    label="&enigmail.confirmBeforeSendingAlways.label;"
                    tooltip="confirmBeforeSendingAlways.tooltip"/>

              <radio id="confirmBeforeSendingIfEncrypted"
                    value="2"
                    label="&enigmail.confirmBeforeSendingIfEncrypted.label;"
                    tooltip="confirmBeforeSendingIfEncrypted.tooltip"/>

              <radio id="confirmBeforeSendingIfNotEncrypted"
                    value="3"
                    label="&enigmail.confirmBeforeSendingIfNotEncrypted.label;"
                    tooltip="confirmBeforeSendingIfNotEncrypted.tooltip"/>

              <radio id="confirmBeforeSendingIfRules"
                    value="4"
                    label="&enigmail.confirmBeforeSendingIfRules.label;"
                    tooltip="confirmBeforeSendingIfRules.tooltip"/>
            </radiogroup>
          </groupbox>
        </groupbox>
        <description>&enigmail.seeAccountSettings.label;</description>
      </vbox>

      <!-- "Key Selection" Tab -->
      <vbox id="keySel" flex="1"
            advanced="true">

          <groupbox>
            <caption label="&enigmail.recipientsSelectionOption.label;"/>

              <checkbox id="enigmail_assignKeysByRules"
                        label="&enigmail.assignKeysByRules.label;"
                        tooltip="assignKeysByRules.tooltip" />
              <checkbox id="enigmail_assignKeysByEmailAddr"
                        label="&enigmail.assignKeysByEmailAddr.label;"
                        tooltip="assignKeysByEmailAddr.tooltip" />
              <checkbox id="enigmail_assignKeysManuallyIfMissing"
                        label="&enigmail.assignKeysManuallyIfMissing.label;"
                        tooltip="assignKeysManuallyIfMissing.tooltip" />
              <checkbox id="enigmail_assignKeysManuallyAlways"
                        label="&enigmail.assignKeysManuallyAlways.label;"
                        tooltip="assignKeysManuallyAlways.tooltip" />

            <vbox autostretch="always" align="end">
              <button id="openRulesEditor"
                      label="&enigmail.defineRules.label;"
                      tooltip="defineRules.tooltip"
                      oncommand="EnigRulesEditor();"/>
            </vbox>
          </groupbox>

      </vbox>

      <!-- "Advanced" Tab -->
      <vbox id="advanced" flex="1"
            advanced="true">
          <description class="enigmailPrefsTitle">&enigmail.moreOptions.label;</description>
          <spacer flex="0"/>

          <checkbox id="enigmail_allowEmptySubject"
                    hidden="true"/>

          <checkbox id="enigmail_wrapHtmlBeforeSend"
                    label="&enigmail.wrapHtmlBeforeSend.label;"
                    tooltip="wrapHtmlBeforeSend.tooltip"/>

          <checkbox id="enigmail_useDefaultComment"
                    invert="true"
                    label="&enigmail.useNonDefaultComment.label;" />

          <checkbox id="enigmail_doubleDashSeparator"
                    tooltip="doubleDashSeparator.tooltip"
                    label="&enigmail.doubleDashSeparator.label;" />

          <checkbox id="enigmail_useGpgAgent"
                    tooltip="useGpgAgent.tooltip"
                    label="&enigmail.useGpgAgent.label;" />

          <checkbox id="enigmail_hushMailSupport"
                    invert="true"
                    tooltip="noHushMailSupport.tooltip"
                    label="&enigmail.noHushMailSupport.label;" />

          <checkbox id="mime_parts_on_demand"
                    tooltip="mime_parts_on_demand.tooltip"
                    label="&enigmail.mime_parts_on_demand.label;" />

          <separator/>

          <hbox>
            <hbox align="center">
              <label control="enigmail_agentAdditionalParam"
                     tooltip="agentAdditionalParam.tooltip"
                     value="&enigmail.agentAdditionalParam.label;"/>
            </hbox>
            <hbox>
              <textbox id="enigmail_agentAdditionalParam"
                       tooltip="agentAdditionalParam.tooltip"
                       size="30"/>
            </hbox>
          </hbox>

          <separator/>

          <hbox>
            <button id="resetRememberedValues"
                    label="&enigmail.resetRememberedValues.label;"
                    tooltip="resetRememberedValues.tooltip"
                    oncommand="resetRememberedValues();"/>
          </hbox>
      </vbox>

      <!-- "Key Server" Tab -->
      <vbox id="keyserver" flex="1"
            advanced="true">
          <vbox>
            <label control="enigmail_keyserver"
                  value="&enigmail.keyservers.label;:" />
            <textbox id="enigmail_keyserver"/>
            <label value="&enigmail.keyservers.sample;" style="font-style: italic;"/>
          </vbox>

          <separator/>

          <vbox>
            <label value="&enigmail.autoKeyRetrieve.label;" id="autoKeyRetrieveLabel1"/>
            <label value="&enigmail.autoKeyRetrieve2.label;" id="autoKeyRetrieveLabel2"/>
            <textbox id="enigmail_autoKeyRetrieve" size="35" aria-labelledby="autoKeyRetrieveLabel1 autoKeyRetrieveLabel2"/>
          </vbox>

      </vbox>

      <!-- "Debugging" Tab -->
      <vbox id="debug" flex="1"
            advanced="true">
        <description class="enigmailPrefsTitle">&enigmail.debugMenu.label;</description>
        <spacer flex="0"/>

        <grid>
          <columns>
            <column/>
            <column flex="1"/>
          </columns>

          <rows autostretch="never">
            <row>
              <hbox align="center">
                <label control="enigmail_logDirectory"
                    value="&enigmail.logdirectory.label;" />
              </hbox>
              <textbox id="enigmail_logDirectory" />
            </row>
            <row>
              <hbox align="center">
                <label control="enigmail_test_email"
                    value="&enigmail.testemail.label;" />
              </hbox>
              <hbox autostretch="never">
                <textbox id="enigmail_test_email"/>

                <button class="dialog"
                        id="enigmail_test"
                        label="&enigmail.test.label;"
                        oncommand="EnigTest();"/>
              </hbox>
            </row>
          </rows>
        </grid>
      </vbox>
    </tabpanels>
  </tabbox>

</dialog>
