<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">

<dialog id="torbutton-prefs"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml"
        title="&torbutton.prefs.title;"
        buttons="accept,cancel,extra1"
        buttonlabelextra1="&torbutton.prefs.restore_defaults;"
        ondialogextra1="torbutton_prefs_reset_defaults();"
        persist="screenX screenY"
        onload="torbutton_prefs_init(document)"
        ondialogaccept="torbutton_prefs_save(document)" >

    <script type="application/x-javascript" src="torbutton_util.js"/>
    <script type="application/x-javascript" src="preferences.js"/>
    <tabbox>
     <tabs>
      <tab label="&torbutton.prefs.tor_settings;"/>
      <tab label="&torbutton.prefs.sec_settings;"/>
      <tab label="&torbutton.prefs.display_settings;"/>
     </tabs>
     <tabpanels>
    <tabpanel>
        <vbox>
        <radiogroup id="torbutton_settingsMethod">
            <radio value="recommended" id="torbutton_useRecommendedSettings"
                   label="&torbutton.prefs.recommended_settings;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
                <checkbox class="indent" id="torbutton_usePrivoxy"
                   label="&torbutton.prefs.use_polipo;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <radio value="custom" id="torbutton_useCustomSettings"
                   label="&torbutton.prefs.custom_settings;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
<!--
        <checkbox id="torbutton_useRecommendedSettings" label="&torbutton.prefs.recommended_settings;"
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
-->
                <grid class="indent" flex="1">
                    <columns>
                    <column/>
                    <column flex="1"/>
                </columns>
                <rows>
                    <row align="center">
                        <hbox align="center" pack="end">
                            <label value="&torbutton.prefs.proxy.host.http;" control="torbutton_httpProxy"/>
                        </hbox>
                        <hbox align="center">
                            <textbox id="torbutton_httpProxy" preftype="string" flex="1"/>
                            <label value="&torbutton.prefs.proxy.port;" control="torbutton_httpPort"/>
                            <textbox id="torbutton_httpPort" size="5"/>
                        </hbox>
                    </row>
                    <row align="center">
                        <hbox align="center" pack="end">
                            <label value="&torbutton.prefs.proxy.host.https;" control="torbutton_httpsProxy"/>
                        </hbox>
                        <hbox align="center">
                            <textbox id="torbutton_httpsProxy" preftype="string" flex="1"/>
                            <label value="&torbutton.prefs.proxy.port;" control="torbutton_httpsPort"/>
                            <textbox id="torbutton_httpsPort" size="5"/>
                        </hbox>
                    </row>
                    <row align="center">
                        <hbox align="center" pack="end">
                            <label value="&torbutton.prefs.proxy.host.ftp;" control="torbutton_ftpProxy"/>
                        </hbox>
                        <hbox align="center">
                            <textbox id="torbutton_ftpProxy" preftype="string" flex="1"/>
                            <label value="&torbutton.prefs.proxy.port;" control="torbutton_ftpPort"/>
                            <textbox id="torbutton_ftpPort" size="5"/>
                        </hbox>
                    </row>
                    <row align="center">
                        <hbox align="center" pack="end">
                            <label value="&torbutton.prefs.proxy.host.gopher;" control="torbutton_gopherProxy"/>
                        </hbox>
                        <hbox align="center">
                            <textbox id="torbutton_gopherProxy" preftype="string" flex="1"/>
                            <label value="&torbutton.prefs.proxy.port;" control="torbutton_gopherPort"/>
                            <textbox id="torbutton_gopherPort" size="5"/>
                        </hbox>
                    </row>
                    <row align="center">
                        <hbox align="center" pack="end">
                            <label value="&torbutton.prefs.proxy.host.socks;" control="torbutton_socksHost"/>
                        </hbox>
                        <hbox align="center">
                            <textbox id="torbutton_socksHost" flex="1"/>
                            <label value="&torbutton.prefs.proxy.port;" control="torbutton_socksPort"/>
                            <textbox id="torbutton_socksPort" size="5"/>
                        </hbox>
                    </row>
                    <row align="center">
                     <hbox align="center" pack="end">
                      <spacer flex="1"/>
                     </hbox>
                      <radiogroup align="center" orient="horizontal" id="torbutton_socksGroup">
                          <radio id="torbutton_socksv4"
                                label="&torbutton.prefs.socks_vfour;" 
                                oncommand="torbutton_prefs_set_field_attributes(document)"/>
                          <radio id="torbutton_socksv5" 
                                label="&torbutton.prefs.socks_vfive;" 
                                oncommand="torbutton_prefs_set_field_attributes(document)"/>
                      </radiogroup>
                    </row>
                    <row align="center">
                       <hbox align="center" pack="end">
                         <label value="&torbutton.prefs.no_proxies_on;" control="torbutton_noProxiesOn"/>
                       </hbox>
                       <hbox align="center">
                         <textbox id="torbutton_noProxiesOn"/>
                         <spacer/>
                      </hbox>
                    </row>
                    <row align="right">
                     <hbox align="center" pack="end">
                      <spacer flex="1"/>
                     </hbox>
                     <hbox align="center" pack="end">
                       <label class="indent" value="&torbutton.prefs.no_proxy_warning;"/>
                     </hbox>
                    </row>
                </rows>
            </grid>

        <!-- This is where we overload for maximum functionality and assume
        transparent proxy settings -->

        <radio id="torbutton_transparentTor"
        label="&torbutton.prefs.transparentTor;"
        oncommand="torbutton_prefs_set_field_attributes(document)"/>

        </radiogroup>
       
        
        <checkbox id="torbutton_lockedMode"
        label="&torbutton.prefs.locked_mode;"
        oncommand="torbutton_prefs_set_field_attributes(document)"/>

        <hbox>
         <spacer flex="1"/>
         <button id="torbutton_testSettings"
         label="&torbutton.prefs.test_settings;"
         oncommand="torbutton_prefs_test_settings()"/>
        </hbox>
       </vbox>
<!--
        <label value="&torbutton.prefs.non_socks;" control="nonsocks_proxy"/>
        <textbox id="nonsocks_proxy"/>
        <label value="&torbutton.prefs.port;" control="nonsocks_port"/>
        <textbox id="nonsocks_port"/>
        <label value="&torbutton.prefs.socks;" control="socks_host"/>
        <textbox id="socks_host"/>
        <label value="&torbutton.prefs.port;" control="socks_port"/>
        <textbox id="socks_port"/>
-->
    </tabpanel>
    <tabpanel>
        <tabbox style="border: 0px">
         <tabs style="border: 0px">
          <tab label="&torbutton.prefs.dynamic;"/>
          <tab label="&torbutton.prefs.history;"/>
          <tab label="&torbutton.prefs.forms;"/>
          <tab label="&torbutton.prefs.cache;"/>
          <tab label="&torbutton.prefs.cookies;"/>
          <tab label="&torbutton.prefs.startup;"/>
          <tab label="&torbutton.prefs.shutdown;"/>
          <tab label="&torbutton.prefs.headers;"/>
         </tabs>
         <tabpanels style="border: 0px">
          <tabpanel id="plugins">
           <vbox>
        <checkbox id="torbutton_disablePlugins" label="&torbutton.prefs.disable_plugins;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_isolateContent" label="&torbutton.prefs.isolate_content;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_killBadJS" label="&torbutton.prefs.kill_bad_js;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_resizeOnToggle" label="&torbutton.prefs.resize_on_toggle;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_noSearch" label="&torbutton.prefs.no_search;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_disableLivemarks"
                  label="&torbutton.prefs.disable_livemarks; &torbutton.prefs.dtd_recommended;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_blockTorFileNet" label="&torbutton.prefs.block_tor_file_net;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_blockNonTorFileNet" label="&torbutton.prefs.block_nontor_file_net;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_updateTorbuttonViaTor"
                  label="&torbutton.prefs.update_torbutton_via_tor; &torbutton.prefs.dtd_recommended;"
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_noUpdates" label="&torbutton.prefs.no_updates;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_closeTor" label="&torbutton.prefs.close_tor;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
        <checkbox id="torbutton_closeNonTor" label="&torbutton.prefs.close_nontor;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
           </vbox>
          </tabpanel>
          <tabpanel id="history">
           <vbox>
          <checkbox id="torbutton_blockJSHistory" label="&torbutton.prefs.block_js_history;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_blockTorHRead" label="&torbutton.prefs.block_thread;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_blockTorHWrite" label="&torbutton.prefs.block_thwrite;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_blockNonTorHRead" label="&torbutton.prefs.block_nthread;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_blockNonTorHWrite" label="&torbutton.prefs.block_nthwrite;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_clearHistory" label="&torbutton.prefs.clear_history;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
           </vbox>
          </tabpanel>
          <tabpanel id="forms">
           <vbox flex="1">
          <checkbox id="torbutton_blockTorForms" label="&torbutton.prefs.block_tforms;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_blockNonTorForms" label="&torbutton.prefs.block_ntforms;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
           </vbox>
          </tabpanel>
          <tabpanel id="cache">
           <vbox>
            <!-- FIXME: maybe add pref to manage cache by yourself... --> 
            <radiogroup id="torbutton_cacheGroup">
             <radio id="torbutton_clearCache" 
                   label="&torbutton.prefs.clear_cache;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             <radio id="torbutton_blockCache" 
                   label="&torbutton.prefs.block_cache;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </radiogroup>
           </vbox>
          </tabpanel>
          <tabpanel id="cookies">
           <vbox>
            <radiogroup onselect="torbutton_cookie_update(document)" id="torbutton_cookieGroup">
             <radio id="torbutton_clearCookies"
                    label="&torbutton.prefs.clear_cookies;" 
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>             
            <radio id="torbutton_cookieJars"
                    label="&torbutton.prefs.cookie_jars;" 
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>

            <radio id="torbutton_dualCookieJars"
                    label="&torbutton.prefs.dual_cookie_jars;" 
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <radio id="torbutton_cookieProtections"
                    label="&torbutton.prefs.cookie_protection;"
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <radio id="torbutton_mmmCookies"
                    label="&torbutton.prefs.mmm_cookies;" 
                    oncommand="torbutton_prefs_set_field_attributes(document)"/> 
            </radiogroup>
            <checkbox id="torbutton_torMemoryJar" 
                   label="&torbutton.prefs.tor_memory_jar;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <checkbox id="torbutton_nonTorMemoryJar" 
                   label="&torbutton.prefs.nontor_memory_jar;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <checkbox id="torbutton_noDomStorage" 
                   label="&torbutton.prefs.disable_domstorage;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            <checkbox id="torbutton_clearHttpAuth" 
                   label="&torbutton.prefs.clear_http_auth;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
           </vbox>
          </tabpanel>
          <tabpanel id="startup">
            <!-- 
            This shouldn't be a user-changeable pref. Unless something is broken,
            it should always be true        
            <checkbox id="torbutton_reloadCrashedJar" label="&torbutton.prefs.reload_crashed_jar;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             -->
            <vbox>
            <!--
            <hbox>
             <label value="&torbutton.prefs.startup_state;" control="torbutton_startupStateGroup"/>
             <radiogroup align="center" orient="horizontal" id="torbutton_startupStateGroup">
              <radio id="torbutton_startTor" 
                   label="&torbutton.prefs.tor;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_startNonTor" 
                   label="&torbutton.prefs.non_tor;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_startPrevious" 
                   label="&torbutton.prefs.shutdown_state;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             </radiogroup>
            </hbox>
            -->
            <hbox>
             <label value="&torbutton.prefs.startup_tor;" control="torbutton_restoreTorGroup"/>
             <radiogroup align="center" orient="horizontal" id="torbutton_restoreTorGroup">
              <radio id="torbutton_restoreTor" 
                   label="&torbutton.prefs.tor;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_restoreNonTor" 
                   label="&torbutton.prefs.non_tor;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             </radiogroup>
            </hbox>
            <vbox>
             <label value="&torbutton.prefs.session_restore;" control="torbutton_restoreTorGroup"/>
             <checkbox class="indent" id="torbutton_torSessionStore" label="&torbutton.prefs.tor_tabs;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             <checkbox class="indent" id="torbutton_nonTorSessionStore" label="&torbutton.prefs.nontor_tabs;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </vbox>
            
           </vbox>
          </tabpanel>

          <tabpanel id="shutdown">
           <vbox>
            <radiogroup id="torbutton_shutdownGroup">
             <radio id="torbutton_noShutdown" 
                   label="&torbutton.prefs.no_shutdown;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             <radio id="torbutton_torShutdown" 
                   label="&torbutton.prefs.tor_shutdown;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             <radio id="torbutton_allShutdown" 
                   label="&torbutton.prefs.all_shutdown;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </radiogroup>
           </vbox>
          </tabpanel>
          <tabpanel id="headers">
           <vbox>
          <checkbox id="torbutton_setUagent" label="&torbutton.prefs.set_uagent;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_spoofEnglish" label="&torbutton.prefs.spoof_english;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
<!--
          <checkbox id="torbutton_jarCerts" label="&torbutton.prefs.jar_certs;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <checkbox id="torbutton_jarCACerts" label="&torbutton.prefs.jar_ca_certs;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
-->
           <radiogroup id="torbutton_refererSpoofGroup" label="&torbutton.prefs.refererspoofing;" collapsed="true">
              <radio id="torbutton_smartSpoof" label="&torbutton.prefs.smartspoof;" oncommand="torbutton_prefs_set_field_attributes(document)" />              
              <radio id="torbutton_noRefSpoof" label="&torbutton.prefs.nospoof;" oncommand="torbutton_prefs_set_field_attributes(document)" />
              <radio id="torbutton_blankReferer" label="&torbutton.prefs.spoofblank;" oncommand="torbutton_prefs_set_field_attributes(document)" />
          </radiogroup>
          <checkbox id="torbutton_fixGoogleSrch" label="&torbutton.prefs.fix_google_srch;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <spacer/>
          <checkbox id="torbutton_noCaptcha" label="&torbutton.prefs.dodge_google_captcha;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
          <hbox class="indent" align="center">
             <radiogroup align="center" orient="horizontal" id="torbutton_searchEngine">
              <radio id="torbutton_engine4" label="&torbutton.prefs.engine4;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_engine5" label="&torbutton.prefs.engine5;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_engine1" label="&torbutton.prefs.engine1;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_engine2" label="&torbutton.prefs.engine2;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
              <radio id="torbutton_engine3" label="&torbutton.prefs.engine3;"
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
             </radiogroup>
            </hbox>

            </vbox>
          </tabpanel>
         </tabpanels>
        </tabbox>
     </tabpanel>
    <tabpanel>
       <vbox>
        <label class="indent" control="torbutton_panelStyle" value="&torbutton.prefs.panel_format;"/>
        <radiogroup class="indent" id="torbutton_panelStyle">
            <radio value="text" id="torbutton_panelStyleText" label="&torbutton.prefs.panel_text_format;"/>

            <radio value="iconic" id="torbutton_panelStyleIcon" label="&torbutton.prefs.panel_icon_format;"/>

        </radiogroup>
        <checkbox id="torbutton_displayStatusPanel" label="&torbutton.prefs.display_panel;" 
                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
       </vbox>
    </tabpanel>

	</tabpanels>
   </tabbox>

<!--
    <checkbox id="torbutton_warnUponExcludedSite" label="&torbutton.prefs.prompt_before_visiting_excluded_sites;" />
    <description>
        <textnode value="&torbutton.prefs.warning_explanation;"/>
    </description>
-->
</dialog>
