#115533, Mozilla should be able to become the default viewer of BMP, ICO and MNG image files.

r=law, sr=alecf
This commit is contained in:
hwaara%chello.se 2002-01-09 10:14:25 +00:00
parent b6ef1e80d1
commit 0bd485ceda
6 changed files with 78 additions and 2 deletions

View File

@ -39,6 +39,9 @@ if ( !( "winHooks" in parent ) ) {
"isHandlingJPEG",
"isHandlingGIF",
"isHandlingPNG",
"isHandlingMNG",
"isHandlingBMP",
"isHandlingICO",
"isHandlingXML",
"isHandlingXUL",
"isHandlingHTTP",

View File

@ -71,6 +71,27 @@
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell>
<checkbox id="isHandlingMNG" label="&mng.label;" accesskey="&mng.accesskey;" allowevents="true"/>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell>
<checkbox id="isHandlingBMP" label="&bmp.label;" accesskey="&bmp.accesskey;" allowevents="true"/>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell>
<checkbox id="isHandlingICO" label="&ico.label;" accesskey="&ico.accesskey;" allowevents="true"/>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell>

View File

@ -13,8 +13,14 @@
<!ENTITY gif.accesskey "G">
<!ENTITY png.label "PNG images">
<!ENTITY png.accesskey "P">
<!ENTITY mng.label "MNG images">
<!ENTITY mng.accesskey "M">
<!ENTITY bmp.label "BMP images">
<!ENTITY bmp.accesskey "B">
<!ENTITY ico.label "ICO images">
<!ENTITY ico.accesskey "I">
<!ENTITY xml.label "XML documents">
<!ENTITY xml.accesskey "x">
<!ENTITY xml.accesskey "X">
<!ENTITY xul.label "XUL documents">
<!ENTITY xul.accesskey "U">

View File

@ -56,7 +56,7 @@
* extensions are assigned a "file type" via a Windows registry entry.
* For example, given the file extension ".foo", the file type is
* determined by examing the value stored in the "default" value stored
* at the registry key HEKY_LOCAL_MACHINE\Software\Classes\.foo.
* at the registry key HKEY_LOCAL_MACHINE\Software\Classes\.foo.
*
* Once you have the "file type" then you use that the same way you use
* Internet Shortcut protocol names to determine which application to
@ -131,6 +131,9 @@ interface nsIWindowsHooksSettings : nsISupports {
attribute boolean isHandlingJPEG;
attribute boolean isHandlingGIF;
attribute boolean isHandlingPNG;
attribute boolean isHandlingMNG;
attribute boolean isHandlingBMP;
attribute boolean isHandlingICO;
attribute boolean isHandlingXML;
attribute boolean isHandlingXUL;

View File

@ -22,6 +22,7 @@
* Contributor(s):
* Bill Law <law@netscape.com>
* Syd Logan <syd@netscape.com> added turbo mode stuff
* Håkan Waara <hwaara@chello.se>
*
* 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
@ -71,6 +72,9 @@ static ProtocolRegistryEntry
const char *jpgExts[] = { ".jpg", ".jpeg", 0 };
const char *gifExts[] = { ".gif", 0 };
const char *pngExts[] = { ".png", 0 };
const char *mngExts[] = { ".mng", 0 };
const char *bmpExts[] = { ".bmp", 0 };
const char *icoExts[] = { ".ico", 0 };
const char *xmlExts[] = { ".xml", 0 };
const char *xulExts[] = { ".xul", 0 };
const char *htmExts[] = { ".htm", ".html", 0 };
@ -79,6 +83,9 @@ static FileTypeRegistryEntry
jpg( jpgExts, "MozillaJPEG", "Mozilla Joint Photographic Experts Group Image File" ),
gif( gifExts, "MozillaGIF", "Mozilla Graphics Interchange Format Image File" ),
png( pngExts, "MozillaPNG", "Mozilla Portable Network Graphic Image File" ),
mng( mngExts, "MozillaMNG", "Mozilla Multiple-Image Network Graphic Image File" ),
bmp( bmpExts, "MozillaBMP", "Mozilla Bitmap Image File" ),
ico( icoExts, "MozillaICO", "Mozilla Icon File" ),
xml( xmlExts, "MozillaXML", "Mozilla XML File Document" ),
xul( xulExts, "MozillaXUL", "Mozilla XUL File Document" );
@ -129,6 +136,9 @@ DEFINE_GETTER_AND_SETTER( IsHandlingHTML, mHandleHTML )
DEFINE_GETTER_AND_SETTER( IsHandlingJPEG, mHandleJPEG )
DEFINE_GETTER_AND_SETTER( IsHandlingGIF, mHandleGIF )
DEFINE_GETTER_AND_SETTER( IsHandlingPNG, mHandlePNG )
DEFINE_GETTER_AND_SETTER( IsHandlingMNG, mHandleMNG )
DEFINE_GETTER_AND_SETTER( IsHandlingBMP, mHandleBMP )
DEFINE_GETTER_AND_SETTER( IsHandlingICO, mHandleICO )
DEFINE_GETTER_AND_SETTER( IsHandlingXML, mHandleXML )
DEFINE_GETTER_AND_SETTER( IsHandlingXUL, mHandleXUL )
DEFINE_GETTER_AND_SETTER( IsHandlingHTTP, mHandleHTTP )
@ -176,6 +186,9 @@ nsWindowsHooks::GetSettings( nsWindowsHooksSettings **result ) {
prefs->mHandleJPEG = (void*)( BoolRegistryEntry( "isHandlingJPEG" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleGIF = (void*)( BoolRegistryEntry( "isHandlingGIF" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandlePNG = (void*)( BoolRegistryEntry( "isHandlingPNG" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleMNG = (void*)( BoolRegistryEntry( "isHandlingMNG" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleBMP = (void*)( BoolRegistryEntry( "isHandlingBMP" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleICO = (void*)( BoolRegistryEntry( "isHandlingICO" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleXML = (void*)( BoolRegistryEntry( "isHandlingXML" ) ) ? PR_TRUE : PR_FALSE;
prefs->mHandleXUL = (void*)( BoolRegistryEntry( "isHandlingXUL" ) ) ? PR_TRUE : PR_FALSE;
prefs->mShowDialog = (void*)( BoolRegistryEntry( "showDialog" ) ) ? PR_TRUE : PR_FALSE;
@ -292,6 +305,9 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) {
settings->mHandleJPEG = PR_TRUE;
settings->mHandleGIF = PR_TRUE;
settings->mHandlePNG = PR_TRUE;
settings->mHandleMNG = PR_TRUE;
settings->mHandleBMP = PR_TRUE;
settings->mHandleICO = PR_TRUE;
settings->mHandleXML = PR_TRUE;
settings->mHandleXUL = PR_TRUE;
@ -335,6 +351,12 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) {
||
misMatch( settings->mHandlePNG, png )
||
misMatch( settings->mHandlePNG, mng )
||
misMatch( settings->mHandlePNG, bmp )
||
misMatch( settings->mHandlePNG, ico )
||
misMatch( settings->mHandleXML, xml )
||
misMatch( settings->mHandleXUL, xul ) ) {
@ -490,6 +512,9 @@ nsWindowsHooks::SetSettings(nsIWindowsHooksSettings *prefs) {
putPRBoolIntoRegistry( "isHandlingJPEG", prefs, &nsIWindowsHooksSettings::GetIsHandlingJPEG );
putPRBoolIntoRegistry( "isHandlingGIF", prefs, &nsIWindowsHooksSettings::GetIsHandlingGIF );
putPRBoolIntoRegistry( "isHandlingPNG", prefs, &nsIWindowsHooksSettings::GetIsHandlingPNG );
putPRBoolIntoRegistry( "isHandlingMNG", prefs, &nsIWindowsHooksSettings::GetIsHandlingMNG );
putPRBoolIntoRegistry( "isHandlingBMP", prefs, &nsIWindowsHooksSettings::GetIsHandlingBMP );
putPRBoolIntoRegistry( "isHandlingICO", prefs, &nsIWindowsHooksSettings::GetIsHandlingICO );
putPRBoolIntoRegistry( "isHandlingXML", prefs, &nsIWindowsHooksSettings::GetIsHandlingXML );
putPRBoolIntoRegistry( "isHandlingXUL", prefs, &nsIWindowsHooksSettings::GetIsHandlingXUL );
putPRBoolIntoRegistry( "showDialog", prefs, &nsIWindowsHooksSettings::GetShowDialog );
@ -533,6 +558,21 @@ nsWindowsHooks::SetRegistry() {
} else {
(void) png.reset();
}
if ( prefs->mHandleMNG ) {
(void) mng.set();
} else {
(void) mng.reset();
}
if ( prefs->mHandleBMP ) {
(void) bmp.set();
} else {
(void) bmp.reset();
}
if ( prefs->mHandleICO ) {
(void) ico.set();
} else {
(void) ico.reset();
}
if ( prefs->mHandleXML ) {
(void) xml.set();
} else {

View File

@ -83,6 +83,9 @@ private:
PRBool mHandleJPEG;
PRBool mHandleGIF;
PRBool mHandlePNG;
PRBool mHandleMNG;
PRBool mHandleBMP;
PRBool mHandleICO;
PRBool mHandleXML;
PRBool mHandleXUL;
};