New panel for Windows desktop integration preferences

This commit is contained in:
law%netscape.com 2000-05-10 22:20:50 +00:00
parent c30462e26a
commit c3ff906f1e
3 changed files with 219 additions and 0 deletions

View File

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*
* Contributor(s):
* Bill Law <law@netscape.com>
*/
// Turn this on to get debug output.
const debug = 1;
function debugDump( text ) {
if ( debug ) {
dump( text + "\n" );
}
}
function dumpObject( obj, name ) {
for ( prop in obj ) {
debugDump( name + "." + prop + "=" + obj[prop] );
}
}
// Top-level windows integration preferences.
const settings = [ "isHandlingHTML",
"isHandlingJPEG",
"isHandlingGIF",
"isHandlingPNG",
"isHandlingXML",
"isHandlingXUL",
"isHandlingHTTP",
"isHandlingHTTPS",
"isHandlingFTP",
"isHandlingCHROME" ];
var winhooks = null;
var prefs = null;
// This function is called when the user presses Ok to close the prefs window.
function onOK() {
// Transfer data from dialog to prefs object.
for( var index in settings ) {
var setting = settings[ index ];
var checkbox = document.getElementById( setting );
if ( checkbox ) {
prefs[ setting ] = checkbox.checked;
}
}
try {
// Update prefs.
winhooks.settings = prefs;
}
catch(e) {
alert( "Oh oh!" );
}
}
// This function is called when our pref panel is loaded.
function Startup() {
if ( !winhooks ) {
// Get component service.
try {
winhooks = Components.classes[ "component://mozilla/winhooks" ].getService( Components.interfaces.nsIWindowsHooks );
if ( winhooks ) {
// Try to get preferences.
prefs = winhooks.settings;
// Now transfer those to the dialog checkboxes.
for( var index in settings ) {
var setting = settings[ index ];
var checkbox = document.getElementById( setting );
if ( checkbox && prefs[ setting ] ) {
checkbox.setAttribute( "checked", "true" );
}
}
}
}
catch(e) {
dump( e + "\n" );
alert( "Rats!" );
}
}
// If all is well, hook into "Ok".
if ( winhooks && prefs && parent && parent.hPrefWindow ) {
parent.hPrefWindow.registerOKCallbackFunc( onOK );
}
}
// Launch specified dialog.
function showDialog( index ) {
var url = "chrome://pref/content/pref-winhooks-" + index + ".xul";
window.openDialog( url, "", "chrome", prefs );
}

View File

@ -0,0 +1,83 @@
<?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/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
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):
Bill Law <law@netscape.com>
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % platformDTD SYSTEM "chrome://global/locale/platformDialogOverlay.dtd" >
%platformDTD;
<!ENTITY % prefWinhooksDTD SYSTEM "chrome://communicator/locale/pref/pref-winhooks.dtd" >
%prefWinhooksDTD;
]>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="color-dialog"
onload="parent.initPanel('chrome://communicator/content/pref/pref-winhooks.xul');"
orient="vertical"
>
<html:script language="JavaScript" src="chrome://communicator/content/pref/pref-winhooks.js"/>
<box class="box-smallheader" title="&title.label;"/>
<box orient="vertical">
<!-- File types -->
<titledbox>
<title>
<text value="&files.label;"/>
</title>
<box orient="vertical">
<html>
&files.text;
</html>
<checkbox id="isHandlingHTML" value="&html.label;"/>
<checkbox id="isHandlingJPEG" value="&jpeg.label;"/>
<checkbox id="isHandlingGIF" value="&gif.label;"/>
<checkbox id="isHandlingPNG" value="&png.label;"/>
<checkbox id="isHandlingXML" value="&xml.label;"/>
<checkbox id="isHandlingXUL" value="&xul.label;"/>
</box>
</titledbox>
<!-- Internet Shortcuts -->
<titledbox>
<title>
<text value="&shortcuts.label;"/>
</title>
<box orient="vertical">
<html>
&shortcuts.text;
</html>
<checkbox id="isHandlingHTTP" value="&http.label;"/>
<checkbox id="isHandlingHTTPS" value="&https.label;"/>
<checkbox id="isHandlingFTP" value="&ftp.label;"/>
<checkbox id="isHandlingCHROME" value="&chrome.label;"/>
</box>
</titledbox>
</box>
</window>

View File

@ -0,0 +1,33 @@
<!-- LOCALIZATION NOTE : FILE "Windows integration" preferences -->
<!ENTITY title.label "Desktop Integration">
<!ENTITY info.label "Configuration">
<!-- These entities are used on the "File types" section of the dialog. -->
<!ENTITY files.label "File types">
<!ENTITY files.text "Select the types of files you want to view using Mozilla. Windows will use Mozilla when you open any files of the selected types.">
<!ENTITY html.label "Hyper-Text Markup Language documents (*.htm, *.html)">
<!ENTITY html.accesskey "H">
<!ENTITY jpeg.label "JPEG images (*.jpg, *.jpeg, *.jfif, *.pjpeg, *.pjp)">
<!ENTITY jpeg.accesskey "J">
<!ENTITY gif.label "GIF images (*.gif)">
<!ENTITY gif.accesskey "G">
<!ENTITY png.label "Portable Network Graphics images (*.png)">
<!ENTITY png.accesskey "P">
<!ENTITY xml.label "Extensible Markup Language documents (*.xml)">
<!ENTITY xml.accesskey "x">
<!ENTITY xul.label "eXtensible User-interface Language documents (*.xul)">
<!ENTITY xul.accesskey "U">
<!-- These entities are used on the "Internet Shortcuts" section of the dialog. -->
<!ENTITY shortcuts.label "Internet Shortcuts">
<!ENTITY shortcuts.text "Select the types of Internet Shortcuts you want to view using Mozilla. Windows will use Mozilla when you open any shortcuts of the selected types of shortcuts.">
<!ENTITY http.label "Hyper-Text Transfer Protocol (http:)">
<!ENTITY http.accesskey "H">
<!ENTITY https.label "Secure HTTP (https:)">
<!ENTITY https.accesskey "S">
<!ENTITY ftp.label "File Transfer Protocol (ftp:)">
<!ENTITY ftp.accesskey "F">
<!ENTITY chrome.label "Chrome Protocol (chrome:)">
<!ENTITY chrome.accesskey "C">