home *** CD-ROM | disk | FTP | other *** search
/ ftp.swcp.com / ftp.swcp.com.zip / ftp.swcp.com / mac / mozilla-macos9-1.3.1.sea.bin / Mozilla1.3.1 / Chrome / comm.jar / content / communicator / pref / pref-advanced.xul < prev    next >
Extensible Markup Language  |  2003-06-08  |  6KB  |  172 lines

  1. <?xml version="1.0"?> 
  2.  
  3. <!--
  4.    The contents of this file are subject to the Netscape Public
  5.    License Version 1.1 (the "License"); you may not use this file
  6.    except in compliance with the License. You may obtain a copy of
  7.    the License at http://www.mozilla.org/NPL/
  8.     
  9.    implied. See the License for the specific language governing
  10.    rights and limitations under the License.
  11.     
  12.    The Original Code is Mozilla Communicator client code, released
  13.    March 31, 1998.
  14.    
  15.    The Initial Developer of the Original Code is Netscape
  16.    Communications Corporation. Portions created by Netscape are
  17.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  18.    Rights Reserved.
  19.    
  20.    Contributor(s): 
  21.      Mike Kowalski <mikejk@ameritech.net>
  22.   -->
  23. <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
  24.  
  25. <!DOCTYPE page [
  26. <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
  27. %brandDTD;
  28. <!ENTITY % prefAdvancedDTD SYSTEM "chrome://communicator/locale/pref/pref-advanced.dtd"> %prefAdvancedDTD;
  29. ]>
  30.  
  31. <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  32.       onload="parent.initPanel('chrome://communicator/content/pref/pref-advanced.xul');"
  33.       headertitle="&lHeader;">
  34.  
  35.   <script type="application/x-javascript">
  36.   <![CDATA[
  37.     var panel = "chrome://communicator/content/pref/pref-advanced.xul";
  38.     var _elementIDs = ["advancedJavaAllow", "advancedMailFTP", "advancedMailFTPAddress"];
  39.     
  40.     function Startup() {
  41.       ftpCheck(false);
  42.       turboCheck();
  43.     }   
  44.     
  45.     function ftpCheck(setFocus) {
  46.       var checked = document.getElementById("advancedMailFTP").checked;
  47.       var field = document.getElementById("advancedMailFTPAddress");
  48.       field.disabled = !checked;
  49.  
  50.       if (!field.disabled && setFocus)
  51.         field.focus();
  52.     }
  53.  
  54.     /* 
  55.      * Name: turboCheck()
  56.      * 
  57.      * Arguments: none
  58.      *
  59.      * Description: This function is called when the root advanced prefs panel
  60.      * is loaded. The turbo mode setting is not exactly a preference -- setting
  61.      * the checkbox should (on leaving the prefs with an "Ok") result in a call
  62.      * to the backend to do the necessary win32 registry twiddling needed for
  63.      * turbo mode to go into effect. Clearing it should undo this work. We need
  64.      * to call the backend to determine if turbo mode is enabled (since we are 
  65.      * required to check for it in a non-trivial way) and then explicitly set the
  66.      * checkbox here based on what we find. Finally, we have to hide the checkbox
  67.      * (and the group box that frames it) if we are not executing on a Win32 
  68.      * platform.
  69.      *
  70.      * Return Value: void
  71.      *
  72.      * Original Code: syd@netscape.com 6/8/2001
  73.      *
  74.     */
  75.  
  76.     function turboCheck()
  77.     {
  78.       var frame = document.getElementById("perfSettings");
  79.       if (navigator.platform != "Win32") {
  80.         frame.setAttribute("hidden", "true");
  81.         return;
  82.       }
  83.       if (!("isTurboEnabled" in parent))
  84.         parent.isTurboEnabled = -1;
  85.       else {
  86.         document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
  87.         return;
  88.       }
  89.       var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
  90.       if (winhooksService) {
  91.         parent.isTurboEnabled = winhooksService.isOptionEnabled("-turbo");
  92.         document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
  93.       }
  94.  
  95.       parent.hPrefWindow.registerOKCallbackFunc( saveTurboSetting );
  96.     }
  97.  
  98.     /* 
  99.      * Name: saveTurboSetting()
  100.      * 
  101.      * Arguments: none
  102.      *
  103.      * Description: This function is called when the user hits the OK button in
  104.      * the preferences panel. The function determines what the turbo "preference" 
  105.      * setting is and performs the appropriate action to enable or disable turbo mode.
  106.      *
  107.      * Return Value: void
  108.      *
  109.      * Original Code: syd@netscape.com 6/9/2001
  110.      *
  111.     */
  112.  
  113.     function saveTurboSetting() {
  114.       if (navigator.platform != "Win32")
  115.         return;   
  116.  
  117.       var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
  118.       if (winhooksService && parent.isTurboEnabled != -1) {
  119.         if (parent.isTurboEnabled)
  120.           winhooksService.startupAddOption("-turbo");
  121.         else 
  122.           winhooksService.startupRemoveOption("-turbo");
  123.         var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
  124.         appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService );
  125.         var nativeAppSupport = null;
  126.         try {
  127.           nativeAppSupport = appShell.nativeAppSupport;
  128.         }
  129.         catch ( ex ) {
  130.         }
  131.         if (nativeAppSupport)
  132.           nativeAppSupport.isServerMode = parent.isTurboEnabled;
  133.         }
  134.       }
  135.   ]]>
  136.   </script>
  137.  
  138.   <groupbox id="advancedSettings" align="start">
  139.     <caption label="&advancedTitle.label;"/>
  140.     <vbox align="start" id="contentEnablingBox">
  141.       <checkbox id="advancedJavaAllow" label="&enbJavaCheck.label;" accesskey="&enbJavaCheck.accesskey;"
  142.                 prefstring="security.enable_java"/>
  143.     </vbox>
  144.     <vbox>
  145.     <vbox align="start">
  146.       <checkbox id="advancedMailFTP" label="&sendAddFtpCheck.label;" accesskey="&sendAddFtpCheck.accesskey;"
  147.                 prefstring="advanced.mailftp"
  148.                 oncommand="ftpCheck(true);"/>
  149.     </vbox>
  150.     <hbox class="indent">
  151.       <textbox id="advancedMailFTPAddress"
  152.                preftype="string" prefstring="network.ftp.anonymous_password" class="uri-element"
  153.                flex="2"/>
  154.     </hbox>
  155.     </vbox>
  156.     <separator/>
  157.   </groupbox>
  158.   <groupbox id="perfSettings">
  159.     <caption id="perfLabel" label="&perfTitle.label;"/>
  160.     <vbox id="perfBox" align="start">
  161.       <checkbox id="enableTurbo" label="&enableTurbo.label;" accesskey="&enableTurboCheck.accesskey;"
  162.                 oncommand="parent.isTurboEnabled = this.checked;"/>
  163.       <vbox class="indent" flex="1">
  164.         <description>&perfdescription.label;</description>
  165.       </vbox>
  166.     </vbox>
  167.   </groupbox>
  168.   
  169. </page>
  170.  
  171.  
  172.