<?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 https://mozilla.org/MPL/2.0/.
-->

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
<!-- ?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"? -->

<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/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"
        xmlns:html="http://www.w3.org/1999/xhtml"
        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="backupPrefs.tooltip">
      <description>&enigmail.backupPrefs.tooltip;</description>
    </tooltip>
    <tooltip id="wrapHtmlBeforeSend.tooltip">
      <description>&enigmail.wrapHtmlBeforeSend.tooltip;</description>
    </tooltip>
    <tooltip id="autoKeyServerSelection.tooltip">
      <description>&enigmail.autoKeyServerSelection.tooltip;</description>
    </tooltip>

    <!-- sending preferences: accepted keys -->
    <tooltip id="acceptedKeysTrusted.tooltip">
      <description>&enigmail.acceptedKeysTrusted.tooltip;</description>
    </tooltip>
    <tooltip id="acceptedKeysAllUsable.tooltip">
      <description>&enigmail.acceptedKeysAllUsable.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="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="protectHeaders.tooltip">
      <description>&enigmail.protectHeadersPrefs.tooltip;</description>
    </tooltip>

    <tooltip id="protectedSubjectText.tooltip">
      <description>&enigmail.protectedSubjectText.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="backupRestore" label="&enigmail.transferSettings.label;"/>
    </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.acceptedKeysTrusted.label;"
                    tooltip="acceptedKeysTrusted.tooltip"/>
              <radio id="acceptedKeysAll"
                    value="1"
                    label="&enigmail.acceptedKeysAllUsable.label;"
                    tooltip="acceptedKeysAllUsable.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"/>

          <groupbox>
            <checkbox id="enigmail_protectHeaders"
                      label="&enigmail.protectHeadersPrefs.label;"
                      tooltip="protectHeaders.tooltip"/>

            <hbox>
              <hbox align="center">
                <label control="protectedSubjectText"
                       tooltip="protectedSubjectText.tooltip"
                       value="&enigmail.protectedSubjectText.label;"/>
              </hbox>
              <hbox>
                <textbox id="protectedSubjectText"
                         tooltip="protectedSubjectText.tooltip"
                         placeholder=""
                         size="40"/>
              </hbox>
            </hbox>
          </groupbox>

          <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_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.sample2;" style="font-style: italic;"/>
          </vbox>

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

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

      <!-- Backup/Restore Panel -->
      <vbox id="backupRestoreTab" flex="1">

        <vbox flex="1">

          <description style="max-width: 500px;">
            &enigmail.pref.backupRestore.overallDesc;
          </description>

          <separator style="height: 20px;"/>

          <description>
            &enigmail.pref.acSetupMessage.desc;
          </description>

          <hbox>
            <button id="initiateAcSetupMsg"
                label="&enigmail.pref.acSetupMessage.button;"
                oncommand="initiateAcKeyTransfer();"/>
          </hbox>

          <separator style="height: 20px;"/>

          <description>
            &enigmail.backupRestore.desc;
          </description>

          <separator/>

          <hbox>
            <button id="backupPrefs"
                label="&enigmail.backupPrefsButton.label;"
                tooltip="&enigmail.backupPrefs.tooltip;"
                oncommand="backupPrefs();"/>
          </hbox>
          <separator/>

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

    </tabpanels>
  </tabbox>

</dialog>
