Bug 877467 - List API for prompt.jsm should take a flat list. r=mfinkle

This commit is contained in:
Wes Johnston 2013-06-03 09:20:43 -07:00
parent 9947e1b83f
commit 225ef0ead5

View File

@ -112,17 +112,13 @@ Prompt.prototype = {
this.callback(data);
},
_setListItems: function(aItems, aInGroup) {
_setListItems: function(aItems) {
let hasSelected = false;
if (!aInGroup)
this.msg.listitems = [];
aItems.forEach(function(item) {
let obj = { id: item.id };
if (aInGroup !== undefined)
obj.inGroup = aInGroup;
obj.label = item.label;
if (item.disabled)
@ -136,19 +132,17 @@ Prompt.prototype = {
this.msg.selected[this.msg.listitems.length] = item.selected;
}
if (item.children) {
if (item.header)
obj.isGroup = true;
} else if (item.submenu) {
if (item.menu)
obj.isParent = true;
}
// Order matters in the java message, so make sure we add the obj
// to the list before we add its children
if (item.child)
obj.inGroup = true;
this.msg.listitems.push(obj);
if (item.children)
this._setListItems(item.children, true);
}, this);
return this;
},