Bug 351263 - Dialog steals focus while navigating combobox in subscription options on feed preview pane. r=mconnor.

git-svn-id: svn://10.0.0.236/trunk@209367 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla.mano%sent.com
2006-09-07 18:57:34 +00:00
parent da4de1402a
commit 9602472e98

View File

@@ -347,6 +347,10 @@ FeedWriter.prototype = {
return "moz-icon://" + urlSpec + "?size=16";
},
/**
* Displays a prompt from which the user may choose a (client) feed reader.
* @return - true if a feed reader was selected, false otherwise.
*/
_chooseClientApp: function FW__chooseClientApp() {
try {
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
@@ -382,15 +386,14 @@ FeedWriter.prototype = {
// Show and select the selected application menuitem
selectedAppMenuItem.wrappedJSObject.hidden = false;
selectedAppMenuItem.doCommand();
return;
return true;
}
}
}
}
catch(ex) { }
// Select the (per-prefs) selected handler if no application was selected
this._setSelectedHandler();
return false;
},
_setAlwaysUseCheckedState: function FW__setAlwaysUseCheckedState() {
@@ -428,16 +431,29 @@ FeedWriter.prototype = {
return;
}
if (event.type == "command") {
switch(event.target.id) {
case "subscribeButton":
this.subscribe();
break;
case "chooseApplicationMenuItem":
this._chooseClientApp();
break;
default:
this._setAlwaysUseLabel();
switch(event.type) {
case "command" : {
switch(event.target.id) {
case "subscribeButton":
this.subscribe();
break;
case "chooseApplicationMenuItem":
// For keyboard-only users, we only show the file picker once the
// subscribe button is pressed. See click event handling for the
// mouse-case.
break;
default:
this._setAlwaysUseLabel();
}
break;
}
case "click": {
if (event.target.id == "chooseApplicationMenuItem") {
if (!this._chooseClientApp()) {
// Select the (per-prefs) selected handler if no application was selected
this._setSelectedHandler();
}
}
}
}
},
@@ -599,6 +615,7 @@ FeedWriter.prototype = {
menuItem = this._document.createElementNS(XUL_NS, "menuitem");
menuItem.id = "chooseApplicationMenuItem";
menuItem.setAttribute("label", this._getString("chooseApplicationMenuItem"));
menuItem.addEventListener("click", this, false);
handlersMenuPopup.appendChild(menuItem);
// separator
@@ -748,10 +765,21 @@ FeedWriter.prototype = {
var useAsDefault = this._document.getElementById("alwaysUse")
.getAttribute("checked");
var selectedHandler = this._document.getElementById("handlersMenuList")
.wrappedJSObject.selectedItem;
if (selectedHandler.hasAttribute("webhandlerurl")) {
var webURI = selectedHandler.getAttribute("webhandlerurl");
var selectedItem = this._document.getElementById("handlersMenuList")
.wrappedJSObject.selectedItem;
// Show the file picker before subscribing if the
// choose application menuitem was choosen using the keyboard
if (selectedItem.id == "chooseApplicationMenuItem") {
if (!this._chooseClientApp())
return;
selectedItem = this._document.getElementById("handlersMenuList")
.wrappedJSObject.selectedItem;
}
if (selectedItem.hasAttribute("webhandlerurl")) {
var webURI = selectedItem.getAttribute("webhandlerurl");
prefs.setCharPref(PREF_SELECTED_READER, "web");
prefs.setCharPref(PREF_SELECTED_WEB, webURI);
@@ -768,14 +796,14 @@ FeedWriter.prototype = {
}
}
else {
switch (selectedHandler.id) {
switch (selectedItem.id) {
case "selectedAppMenuItem":
#ifdef XP_WIN
case "defaultHandlerMenuItem":
#endif
prefs.setCharPref(PREF_SELECTED_READER, "client");
prefs.setComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile,
selectedHandler.file);
selectedItem.file);
break;
case "liveBookmarksMenuItem":
defaultHandler = "bookmarks";