1999-11-15 11:13:40 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-11-15 11:13:40 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2012-06-06 06:08:30 +04:00
|
|
|
interface nsIFile;
|
2008-02-26 19:12:17 +03:00
|
|
|
interface nsIURI;
|
2016-01-30 20:05:36 +03:00
|
|
|
interface mozIDOMWindowProxy;
|
2002-09-07 09:23:45 +04:00
|
|
|
interface nsISimpleEnumerator;
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2012-09-20 03:21:38 +04:00
|
|
|
[scriptable, function, uuid(0d79adad-b244-49A5-9997-2a8cad93fc44)]
|
2012-08-17 19:35:00 +04:00
|
|
|
interface nsIFilePickerShownCallback : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Callback which is called when a filepicker is shown and a result
|
|
|
|
* is returned.
|
|
|
|
*
|
|
|
|
* @param aResult One of returnOK, returnCancel, or returnReplace
|
|
|
|
*/
|
|
|
|
void done(in short aResult);
|
|
|
|
};
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
[scriptable, uuid(9285b984-02d3-46b4-9514-7da8c471a747)]
|
1999-11-15 12:32:51 +03:00
|
|
|
interface nsIFilePicker : nsISupports
|
1999-11-15 11:13:40 +03:00
|
|
|
{
|
2000-03-29 05:42:45 +04:00
|
|
|
const short modeOpen = 0; // Load a file or directory
|
1999-11-15 13:19:00 +03:00
|
|
|
const short modeSave = 1; // Save a file or directory
|
2001-12-09 04:36:47 +03:00
|
|
|
const short modeGetFolder = 2; // Select a folder/directory
|
2002-09-07 09:23:45 +04:00
|
|
|
const short modeOpenMultiple= 3; // Load multiple files
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2001-12-09 04:36:47 +03:00
|
|
|
const short returnOK = 0; // User hit Ok, process selection
|
|
|
|
const short returnCancel = 1; // User hit cancel, ignore selection
|
1999-11-15 11:13:40 +03:00
|
|
|
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
|
|
|
|
2010-07-17 11:00:28 +04: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 06:28:01 +04:00
|
|
|
// *.png; *.bmp; *.ico; *.svg;
|
|
|
|
// *.svgz; *.tif; *.tiff; *.ai;
|
|
|
|
// *.drw; *.pct; *.psp; *.xcf;
|
|
|
|
// *.psd; *.raw
|
2010-07-17 11:00:28 +04: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 10:41:09 +03:00
|
|
|
|
2019-07-30 21:13:05 +03:00
|
|
|
const short captureNone = 0; // No capture target specified.
|
|
|
|
const short captureDefault = 1; // Missing/invalid value default.
|
|
|
|
const short captureUser = 2; // "user" capture target specified.
|
|
|
|
const short captureEnv = 3; // "environment" capture target specified.
|
|
|
|
|
1999-11-15 11:13:40 +03:00
|
|
|
/**
|
2004-07-21 19:44:00 +04:00
|
|
|
* Initialize the file picker widget. The file picker is not valid until this
|
|
|
|
* method is called.
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
2016-01-30 20:05:36 +03:00
|
|
|
* @param parent mozIDOMWindow parent. This dialog will be dependent
|
2004-04-22 03:38:22 +04:00
|
|
|
* on this parent. parent must be non-null.
|
1999-11-15 11:13:40 +03:00
|
|
|
* @param title The title for the file widget
|
|
|
|
* @param mode load, save, or get folder
|
|
|
|
*
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
void init(in mozIDOMWindowProxy parent, in AString title, in short mode);
|
1999-11-15 11:13:40 +03:00
|
|
|
|
|
|
|
/**
|
2000-05-25 04:44:10 +04:00
|
|
|
* Append to the filter list with things from the predefined list
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
2000-03-23 10:41:09 +03:00
|
|
|
* @param filters mask of filters i.e. (filterAll | filterHTML)
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
|
|
|
*/
|
2000-05-25 04:44:10 +04:00
|
|
|
void appendFilters(in long filterMask);
|
1999-11-15 11:13:40 +03:00
|
|
|
|
|
|
|
/**
|
2000-03-23 10:41:09 +03:00
|
|
|
* Add a filter
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
2000-03-23 10:41:09 +03:00
|
|
|
* @param title name of the filter
|
2001-12-09 04:36:47 +03:00
|
|
|
* @param filter extensions to filter -- semicolon and space separated
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
|
|
|
*/
|
2004-04-22 03:38:22 +04:00
|
|
|
void appendFilter(in AString title,
|
|
|
|
in AString filter);
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2019-01-24 19:21:05 +03:00
|
|
|
/**
|
|
|
|
* Add a raw filter (eg, add a MIME type without transforming it to a list of
|
|
|
|
* extensions).
|
|
|
|
*
|
|
|
|
* @param filter a filter taken directly from the accept attribute
|
|
|
|
* without processing
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void appendRawFilter(in AString filter);
|
|
|
|
|
2002-02-20 10:50:52 +03:00
|
|
|
/**
|
2010-03-24 12:41:48 +03:00
|
|
|
* The filename that should be suggested to the user as a default. This should
|
|
|
|
* include the extension.
|
2002-02-20 10:50:52 +03:00
|
|
|
*
|
|
|
|
* @throws NS_ERROR_FAILURE on attempts to get
|
|
|
|
*/
|
2004-04-22 03:38:22 +04:00
|
|
|
attribute AString defaultString;
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2002-02-20 10:50:52 +03:00
|
|
|
/**
|
|
|
|
* The extension that should be associated with files of the type we
|
|
|
|
* want to work with. On some platforms, this extension will be
|
2019-05-23 01:37:14 +03:00
|
|
|
* automatically appended to filenames the user enters, if needed.
|
2002-02-20 10:50:52 +03:00
|
|
|
*/
|
2004-04-22 03:38:22 +04:00
|
|
|
attribute AString defaultExtension;
|
2019-05-23 01:37:14 +03:00
|
|
|
|
2001-12-12 07:17:26 +03:00
|
|
|
/**
|
|
|
|
* The filter which is currently selected in the File Picker dialog
|
|
|
|
*
|
2019-05-23 01:37:14 +03:00
|
|
|
* @return Returns the index (0 based) of the selected filter in the filter list.
|
2001-12-12 07:17:26 +03:00
|
|
|
*/
|
|
|
|
attribute long filterIndex;
|
|
|
|
|
1999-11-15 11:13:40 +03:00
|
|
|
/**
|
|
|
|
* Set the directory that the file open/save dialog initially displays
|
2017-04-26 19:20:19 +03:00
|
|
|
* Note that, if displaySpecialDirectory has been already set, this value will
|
|
|
|
* be ignored.
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
|
|
|
* @param displayDirectory the name of the directory
|
|
|
|
*
|
|
|
|
*/
|
2012-06-06 06:08:30 +04:00
|
|
|
attribute nsIFile displayDirectory;
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2017-04-26 19:20:19 +03:00
|
|
|
/**
|
|
|
|
* Set the directory that the file open/save dialog initially displays using
|
|
|
|
* one of the special name as such as 'Desk', 'TmpD', and so on.
|
|
|
|
* Note that, if displayDirectory has been already set, this value will be
|
|
|
|
* ignored.
|
|
|
|
*
|
|
|
|
* @param displaySpecialDirectory the name of the special directory
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
attribute AString displaySpecialDirectory;
|
|
|
|
|
1999-11-15 11:13:40 +03:00
|
|
|
|
|
|
|
/**
|
2012-06-06 06:08:30 +04:00
|
|
|
* Get the nsIFile for the file or directory.
|
1999-11-15 11:13:40 +03:00
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
2012-06-06 06:08:30 +04:00
|
|
|
readonly attribute nsIFile file;
|
1999-11-15 11:13:40 +03:00
|
|
|
|
2000-04-05 03:50:41 +04:00
|
|
|
/**
|
2009-01-07 08:33:04 +03:00
|
|
|
* Get the nsIURI for the file or directory.
|
2000-04-05 03:50:41 +04:00
|
|
|
*
|
|
|
|
* @return Returns the file currently selected
|
|
|
|
*/
|
2008-02-26 19:12:17 +03:00
|
|
|
readonly attribute nsIURI fileURL;
|
2000-04-05 03:50:41 +04:00
|
|
|
|
2002-09-07 09:23:45 +04:00
|
|
|
/**
|
|
|
|
* Get the enumerator for the selected files
|
|
|
|
* only works in the modeOpenMultiple mode
|
|
|
|
*
|
|
|
|
* @return Returns the files currently selected
|
|
|
|
*/
|
|
|
|
readonly attribute nsISimpleEnumerator files;
|
|
|
|
|
2013-03-19 21:49:16 +04:00
|
|
|
/**
|
2016-01-12 22:18:15 +03:00
|
|
|
* Get the DOM File or the DOM Directory
|
2013-03-19 21:49:16 +04:00
|
|
|
*
|
2016-01-12 22:18:15 +03:00
|
|
|
* @return Returns the file or directory currently selected DOM object.
|
2013-03-19 21:49:16 +04:00
|
|
|
*/
|
2016-01-12 22:18:15 +03:00
|
|
|
readonly attribute nsISupports domFileOrDirectory;
|
2013-03-19 21:49:16 +04:00
|
|
|
|
|
|
|
/**
|
2016-01-12 22:18:15 +03:00
|
|
|
* Get the enumerator for the selected files or directories
|
2013-03-19 21:49:16 +04:00
|
|
|
* only works in the modeOpenMultiple mode
|
|
|
|
*
|
2016-01-12 22:18:15 +03:00
|
|
|
* @return Returns the files/directories currently selected as DOM object.
|
2013-03-19 21:49:16 +04:00
|
|
|
*/
|
2016-01-12 22:18:15 +03:00
|
|
|
readonly attribute nsISimpleEnumerator domFileOrDirectoryEnumerator;
|
2013-03-19 21:49:16 +04:00
|
|
|
|
2011-05-24 16:28:19 +04: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;
|
|
|
|
|
2012-08-17 19:35:00 +04:00
|
|
|
/**
|
|
|
|
* Opens the file dialog asynchrounously.
|
|
|
|
* The passed in object's done method will be called upon completion.
|
|
|
|
*/
|
|
|
|
void open(in nsIFilePickerShownCallback aFilePickerShownCallback);
|
|
|
|
|
2013-07-22 16:46:27 +04:00
|
|
|
/**
|
|
|
|
* The picker's mode, as set by the 'mode' argument passed to init()
|
|
|
|
* (one of the modeOpen et. al. constants specified above).
|
|
|
|
*/
|
|
|
|
readonly attribute short mode;
|
2016-08-24 02:07:21 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set to non-empty string, the nsIFilePicker implementation
|
|
|
|
* may use okButtonLabel as the label for the button the user uses to accept
|
|
|
|
* file selection.
|
|
|
|
*/
|
|
|
|
attribute AString okButtonLabel;
|
2019-07-30 21:13:05 +03:00
|
|
|
|
|
|
|
attribute short capture;
|
1999-11-15 11:13:40 +03:00
|
|
|
};
|