1999-11-15 08:13:40 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2004-04-18 22:01:16 +00:00
|
|
|
* ***** 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.
|
|
|
|
*
|
1999-11-15 10:19:00 +00:00
|
|
|
* The Original Code is the Mozilla browser.
|
2004-04-18 22:01:16 +00:00
|
|
|
*
|
|
|
|
* 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):
|
1999-11-15 10:19:00 +00:00
|
|
|
* Stuart Parmenter <pavlov@netscape.com>
|
2004-04-18 22:01:16 +00:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
1999-11-15 08:13:40 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2001-07-16 02:40:48 +00:00
|
|
|
interface nsILocalFile;
|
2008-02-26 16:12:17 +00:00
|
|
|
interface nsIURI;
|
2004-04-21 23:38:22 +00:00
|
|
|
interface nsIDOMWindow;
|
2002-09-07 05:23:45 +00:00
|
|
|
interface nsISimpleEnumerator;
|
1999-11-15 08:13:40 +00:00
|
|
|
|
2011-05-24 12:28:19 +00:00
|
|
|
[scriptable, uuid(f2c0e216-5d07-4df4-bbcb-37683077ae7e)]
|
1999-11-15 09:32:51 +00:00
|
|
|
interface nsIFilePicker : nsISupports
|
1999-11-15 08:13:40 +00:00
|
|
|
{
|
2000-03-29 01:42:45 +00:00
|
|
|
const short modeOpen = 0; // Load a file or directory
|
1999-11-15 10:19:00 +00:00
|
|
|
const short modeSave = 1; // Save a file or directory
|
2001-12-09 01:36:47 +00:00
|
|
|
const short modeGetFolder = 2; // Select a folder/directory
|
2002-09-07 05:23:45 +00:00
|
|
|
const short modeOpenMultiple= 3; // Load multiple files
|
1999-11-15 08:13:40 +00:00
|
|
|
|
2001-12-09 01:36:47 +00:00
|
|
|
const short returnOK = 0; // User hit Ok, process selection
|
|
|
|
const short returnCancel = 1; // User hit cancel, ignore selection
|
1999-11-15 08:13:40 +00:00
|
|
|
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
|
|
|
|
2010-07-17 07:00:28 +00: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-20 02:28:01 +00:00
|
|
|
// *.png; *.bmp; *.ico; *.svg;
|
|
|
|
// *.svgz; *.tif; *.tiff; *.ai;
|
|
|
|
// *.drw; *.pct; *.psp; *.xcf;
|
|
|
|
// *.psd; *.raw
|
2010-07-17 07:00:28 +00: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
|
2000-03-23 07:41:09 +00:00
|
|
|
|
1999-11-15 08:13:40 +00:00
|
|
|
/**
|
2004-07-21 15:44:00 +00:00
|
|
|
* Initialize the file picker widget. The file picker is not valid until this
|
|
|
|
* method is called.
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
2004-04-21 23:38:22 +00:00
|
|
|
* @param parent nsIDOMWindow parent. This dialog will be dependent
|
|
|
|
* on this parent. parent must be non-null.
|
1999-11-15 08:13:40 +00:00
|
|
|
* @param title The title for the file widget
|
|
|
|
* @param mode load, save, or get folder
|
|
|
|
*
|
|
|
|
*/
|
2004-04-21 23:38:22 +00:00
|
|
|
void init(in nsIDOMWindow parent, in AString title, in short mode);
|
1999-11-15 08:13:40 +00:00
|
|
|
|
|
|
|
/**
|
2000-05-25 00:44:10 +00:00
|
|
|
* Append to the filter list with things from the predefined list
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
2000-03-23 07:41:09 +00:00
|
|
|
* @param filters mask of filters i.e. (filterAll | filterHTML)
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
|
|
|
*/
|
2000-05-25 00:44:10 +00:00
|
|
|
void appendFilters(in long filterMask);
|
1999-11-15 08:13:40 +00:00
|
|
|
|
|
|
|
/**
|
2000-03-23 07:41:09 +00:00
|
|
|
* Add a filter
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
2000-03-23 07:41:09 +00:00
|
|
|
* @param title name of the filter
|
2001-12-09 01:36:47 +00:00
|
|
|
* @param filter extensions to filter -- semicolon and space separated
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
|
|
|
*/
|
2004-04-21 23:38:22 +00:00
|
|
|
void appendFilter(in AString title,
|
|
|
|
in AString filter);
|
1999-11-15 08:13:40 +00:00
|
|
|
|
2002-02-20 07:50:52 +00:00
|
|
|
/**
|
2010-03-24 09:41:48 +00:00
|
|
|
* The filename that should be suggested to the user as a default. This should
|
|
|
|
* include the extension.
|
2002-02-20 07:50:52 +00:00
|
|
|
*
|
|
|
|
* @throws NS_ERROR_FAILURE on attempts to get
|
|
|
|
*/
|
2004-04-21 23:38:22 +00:00
|
|
|
attribute AString defaultString;
|
1999-11-15 08:13:40 +00:00
|
|
|
|
2002-02-20 07:50:52 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-04-21 23:38:22 +00:00
|
|
|
attribute AString defaultExtension;
|
2002-02-20 07:50:52 +00:00
|
|
|
|
2001-12-12 04:17:26 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
1999-11-15 08:13:40 +00:00
|
|
|
/**
|
|
|
|
* Set the directory that the file open/save dialog initially displays
|
|
|
|
*
|
|
|
|
* @param displayDirectory the name of the directory
|
|
|
|
*
|
|
|
|
*/
|
2000-03-22 09:17:01 +00:00
|
|
|
attribute nsILocalFile displayDirectory;
|
1999-11-15 08:13:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2000-04-04 23:50:41 +00:00
|
|
|
* Get the nsILocalFile for the file or directory.
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
2000-03-22 09:17:01 +00:00
|
|
|
readonly attribute nsILocalFile file;
|
1999-11-15 08:13:40 +00:00
|
|
|
|
2000-04-04 23:50:41 +00:00
|
|
|
/**
|
2009-01-07 05:33:04 +00:00
|
|
|
* Get the nsIURI for the file or directory.
|
2000-04-04 23:50:41 +00:00
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
2008-02-26 16:12:17 +00:00
|
|
|
readonly attribute nsIURI fileURL;
|
2000-04-04 23:50:41 +00:00
|
|
|
|
2002-09-07 05:23:45 +00:00
|
|
|
/**
|
|
|
|
* Get the enumerator for the selected files
|
|
|
|
* only works in the modeOpenMultiple mode
|
|
|
|
*
|
|
|
|
* @return Returns the files currently selected
|
|
|
|
*/
|
|
|
|
readonly attribute nsISimpleEnumerator files;
|
|
|
|
|
2011-05-24 12:28:19 +00:00
|
|
|
/**
|
|
|
|
* Controls whether the chosen file(s) should be added to the system's recent
|
|
|
|
* documents list. This attribute will be ignored if the system has no "Recent
|
|
|
|
* Docs" concept, or if the application is in private browsing mode (in which
|
|
|
|
* case the file will not be added). Defaults to true.
|
|
|
|
*/
|
|
|
|
attribute boolean addToRecentDocs;
|
|
|
|
|
1999-11-15 08:13:40 +00:00
|
|
|
/**
|
|
|
|
* Show File Dialog. The dialog is displayed modally.
|
|
|
|
*
|
1999-11-15 10:19:00 +00:00
|
|
|
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
1999-11-15 08:13:40 +00:00
|
|
|
*
|
|
|
|
*/
|
1999-11-15 10:19:00 +00:00
|
|
|
short show();
|
1999-11-15 08:13:40 +00:00
|
|
|
};
|