2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Mozilla browser.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Stuart Parmenter <pavlov@netscape.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsILocalFile;
|
2008-02-26 08:12:17 -08:00
|
|
|
interface nsIURI;
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsIDOMWindow;
|
|
|
|
interface nsISimpleEnumerator;
|
|
|
|
|
2008-02-26 08:12:17 -08:00
|
|
|
[scriptable, uuid(d24ef0aa-d555-4117-84af-9cbbb7406909)]
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsIFilePicker : nsISupports
|
|
|
|
{
|
|
|
|
const short modeOpen = 0; // Load a file or directory
|
|
|
|
const short modeSave = 1; // Save a file or directory
|
|
|
|
const short modeGetFolder = 2; // Select a folder/directory
|
|
|
|
const short modeOpenMultiple= 3; // Load multiple files
|
|
|
|
|
|
|
|
const short returnOK = 0; // User hit Ok, process selection
|
|
|
|
const short returnCancel = 1; // User hit cancel, ignore selection
|
|
|
|
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
|
|
|
|
2010-07-17 00:00:28 -07:00
|
|
|
const long filterAll = 0x001; // *.*
|
|
|
|
const long filterHTML = 0x002; // *.html; *.htm
|
|
|
|
const long filterText = 0x004; // *.txt
|
|
|
|
const long filterImages = 0x008; // *.jpe; *.jpg; *.jpeg; *.gif;
|
2010-05-19 19:28:01 -07:00
|
|
|
// *.png; *.bmp; *.ico; *.svg;
|
|
|
|
// *.svgz; *.tif; *.tiff; *.ai;
|
|
|
|
// *.drw; *.pct; *.psp; *.xcf;
|
|
|
|
// *.psd; *.raw
|
2010-07-17 00:00:28 -07:00
|
|
|
const long filterXML = 0x010; // *.xml
|
|
|
|
const long filterXUL = 0x020; // *.xul
|
|
|
|
const long filterApps = 0x040; // Applications (per-platform implementation)
|
|
|
|
const long filterAllowURLs = 0x080; // Allow URLs
|
|
|
|
const long filterAudio = 0x100; // *.aac; *.aif; *.flac; *.iff;
|
|
|
|
// *.m4a; *.m4b; *.mid; *.midi;
|
|
|
|
// *.mp3; *.mpa; *.mpc; *.oga;
|
|
|
|
// *.ogg; *.ra; *.ram; *.snd;
|
|
|
|
// *.wav; *.wma
|
|
|
|
const long filterVideo = 0x200; // *.avi; *.divx; *.flv; *.m4v;
|
|
|
|
// *.mkv; *.mov; *.mp4; *.mpeg;
|
|
|
|
// *.mpg; *.ogm; *.ogv; *.ogx;
|
|
|
|
// *.rm; *.rmvb; *.smil; *.webm;
|
|
|
|
// *.wmv; *.xvid
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the file picker widget. The file picker is not valid until this
|
|
|
|
* method is called.
|
|
|
|
*
|
|
|
|
* @param parent nsIDOMWindow parent. This dialog will be dependent
|
|
|
|
* on this parent. parent must be non-null.
|
|
|
|
* @param title The title for the file widget
|
|
|
|
* @param mode load, save, or get folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void init(in nsIDOMWindow parent, in AString title, in short mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Append to the filter list with things from the predefined list
|
|
|
|
*
|
|
|
|
* @param filters mask of filters i.e. (filterAll | filterHTML)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void appendFilters(in long filterMask);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a filter
|
|
|
|
*
|
|
|
|
* @param title name of the filter
|
|
|
|
* @param filter extensions to filter -- semicolon and space separated
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void appendFilter(in AString title,
|
|
|
|
in AString filter);
|
|
|
|
|
|
|
|
/**
|
2010-03-24 02:41:48 -07:00
|
|
|
* The filename that should be suggested to the user as a default. This should
|
|
|
|
* include the extension.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* @throws NS_ERROR_FAILURE on attempts to get
|
|
|
|
*/
|
|
|
|
attribute AString defaultString;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The extension that should be associated with files of the type we
|
|
|
|
* want to work with. On some platforms, this extension will be
|
|
|
|
* automatically appended to filenames the user enters, if needed.
|
|
|
|
*/
|
|
|
|
attribute AString defaultExtension;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The filter which is currently selected in the File Picker dialog
|
|
|
|
*
|
|
|
|
* @return Returns the index (0 based) of the selected filter in the filter list.
|
|
|
|
*/
|
|
|
|
attribute long filterIndex;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the directory that the file open/save dialog initially displays
|
|
|
|
*
|
|
|
|
* @param displayDirectory the name of the directory
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
attribute nsILocalFile displayDirectory;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the nsILocalFile for the file or directory.
|
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
|
|
|
readonly attribute nsILocalFile file;
|
|
|
|
|
|
|
|
/**
|
2009-01-06 21:33:04 -08:00
|
|
|
* Get the nsIURI for the file or directory.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
2008-02-26 08:12:17 -08:00
|
|
|
readonly attribute nsIURI fileURL;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the enumerator for the selected files
|
|
|
|
* only works in the modeOpenMultiple mode
|
|
|
|
*
|
|
|
|
* @return Returns the files currently selected
|
|
|
|
*/
|
|
|
|
readonly attribute nsISimpleEnumerator files;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show File Dialog. The dialog is displayed modally.
|
|
|
|
*
|
|
|
|
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
short show();
|
|
|
|
};
|