diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index ca294b28..e454aef9 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -1125,6 +1125,7 @@ var KeyboardActions = actions.Actions({ editKeyBinding: ['- Interface/Key mapping...', widgets.makeUIDialog(function(mode, code){ var that = this + var abort = false // list the keys (cache)... var keys = that.keyboard.keys(code) @@ -1149,6 +1150,12 @@ var KeyboardActions = actions.Actions({ make.ConfirmAction('Delete', { callback: function(){ dialog.close() }, timeout: that.config['confirm-delete-timeout'] || 2000, + buttons: [ + ['Cancel', function(){ + abort = true + make.dialog.close() + }], + ], }) }, { @@ -1158,6 +1165,10 @@ var KeyboardActions = actions.Actions({ // XXX at this point this does not account for changes // in mode or code... .on('close', function(){ + if(abort){ + return + } + // remove keys... orig_keys .filter(function(k){ return keys.indexOf(k) < 0 }) @@ -1180,6 +1191,7 @@ var KeyboardActions = actions.Actions({ editKeyboardMode: ['- Interface/Mode...', widgets.makeUIDialog(function(mode){ var that = this + var abort = false var dialog = browse.makeLister(null, function(path, make){ @@ -1198,6 +1210,12 @@ var KeyboardActions = actions.Actions({ dialog.close() }, timeout: that.config['confirm-delete-timeout'] || 2000, + buttons: [ + ['Cancel', function(){ + abort = true + make.dialog.close() + }], + ], }) }, { @@ -1206,33 +1224,20 @@ var KeyboardActions = actions.Actions({ return dialog })], + // XXX BUG: for some reason we are adding one key at a time only... // XXX revise: // - '*' toggle // - done/cancel editKeyboardModeDroppedKeys: ['- Interface/Dropped keys...', widgets.makeUIDialog(function(mode){ var that = this - //var abort = false - var abort = true - var drop = that.keybindings[mode].drop || [] + var abort = false + var drop = (that.keybindings[mode].drop || []).slice() return browse.makeLister(null, function(path, make){ var drop_all - // '*' toggler... - // XXX should this close the dialog??? - make.ConfirmAction('Drop all keys', { - callback: function(){ - drop_all = '*' - - make.dialog.close() - }, - timeout: that.config['confirm-delete-timeout'] || 2000, - }) - - make('---') - // the list editor... make.EditableList(function(keys){ // get... @@ -1248,24 +1253,24 @@ var KeyboardActions = actions.Actions({ unique: true }) - make('---') + make.Separator() - //make.Action('Cancel') - // .on('open', function(){ - // abort = true - // make.dialog.close() - // }) - make.Action('Done', { + // '*' toggler... + // XXX should this close the dialog??? + make.ConfirmAction('Drop all keys', { + callback: function(){ + drop_all = '*' + + make.dialog.close() + }, + timeout: that.config['confirm-delete-timeout'] || 2000, buttons: [ ['Cancel', function(){ + abort = true make.dialog.close() }], - ]}) - .on('open', function(){ - abort = false - make.dialog.close() - }) - + ], + }) }) .on('close', function(){ if(!abort){ diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index 8e7cf889..3f2e6e0a 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -274,7 +274,7 @@ function(list, options){ : list var editable = lst instanceof Array // view objects... - lst = !editable ? Object.keys(lst) : lst.slice() + lst = !editable ? Object.keys(lst) : lst // add the 'x' button if not disabled... var buttons = options.buttons = (options.buttons || []).slice() @@ -339,7 +339,7 @@ function(list, options){ : undefined) } - write(list, lst) + lst = write(list, lst) // update list and select new value... dialog.update()