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/
9
implied. See the License for the specific language governing
10
rights and limitations under the License.
12
The Original Code is Mozilla Communicator client code, released
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
21
Mike Kowalski <mikejk@ameritech.net>
23
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
26
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
28
<!ENTITY % prefAdvancedDTD SYSTEM "chrome://communicator/locale/pref/pref-advanced.dtd"> %prefAdvancedDTD;
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;">
35
<script type="application/x-javascript">
37
var panel = "chrome://communicator/content/pref/pref-advanced.xul";
38
var _elementIDs = ["advancedJavaAllow", "advancedMailFTP", "advancedMailFTPAddress", "systemPrefCheck"];
47
function ftpCheck(setFocus) {
48
var checked = document.getElementById("advancedMailFTP").checked;
49
var field = document.getElementById("advancedMailFTPAddress");
50
field.disabled = !checked;
52
if (!field.disabled && setFocus)
61
* Description: This function is called when the root advanced prefs panel
62
* is loaded. The turbo mode setting is not exactly a preference -- setting
63
* the checkbox should (on leaving the prefs with an "Ok") result in a call
64
* to the backend to do the necessary win32 registry twiddling needed for
65
* turbo mode to go into effect. Clearing it should undo this work. We need
66
* to call the backend to determine if turbo mode is enabled (since we are
67
* required to check for it in a non-trivial way) and then explicitly set the
68
* checkbox here based on what we find. Finally, we have to hide the checkbox
69
* (and the group box that frames it) if we are not executing on a Win32
74
* Original Code: syd@netscape.com 6/8/2001
80
var frame = document.getElementById("perfSettings");
81
if (navigator.platform != "Win32") {
85
if (!("isTurboEnabled" in parent))
86
parent.isTurboEnabled = -1;
88
document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
91
var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
92
if (winhooksService) {
93
parent.isTurboEnabled = winhooksService.isOptionEnabled("-turbo");
94
document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
97
parent.hPrefWindow.registerOKCallbackFunc( saveTurboSetting );
101
* Name: saveTurboSetting()
105
* Description: This function is called when the user hits the OK button in
106
* the preferences panel. The function determines what the turbo "preference"
107
* setting is and performs the appropriate action to enable or disable turbo mode.
111
* Original Code: syd@netscape.com 6/9/2001
115
function saveTurboSetting() {
116
if (navigator.platform != "Win32")
119
var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
120
if (winhooksService && parent.isTurboEnabled != -1) {
121
if (parent.isTurboEnabled)
122
winhooksService.startupAddOption("-turbo");
124
winhooksService.startupRemoveOption("-turbo");
125
var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
126
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService );
127
var nativeAppSupport = null;
129
nativeAppSupport = appShell.nativeAppSupport;
133
if (nativeAppSupport)
134
nativeAppSupport.isServerMode = parent.isTurboEnabled;
138
function sysPrefCheck() {
139
var frame = document.getElementById("systemPrefs");
140
if ("@mozilla.org/system-preference-service;1" in Components.classes)
142
var appShell = Components.classes["@mozilla.org/system-preference-service;1"].getService(Components.interfaces.nsIPrefBranch);
149
function sysPrefUpdate() {
150
var checkObj = document.getElementById("systemPrefCheck");
151
var prefstring = checkObj.getAttribute( "prefstring" );
152
parent.hPrefWindow.setPref("bool", prefstring, checkObj.checked);
153
parent.hPrefWindow.pagePrefChanged = true;
154
parent.hPrefWindow.pagePrefUpdated = [];
159
<groupbox id="advancedSettings" align="start">
160
<caption label="&advancedTitle.label;"/>
161
<vbox align="start" id="contentEnablingBox">
162
<checkbox id="advancedJavaAllow" label="&enbJavaCheck.label;" accesskey="&enbJavaCheck.accesskey;"
163
prefstring="security.enable_java"
164
oncommand="javaCheck(true)"/>
168
<checkbox id="advancedMailFTP" label="&sendAddFtpCheck.label;" accesskey="&sendAddFtpCheck.accesskey;"
169
prefstring="advanced.mailftp"
170
oncommand="ftpCheck(true);"/>
172
<hbox class="indent">
173
<textbox id="advancedMailFTPAddress"
174
preftype="string" prefstring="network.ftp.anonymous_password" class="uri-element"
181
<script type="application/x-javascript">
183
function javaCheck(setFocus) {
184
if (!jvmConfigList) return;
185
var checked = document.getElementById("advancedJavaAllow").checked;
189
const nsIJVMConfig = Components.interfaces.nsIJVMConfig;
191
var jvmConfigList = getJVMConfigList();
192
const currentJVMPluginPath = getCurrentJVMPluginPath();
193
var oldJVMConfig = null;
195
function getJVMConfigMgr() {
196
return "@mozilla.org/oji/jvm-config-mgr;1" in Components.classes
197
&& Components.classes["@mozilla.org/oji/jvm-config-mgr;1"]
198
.getService(Components.interfaces.nsIJVMConfigManager);
201
function getJVMConfigList() {
203
jvmConfigMgr = getJVMConfigMgr();
205
return jvmConfigMgr && jvmConfigMgr.getJVMConfigList();
208
function getCurrentJVMPluginPath() {
210
if ("application/x-java-vm" in navigator.mimeTypes)
212
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
213
.getService(Components.interfaces.nsIPrefBranch);
215
// Since we don't have a fullPath attribute in nsIDOMPlugin,
216
// we have to set the set pref "plugin.expose_full_path"
217
// to true and then get it. Related bug is 204476
218
var oldValue = prefs.getBoolPref("plugin.expose_full_path");
220
prefs.setBoolPref("plugin.expose_full_path", true);
223
result = navigator.mimeTypes["application/x-java-vm"]
224
.enabledPlugin.filename;
227
// Set the pref to original value.
229
prefs.setBoolPref("plugin.expose_full_path", oldValue);
235
const jvmConfigListView = {
236
currentJVMConfig : null,
240
setTree : function(tree) {},
241
getImageSrc : function(row, column) {},
242
getProgressMode : function(row, column) {},
243
getCellValue : function(row, column) {},
244
isSeparator : function(index) {return false;},
245
isSorted: function() { return false; },
246
isContainer : function(index) {return false;},
247
cycleHeader : function(aColId, aElt) {},
248
getRowProperties : function(row, column, prop) {},
249
getColumnProperties : function(column, columnElement, prop) {},
250
getCellProperties : function(row, prop) {},
252
getCellText : function(row,column) {
254
var jvmConfig = jvmConfigList.queryElementAt(row, nsIJVMConfig);
255
if (column == "name")
256
return jvmConfig.version;
257
if (column == "home")
258
return jvmConfig.path.path;
263
refresh : function(jvmConfigListObj) {
265
this.rowCount = jvmConfigList.length;
266
var currentIndex = -1;
267
for (i = 0; i < this.rowCount; i++) {
268
var jvmConfig = jvmConfigList.queryElementAt(i, nsIJVMConfig)
269
var jvmHome = jvmConfig.path.path;
270
if (currentJVMPluginPath.indexOf(jvmHome + "/") >= 0) {
271
this.currentJVMConfig = jvmConfig;
275
// Only show the panel if we have the choice.
276
if (jvmConfigList.length == 0 ||
277
(jvmConfigList.length == 1 && currentIndex >= 0)) {
281
jvmConfigListObj.treeBoxObject.view = this;
282
if (currentIndex >= 0)
283
jvmConfigListView.selection.select(currentIndex);
289
getCurrentJVMConfig : function() {
290
return this.currentJVMConfig;
294
function setVisible(visible) {
295
var javaConfigPanel = document.getElementById("javaPluginSettings");
296
javaConfigPanel.hidden = !visible;
299
function initJVMConfigList() {
300
var javaChecked = document.getElementById("advancedJavaAllow").checked;
302
var jvmConfigListObj = document.getElementById("jvmConfigListObj");
303
if (jvmConfigListObj) {
304
jvmConfigListView.refresh(jvmConfigListObj);
305
oldJVMConfig = jvmConfigListView.getCurrentJVMConfig();
306
parent.hPrefWindow.registerOKCallbackFunc(switchJVM);
308
if (!javaChecked) setVisible(false);
314
function switchJVM() {
315
var currentIndex = jvmConfigListView.selection.currentIndex;
316
if (currentIndex >= 0 && jvmConfigMgr && jvmConfigList) {
317
var currentJVMConfig =
318
jvmConfigList.queryElementAt(currentIndex, nsIJVMConfig);
319
if (currentJVMConfig && currentJVMConfig != oldJVMConfig) {
321
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
322
.getService(Components.interfaces.nsIPromptService);
324
var navbundle = document.getElementById("navBundle");
325
var brandbundle = document.getElementById("brandBundle");
326
var dialogTitle = navbundle.getString("switchJVMTitle");
329
jvmConfigMgr.setCurrentJVMConfig(currentJVMConfig);
331
errorMsg = navbundle.getString("switchJVMFailed");
332
promptService.alert(window, dialogTitle, errorMsg);
336
oldJVMConfig = currentJVMConfig;
342
<stringbundle id="navBundle"
343
src="chrome://navigator/locale/navigator.properties"/>
344
<stringbundle id="brandBundle"
345
src="chrome://global/locale/brand.properties"/>
346
<groupbox id="javaPluginSettings" align="start">
347
<caption label="&jvm.configuration;"/>
348
<tree id="jvmConfigListObj" style="width: 60em; height: 10em"
349
hidecolumnpicker="true">
351
<treecol id="name" label="&jvm.name;" flex="2"/>
352
<splitter class="tree-splitter"/>
353
<treecol id="home" label="&jvm.home;" flex="13"/>
359
<groupbox id="perfSettings">
360
<caption id="perfLabel" label="&perfTitle.label;"/>
361
<vbox id="perfBox" align="start">
362
<checkbox id="enableTurbo" label="&enableTurbo.label;" accesskey="&enableTurboCheck.accesskey;"
363
oncommand="parent.isTurboEnabled = this.checked;"/>
364
<vbox class="indent" flex="1">
365
<description>&perfdescription.label;</description>
369
<groupbox id="systemPrefs">
370
<caption id="systemPrefCaption" label="&systemPrefCaption.label;"/>
371
<vbox id="systemPrefBox" align="start">
372
<checkbox id="systemPrefCheck" label="&systemPrefCheck.label;" accesskey="&systemPrefCheck.accesskey;"
373
prefstring="config.use_system_prefs"
374
oncommand="sysPrefUpdate();"/>
375
<vbox class="indent" flex="1">
376
<description>&systemPrefDescription.label;</description>