зеркало из https://github.com/mozilla/gecko-dev.git
use nsILocalFile instead of nsIFile
This commit is contained in:
Родитель
64cf196585
Коммит
a6351bc126
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFile.idl"
|
||||
#include "nsILocalFile.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
|
@ -76,7 +76,7 @@ interface nsIFilePicker : nsISupports
|
|||
* @param displayDirectory the name of the directory
|
||||
*
|
||||
*/
|
||||
attribute nsIFile displayDirectory;
|
||||
attribute nsILocalFile displayDirectory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ interface nsIFilePicker : nsISupports
|
|||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsIFile file;
|
||||
readonly attribute nsILocalFile file;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
|
|
|
@ -187,7 +187,7 @@ NS_IMETHODIMP nsFilePicker::SetFilterList(PRInt32 aNumberOfFilters,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile)
|
||||
NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(*aFile);
|
||||
if (mWidget) {
|
||||
|
@ -199,8 +199,7 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile)
|
|||
|
||||
file->InitWithPath(fn);
|
||||
|
||||
file->QueryInterface(NS_GET_IID(nsIFile), (void**)aFile);
|
||||
NS_ADDREF(*aFile);
|
||||
file->QueryInterface(NS_GET_IID(nsILocalFile), (void**)aFile);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -239,7 +238,7 @@ NS_IMETHODIMP nsFilePicker::GetDefaultString(PRUnichar **aString)
|
|||
// Set the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsIFile *aDirectory)
|
||||
NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsILocalFile *aDirectory)
|
||||
{
|
||||
mDisplayDirectory = aDirectory;
|
||||
return NS_OK;
|
||||
|
@ -250,7 +249,7 @@ NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsIFile *aDirectory)
|
|||
// Get the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsIFile **aDirectory)
|
||||
NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsILocalFile **aDirectory)
|
||||
{
|
||||
*aDirectory = mDisplayDirectory;
|
||||
NS_IF_ADDREF(*aDirectory);
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
const nsString* mTitles;
|
||||
const nsString* mFilters;
|
||||
nsString mDefault;
|
||||
nsCOMPtr<nsIFile> mDisplayDirectory;
|
||||
nsCOMPtr<nsILocalFile> mDisplayDirectory;
|
||||
PRInt16 mSelectedType;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
const nsIFile = Components.interfaces.nsIFile;
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsILocalFile_PROGID = "component://mozilla/file/local";
|
||||
|
||||
|
@ -49,7 +48,7 @@ function onOK()
|
|||
file.initWithPath(textInput.value);
|
||||
|
||||
if (file.isFile() && !file.isDirectory()) {
|
||||
retvals.file = file.QueryInterface(nsIFile);
|
||||
retvals.file = file;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -62,8 +61,6 @@ function onCancel()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onClick(e) {
|
||||
|
||||
sfile.initWithPath(e.target.parentNode.getAttribute("path"));
|
||||
|
@ -198,7 +195,7 @@ function getDirectoryContents(parentElement, dirContents)
|
|||
var i = 0;
|
||||
var array = new Array();
|
||||
while (dirContents.HasMoreElements()) {
|
||||
array[i] = dirContents.GetNext().QueryInterface(nsIFile);
|
||||
array[i] = dirContents.GetNext().QueryInterface(nsILocalFile);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
<box align="horizontal">
|
||||
<tree id="directoryList" onclick="onClick(event);" flex="1">
|
||||
<treecol/>
|
||||
<treecol/>
|
||||
<treecol/>
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell value="Name"/>
|
||||
|
|
|
@ -41,7 +41,6 @@ const FILEPICKER_CID = Components.ID("{54ae32f8-1dd2-11b2-a209-df7c505370f8
|
|||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsISupports = Components.interfaces.nsISupports;
|
||||
const nsIFactory = Components.interfaces.nsIFactory;
|
||||
const nsIFile = Components.interfaces.nsIFile;
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
|
||||
function nsFilePicker()
|
||||
|
@ -54,11 +53,11 @@ function nsFilePicker()
|
|||
|
||||
nsFilePicker.prototype = {
|
||||
|
||||
/* attribute nsIFile displayDirectory; */
|
||||
/* attribute nsILocalFile displayDirectory; */
|
||||
set displayDirectory(a) { this.mDisplayDirectory = a; },
|
||||
get displayDirectory() { return this.mDisplayDirectory; },
|
||||
|
||||
/* readonly attribute nsIFile file; */
|
||||
/* readonly attribute nsILocalFile file; */
|
||||
set file(a) { throw "readonly property"; },
|
||||
get file() { debug("getter called " + this.mFile); return this.mFile; },
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ const FILEPICKER_CID = Components.ID("{54ae32f8-1dd2-11b2-a209-df7c505370f8
|
|||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsISupports = Components.interfaces.nsISupports;
|
||||
const nsIFactory = Components.interfaces.nsIFactory;
|
||||
const nsIFile = Components.interfaces.nsIFile;
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
|
||||
function nsFilePicker()
|
||||
|
@ -54,11 +53,11 @@ function nsFilePicker()
|
|||
|
||||
nsFilePicker.prototype = {
|
||||
|
||||
/* attribute nsIFile displayDirectory; */
|
||||
/* attribute nsILocalFile displayDirectory; */
|
||||
set displayDirectory(a) { this.mDisplayDirectory = a; },
|
||||
get displayDirectory() { return this.mDisplayDirectory; },
|
||||
|
||||
/* readonly attribute nsIFile file; */
|
||||
/* readonly attribute nsILocalFile file; */
|
||||
set file(a) { throw "readonly property"; },
|
||||
get file() { debug("getter called " + this.mFile); return this.mFile; },
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче