home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2003 May
/
PCWorld_2003-05_cd.bin
/
Komunik
/
phoenix
/
chrome
/
browser.jar
/
content
/
browser
/
pref
/
pref-downloads.xul
< prev
next >
Wrap
Extensible Markup Language
|
2002-11-09
|
3KB
|
76 lines
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-downloads.dtd" >
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.initPanel('chrome://browser/content/pref/pref-downloads.xul');"
headertitle="&lHeader;">
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["downloadDir", "defaultDir", "useProgressDialogs", "openDownloadsSidebar"];
function selectFolder()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsILocalFile = Components.interfaces.nsILocalFile;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
// XXXBlake Localize!
fp.init(window, "Select Download Directory:", nsIFilePicker.modeGetFolder);
try
{
var initialDir = pref.getComplexValue("browser.download.dir", nsILocalFile);
if (initialDir)
fp.displayDirectory = initialDir;
}
catch (ex)
{
// ignore exception: file picker will open at default location
}
fp.appendFilters(nsIFilePicker.filterAll);
var ret = fp.show();
if (ret == nsIFilePicker.returnOK) {
var localFile = fp.file.QueryInterface(nsILocalFile);
var viewable = fp.file.path;
var folderField = document.getElementById("defaultDir");
folderField.value = viewable;
pref.setComplexValue("browser.download.dir", nsILocalFile, localFile)
}
}
function doEnabling(aSelectedItem)
{
var textbox = document.getElementById("defaultDir");
var button = document.getElementById("browse");
var disable = aSelectedItem.id == "dontUseIt";
textbox.disabled = disable;
button.disabled = disable;
}
]]>
</script>
<groupbox orient="horizontal">
<caption label="&defaultDir.label;"/>
<radiogroup id="downloadDir" onselect="doEnabling(this.selectedItem);" flex="1"
preftype="bool" prefstring="browser.download.useDownloadDir">
<radio id="dontUseIt" label="&rememberLast.label;" value="false"/>
<hbox flex="1">
<radio id="useIt" label="&useDownloadDir.label;" value="true"/>
<textbox id="defaultDir" flex="1" readonly="true" prefstring="browser.download.dir"/>
<button id="browse" label="&browse.label;" oncommand="selectFolder();"/>
</hbox>
</radiogroup>
</groupbox>
<groupbox>
<caption label="&whenStarting.label;"/>
<checkbox id="useProgressDialogs" label="&useProgressDialogs.label;" accesskey="&useProgressDialogs.accesskey;"
prefstring="browser.download.useProgressDialogs"/>
<checkbox id="openDownloadsSidebar" label="&openSidebar.label;"
prefstring="browser.download.openSidebar"/>
</groupbox>
</page>