<?xml version="1.0"?>


<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/syncSetup.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/syncCommon.css" type="text/css"?>

<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncSetupDTD SYSTEM "chrome://browser/locale/syncSetup.dtd">
%brandDTD;
%syncBrandDTD;
%syncSetupDTD;
]>
<wizard id="accountSetup" title="&accountSetupTitle.label;"
        windowtype="Weave:AccountSetup"
        persist="screenX screenY"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml"
        onwizardnext="return gSyncSetup.onWizardAdvance()"
        onwizardback="return gSyncSetup.onWizardBack()"
        onwizardfinish="gSyncSetup.onWizardFinish()"
        onwizardcancel="gSyncSetup.onWizardCancel()"
        onload="gSyncSetup.init()">

  <script type="application/javascript"
          src="chrome://browser/content/syncSetup.js"/>
  <script type="application/javascript"
          src="chrome://browser/content/syncUtils.js"/>
  <script type="application/javascript"
          src="chrome://browser/content/utilityOverlay.js"/>
  <script type="application/javascript"
          src="chrome://global/content/printUtils.js"/>

  <wizardpage id="pickSetupType"
              label="&syncBrand.fullName.label;"
              onpageshow="gSyncSetup.onPageShow()">
    <vbox align="center" flex="1">
      <description style="padding: 0 7em;">
        &setup.pickSetupType.description;
      </description>
      <spacer flex="1"/>
      <button id="newAccount"
              class="accountChoiceButton"
              label="&button.createNewAccount.label;"
              oncommand="gSyncSetup.startNewAccountSetup()"
              align="center"/>
      <spacer flex="3"/>
    </vbox>
    <separator class="groove"/>
    <vbox align="center" flex="1">
      <spacer flex="3"/>
      <label value="&setup.haveAccount.label;" />
      <spacer flex="1"/>
      <button id="existingAccount"
              class="accountChoiceButton"
              label="&button.connect.label;"
              oncommand="gSyncSetup.useExistingAccount()"/>
      <spacer flex="3"/>
    </vbox>
  </wizardpage>

  <wizardpage label="&setup.newAccountDetailsPage.title.label;"
              id="newAccountStart"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow();">
    <grid>
      <columns>
        <column/>
        <column class="inputColumn" flex="1"/>
      </columns>
      <rows>
        <row id="emailRow" align="center">
          <label value="&setup.emailAddress.label;"
                 accesskey="&setup.emailAddress.accesskey;"
                 control="weaveEmail"/>
          <textbox id="weaveEmail"
                   oninput="gSyncSetup.onEmailInput()"/>
        </row>
        <row id="emailFeedbackRow" align="center" hidden="true">
          <spacer/>
          <hbox>
            <image class="statusIcon"/>
            <label class="status" value=" "/>
          </hbox>
        </row>
        <row id="passwordRow" align="center">
          <label value="&setup.choosePassword.label;"
                 accesskey="&setup.choosePassword.accesskey;"
                 control="weavePassword"/>
          <textbox id="weavePassword"
                   type="password"
                   onchange="gSyncSetup.onPasswordChange()"/>
        </row>
        <row id="confirmRow" align="center">
          <label value="&setup.confirmPassword.label;"
                 accesskey="&setup.confirmPassword.accesskey;"
                 control="weavePasswordConfirm"/>
          <textbox id="weavePasswordConfirm"
                   type="password"
                   onchange="gSyncSetup.onPasswordChange()"/>
        </row>
        <row id="passwordFeedbackRow" align="center" hidden="true">
          <spacer/>
          <hbox>
            <image class="statusIcon"/>
            <label class="status" value=" "/>
          </hbox>
        </row>
        <row align="center">
          <label control="server"
                 value="&server.label;"/>
          <menulist id="server"
                    oncommand="gSyncSetup.onServerCommand()"
                    oninput="gSyncSetup.onServerInput()">
            <menupopup>
              <menuitem label="&serverType.main.label;"
                        value="main"/>
              <menuitem label="&serverType.custom2.label;"
                        value="custom"/>
            </menupopup>
          </menulist>
        </row>
        <row id="serverFeedbackRow" align="center" hidden="true">
          <spacer/>
          <hbox>
            <image class="statusIcon"/>
            <label class="status" value=" "/>
          </hbox>
        </row>
        <row id="TOSRow" align="center">
          <spacer/>
          <hbox align="center">
            <checkbox id="tos"
                      accesskey="&setup.tosAgree1.accesskey;"
                      oncommand="this.focus(); gSyncSetup.checkFields();"/>
            <description id="tosDesc"
                         flex="1"
                         onclick="document.getElementById('tos').focus();
                                  document.getElementById('tos').click()">
              &setup.tosAgree1.label;
              <label class="text-link inline-link"
                     onclick="event.stopPropagation();gSyncUtils.openToS();">
                &setup.tosLink.label;
              </label>
              &setup.tosAgree2.label;
              <label class="text-link inline-link"
                     onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();">
                &setup.ppLink.label;
              </label>
              &setup.tosAgree3.label;
            </description>
          </hbox>
        </row>
      </rows>
    </grid>
  </wizardpage>

  <wizardpage label="&setup.newSyncKeyPage.title.label;"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow();">
    <description>
      &setup.newSyncKeyPage.description.label;
    </description>
    <spacer/>

    <groupbox>
      <label value="&syncKeyEntry.label;"
             accesskey="&syncKeyEntry.accesskey;"
             control="weavePassphrase"/>
      <textbox id="weavePassphrase"
               readonly="true"
               onfocus="this.select();"/>
    </groupbox>

    <groupbox align="center">
      <description>&syncKeyBackup.description;</description>
      <hbox>
        <button id="printSyncKeyButton"
                label="&button.syncKeyBackup.print.label;"
                accesskey="&button.syncKeyBackup.print.accesskey;"
                oncommand="gSyncUtils.passphrasePrint('weavePassphrase');"/>
        <button id="saveSyncKeyButton"
                label="&button.syncKeyBackup.save.label;"
                accesskey="&button.syncKeyBackup.save.accesskey;"
                oncommand="gSyncUtils.passphraseSave('weavePassphrase');"/>
      </hbox>
    </groupbox>
  </wizardpage>

  <wizardpage label="&setup.captchaPage2.title.label;"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow();">
    <vbox flex="1" align="center">
      <browser height="150"
               width="450"
               id="captcha"
               type="content"
               disablehistory="true"/>
      <spacer flex="1"/>
      <hbox id="captchaFeedback" hidden="true">
        <image class="statusIcon"/>
        <label class="status" value=" "/>
      </hbox>
      <spacer flex="3"/>
    </vbox>
  </wizardpage>

  <wizardpage id="addDevice"
              label="&addDevice.title.label;"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow()">
    <description>
      &addDevice.setup.description.label;
      <label class="text-link"
             value="&addDevice.showMeHow.label;"
             href="https://services.mozilla.com/sync/help/easy-setup"/>
    </description>
    <description>&addDevice.setup.enterCode.label;</description>
    <spacer flex="1"/>
    <vbox align="center" flex="1">
      <textbox id="easySetupPIN1"
               class="pin"
               value=""
               disabled="true"
               />
      <textbox id="easySetupPIN2"
               class="pin"
               value=""
               disabled="true"
               />
      <textbox id="easySetupPIN3"
               class="pin"
               value=""
               disabled="true"
               />
    </vbox>
    <spacer flex="3"/>
    <label class="text-link"
           value="&addDevice.dontHaveDevice.label;"
           onclick="gSyncSetup.manualSetup();"/>
  </wizardpage>

  <wizardpage id="existingAccount"
              label="&setup.signInPage.title.label;"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow()">
      <grid>
        <columns>
          <column/>
          <column class="inputColumn" flex="1"/>
        </columns>
        <rows>
          <row id="existingAccountRow" align="center">
            <label id="existingAccountLabel"
                   value="&signIn.account2.label;"
                   accesskey="&signIn.account2.accesskey;"
                   control="existingAccount"/>
            <textbox id="existingAccountName"
                     oninput="gSyncSetup.checkFields(event)"
                     onchange="gSyncSetup.checkFields(event)"/>
          </row>
          <row id="existingPasswordRow" align="center">
            <label id="existingPasswordLabel"
                   value="&signIn.password.label;"
                   accesskey="&signIn.password.accesskey;"
                   control="existingPassword"/>
            <textbox id="existingPassword"
                     type="password"
                     onkeyup="gSyncSetup.checkFields(event)"
                     onchange="gSyncSetup.checkFields(event)"/>
          </row>
          <row id="existingPasswordFeedbackRow" align="center" hidden="true">
            <spacer/>
            <hbox>
              <image class="statusIcon"/>
              <label class="status" value=" "/>
            </hbox>
          </row>
          <row align="center">
            <spacer/>
            <label class="text-link"
                   value="&resetPassword.label;"
                   onclick="gSyncUtils.resetPassword(); return false;"/>
          </row>
          <row align="center">
            <label control="existingServer"
                   value="&server.label;"/>
            <menulist id="existingServer"
                      oncommand="gSyncSetup.onExistingServerCommand()"
                      oninput="gSyncSetup.onExistingServerInput()">
              <menupopup>
                <menuitem label="&serverType.main.label;"
                          value="main"/>
                <menuitem label="&serverType.custom2.label;"
                          value="custom"/>
              </menupopup>
            </menulist>
          </row>
          <row id="existingServerFeedbackRow" align="center" hidden="true">
            <spacer/>
            <hbox>
              <image class="statusIcon"/>
              <vbox>
                <label class="status" value=" "/>
              </vbox>
            </hbox>
          </row>
        </rows>
      </grid>

    <groupbox>
      <label id="existingPassphraseLabel"
             value="&signIn.syncKey.label;"
             accesskey="&signIn.syncKey.accesskey;"
             control="existingPassphrase"/>
      <textbox id="existingPassphrase"
               oninput="gSyncSetup.checkFields()"/>
      <hbox id="login-throbber" hidden="true">
        <image/>
        <label value="&verifying.label;"/>
      </hbox>
      <vbox align="left" id="existingPassphraseFeedbackRow" hidden="true">
        <hbox>
          <image class="statusIcon"/>
          <label class="status" value=" "/>
        </hbox>
      </vbox>
    </groupbox>

    <vbox id="passphraseHelpBox">
      <description>
        &existingSyncKey.description;
        <label class="text-link"
               href="https://services.mozilla.com/sync/help/manual-setup">
          &addDevice.showMeHow.label;
        </label>
        <spacer id="passphraseHelpSpacer"/>
        <label class="text-link"
               onclick="gSyncSetup.resetPassphrase(); return false;">
          &resetSyncKey.label;
        </label>
      </description>
    </vbox>
  </wizardpage>

  <wizardpage id="syncOptionsPage"
              label="&setup.optionsPage.title;"
              onpageshow="gSyncSetup.onPageShow()">
    <groupbox id="syncOptions">
    <grid>
      <columns>
        <column/>
        <column flex="1" style="-moz-margin-end: 2px"/>
      </columns>
      <rows>
        <row align="center">
          <label value="&syncComputerName.label;"
                 accesskey="&syncComputerName.accesskey;"
                 control="syncComputerName"/>
          <textbox id="syncComputerName" flex="1"
                   onchange="gSyncUtils.changeName(this)"/>
        </row>
        <row>
          <label value="&syncMy.label;" />
          <vbox>
            <checkbox label="&engine.bookmarks.label;"
                      accesskey="&engine.bookmarks.accesskey;"
                      id="engine.bookmarks"
                      checked="true"/>
            <checkbox label="&engine.passwords.label;"
                      accesskey="&engine.passwords.accesskey;"
                      id="engine.passwords"
                      checked="true"/>
            <checkbox label="&engine.prefs.label;"
                      accesskey="&engine.prefs.accesskey;"
                      id="engine.prefs"
                      checked="true"/>
            <checkbox label="&engine.history.label;"
                      accesskey="&engine.history.accesskey;"
                      id="engine.history"
                      checked="true"/>
            <checkbox label="&engine.tabs.label;"
                      accesskey="&engine.tabs.accesskey;"
                      id="engine.tabs"
                      checked="true"/>
          </vbox>
        </row>
      </rows>
    </grid>
    </groupbox>

    <groupbox id="mergeOptions">
      <radiogroup id="mergeChoiceRadio" pack="start">
        <grid>
          <columns>
            <column/>
            <column flex="1"/>
          </columns>
          <rows flex="1">
            <row align="center">
              <radio id="resetClient"
                     class="mergeChoiceButton"
                     aria-labelledby="resetClientLabel"/>
              <label id="resetClientLabel" control="resetClient">
                <html:strong>&choice2.merge.recommended.label;</html:strong>
                &choice2.merge.main.label;
              </label>
            </row>
            <row align="center">
              <radio id="wipeClient"
                     class="mergeChoiceButton"
                     aria-labelledby="wipeClientLabel"/>
              <label id="wipeClientLabel"
                     control="wipeClient">
                &choice2.client.main.label;
              </label>
            </row>
            <row align="center">
              <radio id="wipeRemote"
                     class="mergeChoiceButton"
                     aria-labelledby="wipeRemoteLabel"/>
              <label id="wipeRemoteLabel"
                     control="wipeRemote">
                &choice2.server.main.label;
              </label>
            </row>
          </rows>
        </grid>
      </radiogroup>
    </groupbox>
  </wizardpage>

  <wizardpage id="syncOptionsConfirm"
              label="&setup.optionsConfirmPage.title;"
              onpageshow="gSyncSetup.onPageShow()">
      <deck id="chosenActionDeck">
        <vbox id="chosenActionMerge" class="confirm">
          <description class="normal">
            &confirm.merge.label;
          </description>
        </vbox>
        <vbox id="chosenActionWipeClient" class="confirm">
          <description class="normal">
            &confirm.client2.label;
          </description>
          <separator class="thin"/>
          <vbox id="dataList">
            <label class="data indent" id="bookmarkCount"/>
            <label class="data indent" id="historyCount"/>
            <label class="data indent" id="passwordCount"/>
            <label class="data indent" id="prefsWipe"
                   value="&engine.prefs.label;"/>
          </vbox>
          <separator class="thin"/>
          <description class="normal">
            &confirm.client.moreinfo.label;
          </description>
        </vbox>
        <vbox id="chosenActionWipeServer" class="confirm">
          <description class="normal">
            &confirm.server2.label;
          </description>
          <separator class="thin"/>
          <vbox id="clientList">
          </vbox>
        </vbox>
      </deck>
  </wizardpage>

  <wizardpage label="&setup.successPage.title;" 
              id="successfulSetup"
              onextra1="gSyncSetup.onSyncOptions()"
              onpageshow="gSyncSetup.onPageShow()">
    <vbox align="center">
      <image id="successPageIcon"/>
    </vbox>
    <separator/>
    <description class="normal">
      <html:span id="firstSyncAction">replace me</html:span>
      <html:strong id="firstSyncActionWarning">replace me</html:strong>
      <html:span id="firstSyncActionChange">replace me</html:span>
    </description>
    <description>
      &continueUsing.label;
    </description>
    <separator flex="1"/>
  </wizardpage>
</wizard>

