зеркало из https://github.com/mozilla/pjs.git
use nsIFilePicker instead of nsIFileSpecWithUI
This commit is contained in:
Родитель
7c69941bdc
Коммит
a66c3f2998
|
@ -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) { }
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче