<?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 Patrick Brunschwig.
 * Portions created by Patrick Brunschwig <patrick@enigmail.net> are
 * Copyright (C) 2005 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 ***** *
-->

<?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;
]>

<wizard id="enigmailSetupWizard"
        title="&enigmail.setupWiz.title;"
        onwizardnext="return onNext();"
        onwizardback="return onBack();"
        onload="onLoad();"
        onwizardcancel="return onCancel();"
        height="500px"
        width="600px"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

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

  <broadcasterset>
    <broadcaster id="bcKeyEnabled" properties=""/>
  </broadcasterset>


  <!-- Welcome Page -->
  <wizardpage id="pgWelcome" pageid="pgWelcome"
              next="pgInstallGnuPG"
              onpageshow="wizardSetFocus()">
    <description>
      &enigmail.setupWiz.pgWelcome.desc;
    </description>
    <separator/>

    <label value="&enigmail.setupWiz.pgWelcome.startNow;" control="startNow"/>
    <radiogroup id="startNow" value="1">
      <radio id="startNow_yes"
             label="&enigmail.setupWiz.pgWelcome.yes;"
             selected="true"
             oncommand="onSetStartNow(true)"
             value="1"/>
      <radio id="startNow_sel"
             label="&enigmail.setupWiz.pgWelcome.no;"
             oncommand="onSetStartNow(false)"
             value="0"/>
    </radiogroup>
  </wizardpage>


  <!-- Optional Install GnuPG Page -->
  <wizardpage id="pgInstallGnuPG" pageid="pgInstallGnuPG"
              next="pgSelectId"
              label="&enigmail.setupWiz.pgInstall.title;"
              description="&enigmail.setupWiz.pgInstall.title;"
              onpageshow="onShowPgInstallGnuPG()">

    <description>
      &enigmail.setupWiz.pgInstall.desc;
    </description>

    <vbox id="installBox" collapsed="true">
      <description>
        &enigmail.setupWiz.pgInstall.installDesc;
      </description>
      <hbox>
        <button id="btnInstallGnupg" label="&enigmail.setupWiz.pgInstall.installButton;" oncommand="installGnuPG()"/>
        <button id="btnLocateGnuPG" label="&enigmail.setupWiz.pgInstall.locateButton;" oncommand="wizardLocateGpg()"/>
      </hbox>
    </vbox>

    <vbox id="findGpgBox" collapsed="true">
      <description>
        &enigmail.setupWiz.pgInstall.locateDesc;
      </description>
      <hbox>
        <button label="&enigmail.setupWiz.pgInstall.locateButton;" oncommand="wizardLocateGpg()"/>
      </hbox>
    </vbox>

    <vbox id="progressBox" collapsed="true">
      <label id="downloadLabel" value="&enigmail.setupWiz.pgInstall.downloadLabel;" control="progressBar"/>
      <progressmeter id="downloadProgress" mode="determined" value="0"/>
      <label value=""/>
      <label id="installLabel" value="&enigmail.setupWiz.pgInstall.installLabel;" collapsed="true"/>
      <progressmeter id="installProgress" mode="undetermined" collapsed="true"/>
      <label value=""/>
      <label id="installComplete" value="&enigmail.setupWiz.pgInstall.installDone;" collapsed="true"/>
    </vbox>

    <vbox id="gpgFoundBox" collapsed="true">
      <label value="&enigmail.setupWiz.pgInstall.gnupgFound;"/>
    </vbox>
  </wizardpage>


  <!-- Select Account IDs Page -->
  <wizardpage id="pgSelectId" pageid="pgSelectId" next="pgEncConv"
              label="&enigmail.setupWiz.pgSelectId.title;"
              description="&enigmail.setupWiz.pgSelectId.subtitle;">
    <description>
      &enigmail.setupWiz.pgSelectId.desc;
    </description>

    <separator/>

    <label value="&enigmail.setupWiz.pgSelectId.allIds;" control="activateId"/>
    <radiogroup id="activateId" value="1">
      <radio id="activateId_all"
             label="&enigmail.setupWiz.yes;"
             selected="true"
             oncommand="disableIdSel(true)"
             value="1"/>
      <radio id="activateId_sel"
             label="&enigmail.setupWiz.pgSelectId.selectIds;"
             oncommand="disableIdSel(false)"
             value="0"/>
    </radiogroup>
    <groupbox height="60px" width="200px">
      <vbox id="idSelection"/>
    </groupbox>

    <separator/>
    <description>
      &enigmail.setupWiz.pgSelectId.note;
    </description>
  </wizardpage>


  <!-- Encryption Prefs Page -->
  <wizardpage id="pgEncConv" pageid="pgEncConv" next="pgSign"
              label="&enigmail.setupWiz.pgEncConv.title;"
              description="&enigmail.setupWiz.pgEncConv.subtitle;">
    <description>
      &enigmail.setupWiz.pgEncConv.desc;
    </description>
    <separator/>
    <label value="&enigmail.setupWiz.pgEncConv.convEncMsg;" control="convEncryptMsg"/>
    <radiogroup id="convEncryptMsg" value="0">
      <radio id="convEncryptMsg_yes"
             label="&enigmail.setupWiz.pgEncConv.convYes;"
             selected="true"
             value="0"/>
      <radio id="convEncryptMsg_yes"
             label="&enigmail.setupWiz.pgEncConv.convEncYes;"
             value="1"/>
      <radio id="convEncryptMsg_no"
             label="&enigmail.setupWiz.pgEncConv.convEncNo;"
             value="2"/>
    </radiogroup>
  </wizardpage>


  <!-- Signing Prefs Page -->
  <wizardpage id="pgSign" pageid="pgSign" next="pgSettings"
              label="&enigmail.setupWiz.pgSign.title;"
              description="&enigmail.setupWiz.pgSign.subtitle;">
    <description>
      &enigmail.setupWiz.pgSign.desc;
    </description>
    <separator/>
    <label value="&enigmail.setupWiz.pgSign.signMsg;" control="signMsg"/>
    <radiogroup id="signMsg" value="1">
      <radio id="signMsg_yes"
             label="&enigmail.setupWiz.pgSign.signYes;"
             selected="true"
             value="1"/>
      <radio id="signMsg_no"
             label="&enigmail.setupWiz.pgSign.signNo;"
             value="0"/>
    </radiogroup>
  </wizardpage>


  <!-- Other Settings Page -->
  <wizardpage id="pgSettings" pageid="pgSettings" next="pgKeySel"
              label="&enigmail.setupWiz.pgSettings.title;"
              description="&enigmail.setupWiz.pgSettings.subtitle;"
              onpageshow="disableNext(false)">
    <description>
      &enigmail.setupWiz.pgSettings.desc;
    </description>
    <separator/>
    <description id="changeSettingsLabel">
     &enigmail.setupWiz.pgSettings.changePref;
    </description>
    <radiogroup id="changeSettings" value="1" aria-labelledby="changeSettingsLabel">
      <hbox>
        <radio id="changeSettings_yes"
               label="&enigmail.setupWiz.yes;"
               selected="true"
               value="1"/>
        <button id="detailChanges" label="&enigmail.setupWiz.pgSettings.details;"
                oncommand="showPrefDetails()"/>
      </hbox>
      <radio id="changeSettings_no"
             label="&enigmail.setupWiz.no;"
             value="0"/>
    </radiogroup>
  </wizardpage>


  <!-- Select Keys Page -->
  <wizardpage id="pgKeySel" pageid="pgKeySel"
              next="pgSummary"
              onpageshow="displayKeySel()"
              label="&enigmail.setupWiz.pgKeySel.title;"
              description="&enigmail.setupWiz.pgKeySel.subtitle;">
    <description id="createPgpKeyLabel">
      &enigmail.setupWiz.pgKeySel.desc;
    </description>
    <radiogroup id="createPgpKey" value="0" aria-labelledby="createPgpKeyLabel">
      <radio id="createPgpKey_no"
             label="&enigmail.setupWiz.pgKeySel.useExistingKey;"
             oncommand="setUseKey()"
             selected="true"
             value="0"/>

      <tree id="uidSelection"
        hidecolumnpicker="false"
        style="height:200px"
        minwidth="450"
        seltype="single"
        onselect="onKeySelected();">

        <treecols>
          <treecol id="uidCol" primary="true"
                   flex="1"
                   ignoreincolumnpicker="true"
                   label="&enigmail.keyUserId.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="keyCol" style="width:90px"
                   label="&enigmail.keyId.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="expCol" style="width:70px"
                   label="&enigmail.created.label;"/>
        </treecols>

        <treechildren id="uidSelectionChildren"/>
      </tree>

      <separator/>

      <radio id="createNewPgpKey"
             label="&enigmail.setupWiz.pgKeySel.newKey;"
             oncommand="setNewKey()"
             value="1"/>

    </radiogroup>

  </wizardpage>


  <!-- Optional NoKeyFound Page -->
  <wizardpage id="pgNoKeyFound" pageid="pgNoKeyFound"
              next="pgKeyCreate"
              onpageshow="disableNext(true)"
              label="&enigmail.setupWiz.pgNoKeyFound.title;"
              description="&enigmail.setupWiz.pgNoKeyFound.subtitle;">

    <description id="noPgpKeyFoundLabel">
      &enigmail.setupWiz.pgNoKeyFound.desc;
    </description>
    <radiogroup id="newPgpKey" value="0" aria-labelledby="noPgpKeyFoundLabel">

      <radio id="createNewPgpKey2"
             label="&enigmail.setupWiz.pgKeySel.newKey;"
             oncommand="setNewKey()"
             value="1"/>

      <radio id="importPgpKeys"
             label="&enigmail.setupWiz.pgNoKeyFound.importKey;"
             oncommand="setImportKeys()"
             value="2"/>
    </radiogroup>
  </wizardpage>


  <!-- Optional Create Key Page -->
  <wizardpage id="pgKeyCreate" pageid="pgKeyCreate"
              next="pgSummary"
              onpageshow="displayKeyCreate()"
              label="&enigmail.setupWiz.pgKeyCreate.title;"
              description="&enigmail.setupWiz.pgKeyCreate.subtitle;">
    <description>
      &enigmail.setupWiz.pgKeyCreate.desc1;
    </description>
    <separator/>
    <description id="keyCreateDesc2">
      &enigmail.setupWiz.pgKeyCreate.desc2;
    </description>
    <separator/>
    <vbox>
      <label class="label" value="&enigmail.keyUserId.label;:" control="userIdentity"/>
      <hbox flex="1">
        <menulist id="userIdentity" label="...">
          <menupopup id="userIdentityPopup"/>
        </menulist>
      </hbox>
    </vbox>
    <label id="userIdentityLabel" value="" collapsed="true"/>

    <vbox id="passphraseBox" align="start">
      <label control="passphrase" value="&enigmail.keyPassphrase.label;" />
      <textbox id="passphrase" size="20" type="password" />
      <label control="passphraseRepeat" value="&enigmail.setupWiz.pgKeyCreate.passRepeat;" />
      <textbox id="passphraseRepeat" size="20" type="password" />
    </vbox>
  </wizardpage>


  <!-- Optional Import Key Page -->
  <wizardpage id="pgKeyImport" pageid="pgKeyImport"
              next="pgKeySel"
              label="&enigmail.setupWiz.pgKeyImport.title;"
              onpageadvanced="return importKeyFiles()"
              description="&enigmail.setupWiz.pgKeyImport.subtitle;">
    <description>
      &enigmail.setupWiz.pgKeyImport.desc;
    </description>

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

      <rows autostretch="never">
        <row>
          <hbox align="center">
            <label class="label" value="&enigmail.setupWiz.pgKeyImport.pubkeyFile;" id="publicKeysFileLbl"/>
          </hbox>
          <hbox align="center">
            <textbox id="publicKeysFile" size="30" aria-labelledby="publicKeysFileLbl" readonly="true"/>
            <button id="browsePubKeyFile"
                    label="&enigmail.browse.label;"
              oncommand="browseKeyFile('publicKeysFile', gPubkeyFile);"/>
          </hbox>
        </row>

        <row>
          <hbox align="center">
            <label class="label" value="&enigmail.setupWiz.pgKeyImport.seckeyFile;" id="privateKeysFileLbl"/>
          </hbox>
          <hbox align="center">
            <textbox id="privateKeysFile" size="30" aria-labelledby="privateKeysFileLbl" readonly="true"/>
            <button id="browseSecKeyFile"
                    label="&enigmail.browse.label;"
              oncommand="browseKeyFile('privateKeysFile', gSeckeyFile);"/>
          </hbox>
        </row>
      </rows>
    </grid>
  </wizardpage>


  <!-- Summary Page -->
  <wizardpage id="pgSummary" pageid="pgSummary"
              onpageshow="displayActions()"
              next="pgComplete"
              label="&enigmail.setupWiz.pgSummary.title;"
              description="&enigmail.setupWiz.pgSummary.subtitle;">
    <description>
      &enigmail.setupWiz.pgSummary.desc;
    </description>
    <separator/>
    <vbox>
      <label id="applyDesc1" collapsed="true"/>
      <label id="applyDesc2" collapsed="true"/>
      <label id="applyDesc3" collapsed="true"/>
      <label id="applyDesc4" collapsed="true"/>
      <label id="applyDesc5" collapsed="true"/>
      <label id="applyDesc6" collapsed="true"/>
      <label id="applyDesc7" collapsed="true"/>
      <label id="applyDesc8" collapsed="true"/>
      <label id="applyDesc9" collapsed="true"/>
      <label id="applyDesc10" collapsed="true"/>
    </vbox>
  </wizardpage>


  <!-- ??? Page -->
  <wizardpage id="pgKeygen" pageid="pgKeygen"
              onpageshow="wizardGenKey()"
              next="pgComplete"
              label="&enigmail.setupWiz.pgKeygen.title;"
              description="&enigmail.setupWiz.pgKeygen.subtitle;">
    <groupbox id="keygenConsoleBox" orient="vertical" flex="1">

      <caption label="&enigmail.keyGen.console.label;"/>

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

      <groupbox>
        <progressmeter id="keygenProgress" mode="determined" value="0"/>
      </groupbox>

    </groupbox>
  </wizardpage>


  <!-- ??? Page -->
  <wizardpage id="pgComplete" pageid="pgComplete"
              onpageshow="applyWizardSettings()"
              label="&enigmail.setupWiz.pgComplete.title;">
    <description>
      &enigmail.setupWiz.pgComplete.desc;
    </description>
  </wizardpage>


  <!-- ??? Page -->
  <wizardpage id="pgNoStart" pageid="pgNoStart"
              label="&enigmail.setupWiz.pgNoStart.title;">
    <description>
      &enigmail.setupWiz.pgNoStart.desc;
    </description>
  </wizardpage>

</wizard>
