зеркало из https://github.com/mozilla/pjs.git
changes to make nsIFileSpecWithUI useful from javascript.
now, this works from js: var filePicker = Components.classes["component://netscape/filespecwithui"].createInstance(); filePicker = filePicker.QueryInterface(Components.interfaces.nsIFileSpecWithUI); file = filePicker.chooseFile("Select a file");
This commit is contained in:
Родитель
eff2f13b29
Коммит
6857b11132
|
@ -68,6 +68,7 @@ interface nsIFileSpecWithUI : nsIFileSpec
|
|||
, in string extraFilterTitle
|
||||
, in string extraFilter
|
||||
);
|
||||
string chooseFile(in string title);
|
||||
void chooseDirectory(in string title);
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,14 @@ NS_IMETHODIMP nsFileSpecWithUIImpl::chooseOutputFile(
|
|||
return mBaseFileSpec->setFromFileSpec(spec);
|
||||
} // nsFileSpecImpl::chooseOutputFile
|
||||
|
||||
NS_IMETHODIMP nsFileSpecWithUIImpl::chooseFile(const char *title, char **_retval)
|
||||
{
|
||||
nsresult rv = chooseInputFile(title, eAllFiles, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = GetURLString(_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsFileSpecWithUIImpl::chooseInputFile(
|
||||
const char *inTitle,
|
||||
|
|
|
@ -37,6 +37,8 @@ class nsFileSpecWithUIImpl
|
|||
|
||||
NS_IMETHOD chooseOutputFile(const char *windowTitle, const char *suggestedLeafName);
|
||||
|
||||
NS_IMETHOD chooseFile(const char *title, char **_retval);
|
||||
|
||||
NS_IMETHOD chooseInputFile(
|
||||
const char *title,
|
||||
nsIFileSpecWithUI::StandardFilterMask standardFilterMask,
|
||||
|
|
Загрузка…
Ссылка в новой задаче