bug 396610: make it possible once again to disable user configuration of handlers; r=gavin, a=mconnor

This commit is contained in:
myk@mozilla.org 2007-09-28 15:45:19 -07:00
parent a4ad8c4b8a
commit b838379102
2 changed files with 30 additions and 7 deletions

View File

@ -919,9 +919,9 @@ var gApplicationsPane = {
item.setAttribute("actionIcon",
this._getIconURLForPreferredAction(visibleType));
this._list.appendChild(item);
if (visibleType.type == this._list.getAttribute("lastSelectedType"))
this._list.selectedItem = item;
}
this._selectLastSelectedType();
},
_getVisibleTypes: function() {
@ -1036,6 +1036,25 @@ var gApplicationsPane = {
}
},
_selectLastSelectedType: function() {
// If the list is disabled by the pref.downloads.disable_button.edit_actions
// preference being locked, then don't select the type, as that would cause
// it to appear selected, with a different background and an actions menu
// that makes it seem like you can choose an action for the type.
if (this._list.disabled)
return;
var lastSelectedType = this._list.getAttribute("lastSelectedType");
if (!lastSelectedType)
return;
var item = this._list.getElementsByAttribute("type", lastSelectedType)[0];
if (!item)
return;
this._list.selectedItem = item;
},
/**
* Whether or not the given handler app is valid.
*
@ -1382,8 +1401,9 @@ var gApplicationsPane = {
// Mark which item in the list was last selected so we can reselect it
// when we rebuild the list or when the user returns to the prefpane.
onSelectionChanged: function() {
this._list.setAttribute("lastSelectedType",
this._list.selectedItem.getAttribute("type"));
if (this._list.selectedItem)
this._list.setAttribute("lastSelectedType",
this._list.selectedItem.getAttribute("type"));
},
_getIconURLForPreferredAction: function(aHandlerInfo) {

View File

@ -69,6 +69,9 @@
<preference id="browser.feeds.handlers.webservice"
name="browser.feeds.handlers.webservice"
type="string"/>
<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://browser/content/preferences/applications.js"/>
@ -88,9 +91,9 @@
<separator class="thin"/>
<richlistbox id="handlersView" orient="vertical"
onselect="gApplicationsPane.onSelectionChanged();"
persist="lastSelectedType">
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
preference="pref.downloads.disable_button.edit_actions"
onselect="gApplicationsPane.onSelectionChanged();">
<listheader equalsize="always" style="border: 0; padding: 0;">
<treecol id="typeColumn" label="&typeColumn.label;" value="type"
accesskey="&typeColumn.accesskey;" persist="sortDirection"