bug 395138: show types set to 'always ask' in Applications prefpane; r=gavin, a=mconnor
--- a/browser/components/preferences/applications.js
+++ b/browser/components/preferences/applications.js
@@ -954,24 +954,16 @@ var gApplicationsPane = {
continue;
// Hide types handled only by disabled plugins.
// FIXME: we should show these types to give the user a chance to reenable
// the plugins. Filed as bug 395136.
if (handlerInfo.handledOnlyByPlugin && handlerInfo.isDisabledPluginType)
continue;
- // Don't display entries for types we always ask about before handling.
- // FIXME: that's what the old code did, but we should be showing these
- // types and letting users choose to do something different. Filed as
- // bug 395138.
- if (handlerInfo.alwaysAskBeforeHandling &&
- handlerInfo.type != TYPE_MAYBE_FEED)
- continue;
-
// If the user is filtering the list, then only show matching types.
if (this._filter.value && !this._matchesFilter(handlerInfo))
continue;
// We couldn't find any reason to exclude the type, so include it.
visibleTypes.push(handlerInfo);
}
@@ -992,22 +984,25 @@ var gApplicationsPane = {
* violate the separation of model and view, but it might make more sense
* nonetheless (f.e. it would make sortTypes easier).
*
* @param aHandlerInfo {nsIHandlerInfo} the type whose preferred action
* is being described
*/
_describePreferredAction: function(aHandlerInfo) {
// alwaysAskBeforeHandling overrides the preferred action, so if that flag
- // is set, then describe that behavior instead. Currently we hide all types
- // with alwaysAskBeforeHandling except for the feed type, so here we use
- // a feed-specific message to describe the behavior.
- if (aHandlerInfo.alwaysAskBeforeHandling)
- return this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
+ // is set, then describe that behavior instead. For most types, this is
+ // the "alwaysAsk" string, but for the feed type we show something special.
+ if (aHandlerInfo.alwaysAskBeforeHandling) {
+ if (aHandlerInfo.type == TYPE_MAYBE_FEED)
+ return this._prefsBundle.getFormattedString("previewInApp",
+ [this._brandShortName]);
+ else
+ return this._prefsBundle.getString("alwaysAsk");
+ }
switch (aHandlerInfo.preferredAction) {
case Ci.nsIHandlerInfo.saveToDisk:
return this._prefsBundle.getString("saveFile");
case Ci.nsIHandlerInfo.useHelperApp:
var preferredApp = aHandlerInfo.preferredApplicationHandler;
if (preferredApp instanceof Ci.nsILocalHandlerApp)
@@ -1098,29 +1093,35 @@ var gApplicationsPane = {
var menu =
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
var menuPopup = menu.firstChild;
// Clear out existing items.
while (menuPopup.hasChildNodes())
menuPopup.removeChild(menuPopup.lastChild);
- // If this is the feed type, add Preview in Firefox and Live Bookmarks items.
- if (handlerInfo.type == TYPE_MAYBE_FEED) {
+ {
var askMenuItem = document.createElementNS(kXULNS, "menuitem");
askMenuItem.setAttribute("alwaysAsk", "true");
- let label = this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
+ let label;
+ if (handlerInfo.type == TYPE_MAYBE_FEED)
+ label = this._prefsBundle.getFormattedString("previewInApp",
+ [this._brandShortName]);
+ else
+ label = this._prefsBundle.getString("alwaysAsk");
askMenuItem.setAttribute("label", label);
menuPopup.appendChild(askMenuItem);
+ }
+ // If this is the feed type, add a Live Bookmarks item.
+ if (handlerInfo.type == TYPE_MAYBE_FEED) {
var internalMenuItem = document.createElementNS(kXULNS, "menuitem");
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
- label = this._prefsBundle.getFormattedString("liveBookmarksInApp",
- [this._brandShortName]);
+ let label = this._prefsBundle.getFormattedString("liveBookmarksInApp",
+ [this._brandShortName]);
internalMenuItem.setAttribute("label", label);
internalMenuItem.setAttribute("image", ICON_URL_LIVEMARK);
menuPopup.appendChild(internalMenuItem);
// Add a separator to distinguish these items from the helper app items
// that follow them.
let menuItem = document.createElementNS(kXULNS, "menuseparator");
menuPopup.appendChild(menuItem);
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -45,16 +45,17 @@ chooseDownloadFolderTitle=Choose Downloa
#### Applications
fileEnding=%S file
saveFile=Save File
chooseApp=Choose application...
fpTitleChooseApp=Select Helper Application
webFeed=Web Feed
+alwaysAsk=Always ask
# LOCALIZATION NOTE (pluginName):
# %1$S = plugin name (for example "QuickTime Plugin-in 7.2")
# %2$S = brandShortName from brand.properties (for example "Minefield")
pluginName=%S (in %S)
# LOCALIZATION NOTE (previewInApp, liveBookmarksInApp): %S = brandShortName
previewInApp=Preview in %S