bug 377784: new Applications prefpane, which replaces the Download Actions dialog and the Feeds prefpane and provides a better UI for configuring handlers for MIME types and protocol schemes; r=gavin, ui-r=mconnor

This commit is contained in:
myk@mozilla.org 2007-09-05 21:55:45 -07:00
parent 09d6854091
commit ec3ff32ae8
29 changed files with 1870 additions and 2192 deletions

View File

@ -36,11 +36,12 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIMIMEInfo.idl"
interface nsIRequest;
[scriptable, uuid(2bd97d63-e928-4d52-9fd4-34061349a9a6)]
interface nsIWebContentHandlerInfo : nsISupports
[scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)]
interface nsIWebContentHandlerInfo : nsIHandlerApp
{
/**
* The content type handled by the handler
@ -53,11 +54,6 @@ interface nsIWebContentHandlerInfo : nsISupports
*/
readonly attribute AString uri;
/**
* A human readable title of the handler.
*/
readonly attribute AString name;
/**
* Gets the service URL Spec, with the loading document URI encoded in it.
* @param uri
@ -66,15 +62,6 @@ interface nsIWebContentHandlerInfo : nsISupports
* it.
*/
AString getHandlerURI(in AString uri);
/**
* Determines if this handler object is equivalent to another.
* @param other
* The other handler info object
* @returns true if the two objects are equivalent (same content type,
* same uri).
*/
boolean equals(in nsIWebContentHandlerInfo other);
};
[scriptable, uuid(632b16a8-5c6b-4dc5-a8db-01771af7a79d)]

View File

@ -110,6 +110,28 @@ function ServiceInfo(contentType, uri, name) {
this._name = name;
}
ServiceInfo.prototype = {
/**
* See nsIHandlerApp
*/
get name() {
return this._name;
},
/**
* See nsIHandlerApp
*/
equals: function SI_equals(aHandlerApp) {
if (!aHandlerApp)
throw Cr.NS_ERROR_NULL_POINTER;
if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo &&
aHandlerApp.contentType == this.contentType &&
aHandlerApp.uri == this.uri)
return true;
return false;
},
/**
* See nsIWebContentHandlerInfo
*/
@ -124,13 +146,6 @@ ServiceInfo.prototype = {
return this._uri;
},
/**
* See nsIWebContentHandlerInfo
*/
get name() {
return this._name;
},
/**
* See nsIWebContentHandlerInfo
*/
@ -138,14 +153,6 @@ ServiceInfo.prototype = {
return this._uri.replace(/%s/gi, encodeURIComponent(uri));
},
/**
* See nsIWebContentHandlerInfo
*/
equals: function SI_equals(other) {
return this.contentType == other.contentType &&
this.uri == other.uri;
},
QueryInterface: function SI_QueryInterface(iid) {
if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
iid.equals(Ci.nsISupports))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,116 @@
<?xml version="1.0"?>
<!--
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# ***** 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.
#
# The Original Code is the Firefox Preferences System.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>.
# Asaf Romano <mozilla.mano@sent.com>
# Myk Melez <myk@mozilla.org>
#
# 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 *****
-->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
%brandDTD;
%applicationsDTD;
]>
<overlay id="ApplicationsPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneApplications" onpaneload="gApplicationsPane.init();"
helpTopic="prefs-applications" helpURI="chrome://browser/locale/help/help.rdf">
<preferences id="feedsPreferences">
<preference id="browser.feeds.handler"
name="browser.feeds.handler"
type="string"/>
<preference id="browser.feeds.handler.default"
name="browser.feeds.handler.default"
type="string"/>
<preference id="browser.feeds.handlers.application"
name="browser.feeds.handlers.application"
type="file"/>
<preference id="browser.feeds.handlers.webservice"
name="browser.feeds.handlers.webservice"
type="string"/>
</preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/applications.js"/>
<keyset>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
</keyset>
<label>&prefpane.label;</label>
<vbox flex="1" class="contentPane">
<hbox align="center">
<label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
<textbox id="filter" flex="1" oninput="gApplicationsPane.onFilterInput();"
onkeypress="gApplicationsPane.onFilterKeyPress(event);"/>
<button id="clearFilter" icon="clear" label="&clear.label;" accesskey="&clear.accesskey;"
oncommand="gApplicationsPane.clearFilter();" disabled="true"/>
</hbox>
<separator class="thin"/>
<label id="filterActiveLabel" hidden="true">
&filterActive.label;
</label>
<separator class="thin"/>
<richlistbox id="handlersView" orient="vertical" style="height: 300px"
onselect="gApplicationsPane.onSelectionChanged();"
persist="lastSelectedType">
<listheader equalsize="always" style="border: 0; padding: 0;">
<treecol id="typeColumn" label="&typeColumn.label;" value="type"
accesskey="&typeColumn.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"
sortDirection="ascending"/>
<treecol id="actionColumn" label="&actionColumn.label;" value="action"
accesskey="&actionColumn.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"/>
</listheader>
</richlistbox>
</vbox>
</prefpane>
</overlay>

View File

@ -1,255 +0,0 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Download Actions Manager.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
#
# 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 *****
var gChangeActionDialog = {
_item : null,
_bundle : null,
_lastSelectedMode : null,
_lastSelectedSave : null,
init: function ()
{
this._item = window.arguments[0];
this._bundle = document.getElementById("bundlePreferences");
dump("*** ir = " + this._item.toSource() + "\n");
var typeField = document.getElementById("typeField");
typeField.value = this._item.typeName;
var extensionField = document.getElementById("extensionField");
var ext = "." + this._item.extension.toLowerCase();
var contentType = this._item.type;
extensionField.value = this._bundle.getFormattedString("extensionStringFormat", [ext, contentType]);
var typeIcon = document.getElementById("typeIcon");
typeIcon.src = this._item.bigIcon;
// Custom App Handler Path - this must be set before we set the selected
// radio button because the selection event handler for the radio group
// requires the extapp handler field to be non-empty for the extapp radio
// button to be selected.
var customApp = document.getElementById("customApp");
if (this._item.customHandler)
customApp.file = this._item.customHandler;
else
customApp.file = null;
var defaultApp = document.getElementById("defaultApp");
var defaultAppIcon = null;
var fallbackIconURL = "moz-icon://goat?contentType=" + this._item.type + "&size=16";
if (this._item.mimeInfo instanceof Components.interfaces.nsIPropertyBag) {
try {
defaultAppIcon = this._item.mimeInfo.getProperty("defaultApplicationIconURL");
}
catch (e) { }
if (defaultAppIcon)
defaultAppIcon += "?size=16";
}
defaultApp.image = defaultAppIcon || fallbackIconURL;
defaultApp.label = this._item.mimeInfo.defaultDescription;
var pluginName = document.getElementById("pluginName");
var foundPlugin = false;
for (var i = 0; i < navigator.plugins.length; ++i) {
var plugin = navigator.plugins[i];
for (var j = 0; j < plugin.length; ++j) {
if (contentType == plugin[j].type) {
pluginName.label = plugin.name;
pluginName.image = "moz-icon://goat.goat?contentType=" + contentType + "&size=16";
foundPlugin = true;
}
}
}
if (!foundPlugin) {
pluginName.label = this._bundle.getString("pluginHelperNoneAvailable");
document.getElementById("plugin").disabled = true;
}
// Selected Action Radiogroup
var handlerGroup = document.getElementById("handlerGroup");
if (this._item.handleMode == FILEACTION_OPEN_PLUGIN && this._item.pluginEnabled)
handlerGroup.selectedItem = document.getElementById("plugin");
else {
if (this._item.handleMode == FILEACTION_OPEN_DEFAULT)
handlerGroup.selectedItem = document.getElementById("openDefault");
else if (this._item.handleMode == FILEACTION_SAVE_TO_DISK)
handlerGroup.selectedItem = document.getElementById("saveToDisk");
else
handlerGroup.selectedItem = document.getElementById("openApplication");
}
this._lastSelectedMode = handlerGroup.selectedItem;
// Figure out the last selected Save As mode
var saveToOptions = document.getElementById("saveToOptions");
this._lastSelectedSave = saveToOptions.selectedItem;
// We don't let users open .exe files or random binary data directly
// from the browser at the moment because of security concerns.
var mimeType = this._item.mimeInfo.MIMEType;
if (mimeType == "application/object-stream" ||
mimeType == "application/x-msdownload") {
document.getElementById("openApplication").disabled = true;
document.getElementById("openDefault").disabled = true;
handlerGroup.selectedItem = document.getElementById("saveToDisk");
}
},
onAccept: function ()
{
var contentType = this._item.mimeInfo.MIMEType;
var handlerGroup = document.getElementById("handlerGroup");
switch (handlerGroup.selectedItem.value) {
case "plugin":
this._item.handleMode = FILEACTION_OPEN_PLUGIN;
var pluginName = document.getElementById("pluginName");
this._item.action = this._bundle.getFormattedString("openWith", [pluginName.label]);
this._item.pluginEnabled = true;
break;
case "system":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_OPEN_DEFAULT;
var defaultDescr = this._item.mimeInfo.defaultDescription;
this._item.action = this._bundle.getFormattedString("openWith", [defaultDescr]);
break;
case "app":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_OPEN_CUSTOM;
var customApp = document.getElementById("customApp");
this._item.action = this._bundle.getFormattedString("openWith", [customApp.label]);
break;
case "save":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_SAVE_TO_DISK;
this._item.action = this._bundle.getString("saveToDisk");
break;
}
// The opener uses the modifications to the FileAction item to update the
// datasource.
return true;
},
doEnabling: function (aSelectedItem)
{
var defaultApp = document.getElementById("defaultApp");
var saveToDefault = document.getElementById("saveToDefault");
var saveToCustom = document.getElementById("saveToCustom");
var customDownloadFolder = document.getElementById("customDownloadFolder");
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
var saveToAskMe = document.getElementById("saveToAskMe");
var pluginName = document.getElementById("pluginName");
var changeApp = document.getElementById("changeApp");
var customApp = document.getElementById("customApp");
switch (aSelectedItem.id) {
case "openDefault":
changeApp.disabled = customApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
defaultApp.disabled = false;
break;
case "openApplication":
defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
changeApp.disabled = customApp.disabled = false;
if (!customApp.file && !this.changeApp()) {
this._lastSelectedMode.click();
return;
}
break;
case "saveToDisk":
changeApp.disabled = customApp.disabled = defaultApp.disabled = pluginName.disabled = true;
var saveToOptions = document.getElementById("saveToOptions");
customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = !(saveToOptions.selectedItem.id == "saveToCustom");
saveToDefault.disabled = saveToCustom.disabled = saveToAskMe.disabled = false;
break;
case "plugin":
changeApp.disabled = customApp.disabled = defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = true;
pluginName.disabled = false;
break;
}
this._lastSelectedMode = aSelectedItem;
},
doSaveToDiskEnabling: function (aSelectedItem)
{
var isSaveToCustom = aSelectedItem.id == "saveToCustom";
var customDownloadFolder = document.getElementById("customDownloadFolder");
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
chooseCustomDownloadFolder.disabled = customDownloadFolder.disabled = !isSaveToCustom;
if (isSaveToCustom &&
!customDownloadFolder.file && !this.changeCustomFolder()) {
this._lastSelectedSave.click();
return;
}
this._lastSelectedSave = aSelectedItem;
},
changeApp: function ()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var winTitle = this._bundle.getString("fpTitleChooseApp");
fp.init(window, winTitle, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
var customApp = document.getElementById("customApp");
customApp.file = fp.file;
this._item.customHandler = fp.file;
return true;
}
return false;
},
changeCustomFolder: function ()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
// extract the window title
var winTitle = this._bundle.getString("fpTitleChooseDL");
fp.init(window, winTitle, nsIFilePicker.modeGetFolder);
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
var customDownloadFolder = document.getElementById("customDownloadFolder");
customDownloadFolder.file = fp.file;
customDownloadFolder.label = fp.file.path;
return true;
}
return false;
}
};

View File

@ -1,114 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Download Actions Manager.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
#
# 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 *****
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://browser/locale/preferences/changeaction.dtd">
<dialog id="ChangeActionDialog" title="&changeAction.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="gChangeActionDialog.init();"
buttons="accept,cancel,help"
ondialogaccept="return gChangeActionDialog.onAccept();"
ondialoghelp="openHelp('prefs-file-types', 'chrome://browser/locale/help/help.rdf');"
xmlns:aaa="http://www.w3.org/2005/07/aaa"
style="width: &window.width;;"
persist="screenX screenY">
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/actionsshared.js"/>
<script type="application/x-javascript" src="chrome://browser/content/preferences/changeaction.js"/>
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<hbox id="changeActionHeader" align="center" class="indent">
<image id="typeIcon"/>
<vbox flex="1">
<label id="typeField" crop="right"/>
<label id="extensionField" crop="right"/>
</vbox>
</hbox>
<vbox id="changeActionContent" flex="1">
<label control="handlerGroup">&whenDownloading.label;</label>
<radiogroup id="handlerGroup" onselect="gChangeActionDialog.doEnabling(this.selectedItem);"
flex="1" aaa:describedby="changeActionHeader">
<separator class="thin"/>
<radio id="openDefault" value="system"
label="&openDefault.label;" accesskey="&openDefault.accesskey;"
aaa:labelledby="openDefault defaultApp"/>
<filefield class="indent" id="defaultApp" disabled="true"/>
<separator class="thin"/>
<radio id="openApplication" value="app"
label="&openApplication.label;" accesskey="&openApplication.accesskey;"
aaa:labelledby="openApplication customApp"/>
<hbox align="center">
<filefield id="customApp" class="indent" flex="1" disabled="true"/>
<button id="changeApp" oncommand="gChangeActionDialog.changeApp();"
label="&changeApp.label;" accesskey="&changeApp.accesskey;"
disabled="true"/>
</hbox>
<separator class="thin"/>
<radio id="saveToDisk" value="save"
label="&saveToDisk.label;" accesskey="&saveToDisk.accesskey;"/>
<radiogroup id="saveToOptions" class="indent" onselect="gChangeActionDialog.doSaveToDiskEnabling(this.selectedItem);"
hidden="true">
<radio id="saveToDefault" value="default" selected="true"
label="&saveToDefaultFolder.label;" accesskey="&saveToDefaultFolder.accesskey;"/>
<radio id="saveToCustom" value="custom"
label="&saveToThisFolder.label;" accesskey="&saveToThisFolder.accesskey;"
aaa:labelledby="saveToCustom customDownloadFolder"/>
<hbox align="center" class="indent">
<filefield id="customDownloadFolder" flex="1"/>
<button id="chooseCustomDownloadFolder" oncommand="gChangeActionDialog.changeCustomFolder();"
label="&chooseFolder.label;" accesskey="&chooseFolder.accesskey;"/>
</hbox>
<radio id="saveToAskMe" value="ask"
label="&saveToAskMe.label;" accesskey="&saveToAskMe.accesskey;"/>
</radiogroup>
<radio id="plugin" value="plugin"
label="&usePlugin.label;" accesskey="&usePlugin.accesskey;"
aaa:labelledby="plugin pluginName"/>
<filefield class="indent" id="pluginName" disabled="true"/>
</radiogroup>
</vbox>
</dialog>

View File

@ -58,7 +58,7 @@ var gContentPane = {
/**
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
*/
updateButtons: function (aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
@ -262,18 +262,6 @@ var gContentPane = {
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/colors.xul",
"", null);
},
// FILE TYPES
/**
* Displays the file type configuration dialog.
*/
configureFileTypes: function ()
{
document.documentElement.openWindow("Preferences:DownloadActions",
"chrome://browser/content/preferences/downloadactions.xul",
"", null);
}
};

View File

@ -73,11 +73,6 @@
name="font.language.group"
type="wstring"
onchange="gContentPane._rebuildFonts();"/>
<!-- FILE TYPES -->
<preference id="pref.downloads.disable_button.edit_actions"
name="pref.downloads.disable_button.edit_actions"
type="bool"/>
</preferences>
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
@ -207,20 +202,6 @@
</grid>
</groupbox>
<!-- File Types -->
<groupbox id="fileTypesGroup">
<caption label="&fileTypes.label;"/>
<hbox id="configureFileTypesRow" align="center">
<description control="manageTypes" flex="1">&configureFileTypes.label;</description>
<button id="manageTypes"
label="&manage.label;"
accesskey="&manage.accesskey;"
oncommand="gContentPane.configureFileTypes();"
preference="pref.downloads.disable_button.edit_actions"/>
</hbox>
</groupbox>
</prefpane>
</overlay>

View File

@ -1,870 +0,0 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Download Actions Manager.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
#
# 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 *****
const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
const kDisabledPluginTypesPref = "plugin.disable_full_page_plugin_for_types";
const kShowPluginsInList = "browser.download.show_plugins_in_list";
const kHideTypesWithoutExtensions = "browser.download.hide_plugins_without_extensions";
const kRootTypePrefix = "urn:mimetype:";
///////////////////////////////////////////////////////////////////////////////
// MIME Types Datasource RDF Utils
function NC_URI(aProperty)
{
return "http://home.netscape.com/NC-rdf#" + aProperty;
}
function MIME_URI(aType)
{
return "urn:mimetype:" + aType;
}
function HANDLER_URI(aHandler)
{
return "urn:mimetype:handler:" + aHandler;
}
function APP_URI(aType)
{
return "urn:mimetype:externalApplication:" + aType;
}
var gDownloadActionsWindow = {
_tree : null,
_editButton : null,
_removeButton : null,
_actions : [],
_plugins : {},
_bundle : null,
_pref : Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch),
_mimeSvc : Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
.getService(Components.interfaces.nsIMIMEService),
_excludingPlugins : false,
_excludingMissingExtensions : false,
init: function ()
{
(this._editButton = document.getElementById("editFileHandler")).disabled = true;
(this._removeButton = document.getElementById("removeFileHandler")).disabled = true;
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
this._pref.addObserver(kShowPluginsInList, this, false);
this._pref.addObserver(kHideTypesWithoutExtensions, this, false);
}
// Initialize the File Type list
this._bundle = document.getElementById("bundlePreferences");
this._tree = document.getElementById("fileHandlersList");
this._loadView();
// Determine any exclusions being applied - e.g. don't show types for which
// only a plugin handler exists, don't show types lacking extensions, etc.
this._view._rowCount = this._updateExclusions();
this._tree.treeBoxObject.view = this._view;
var indexToSelect = parseInt(this._tree.getAttribute("lastSelected"));
if (indexToSelect < this._tree.view.rowCount)
this._tree.view.selection.select(indexToSelect);
this._tree.focus();
},
_loadView: function ()
{
// Reset ALL the collections and state flags, because we can call this after
// the window has initially displayed by resetting the filter.
this._actions = [];
this._plugins = {};
this._view._filtered = false;
this._view._filterSet = [];
this._view._usingExclusionSet = false;
this._view._exclusionSet = [];
this._view._filterValue = "";
this._loadPluginData();
this._loadMIMERegistryData();
},
_updateRowCount: function (aNewRowCount)
{
var oldCount = this._view._rowCount;
this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -oldCount);
this._view._rowCount = aNewRowCount;
this._tree.treeBoxObject.rowCountChanged(0, aNewRowCount);
},
uninit: function ()
{
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
this._pref.removeObserver(kShowPluginsInList, this);
this._pref.removeObserver(kHideTypesWithoutExtensions, this);
}
},
observe: function (aSubject, aTopic, aData)
{
if (aTopic == "nsPref:changed" &&
(aData == kShowPluginsInList || aData == kHideTypesWithoutExtensions))
this._updateRowCount(this._updateExclusions());
},
_updateExclusions: function ()
{
this._excludingPlugins = !this._pref.getBoolPref(kShowPluginsInList);
this._excludingMissingExtensions = this._pref.getBoolPref(kHideTypesWithoutExtensions);
this._view._exclusionSet = [].concat(this._actions);
if (this._excludingMissingExtensions) {
this._view._usingExclusionSet = true;
for (var i = 0; i < this._view._exclusionSet.length;) {
if (!this._view._exclusionSet[i].hasExtension)
this._view._exclusionSet.splice(i, 1);
else
++i;
}
}
if (this._excludingPlugins) {
this._view._usingExclusionSet = true;
for (i = 0; i < this._view._exclusionSet.length;) {
if (this._view._exclusionSet[i].handledOnlyByPlugin)
this._view._exclusionSet.splice(i, 1);
else
++i
}
}
return this._view._usingExclusionSet ? this._view._exclusionSet.length
: this._view._filtered ? this._view._filterSet.length
: this._actions.length;
},
_loadPluginData: function ()
{
// Read enabled plugin type information from the category manager
var disabled = "";
if (this._pref.prefHasUserValue(kDisabledPluginTypesPref))
disabled = this._pref.getCharPref(kDisabledPluginTypesPref);
for (var i = 0; i < navigator.plugins.length; ++i) {
var plugin = navigator.plugins[i];
for (var j = 0; j < plugin.length; ++j) {
var actionName = this._bundle.getFormattedString("openWith", [plugin.name])
var type = plugin[j].type;
this._createAction(type, actionName, true, FILEACTION_OPEN_PLUGIN,
null, true, disabled.indexOf(type) == -1, true);
}
}
},
_createAction: function (aMIMEType, aActionName,
aIsEditable, aHandleMode, aCustomHandler,
aPluginAvailable, aPluginEnabled,
aHandledOnlyByPlugin)
{
var newAction = !(aMIMEType in this._plugins);
var action = newAction ? new FileAction() : this._plugins[aMIMEType];
action.type = aMIMEType;
var info = this._mimeSvc.getFromTypeAndExtension(action.type, null);
// File Extension
try {
action.extension = info.primaryExtension;
}
catch (e) {
action.extension = this._bundle.getString("extensionNone");
action.hasExtension = false;
}
// Large and Small Icon
try {
action.smallIcon = "moz-icon://goat." + info.primaryExtension + "?size=16";
action.bigIcon = "moz-icon://goat." + info.primaryExtension + "?size=32";
}
catch (e) {
action.smallIcon = "moz-icon://goat?size=16&contentType=" + info.MIMEType;
action.bigIcon = "moz-icon://goat?contentType=" + info.MIMEType + "&size=32";
}
// Pretty Type Name
if (info.description == "") {
try {
action.typeName = this._bundle.getFormattedString("fileEnding", [info.primaryExtension.toUpperCase()]);
}
catch (e) {
// Wow, this sucks, just show the MIME type as a last ditch effort to display
// the type of file that this is.
action.typeName = info.MIMEType;
}
}
else
action.typeName = info.description;
// Pretty Action Name
if (aActionName)
action.action = aActionName;
action.pluginAvailable = aPluginAvailable;
action.pluginEnabled = aPluginEnabled;
action.editable = aIsEditable;
action.handleMode = aHandleMode;
action.customHandler = aCustomHandler;
action.mimeInfo = info;
action.handledOnlyByPlugin = aHandledOnlyByPlugin
if (newAction && !(action.handledOnlyByPlugin && !action.pluginEnabled)) {
this._actions.push(action);
this._plugins[action.type] = action;
}
return action;
},
_loadMIMEDS: function ()
{
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = fileLocator.get("UMimTyp", Components.interfaces.nsIFile);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
this._mimeDS = this._rdf.GetDataSourceBlocking(fileHandler.getURLSpecFromFile(file));
},
_getLiteralValue: function (aResource, aProperty)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
var value = this._mimeDS.GetTarget(aResource, property, true);
if (value)
return value.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
return "";
},
_getChildResource: function (aResource, aProperty)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
return this._mimeDS.GetTarget(aResource, property, true);
},
_getDisplayNameForFile: function (aFile)
{
#ifdef XP_WIN
if (aFile instanceof Components.interfaces.nsILocalFileWin) {
try {
return aFile.getVersionInfoField("FileDescription");
}
catch (e) {
// fall through to the filename
}
}
#endif
#ifdef XP_MACOSX
var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac);
try {
return lfm.bundleDisplayName;
}
catch (e) {
// fall through to the file name
}
#endif
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
return url.fileName;
},
_loadMIMERegistryData: function ()
{
this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
this._loadMIMEDS();
var root = this._rdf.GetResource("urn:mimetypes:root");
var container = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
container.Init(this._mimeDS, root);
var elements = container.GetElements();
while (elements.hasMoreElements()) {
var type = elements.getNext();
if (!(type instanceof Components.interfaces.nsIRDFResource))
break;
var editable = this._getLiteralValue(type, "editable") == "true";
if (!editable)
continue;
var handler = this._getChildResource(type, "handlerProp");
var alwaysAsk = this._getLiteralValue(handler, "alwaysAsk") == "true";
if (alwaysAsk)
continue;
var saveToDisk = this._getLiteralValue(handler, "saveToDisk") == "true";
var useSystemDefault = this._getLiteralValue(handler, "useSystemDefault") == "true";
var editable = this._getLiteralValue(type, "editable") == "true";
var handledInternally = this._getLiteralValue(handler, "handleInternal") == "true";
var externalApp = this._getChildResource(handler, "externalApplication");
var externalAppPath = this._getLiteralValue(externalApp, "path");
try {
var customHandler = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
customHandler.initWithPath(externalAppPath);
}
catch (e) {
customHandler = null;
}
if (customHandler && !customHandler.exists())
customHandler = null;
var mimeType = this._getLiteralValue(type, "value");
var typeInfo = this._mimeSvc.getFromTypeAndExtension(mimeType, null);
// Determine the pretty name of the associated action.
var actionName = "";
var handleMode = 0;
if (saveToDisk) {
// Save the file to disk
actionName = this._bundle.getString("saveToDisk");
handleMode = FILEACTION_SAVE_TO_DISK;
}
else if (useSystemDefault) {
// Use the System Default handler
actionName = this._bundle.getFormattedString("openWith",
[typeInfo.defaultDescription]);
handleMode = FILEACTION_OPEN_DEFAULT;
}
else {
// Custom Handler
if (customHandler) {
actionName = this._bundle.getFormattedString("openWith",
[this._getDisplayNameForFile(customHandler)]);
handleMode = FILEACTION_OPEN_CUSTOM;
}
else {
// Corrupt datasource, invalid custom handler path. Revert to default.
actionName = this._bundle.getFormattedString("openWith",
[typeInfo.defaultDescription]);
handleMode = FILEACTION_OPEN_DEFAULT;
}
}
if (handledInternally)
handleMode = FILEACTION_OPEN_INTERNALLY;
var pluginAvailable = mimeType in this._plugins && this._plugins[mimeType].pluginAvailable;
var pluginEnabled = pluginAvailable && this._plugins[mimeType].pluginEnabled;
if (pluginEnabled) {
handleMode = FILEACTION_OPEN_PLUGIN;
actionName = null;
}
var action = this._createAction(mimeType, actionName, editable, handleMode,
customHandler, pluginAvailable, pluginEnabled,
false);
}
},
_view: {
_filtered : false,
_filterSet : [],
_usingExclusionSet : false,
_exclusionSet : [],
_filterValue : "",
_rowCount: 0,
get rowCount()
{
return this._rowCount;
},
get activeCollection ()
{
return this._filtered ? this._filterSet
: this._usingExclusionSet ? this._exclusionSet
: gDownloadActionsWindow._actions;
},
getItemAtIndex: function (aIndex)
{
return this.activeCollection[aIndex];
},
getCellText: function (aIndex, aColumn)
{
switch (aColumn.id) {
case "fileExtension":
return this.getItemAtIndex(aIndex).extension.toUpperCase();
case "fileType":
return this.getItemAtIndex(aIndex).typeName;
case "fileMIMEType":
return this.getItemAtIndex(aIndex).type;
case "fileHandler":
return this.getItemAtIndex(aIndex).action;
}
return "";
},
getImageSrc: function (aIndex, aColumn)
{
if (aColumn.id == "fileExtension")
return this.getItemAtIndex(aIndex).smallIcon;
return "";
},
_selection: null,
get selection () { return this._selection; },
set selection (val) { this._selection = val; return val; },
getRowProperties: function (aIndex, aProperties) {},
getCellProperties: function (aIndex, aColumn, aProperties) {},
getColumnProperties: function (aColumn, aProperties) {},
isContainer: function (aIndex) { return false; },
isContainerOpen: function (aIndex) { return false; },
isContainerEmpty: function (aIndex) { return false; },
isSeparator: function (aIndex) { return false; },
isSorted: function (aIndex) { return false; },
canDrop: function (aIndex, aOrientation) { return false; },
drop: function (aIndex, aOrientation) {},
getParentIndex: function (aIndex) { return -1; },
hasNextSibling: function (aParentIndex, aIndex) { return false; },
getLevel: function (aIndex) { return 0; },
getProgressMode: function (aIndex, aColumn) {},
getCellValue: function (aIndex, aColumn) {},
setTree: function (aTree) {},
toggleOpenState: function (aIndex) { },
cycleHeader: function (aColumn) {},
selectionChanged: function () {},
cycleCell: function (aIndex, aColumn) {},
isEditable: function (aIndex, aColumn) { return false; },
isSelectable: function (aIndex, aColumn) { return false; },
setCellValue: function (aIndex, aColumn, aValue) {},
setCellText: function (aIndex, aColumn, aValue) {},
performAction: function (aAction) {},
performActionOnRow: function (aAction, aIndex) {},
performActionOnCell: function (aAction, aindex, aColumn) {}
},
removeFileHandler: function ()
{
var selection = this._tree.view.selection;
if (selection.count < 1)
return;
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0;
flags += promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1;
var title = this._bundle.getString("removeTitle" + (selection.count > 1 ? "Multiple" : "Single"));
var message = this._bundle.getString("removeMessage" + (selection.count > 1 ? "Multiple" : "Single"));
var button = this._bundle.getString("removeButton" + (selection.count > 1 ? "Multiple" : "Single"));
var rv = promptService.confirmEx(window, title, message, flags, button,
null, null, null, { value: 0 });
if (rv != 0)
return;
var rangeCount = selection.getRangeCount();
var lastSelected = 0;
var mimeDSDirty = false;
for (var i = 0; i < rangeCount; ++i) {
var min = { }; var max = { };
selection.getRangeAt(i, min, max);
for (var j = min.value; j <= max.value; ++j) {
var item = this._view.getItemAtIndex(j);
if (!item.handledOnlyByPlugin) {
// There is data for this type in the MIME registry, so make sure we
// remove it from the MIME registry. We don't disable the plugin here because
// if we do there's currently no way through the UI to re-enable it. We may
// come up with some sort of solution for that at a later date.
var typeRes = this._rdf.GetResource(MIME_URI(item.type));
var handlerRes = this._getChildResource(typeRes, "handlerProp");
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
this._cleanResource(extAppRes);
this._cleanResource(handlerRes);
this._cleanResource(typeRes);
mimeDSDirty = true;
}
lastSelected = (j + 1) >= this._view.rowCount ? j-1 : j;
}
}
if (mimeDSDirty &&
this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
this._mimeDS.Flush();
// Just reload the list to make sure deletions are respected
this._loadView();
this._updateRowCount(this._updateExclusions());
selection.select(lastSelected);
},
_cleanResource: function (aResource)
{
var labels = this._mimeDS.ArcLabelsOut(aResource);
while (labels.hasMoreElements()) {
var arc = labels.getNext();
if (!(arc instanceof Components.interfaces.nsIRDFResource))
break;
var target = this._mimeDS.GetTarget(aResource, arc, true);
this._mimeDS.Unassert(aResource, arc, target);
}
},
_disablePluginForItem: function (aItem)
{
if (aItem.pluginAvailable) {
// Since we're disabling the full page plugin for this content type,
// we must add it to the disabled list if it's not in there already.
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var disabled = aItem.type;
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
disabled = prefs.getCharPref(kDisabledPluginTypesPref);
if (disabled.indexOf(aItem.type) == -1)
disabled += "," + aItem.type;
}
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
// Also, we update the category manager so that existing browser windows
// update.
var catman = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catman.deleteCategoryEntry("Gecko-Content-Viewers", aItem.type, false);
}
},
_enablePluginForItem: function (aItem)
{
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
// Since we're enabling the full page plugin for this content type, we must
// look at the disabled types list and ensure that this type isn't in it.
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
var disabledList = prefs.getCharPref(kDisabledPluginTypesPref);
if (disabledList == aItem.type)
prefs.clearUserPref(kDisabledPluginTypesPref);
else {
var disabledTypes = disabledList.split(",");
var disabled = "";
for (var i = 0; i < disabledTypes.length; ++i) {
if (aItem.type != disabledTypes[i])
disabled += disabledTypes[i] + (i == disabledTypes.length - 1 ? "" : ",");
}
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
}
}
// Also, we update the category manager so that existing browser windows
// update.
var catman = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catman.addCategoryEntry("Gecko-Content-Viewers", aItem.type,
kPluginHandlerContractID, false, true);
},
_ensureMIMERegistryEntry: function (aItem)
{
var root = this._rdf.GetResource("urn:mimetypes:root");
var container = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
container.Init(this._mimeDS, root);
var itemResource = this._rdf.GetResource(MIME_URI(aItem.type));
var handlerResource = null;
if (container.IndexOf(itemResource) == -1) {
container.AppendElement(itemResource);
this._setLiteralValue(itemResource, "editable", "true");
this._setLiteralValue(itemResource, "value", aItem.type);
handlerResource = this._rdf.GetResource(HANDLER_URI(aItem.type));
this._setLiteralValue(handlerResource, "alwaysAsk", "false");
var handlerProp = this._rdf.GetResource(NC_URI("handlerProp"));
this._mimeDS.Assert(itemResource, handlerProp, handlerResource, true);
var extAppResource = this._rdf.GetResource(APP_URI(aItem.type));
this._setLiteralValue(extAppResource, "path", "");
var extAppProp = this._rdf.GetResource(NC_URI("externalApplication"));
this._mimeDS.Assert(handlerResource, extAppProp, extAppResource, true);
}
else
handlerResource = this._getChildResource(itemResource, "handlerProp");
return handlerResource;
},
_setLiteralValue: function (aResource, aProperty, aValue)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
var newValue = this._rdf.GetLiteral(aValue);
var oldValue = this._mimeDS.GetTarget(aResource, property, true);
if (oldValue)
this._mimeDS.Change(aResource, property, oldValue, newValue);
else
this._mimeDS.Assert(aResource, property, newValue, true);
},
editFileHandler: function ()
{
var selection = this._tree.view.selection;
if (selection.count != 1)
return;
var item = this._view.getItemAtIndex(selection.currentIndex);
openDialog("chrome://browser/content/preferences/changeaction.xul",
"_blank", "modal,centerscreen", item);
// Update the database
switch (item.handleMode) {
case FILEACTION_OPEN_PLUGIN:
this._enablePluginForItem(item);
// We don't need to adjust the database because plugin settings always
// supercede whatever is in the db, leaving it untouched allows the last
// user setting(s) to be preserved if they ever revert.
break;
case FILEACTION_OPEN_DEFAULT:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "true");
this._setLiteralValue(handlerRes, "saveToDisk", "false");
break;
case FILEACTION_OPEN_CUSTOM:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
this._setLiteralValue(handlerRes, "saveToDisk", "false");
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
this._setLiteralValue(extAppRes, "path", item.customHandler.path);
break;
case FILEACTION_SAVE_TO_DISK:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
this._setLiteralValue(handlerRes, "saveToDisk", "true");
break;
}
if (this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
this._mimeDS.Flush();
// Update the view
this._tree.treeBoxObject.invalidateRow(selection.currentIndex);
},
onSelectionChanged: function ()
{
if (this._tree.view.rowCount == 0) {
this._removeButton.disabled = true;
this._editButton.disabled = true;
return;
}
var selection = this._tree.view.selection;
var selected = selection.count;
this._removeButton.disabled = selected == 0;
this._editButton.disabled = selected != 1;
var stringKey = selected > 1 ? "removeButtonMultiple" : "removeButtonSingle";
this._removeButton.label = this._bundle.getString(stringKey);
var canRemove = true;
var canEdit = true;
var rangeCount = selection.getRangeCount();
var min = { }, max = { };
var setLastSelected = false;
for (var i = 0; i < rangeCount; ++i) {
selection.getRangeAt(i, min, max);
for (var j = min.value; j <= max.value; ++j) {
if (!setLastSelected) {
// Set the last selected index to the first item in the selection
this._tree.setAttribute("lastSelected", j);
setLastSelected = true;
}
var item = this._view.getItemAtIndex(j);
if (item &&
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY))
canEdit = false;
if (item &&
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY ||
item.handledOnlyByPlugin))
canRemove = false;
}
}
if (!canRemove)
this._removeButton.disabled = true;
if (!canEdit)
this._editButton.disabled = true;
},
_lastSortProperty : "",
_lastSortAscending: false,
sort: function (aProperty)
{
var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
function sortByProperty(a, b)
{
return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
}
function sortByExtension(a, b)
{
if (!a.hasExtension && b.hasExtension)
return 1;
if (!b.hasExtension && a.hasExtension)
return -1;
return a.extension.toLowerCase().localeCompare(b.extension.toLowerCase());
}
// Sort the Filtered List, if in Filtered mode
if (!this._view._filtered) {
this._view.activeCollection.sort(aProperty == "extension" ? sortByExtension : sortByProperty);
if (!ascending)
this._view.activeCollection.reverse();
}
this._view.selection.clearSelection();
this._view.selection.select(0);
this._tree.treeBoxObject.invalidate();
this._tree.treeBoxObject.ensureRowIsVisible(0);
this._lastSortAscending = ascending;
this._lastSortProperty = aProperty;
},
clearFilter: function ()
{
// Clear the Filter and the Tree Display
document.getElementById("filter").value = "";
this._view._filtered = false;
this._view._filterSet = [];
// Just reload the list to make sure deletions are respected
this._loadView();
this._updateRowCount(this._updateExclusions());
// Restore selection
this._view.selection.clearSelection();
for (var i = 0; i < this._lastSelectedRanges.length; ++i) {
var range = this._lastSelectedRanges[i];
this._view.selection.rangedSelect(range.min, range.max, true);
}
this._lastSelectedRanges = [];
document.getElementById("actionsIntro").value = this._bundle.getString("actionsAll");
document.getElementById("clearFilter").disabled = true;
document.getElementById("filter").focus();
},
_actionMatchesFilter: function (aAction)
{
return aAction.extension.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.typeName.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.type.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.action.toLowerCase().indexOf(this._view._filterValue) != -1;
},
_filterActions: function (aFilterValue)
{
this._view._filterValue = aFilterValue;
var actions = [];
var collection = this._view._usingExclusionSet ? this._view._exclusionSet : this._actions;
for (var i = 0; i < collection.length; ++i) {
var action = collection[i];
if (this._actionMatchesFilter(action))
actions.push(action);
}
return actions;
},
_lastSelectedRanges: [],
_saveState: function ()
{
// Save selection
var seln = this._view.selection;
this._lastSelectedRanges = [];
var rangeCount = seln.getRangeCount();
for (var i = 0; i < rangeCount; ++i) {
var min = {}; var max = {};
seln.getRangeAt(i, min, max);
this._lastSelectedRanges.push({ min: min.value, max: max.value });
}
},
_filterTimeout: -1,
onFilterInput: function ()
{
if (this._filterTimeout != -1)
clearTimeout(this._filterTimeout);
function filterActions()
{
var filter = document.getElementById("filter").value.toLowerCase();
if (filter == "") {
gDownloadActionsWindow.clearFilter();
return;
}
var view = gDownloadActionsWindow._view;
view._filterSet = gDownloadActionsWindow._filterActions(filter);
if (!view._filtered) {
// Save Display Info for the Non-Filtered mode when we first
// enter Filtered mode.
gDownloadActionsWindow._saveState();
view._filtered = true;
}
// Clear the display
gDownloadActionsWindow._updateRowCount(view._filterSet.length);
// if the view is not empty then select the first item
if (view.rowCount > 0)
view.selection.select(0);
document.getElementById("actionsIntro").value = gDownloadActionsWindow._bundle.getString("actionsFiltered");
document.getElementById("clearFilter").disabled = false;
}
window.filterActions = filterActions;
this._filterTimeout = setTimeout("filterActions();", 500);
},
onFilterKeyPress: function (aEvent)
{
if (aEvent.keyCode == 27) // ESC key
this.clearFilter();
},
focusFilterBox: function ()
{
var filter = document.getElementById("filter");
filter.focus();
filter.select();
}
};

View File

@ -1,129 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Firefox Preferences System.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
#
# 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 *****
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % downloadactionsDTD SYSTEM "chrome://browser/locale/preferences/downloadactions.dtd">
%brandDTD;
%downloadactionsDTD;
]>
<window id="DownloadActionsWindow" class="windowDialog"
windowtype="Preferences:DownloadActions"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="gDownloadActionsWindow.init();"
onunload="gDownloadActionsWindow.uninit();"
title="&downloadactionsWindow.title;"
width="&window.width;" height="&window.height;" persist="width height screenX screenY">
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/actionsshared.js"/>
<script type="application/x-javascript" src="chrome://browser/content/preferences/downloadactions.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<keyset>
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
</keyset>
<vbox flex="1" class="contentPane">
<hbox align="center">
<label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
<textbox id="filter" flex="1" oninput="gDownloadActionsWindow.onFilterInput();"
onkeypress="gDownloadActionsWindow.onFilterKeyPress(event);"/>
<button id="clearFilter" icon="clear" label="&clear.label;" accesskey="&clear.accesskey;"
oncommand="gDownloadActionsWindow.clearFilter();" disabled="true"/>
</hbox>
<separator class="thin"/>
<label id="actionsIntro" control="fileHandlersList">
&fileTypesDescription.label;
</label>
<separator class="thin"/>
<tree id="fileHandlersList" flex="1"
lastSelected="0" persist="lastSelected"
onselect="gDownloadActionsWindow.onSelectionChanged();"
ondblclick="gDownloadActionsWindow.editFileHandler();">
<treechildren id="extensionChildren"/>
<treecols>
<treecol id="fileExtension" ignoreincolumnpicker="true"
class="sortDirectionIndicator" persist="width"
label="&fileExtensionColumn.label;" accesskey="&fileExtensionColumn.accesskey;"
onclick="gDownloadActionsWindow.sort('extension');"/>
<treecol id="fileType" flex="1"
class="sortDirectionIndicator" persist="width"
label="&fileTypeColumn.label;" accesskey="&fileTypeColumn.accesskey;"
onclick="gDownloadActionsWindow.sort('typeName');"/>
<splitter class="tree-splitter" />
<treecol id="fileMIMEType" flex="1" hidden="true"
class="sortDirectionIndicator" persist="width"
label="&fileMIMETypeColumn.label;" accesskey="&fileMIMETypeColumn.accesskey;"
onclick="gDownloadActionsWindow.sort('type');"/>
<splitter class="tree-splitter" />
<treecol id="fileHandler" flex="1"
class="sortDirectionIndicator" persist="width"
label="&fileHandlerColumn.label;" accesskey="&fileHandlerColumn.accesskey;"
onclick="gDownloadActionsWindow.sort('action');"/>
<splitter class="tree-splitter" />
</treecols>
</tree>
</vbox>
<separator class="thin"/>
<hbox>
<hbox flex="1" class="actionButtons">
<button id="removeFileHandler" icon="remove"
label="&remove.label;" accesskey="&remove.accesskey;"
oncommand="gDownloadActionsWindow.removeFileHandler();"/>
<button id="editFileHandler"
label="&edit.label;" accesskey="&edit.accesskey;"
oncommand="gDownloadActionsWindow.editFileHandler();"/>
<spacer flex="1"/>
#ifndef XP_MACOSX
<button oncommand="close();" icon="close"
label="&button.close.label;" accesskey="&button.close.accesskey;"/>
#endif
</hbox>
<resizer dir="bottomright"/>
</hbox>
</window>

View File

@ -1,383 +0,0 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Firefox Preferences System.
#
# The Initial Developer of the Original Code is
# Jeff Walden <jwalden+code@mit.edu>.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Asaf Romano <mozilla.mano@sent.com>
#
# 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 *****
#ifndef XP_MACOSX
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
var TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
#endif
/*
* Preferences:
*
* browser.feeds.handler
* - "bookmarks", "reader" (clarified further using the .default preference),
* or "ask" -- indicates the default handler being used to process feeds
*
* browser.feeds.handler.default
* - "bookmarks", "client" or "web" -- indicates the chosen feed reader used
* to display feeds, either transiently (i.e., when the "use as default"
* checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
* or more permanently (i.e., the item displayed in the dropdown in Feeds
* preferences)
*
* browser.feeds.handler.webservice
* - the URL of the currently selected web service used to read feeds
*
* browser.feeds.handlers.application
* - nsILocalFile, stores the current client-side feed reading app if one has
* been chosen
*/
const PREF_SELECTED_APP = "browser.feeds.handlers.application";
const PREF_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_SELECTED_ACTION = "browser.feeds.handler";
const PREF_SELECTED_READER = "browser.feeds.handler.default";
var gFeedsPane = {
element: function(aID) {
return document.getElementById(aID);
},
/* ........ QueryInterface .............. */
QueryInterface: function(aIID) {
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIObserver) ||
aIID.equals(Ci.nsIDOMEventListener))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
/**
* See nsIObserver
*/
observe: function(aSubject, aTopic, aData) {
if (aTopic != "nsPref:changed" || aData != PREF_SELECTED_WEB)
return;
if (this.element(PREF_SELECTED_ACTION).value == "reader") {
var wccr =
Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
getService(Ci.nsIWebContentConverterService);
var handlerURL = this.element(PREF_SELECTED_WEB).valueFromPreferences;
var handler =
wccr.getWebContentHandlerByURI(TYPE_MAYBE_FEED, handlerURL);
if (handler)
wccr.setAutoHandler(TYPE_MAYBE_FEED, handler);
}
},
/**
* See nsIDOMEventListener
*/
handleEvent: function(aEvent) {
if (aEvent.type == "unload") {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
prefBranch.removeObserver(PREF_SELECTED_WEB, this);
window.removeEventListener("unload", this, false);
}
},
/**
* Initializes this.
*/
init: function () {
var _delayedPaneLoad = function(self) {
self._initFeedReaders();
self.updateSelectedReader();
}
setTimeout(_delayedPaneLoad, 0, this);
// For web readers, we need to call setAutoHandler if the
// preview page should be skipped (i.e. PREF_SELECTED_ACTION="reader")
// To do so, we've to add a pref-observer in order to be notified on
// actual pref-changes (i.e. not on pref changes which may not take
// affect when the prefwindow is closed)
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
prefBranch.addObserver(PREF_SELECTED_WEB, this, false);
window.addEventListener("unload", this, false);
},
/**
* Populates the UI list of available feed readers.
*/
_initFeedReaders: function() {
this.updateSelectedApplicationInfo();
var readersList = this.element("readers");
// List the system default feed reader if it is
// not the last-selected application already
try {
var systemDefaultReader = Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService).
defaultFeedReader;
var defaultSystemReaderFilefield = this.element("defaultSystemReaderFilefield");
defaultSystemReaderFilefield.file = systemDefaultReader;
var selectedAppFile = this.element("selectedAppFilefield").file;
if (!selectedAppFile || defaultSystemReaderFilefield.file.path !=
selectedAppFile.path) {
var defaultReaderItem = document.createElementNS(kXULNS, "listitem");
defaultReaderItem.id = "defaultSystemReaderListitem";
defaultReaderItem.className = "listitem-iconic";
defaultReaderItem.setAttribute("label", defaultSystemReaderFilefield.label);
defaultReaderItem.setAttribute("image", defaultSystemReaderFilefield.image);
readersList.appendChild(defaultReaderItem);
}
}
catch(ex) { /* no default reader */ }
// List of web handlers
var wccr =
Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
getService(Ci.nsIWebContentConverterService);
var handlers = wccr.getContentHandlers(TYPE_MAYBE_FEED, {});
if (handlers.length == 0)
return;
var ios =
Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
for (var i = 0; i < handlers.length; ++i) {
var row = document.createElementNS(kXULNS, "listitem");
row.className = "listitem-iconic";
row.setAttribute("label", handlers[i].name);
row.setAttribute("webhandlerurl", handlers[i].uri);
var uri = ios.newURI(handlers[i].uri, null, null);
if (/^https?/.test(uri.scheme))
row.setAttribute("image", uri.prePath + "/favicon.ico");
readersList.appendChild(row);
}
},
/**
* Updates the label and image of the client feed reader listitem
*/
updateSelectedApplicationInfo: function() {
var appItemCell = this.element("selectedApplicationCell");
var selectedAppFilefield = this.element("selectedAppFilefield");
selectedAppFilefield.file = this.element(PREF_SELECTED_APP).value;
if (selectedAppFilefield.file) {
appItemCell.setAttribute("label", selectedAppFilefield.label);
appItemCell.setAttribute("image", selectedAppFilefield.image);
}
else {
var noAppString =
this.element("stringbundle").getString("noApplicationSelected");
appItemCell.setAttribute("label", noAppString);
appItemCell.setAttribute("image", "");
}
},
/**
* Selects a item in the list without triggering a preference change.
*
* @param aItem
* the listitem to be selected
*/
_silentSelectReader: function(aItem) {
var readers = this.element("readers");
readers.setAttribute("suppressonselect", "true");
readers.selectItem(aItem);
readers.removeAttribute("suppressonselect");
},
/**
* Helper for updateSelectedReader. Syncs the selected item in the readers
* list with value stored invalues stored in PREF_SELECTED_WEB
*/
_updateSelectedWebHandlerItem: function() {
// We should select the new web handler only if the default handler
// is "web"
var readers = this.element("readers")
var readerElts =
readers.getElementsByAttribute("webhandlerurl",
this.element(PREF_SELECTED_WEB).value);
// XXXmano: handle the addition of a new web handler
if (readerElts.length > 0)
this._silentSelectReader(readerElts[0]);
},
/**
* Syncs the selected item in the readers list with the values stored in
* preferences.
*/
updateSelectedReader: function() {
var defaultReader = this.element(PREF_SELECTED_READER).value ||
"bookmarks";
switch (defaultReader) {
case "bookmarks":
this._silentSelectReader(this.element("liveBookmarksListItem"));
break;
case "client":
#ifdef XP_WIN
// Keep the system default feed reader item selected if the
// last-selected application is the the system default feed reader
// and if it is already selected
var currentItem = this.element("readers").currentItem;
if (currentItem && currentItem.id == "defaultSystemReaderListitem") {
var defaultSystemReaderFile = this.element("defaultSystemReaderFilefield").file;
var selectedAppFile = this.element("selectedAppFilefield").file;
if (selectedAppFile && defaultSystemReaderFile &&
defaultSystemReaderFile.path == selectedAppFile.path)
break;
}
#endif
this._silentSelectReader(this.element("selectedApplicationListitem"));
break;
case "web":
this._updateSelectedWebHandlerItem();
break;
}
},
/**
* Displays a prompt from which the user may choose an a (client) feed reader.
*/
chooseClientApp: function () {
var fp = Cc["@mozilla.org/filepicker;1"]
.createInstance(Ci.nsIFilePicker);
fp.init(window, document.title, Ci.nsIFilePicker.modeOpen);
fp.appendFilters(Ci.nsIFilePicker.filterApps);
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file) {
// XXXben - we need to compare this with the running instance executable
// just don't know how to do that via script...
// XXXmano TBD: can probably add this to nsIShellService
#ifdef XP_WIN
#expand if (fp.file.leafName == "__MOZ_APP_NAME__.exe")
#else
#ifdef XP_MACOSX
#expand if (fp.file.leafName == "__MOZ_APP_DISPLAYNAME__.app")
#else
#expand if (fp.file.leafName == "__MOZ_APP_NAME__-bin")
#endif
#endif
return;
this.element(PREF_SELECTED_APP).value = fp.file;
this.element(PREF_SELECTED_READER).value = "client";
}
},
/**
* Disables the readers list if "Show preview..." is selected, enables
* it otherwise.
*/
onReadingMethodSelect: function() {
var disableList = this.element("readingMethod").value == "ask";
this.element("readers").disabled = disableList;
this.element("chooseClientApp").disabled = disableList;
},
/**
* Maps the value of PREF_SELECTED_ACTION to the parallel
* value in the radiogroup
*/
onReadingMethodSyncFromPreference: function() {
var pref = this.element(PREF_SELECTED_ACTION);
var newVal = pref.instantApply ? pref.valueFromPreferences : pref.value;
if (newVal != "ask")
return "reader";
return "ask";
},
/**
* Returns the value to be used for PREF_SELECTED_ACTION
* according to the current UI state.
*/
onReadingMethodSyncToPreference: function() {
var readers = this.element("readers");
// A reader must be choosed in order to skip the preview page
if (this.element("readingMethod").value == "ask" ||
!readers.currentItem)
return "ask";
if (readers.currentItem.id == "liveBookmarksListItem")
return "bookmarks";
return "reader";
},
/**
* Syncs PREF_SELECTED_READER with the selected item in the readers list
* Also updates PREF_SELECTED_ACTION if necessary
*/
writeSelectedFeedReader: function() {
// Force update of the action pref. This is needed for the case in which
// the user flipped from a reader to live bookmarks or vice-versa
this.element(PREF_SELECTED_ACTION).value =
this.onReadingMethodSyncToPreference();
var currentItem = this.element("readers").currentItem;
if (currentItem.hasAttribute("webhandlerurl")) {
this.element(PREF_SELECTED_WEB).value =
currentItem.getAttribute("webhandlerurl");
this.element(PREF_SELECTED_READER).value = "web";
}
else {
switch (currentItem.id) {
case "liveBookmarksListItem":
this.element(PREF_SELECTED_READER).value = "bookmarks";
break;
case "selectedApplicationListitem":
// PREF_SELECTED_APP is saved in chooseClientApp
this.element(PREF_SELECTED_READER).value = "client";
break;
#ifdef XP_WIN
case "defaultSystemReaderListitem":
this.element(PREF_SELECTED_APP).value = this.element("defaultSystemReaderFilefield").file;
this.element(PREF_SELECTED_READER).value = "client";
break;
#endif
}
}
}
};

View File

@ -1,121 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Firefox Preferences System.
#
# The Initial Developer of the Original Code is
# Jeff Walden <jwalden+code@mit.edu>.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Asaf Romano <mozilla.mano@sent.com>
#
# 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 *****
<!DOCTYPE overlay [
<!ENTITY % feedsDTD SYSTEM "chrome://browser/locale/preferences/feeds.dtd">
%feedsDTD;
]>
<overlay id="FeedsPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:aaa="http://www.w3.org/2005/07/aaa">
<prefpane id="paneFeeds"
onpaneload="gFeedsPane.init();"
helpTopic="prefs-feeds"
helpURI="chrome://browser/locale/help/help.rdf">
<preferences id="feedsPreferences">
<preference id="browser.feeds.handler"
name="browser.feeds.handler"
type="string"/>
<preference id="browser.feeds.handler.default"
name="browser.feeds.handler.default"
onchange="gFeedsPane.updateSelectedReader();"
type="string"/>
<preference id="browser.feeds.handlers.application"
name="browser.feeds.handlers.application"
onchange="gFeedsPane.updateSelectedApplicationInfo();"
type="file"/>
<preference id="browser.feeds.handlers.webservice"
name="browser.feeds.handlers.webservice"
onchange="gFeedsPane.updateSelectedReader();"
type="string"/>
</preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/feeds.js"/>
<filefield class="indent" id="selectedAppFilefield" disabled="true" hidden="true"/>
#ifdef XP_WIN
<filefield class="indent" id="defaultSystemReaderFilefield" disabled="true" hidden="true"/>
#endif
<stringbundle id="stringbundle" src="chrome://browser/locale/preferences/feeds.properties"/>
<label value="&feedClick.label;"/>
<radiogroup id="readingMethod"
class="indent"
preference="browser.feeds.handler"
onsyncfrompreference="return gFeedsPane.onReadingMethodSyncFromPreference();"
onsynctopreference="return gFeedsPane.onReadingMethodSyncToPreference();"
onselect="gFeedsPane.onReadingMethodSelect();">
<radio value="ask"
label="&showPreview.label;"
accesskey="&showPreview.accesskey;"/>
<radio value="reader" id="useReader"
label="&subscribeUsing.label;"
accesskey="&subscribeUsing.accesskey;"
aaa:labelledby="useReader readers"/>
<hbox id="readerContainer" class="indent" flex="1">
<listbox id="readers" rows="5" flex="1"
aaa:labelledby="useReader"
onselect="gFeedsPane.writeSelectedFeedReader(); event.stopPropagation();">
<listcols>
<listcol flex="1"/>
<listcol/>
</listcols>
<listitem id="liveBookmarksListItem"
label="&liveBookmarks.label;"
class="listitem-iconic"
image="chrome://browser/skin/page-livemarks.png"/>
<listitem id="selectedApplicationListitem" allowevents="true">
<listcell id="selectedApplicationCell" class="listcell-iconic"/>
<listcell id="chooseClientAppCell">
<button id="chooseClientApp"
label="&chooseApplication.label;"
accesskey="&chooseApplication.accesskey;"
oncommand="gFeedsPane.chooseClientApp();"/>
</listcell>
</listitem>
</listbox>
</hbox>
</radiogroup>
</prefpane>
</overlay>

View File

@ -0,0 +1,66 @@
/* ***** 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.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Myk Melez <myk@mozilla.org>
*
* 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 ***** */
richlistitem {
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler");
}
richlistitem[selected="true"] {
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler-selected");
}
/**
* Somewhat line up the actions menu with action labels above and below it.
* FIXME: to really line this up, equalize the distance from the left side
* of the action box to the left side of the icon for both the menu and the
* non-menu versions of the action box. Also make sure the labels are the
* same distance away from the icons.
*/
.actionsMenu {
margin-left: 0;
}
/**
* Make the icons appear and pad them a bit.
* Note: we display the icon box for every item whether or not it has an icon
* so the labels of all the items align vertically.
*/
.actionsMenu > menupopup > menuitem > .menu-iconic-left {
display: -moz-box;
min-width: 16px;
-moz-padding-start: 2px;
-moz-padding-end: 2px;
}

View File

@ -0,0 +1,100 @@
<?xml version="1.0"?>
<!-- ***** 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.
-
- The Original Code is the Mozilla browser.
-
- The Initial Developer of the Original Code is Mozilla.
- Portions created by the Initial Developer are Copyright (C) 2007
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Myk Melez <myk@mozilla.org>
-
- 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 LGPL or the GPL. 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 ***** -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
%brandDTD;
%applicationsDTD;
]>
<bindings id="handlerBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="handler-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation>
<property name="type" readonly="true">
<getter>
return this.getAttribute("type");
</getter>
</property>
</implementation>
</binding>
<binding id="handler" extends="chrome://browser/content/preferences/handlers.xml#handler-base">
<content>
<xul:hbox flex="1" equalsize="always">
<xul:hbox flex="1" align="center">
<xul:image xbl:inherits="src=typeIcon" height="16" width="16"/>
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
</xul:hbox>
<xul:hbox flex="1" align="center">
<xul:image xbl:inherits="src=actionIcon" height="16" width="16"/>
<xul:label flex="1" crop="end" xbl:inherits="value=actionDescription"/>
</xul:hbox>
</xul:hbox>
</content>
</binding>
<binding id="handler-selected" extends="chrome://browser/content/preferences/handlers.xml#handler-base">
<content>
<xul:hbox flex="1" equalsize="always">
<xul:hbox flex="1" align="center">
<xul:image xbl:inherits="src=typeIcon" height="16" width="16"/>
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
</xul:hbox>
<xul:hbox flex="1">
<xul:menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1"
oncommand="gApplicationsPane.onSelectAction(event)">
<xul:menupopup/>
</xul:menulist>
</xul:hbox>
</xul:hbox>
</content>
<implementation>
<constructor>
gApplicationsPane.rebuildActionsMenu();
</constructor>
</implementation>
</binding>
</bindings>

View File

@ -2,8 +2,8 @@ browser.jar:
* content/browser/preferences/advanced.xul
* content/browser/preferences/advanced.js
* content/browser/preferences/advanced-scripts.xul
* content/browser/preferences/changeaction.xul
* content/browser/preferences/changeaction.js
* content/browser/preferences/applications.xul
* content/browser/preferences/applications.js
* content/browser/preferences/colors.xul
* content/browser/preferences/cookies.xul
* content/browser/preferences/cookies.js
@ -11,13 +11,11 @@ browser.jar:
* content/browser/preferences/content.js
* content/browser/preferences/connection.xul
* content/browser/preferences/connection.js
* content/browser/preferences/downloadactions.xul
* content/browser/preferences/downloadactions.js
* content/browser/preferences/fallbackEULA.xhtml
* content/browser/preferences/feeds.xul
* content/browser/preferences/feeds.js
* content/browser/preferences/fonts.xul
* content/browser/preferences/fonts.js
* content/browser/preferences/handlers.xml
* content/browser/preferences/handlers.css
* content/browser/preferences/languages.xul
* content/browser/preferences/languages.js
* content/browser/preferences/main.xul

View File

@ -43,6 +43,13 @@
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!-- XXX This should be in applications.xul, but bug 393953 means putting it
- there causes the Applications pane not to work the first time you open
- the Preferences dialog in a browsing session, so we work around the problem
- by putting it here instead.
-->
<?xml-stylesheet href="chrome://browser/content/preferences/handlers.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % preferencesDTD SYSTEM "chrome://browser/locale/preferences/preferences.dtd">
@ -93,8 +100,8 @@
src="chrome://browser/content/preferences/tabs.xul"/>
<prefpane id="paneContent" label="&paneContent.title;"
src="chrome://browser/content/preferences/content.xul"/>
<prefpane id="paneFeeds" label="&paneFeeds.title;"
src="chrome://browser/content/preferences/feeds.xul"/>
<prefpane id="paneApplications" label="&paneApplications.title;"
src="chrome://browser/content/preferences/applications.xul"/>
<prefpane id="panePrivacy" label="&panePrivacy.title;"
src="chrome://browser/content/preferences/privacy.xul"/>
<prefpane id="paneSecurity" label="&paneSecurity.title;"

View File

@ -0,0 +1,17 @@
<!ENTITY prefpane.label "Here you can configure &brandShortName; to let your favorite applications handle different types of content.">
<!ENTITY filterActive.label "The following entries match your search:">
<!ENTITY typeColumn.label "Content Type">
<!ENTITY typeColumn.accesskey "T">
<!ENTITY actionColumn.label "Application">
<!ENTITY actionColumn.accesskey "A">
<!ENTITY focusSearch1.key "f">
<!ENTITY focusSearch2.key "k">
<!ENTITY filter.label "Search:">
<!ENTITY filter.accesskey "S">
<!ENTITY clear.label "Clear">
<!ENTITY clear.accesskey "l">

View File

@ -1,23 +0,0 @@
<!ENTITY changeAction.title "Change Action">
<!ENTITY window.width "36em">
<!ENTITY whenDownloading.label "When downloading files like this:">
<!ENTITY openDefault.label "Open them with the default application:">
<!ENTITY openDefault.accesskey "O">
<!ENTITY openApplication.label "Open them with this application:">
<!ENTITY openApplication.accesskey "e">
<!ENTITY changeApp.label "Browse...">
<!ENTITY changeApp.accesskey "B">
<!ENTITY saveToDisk.label "Save them on my computer">
<!ENTITY saveToDisk.accesskey "S">
<!ENTITY saveToDefaultFolder.label "in the default download folder">
<!ENTITY saveToDefaultFolder.accesskey "d">
<!ENTITY saveToThisFolder.label "in this folder:">
<!ENTITY saveToThisFolder.accesskey "h">
<!ENTITY chooseFolder.label "Browse...">
<!ENTITY chooseFolder.accesskey "w">
<!ENTITY saveToAskMe.label "ask me where to save the file">
<!ENTITY saveToAskMe.accesskey "a">
<!ENTITY usePlugin.label "Use this Plugin:">
<!ENTITY usePlugin.accesskey "P">

View File

@ -29,9 +29,3 @@
<!ENTITY colors.label "Colors...">
<!ENTITY colors.accesskey "C">
<!ENTITY fileTypes.label "File Types">
<!ENTITY configureFileTypes.label "Configure how &brandShortName; handles certain types of files">
<!ENTITY manage.label "Manage...">
<!ENTITY manage.accesskey "M">

View File

@ -1,32 +0,0 @@
<!ENTITY downloadactionsWindow.title "Download Actions">
<!ENTITY window.width "480">
<!ENTITY window.height "310">
<!ENTITY fileTypesDescription.label "Automatically perform the associated Action with each of the following file types:">
<!ENTITY fileHandlerColumn.label "Action">
<!ENTITY fileHandlerColumn.accesskey "A">
<!ENTITY fileTypeColumn.label "File Type">
<!ENTITY fileTypeColumn.accesskey "T">
<!ENTITY fileMIMETypeColumn.label "MIME Type">
<!ENTITY fileMIMETypeColumn.accesskey "M">
<!ENTITY fileExtensionColumn.label "Extension">
<!ENTITY fileExtensionColumn.accesskey "E">
<!ENTITY remove.label "Remove Action">
<!ENTITY remove.accesskey "R">
<!ENTITY edit.label "Change Action...">
<!ENTITY edit.accesskey "C">
<!ENTITY windowClose.key "w">
<!ENTITY focusSearch1.key "f">
<!ENTITY focusSearch2.key "k">
<!ENTITY filter.label "Search:">
<!ENTITY filter.accesskey "S">
<!ENTITY clear.label "Clear">
<!ENTITY clear.accesskey "l">
<!ENTITY button.close.label "Close">
<!ENTITY button.close.accesskey "o">

View File

@ -1,8 +0,0 @@
<!ENTITY feedClick.label "When I click on a web feed:">
<!ENTITY showPreview.label "Show me a preview and ask me which Feed Reader to use">
<!ENTITY showPreview.accesskey "S">
<!ENTITY subscribeUsing.label "Subscribe to the feed using:">
<!ENTITY subscribeUsing.accesskey "u">
<!ENTITY liveBookmarks.label "Live Bookmarks">
<!ENTITY chooseApplication.label "Choose Application...">
<!ENTITY chooseApplication.accesskey "C">

View File

@ -1 +0,0 @@
noApplicationSelected=No Application Selected

View File

@ -10,7 +10,7 @@
<!ENTITY paneMain.title "Main">
<!ENTITY paneTabs.title "Tabs">
<!ENTITY paneContent.title "Content">
<!ENTITY paneFeeds.title "Feeds">
<!ENTITY paneApplications.title "Applications">
<!ENTITY panePrivacy.title "Privacy">
<!ENTITY paneSecurity.title "Security">
<!ENTITY paneAdvanced.title "Advanced">

View File

@ -43,29 +43,19 @@ desktopFolderName=Desktop
downloadsFolderName=Downloads
chooseDownloadFolderTitle=Choose Download Folder:
#### Download Actions
#### Applications
extensionNone=(NONE)
removeButtonSingle=Remove Action
removeButtonMultiple=Remove Actions
removeTitleSingle=Remove Action
removeTitleMultiple=Remove Actions
removeMessageSingle=The selected Action will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove this Action?
removeMessageMultiple=The selected Actions will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove these Actions?
removeType=Remove this entry...
removeButton=Remove Entry
removeTitle=Remove Entry
removeMessage=If you remove this entry, Firefox will ask you what to do next time you access content of this type. Are you sure you want to remove this entry?
fileEnding=%S file
saveToDisk=Save to Disk
openWith=Open with %S
actionsFiltered=The following Actions match your search:
actionsAll=Automatically perform the associated Action with each of the following file types:
#### Change Action
extensionStringFormat=%S, %S
downloadHelperNoneSelected=None Selected
pluginHelperNoneAvailable=None Available
chooseApp=Choose application...
fpTitleChooseApp=Select Helper Application
fpTitleChooseDL=Select Download Folder
webFeed=Web Feed
alwaysAskAboutFeed=Show me a preview and ask me which Feed Reader to use
liveBookmarks=Live Bookmarks
#### Cookie Viewer

View File

@ -45,15 +45,12 @@
locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties)
locale/browser/preferences/advanced.dtd (%chrome/browser/preferences/advanced.dtd)
* locale/browser/preferences/advanced-scripts.dtd (%chrome/browser/preferences/advanced-scripts.dtd)
locale/browser/preferences/changeaction.dtd (%chrome/browser/preferences/changeaction.dtd)
locale/browser/preferences/colors.dtd (%chrome/browser/preferences/colors.dtd)
locale/browser/preferences/cookies.dtd (%chrome/browser/preferences/cookies.dtd)
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
locale/browser/preferences/connection.dtd (%chrome/browser/preferences/connection.dtd)
locale/browser/preferences/downloadactions.dtd (%chrome/browser/preferences/downloadactions.dtd)
locale/browser/preferences/applications.dtd (%chrome/browser/preferences/applications.dtd)
locale/browser/preferences/fallbackEULA.dtd (%chrome/browser/preferences/fallbackEULA.dtd)
locale/browser/preferences/feeds.dtd (%chrome/browser/preferences/feeds.dtd)
locale/browser/preferences/feeds.properties (%chrome/browser/preferences/feeds.properties)
locale/browser/preferences/fonts.dtd (%chrome/browser/preferences/fonts.dtd)
locale/browser/preferences/main.dtd (%chrome/browser/preferences/main.dtd)
locale/browser/preferences/languages.dtd (%chrome/browser/preferences/languages.dtd)

View File

@ -114,14 +114,14 @@ radio[pane=paneContent][selected="true"] {
-moz-image-region: rect(32px, 96px, 64px, 64px);
}
/* ----- FEEDS BUTTON ----- */
/* ----- APPLICATIONS BUTTON ----- */
radio[pane=paneFeeds] {
radio[pane=paneApplications] {
-moz-image-region: rect(0px, 128px, 32px, 96px);
}
radio[pane=paneFeeds]:hover,
radio[pane=paneFeeds]:active,
radio[pane=paneFeeds][selected="true"] {
radio[pane=paneApplications]:hover,
radio[pane=paneApplications]:active,
radio[pane=paneApplications][selected="true"] {
-moz-image-region: rect(32px, 128px, 64px, 96px);
}
@ -276,11 +276,3 @@ caption {
.updateControls {
-moz-margin-start: 10px;
}
/**
* Feeds pane
*/
#chooseClientAppCell {
-moz-padding-end: 12px;
}

View File

@ -67,11 +67,11 @@ radio[pane=paneContent][selected="true"] {
-moz-image-region: rect(32px, 96px, 64px, 64px)
}
radio[pane=paneFeeds] {
radio[pane=paneApplications] {
-moz-image-region: rect(0px, 128px, 32px, 96px)
}
radio[pane=paneFeeds]:hover,
radio[pane=paneFeeds][selected="true"] {
radio[pane=paneApplications]:hover,
radio[pane=paneApplications][selected="true"] {
-moz-image-region: rect(32px, 128px, 64px, 96px)
}
@ -191,80 +191,6 @@ filefield[disabled="true"] .fileFieldIcon {
background-color: #E9E7E3;
}
/* Download Actions Manager */
#fileExtension {
width: 5em;
}
#extensionChildren::-moz-tree-image(fileExtension) {
margin: 0px 5px 0px 0px;
}
#typeField {
font-weight: bold;
}
/* Change Action Dialog */
#typeIcon {
width: 32px;
height: 32px;
-moz-margin-end: 3px;
}
#typeField {
background-color: transparent;
margin-top: 1px !important;
margin-bottom: 2px !important;
-moz-margin-start: 6px !important;
-moz-margin-end: 5px !important;
}
#extensionField {
color: GrayText;
font-weight: bold;
}
#ChangeActionDialog {
padding: 0px;
}
#ChangeActionDialog .dialog-button-box {
padding-top: 8px;
padding-bottom: 10px;
-moz-padding-start: 8px;
-moz-padding-end: 10px;
}
#changeActionHeader {
border-bottom: 2px groove ThreeDFace;
margin: 0px;
padding: 10px;
background-color: -moz-Field;
color: -moz-FieldText;
}
#changeActionContent {
padding-top: 8px;
padding-bottom: 10px;
-moz-padding-start: 9px;
-moz-padding-end: 10px;
}
#defaultAppIcon {
width: 16px;
height: 16px;
-moz-margin-start: 2px;
}
#defaultAppName {
-moz-margin-start: 6px !important;
font-weight: bold;
}
/* Feeds pane */
#chooseClientAppCell {
-moz-padding-end: 12px;
}
/* bottom-most box containing a groupbox in a prefpane. Prevents the bottom
of the groupbox from being cutoff */
.bottomBox {

View File

@ -8,7 +8,6 @@ toolkit.jar:
* content/mozapps/downloads/DownloadProgressListener.js (downloads/content/DownloadProgressListener.js)
content/mozapps/downloads/downloads.css (downloads/content/downloads.css)
* content/mozapps/downloads/download.xml (downloads/content/download.xml)
* content/mozapps/preferences/actionsshared.js (preferences/actionsshared.js)
* content/mozapps/preferences/ocsp.js (preferences/ocsp.js)
* content/mozapps/preferences/ocsp.xul (preferences/ocsp.xul)
* content/mozapps/preferences/fontbuilder.js (preferences/fontbuilder.js)

View File

@ -1,64 +0,0 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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.
#
# The Original Code is the Download Actions Manager.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2000-2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
#
# 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 *****
const FILEACTION_SAVE_TO_DISK = 1;
const FILEACTION_OPEN_INTERNALLY = 2;
const FILEACTION_OPEN_DEFAULT = 3;
const FILEACTION_OPEN_CUSTOM = 4;
const FILEACTION_OPEN_PLUGIN = 5;
function FileAction ()
{
}
FileAction.prototype = {
type : "",
extension : "",
hasExtension: true,
editable : true,
smallIcon : "",
bigIcon : "",
typeName : "",
action : "",
mimeInfo : null,
customHandler : "",
handleMode : false,
pluginAvailable : false,
pluginEnabled : false,
handledOnlyByPlugin : false
};