1
0
Fork 0
forked from 0x2620/oxjs

allow menu item to trigger native file dialog when pressing enter

This commit is contained in:
rlx 2012-03-24 11:04:27 +00:00
commit 826eb5548d
3 changed files with 22 additions and 7 deletions

View file

@ -439,9 +439,14 @@ Ox.Menu = function(options, self) {
function selectItem(position) {
var item;
if (self.options.selected > -1) {
//Ox.Log('Menu', 's.o.s', self.options.selected, that.items)
item = that.items[self.options.selected]
item && item.removeClass('OxSelected');
item = that.items[self.options.selected];
if (item) {
item.removeClass('OxSelected');
if (item.options('file')) {
item.$button.blurButton();
that.bindEvent({key_enter: clickSelectedItem})
}
}
/* disabled
that.triggerEvent('deselect', {
id: item.options('id'),
@ -457,15 +462,17 @@ Ox.Menu = function(options, self) {
return false;
}
});
item.options('items').length && that.submenus[item.options('id')].showMenu(); // fixme: do we want to switch to this style?
item.options('items').length && that.submenus[item.options('id')].showMenu();
item.addClass('OxSelected');
///* disabled
if (item.options('file')) {
item.$button.focusButton();
that.unbindEvent('key_enter');
}
that.triggerEvent('select', {
id: item.options('id'),
title: Ox.isString(item.options('title')[0])
? Ox.stripTags(item.options('title')[0]) : ''
});
//*/
}
self.options.selected = position;
}