pjs/netwerk/mime/public/nsIMIMEInfo.idl

192 строки
6.1 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* An nsIMIMEInfo gives a user access to mime information.
* there is a one-to-many relationship between MIME types
* and file extensions. This means that a MIMEInfo object
* may have multiple file extensions associated with it.
* However, the reverse is not true.
*/
#include "nsISupports.idl"
interface nsIURI;
interface nsIFile;
typedef long nsMIMEInfoHandleAction;
[scriptable, uuid(6A57EAE0-2FE8-11d3-A164-0050041CAF44)]
interface nsIMIMEInfo : nsISupports {
/**
* Gives you an array of file types associated with this type.
*
* @return Number of elements in the array.
* @return Array of extensions.
*/
void GetFileExtensions(out PRUint32 elementCount,
[array, size_is(elementCount)] out string extensions);
/**
* Set File Extensions. Input is a comma delimited list of extensions.
*/
void SetFileExtensions( in string aExtensions );
/**
* Returns whether or not the given extension is
* associated with this MIME info.
*
* @return TRUE if the association exists.
*/
boolean ExtensionExists(in string aExtension);
/**
* Append a given extension to the set of extensions
*/
void AppendExtension(in string aExtension);
/**
* Returns a clone of this MIMEInfo.
*
* @return A clone of the MIMEInfo
*/
nsIMIMEInfo clone();
/**
* Returns the first extension association in
* the internal set of extensions.
*
* @return The first extension.
*/
attribute string primaryExtension;
/**
* The MIME type of this MIMEInfo.
*
* @return String representing the MIME type.
*/
attribute string MIMEType;
/**
* A human readable description of the MIME info.
*
* @return The description
*/
attribute wstring Description;
/**
* Gives you arbitrary data about the MIMEInfo. An example
* of this is a generic image graphically representing
* this MIME info. This image can be used to generically
* and graphically represent the type.
*
* @return A URI representing the data location.
*/
readonly attribute nsIURI DataURI;
/**
* Mac Type and creator types
*/
attribute PRUint32 MacType;
attribute PRUint32 MacCreator;
/**
* Returns whether or not these two MIME infos are logically
* equivalent maintaining the one-to-many relationship between
* MIME types and file extensions.
*
* @returns TRUE if the two are considered equal
*/
boolean Equals(in nsIMIMEInfo aMIMEInfo);
/**
* Returns a nsIFile that points to the application the user has said
* they want associated with this content type. This is not always
* guaranteed to be set!!
*/
attribute nsIFile preferredApplicationHandler;
/**
* a pretty name description of the associated application
*/
attribute wstring applicationDescription;
/**
* Returns a nsIFile that points to the application that is associated
* by default with this content type. This will usually be specified in
* the platform settings somehow. This is not always guaranteed
* to be set!!
*/
attribute nsIFile defaultApplicationHandler;
/**
* a pretty name description of the default application
*/
attribute wstring defaultDescription;
const long saveToDisk = 0;
const long alwaysAsk = 1;
const long useHelperApp = 2;
const long handleInternally = 3;
const long useSystemDefault = 4;
/**
* preferredAction is how the user specified they would like to handle
* this content type: save to disk, use specified helper app, use OS
* default handler or handle using navigator.
*/
attribute nsMIMEInfoHandleAction preferredAction;
/**
* alwaysAskBeforeHandling: if true, we should always give the user a
* dialog asking how to dispose of this content.
*/
attribute boolean alwaysAskBeforeHandling;
};
%{C++
#define NS_MIMEINFO_CID \
{ /* {95df6583-0001-11d4-a12b-a66ef662f0bc} */ \
0x95df6583, \
0x0001, \
0x11d4, \
{ 0xa1, 0x2b, 0xa6, 0x6e, 0xf6, 0x62, 0xf0, 0xbc } \
}
#define NS_MIMEINFO_CONTRACTID "@mozilla.org/mime-info;1"
%}