use nsIFilePicker instead of nsIFileSpecWithUI

This commit is contained in:
pavlov%netscape.com 2000-03-31 03:55:41 +00:00
Родитель 7c69941bdc
Коммит a66c3f2998
2 изменённых файлов: 18 добавлений и 26 удалений

Просмотреть файл

@ -704,20 +704,17 @@ function RevealSearchPanel()
newWin.saveFileAndPos = true;
}
const nsIFilePicker = Components.interfaces.nsIFilePicker;
function BrowserOpenFileWindow()
{
// Get filespecwithui component.
var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" );
var url = null;
// Get filepicker component.
try {
fileSpec.parentWindow = window;
url = fileSpec.chooseFile( bundle.GetStringFromName( "openFile" ) );
fileSpec.parentWindow = null;
} catch ( exception ) {
}
if ( url && url != "" ) {
openNewWindowWith( url );
}
var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker);
fp.init(window, bundle.GetStringFromName("openFile"), nsIFilePicker.modeOpen);
fp.setFilters(nsIFilePicker.filterAll);
fp.show();
openNewWindowWith(fp.file.path);
} catch (ex) { }
}
function OpenFile(url) {

Просмотреть файл

@ -111,19 +111,14 @@ function createInstance( progid, iidName )
return Components.classes[ progid ].createInstance( iid );
}
const nsIFilePicker = Components.interfaces.nsIFilePicker;
function onChooseFile()
{
// Get filespecwithui component.
var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" );
try
{
fileSpec.parentWindow = window;
var url = fileSpec.chooseFile( bundle.GetStringFromName("chooseFileDialogTitle") );
fileSpec.parentWindow = null;
dialog.input.value = fileSpec.URLString;
}
catch( exception )
{
// Just a cancel, probably.
}
}
{
try {
var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker);
fp.init(window, bundle.GetStringFromName("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
fp.setFilters(nsIFilePicker.filterAll);
fp.show();
dialog.input.value = fp.file.path;
} catch(ex) { }
}