Bug 877467 - Use a flat list when showing prompts. r=mfinkle

This commit is contained in:
Wes Johnston 2013-06-04 14:38:01 -07:00
parent 4b1dd6e019
commit 66654705cf

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 = [];
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;
},