support enabled and separator properties in the model

This commit is contained in:
Marco Martin 2011-12-27 20:10:24 +01:00
parent 8bad802a44
commit e56a6149f5

View File

@ -80,11 +80,21 @@ Menu {
} }
if (model != undefined) { if (model != undefined) {
for (var j = 0; j < model.count; ++j) { for (var j = 0; j < model.count; ++j) {
var text = model.get(j).text var data = model.get(j)
var text = data.text
if (!text) { if (!text) {
text = model.get(j).display text = data.display
} }
addMenuItem(text) addMenuItem(text)
//enabled property must be present -and- be false
if (data.enabled === false) {
items[items.length-1].enabled = false
}
if (data.separator === true) {
items[items.length-1].separator = true
}
} }
} }
} }