pjs/netwerk/mime/public/nsIMIMEInfo.idl

145 строки
4.5 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Judson Valeski
*/
/* 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"
#include "nsIURI.idl"
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 deliminated 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 assocaition exists.
*/
boolean ExtensionExists(in string aExtension);
/* Returns the first extension association in
* the internal set of extensions.
*
* @return The first extension.
*/
string FirstExtension();
/*
* Append a given extension to the set of extensions
*/
void AppendExtension(in string aExtension);
/* 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
* equivelent 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 guarunteed
* to be set!!
*/
attribute nsIFile preferredApplicationHandler;
/* a pretty name description of the associated application */
attribute wstring applicationDescription;
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"
%}