Module: deluge Branch: master Commit: c45583e8e768c2db5ea8015d46b0929f38443060
Author: Damien Churchill <[email protected]> Date: Wed Apr 28 17:46:21 2010 +0100 enable and disable the panel toolbar buttons upon selection change --- deluge/plugins/execute/execute/data/execute.js | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/deluge/plugins/execute/execute/data/execute.js b/deluge/plugins/execute/execute/data/execute.js index 0e6b3b1..c6d31da 100644 --- a/deluge/plugins/execute/execute/data/execute.js +++ b/deluge/plugins/execute/execute/data/execute.js @@ -182,6 +182,7 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { singleSelect: true, autoExpandColumn: 'name' }); + this.list.on('selectionchange', this.onSelectionChange, this); this.panel = this.add({ items: [this.list], @@ -195,12 +196,14 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { text: _('Edit'), iconCls: 'icon-edit', handler: this.onEditClick, - scope: this + scope: this, + disabled: true }, '->', { text: _('Remove'), iconCls: 'icon-remove', handler: this.onRemoveClick, - scope: this + scope: this, + disabled: true }] } }); @@ -256,6 +259,16 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { }, scope: this }); + }, + + onSelectionChange: function(dv, selections) { + if (selections.length) { + this.panel.getBottomToolbar().items.get(1).enable(); + this.panel.getBottomToolbar().items.get(3).enable(); + } else { + this.panel.getBottomToolbar().items.get(1).disable(); + this.panel.getBottomToolbar().items.get(3).disable(); + } } }); -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
