mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 20:17:37 +00:00
954729c780
Make Integration of mozilla and Java Plugin be better
386 lines
13 KiB
XML
386 lines
13 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
The contents of this file are subject to the Netscape Public
|
|
License Version 1.1 (the "License"); you may not use this file
|
|
except in compliance with the License. You may obtain a copy of
|
|
the License at http://www.mozilla.org/NPL/
|
|
|
|
implied. See the License for the specific language governing
|
|
rights and limitations under the License.
|
|
|
|
The Original Code is Mozilla Communicator client code, released
|
|
March 31, 1998.
|
|
|
|
The Initial Developer of the Original Code is Netscape
|
|
Communications Corporation. Portions created by Netscape are
|
|
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
|
Rights Reserved.
|
|
|
|
Contributor(s):
|
|
Mike Kowalski <mikejk@ameritech.net>
|
|
-->
|
|
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
|
|
|
<!DOCTYPE page [
|
|
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
|
%brandDTD;
|
|
<!ENTITY % prefAdvancedDTD SYSTEM "chrome://communicator/locale/pref/pref-advanced.dtd"> %prefAdvancedDTD;
|
|
]>
|
|
|
|
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
onload="parent.initPanel('chrome://communicator/content/pref/pref-advanced.xul');"
|
|
headertitle="&lHeader;">
|
|
|
|
<script type="application/x-javascript">
|
|
<![CDATA[
|
|
var panel = "chrome://communicator/content/pref/pref-advanced.xul";
|
|
var _elementIDs = ["advancedJavaAllow", "advancedMailFTP", "advancedMailFTPAddress", "systemPrefCheck"];
|
|
|
|
function Startup() {
|
|
ftpCheck(false);
|
|
turboCheck();
|
|
sysPrefCheck();
|
|
initJVMConfigList();
|
|
}
|
|
|
|
function ftpCheck(setFocus) {
|
|
var checked = document.getElementById("advancedMailFTP").checked;
|
|
var field = document.getElementById("advancedMailFTPAddress");
|
|
field.disabled = !checked;
|
|
|
|
if (!field.disabled && setFocus)
|
|
field.focus();
|
|
}
|
|
|
|
/*
|
|
* Name: turboCheck()
|
|
*
|
|
* Arguments: none
|
|
*
|
|
* Description: This function is called when the root advanced prefs panel
|
|
* is loaded. The turbo mode setting is not exactly a preference -- setting
|
|
* the checkbox should (on leaving the prefs with an "Ok") result in a call
|
|
* to the backend to do the necessary win32 registry twiddling needed for
|
|
* turbo mode to go into effect. Clearing it should undo this work. We need
|
|
* to call the backend to determine if turbo mode is enabled (since we are
|
|
* required to check for it in a non-trivial way) and then explicitly set the
|
|
* checkbox here based on what we find. Finally, we have to hide the checkbox
|
|
* (and the group box that frames it) if we are not executing on a Win32
|
|
* platform.
|
|
*
|
|
* Return Value: void
|
|
*
|
|
* Original Code: syd@netscape.com 6/8/2001
|
|
*
|
|
*/
|
|
|
|
function turboCheck()
|
|
{
|
|
var frame = document.getElementById("perfSettings");
|
|
if (navigator.platform != "Win32") {
|
|
frame.setAttribute("hidden", "true");
|
|
return;
|
|
}
|
|
if (!("isTurboEnabled" in parent))
|
|
parent.isTurboEnabled = -1;
|
|
else {
|
|
document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
|
|
return;
|
|
}
|
|
var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
|
|
if (winhooksService) {
|
|
parent.isTurboEnabled = winhooksService.isOptionEnabled("-turbo");
|
|
document.getElementById("enableTurbo").checked = parent.isTurboEnabled;
|
|
}
|
|
|
|
parent.hPrefWindow.registerOKCallbackFunc( saveTurboSetting );
|
|
}
|
|
|
|
/*
|
|
* Name: saveTurboSetting()
|
|
*
|
|
* Arguments: none
|
|
*
|
|
* Description: This function is called when the user hits the OK button in
|
|
* the preferences panel. The function determines what the turbo "preference"
|
|
* setting is and performs the appropriate action to enable or disable turbo mode.
|
|
*
|
|
* Return Value: void
|
|
*
|
|
* Original Code: syd@netscape.com 6/9/2001
|
|
*
|
|
*/
|
|
|
|
function saveTurboSetting() {
|
|
if (navigator.platform != "Win32")
|
|
return;
|
|
|
|
var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
|
|
if (winhooksService && parent.isTurboEnabled != -1) {
|
|
if (parent.isTurboEnabled)
|
|
winhooksService.startupAddOption("-turbo");
|
|
else
|
|
winhooksService.startupRemoveOption("-turbo");
|
|
var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
|
|
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService );
|
|
var nativeAppSupport = null;
|
|
try {
|
|
nativeAppSupport = appShell.nativeAppSupport;
|
|
}
|
|
catch ( ex ) {
|
|
}
|
|
if (nativeAppSupport)
|
|
nativeAppSupport.isServerMode = parent.isTurboEnabled;
|
|
}
|
|
}
|
|
|
|
function sysPrefCheck() {
|
|
var frame = document.getElementById("systemPrefs");
|
|
try {
|
|
var appShell = Components.classes["@mozilla.org/system-preference-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
|
}
|
|
catch(e)
|
|
{
|
|
frame.setAttribute("hidden", "true");
|
|
return;
|
|
}
|
|
frame.setAttribute("hidden", "false");
|
|
}
|
|
|
|
function sysPrefUpdate() {
|
|
var checkObj = document.getElementById("systemPrefCheck");
|
|
var prefstring = checkObj.getAttribute( "prefstring" );
|
|
parent.hPrefWindow.pref.SetBoolPref(prefstring, checkObj.checked);
|
|
parent.hPrefWindow.pagePrefChanged = true;
|
|
parent.hPrefWindow.pagePrefUpdated = [];
|
|
}
|
|
]]>
|
|
</script>
|
|
|
|
<groupbox id="advancedSettings" align="start">
|
|
<caption label="&advancedTitle.label;"/>
|
|
<vbox align="start" id="contentEnablingBox">
|
|
<checkbox id="advancedJavaAllow" label="&enbJavaCheck.label;" accesskey="&enbJavaCheck.accesskey;"
|
|
prefstring="security.enable_java"
|
|
oncommand="javaCheck(true)"/>
|
|
</vbox>
|
|
<vbox>
|
|
<vbox align="start">
|
|
<checkbox id="advancedMailFTP" label="&sendAddFtpCheck.label;" accesskey="&sendAddFtpCheck.accesskey;"
|
|
prefstring="advanced.mailftp"
|
|
oncommand="ftpCheck(true);"/>
|
|
</vbox>
|
|
<hbox class="indent">
|
|
<textbox id="advancedMailFTPAddress"
|
|
preftype="string" prefstring="network.ftp.anonymous_password" class="uri-element"
|
|
flex="2"/>
|
|
</hbox>
|
|
</vbox>
|
|
<separator/>
|
|
</groupbox>
|
|
|
|
<script type="application/x-javascript">
|
|
<![CDATA[
|
|
function javaCheck(setFocus) {
|
|
if (!jvmConfigList) return;
|
|
var checked = document.getElementById("advancedJavaAllow").checked;
|
|
setVisible(checked);
|
|
}
|
|
|
|
const nsIJVMConfig = Components.interfaces.nsIJVMConfig;
|
|
const jvmConfigMgr = getJVMConfigMgr();
|
|
const jvmConfigList = getJVMConfigList();
|
|
const currentJVMPluginPath = getCurrentJVMPluginPath();
|
|
var oldJVMConfig = null;
|
|
|
|
function getJVMConfigMgr() {
|
|
return Components.classes["@mozilla.org/oji/jvm-config-mgr;1"]
|
|
.getService(Components.interfaces.nsIJVMConfigManager);
|
|
}
|
|
|
|
function getJVMConfigList() {
|
|
if (!jvmConfigMgr)
|
|
jvmConfigMgr = getJVMConfigMgr();
|
|
|
|
if (jvmConfigMgr)
|
|
return jvmConfigMgr.getJVMConfigList();
|
|
|
|
return null;
|
|
}
|
|
|
|
function getCurrentJVMPluginPath() {
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
if (prefs) {
|
|
// Since we don't have a fullPath attribute in nsIDOMPlugin,
|
|
// we have to set the set pref "plugin.expose_full_path"
|
|
// to true and then get it. Related bug is 204476
|
|
var oldValue = prefs.getBoolPref("plugin.expose_full_path");
|
|
if (!oldValue)
|
|
prefs.setBoolPref("plugin.expose_full_path", true);
|
|
|
|
var result;
|
|
try {
|
|
result = navigator.mimeTypes["application/x-java-vm"]
|
|
.enabledPlugin.filename;
|
|
} catch (e) { result = ""; };
|
|
|
|
// Set the pref to original value.
|
|
if (!oldValue)
|
|
prefs.setBoolPref("plugin.expose_full_path", oldValue);
|
|
return result;
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
const jvmConfigListView = {
|
|
currentJVMConfig : null,
|
|
|
|
rowCount : 0,
|
|
|
|
setTree : function(tree) {},
|
|
getImageSrc : function(row, column) {},
|
|
getProgressMode : function(row, column) {},
|
|
getCellValue : function(row, column) {},
|
|
isSeparator : function(index) {return false;},
|
|
isSorted: function() { return false; },
|
|
isContainer : function(index) {return false;},
|
|
cycleHeader : function(aColId, aElt) {},
|
|
getRowProperties : function(row, column, prop) {},
|
|
getColumnProperties : function(column, columnElement, prop) {},
|
|
getCellProperties : function(row, prop) {},
|
|
|
|
getCellText : function(row,column) {
|
|
if (jvmConfigList) {
|
|
var jvmConfig = jvmConfigList.queryElementAt(row, nsIJVMConfig);
|
|
if (column == "name")
|
|
return jvmConfig.version;
|
|
if (column == "home")
|
|
return jvmConfig.path.path;
|
|
}
|
|
return "";
|
|
},
|
|
|
|
refresh : function(jvmConfigListObj) {
|
|
if (jvmConfigList) {
|
|
this.rowCount = jvmConfigList.length;
|
|
var currentIndex = -1;
|
|
for (i = 0; i < this.rowCount; i++) {
|
|
var jvmConfig = jvmConfigList.queryElementAt(i, nsIJVMConfig)
|
|
var jvmHome = jvmConfig.path.path;
|
|
if (currentJVMPluginPath.indexOf(jvmHome + "/") >= 0) {
|
|
this.currentJVMConfig = jvmConfig;
|
|
currentIndex = i;
|
|
}
|
|
}
|
|
// Only show the panel if we have the choice.
|
|
if (jvmConfigList.length == 0 ||
|
|
(jvmConfigList.length == 1 && currentIndex >= 0)) {
|
|
setVisible(false);
|
|
return;
|
|
}
|
|
jvmConfigListObj.treeBoxObject.view = this;
|
|
if (currentIndex >= 0)
|
|
jvmConfigListView.selection.select(currentIndex);
|
|
} else {
|
|
this.rowCount = 0;
|
|
}
|
|
},
|
|
|
|
getCurrentJVMConfig : function() {
|
|
return this.currentJVMConfig;
|
|
},
|
|
};
|
|
|
|
function setVisible(visible) {
|
|
var javaConfigPanel = document.getElementById("javaPluginSettings");
|
|
javaConfigPanel.setAttribute("hidden", visible ? "" : "true");
|
|
}
|
|
|
|
function initJVMConfigList() {
|
|
var javaChecked = document.getElementById("advancedJavaAllow").checked;
|
|
if (jvmConfigList) {
|
|
var jvmConfigListObj = document.getElementById("jvmConfigListObj");
|
|
if (jvmConfigListObj) {
|
|
jvmConfigListView.refresh(jvmConfigListObj);
|
|
oldJVMConfig = jvmConfigListView.getCurrentJVMConfig();
|
|
parent.hPrefWindow.registerOKCallbackFunc(switchJVM);
|
|
}
|
|
if (!javaChecked) setVisible(false);
|
|
} else {
|
|
setVisible(false);
|
|
}
|
|
}
|
|
|
|
function switchJVM() {
|
|
var currentIndex = jvmConfigListView.selection.currentIndex;
|
|
if (currentIndex >= 0 && jvmConfigMgr && jvmConfigList) {
|
|
var currentJVMConfig =
|
|
jvmConfigList.queryElementAt(currentIndex, nsIJVMConfig);
|
|
if (currentJVMConfig && currentJVMConfig != oldJVMConfig) {
|
|
var promptService =
|
|
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
|
.getService(Components.interfaces.nsIPromptService);
|
|
|
|
var navbundle = document.getElementById("navBundle");
|
|
var brandbundle = document.getElementById("brandBundle");
|
|
var dialogTitle = navbundle.getString("switchJVMTitle");
|
|
|
|
try {
|
|
jvmConfigMgr.setCurrentJVMConfig(currentJVMConfig);
|
|
} catch (e) {
|
|
errorMsg = navbundle.getString("switchJVMFailed");
|
|
promptService.alert(window, dialogTitle, errorMsg);
|
|
return;
|
|
}
|
|
|
|
oldJVMConfig = currentJVMConfig;
|
|
}
|
|
}
|
|
}
|
|
]]>
|
|
</script>
|
|
<stringbundle id="navBundle"
|
|
src="chrome://navigator/locale/navigator.properties"/>
|
|
<stringbundle id="brandBundle"
|
|
src="chrome://global/locale/brand.properties"/>
|
|
<groupbox id="javaPluginSettings" align="start">
|
|
<caption label="&jvm.configuration;"/>
|
|
<tree id="jvmConfigListObj" style="width: 60em; height: 10em"
|
|
hidecolumnpicker="true">
|
|
<treecols>
|
|
<treecol id="name" label="&jvm.name;" flex="2"/>
|
|
<splitter class="tree-splitter"/>
|
|
<treecol id="home" label="&jvm.home;" flex="13"/>
|
|
</treecols>
|
|
<treechildren/>
|
|
</tree>
|
|
</groupbox>
|
|
|
|
<groupbox id="perfSettings">
|
|
<caption id="perfLabel" label="&perfTitle.label;"/>
|
|
<vbox id="perfBox" align="start">
|
|
<checkbox id="enableTurbo" label="&enableTurbo.label;" accesskey="&enableTurboCheck.accesskey;"
|
|
oncommand="parent.isTurboEnabled = this.checked;"/>
|
|
<vbox class="indent" flex="1">
|
|
<description>&perfdescription.label;</description>
|
|
</vbox>
|
|
</vbox>
|
|
</groupbox>
|
|
<groupbox id="systemPrefs">
|
|
<caption id="systemPrefCaption" label="&systemPrefCaption.label;"/>
|
|
<vbox id="systemPrefBox" align="start">
|
|
<checkbox id="systemPrefCheck" label="&systemPrefCheck.label;" accesskey="&systemPrefCheck.accesskey;"
|
|
prefstring="config.use_system_prefs"
|
|
oncommand="sysPrefUpdate();"/>
|
|
<vbox class="indent" flex="1">
|
|
<description>&systemPrefDescription.label;</description>
|
|
</vbox>
|
|
</vbox>
|
|
</groupbox>
|
|
|
|
</page>
|