2000-02-15 01:14:23 +00:00
|
|
|
var bundle = srGetStrBundle("chrome://pref/locale/prefutilities.properties");
|
2000-01-07 06:52:11 +00:00
|
|
|
|
|
|
|
function getFileOrFolderURL( aTitle, aFolder )
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
var fileSpecWithUI = Components.classes["component://netscape/filespecwithui"].createInstance();
|
|
|
|
if( fileSpecWithUI )
|
|
|
|
fileSpecWithUI = fileSpecWithUI.QueryInterface( Components.interfaces.nsIFileSpecWithUI );
|
|
|
|
}
|
|
|
|
catch(e) {
|
|
|
|
dump("*** failed to create fileSpecWithUI or fileSpec objects\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
try {
|
2000-02-15 01:14:23 +00:00
|
|
|
var value;
|
|
|
|
if( aFolder )
|
|
|
|
value = fileSpecWithUI.chooseDirectory( aTitle );
|
2000-01-07 06:52:11 +00:00
|
|
|
else
|
2000-02-15 01:14:23 +00:00
|
|
|
value = fileSpecWithUI.chooseFile( aTitle );
|
|
|
|
dump("filespecWithUI.path = " + value + "\n");
|
|
|
|
fileSpecWithUI.URLString = value;
|
2000-01-07 06:52:11 +00:00
|
|
|
}
|
|
|
|
catch(e) {
|
2000-02-15 01:14:23 +00:00
|
|
|
dump("Error: " + e + "\n");
|
2000-01-07 06:52:11 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2000-02-16 07:21:07 +00:00
|
|
|
return fileSpecWithUI.URLString;
|
2000-01-07 06:52:11 +00:00
|
|
|
}
|
|
|
|
|
2000-02-15 01:14:23 +00:00
|
|
|
function prefNavSelectFile(folderFieldId, stringId)
|
|
|
|
{
|
|
|
|
var folderField = document.getElementById(folderFieldId);
|
|
|
|
var url = getFileOrFolderURL( bundle.GetStringFromName(stringId), false );
|
|
|
|
if( url != -1 )
|
|
|
|
folderField.value = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setHomePageToCurrentPage(folderFieldId)
|
|
|
|
{
|
|
|
|
if( !parent.opener.appCore )
|
|
|
|
return false;
|
|
|
|
var homePageField = document.getElementById(folderFieldId);
|
|
|
|
var url = parent.opener.content.location.href;
|
|
|
|
if( url )
|
|
|
|
homePageField.value = url;
|
|
|
|
}
|