Changeset 1060

Show
Ignore:
Timestamp:
2008-08-21 09:18:23 (3 months ago)
Author:
MaierMan
Message:

refreshTools() enables/disabled "move" items gracefully

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/dta/manager/tree.js

    r1027 r1060  
    529529                try { 
    530530                        let empty = this.current == null; 
    531                         for each (let o in $('info', 'remove', 'movetop', 'moveup', 'movedown', 'movebottom', 'toolmovetop', 'toolmoveup', 'toolmovedown', 'toolmovebottom')) { 
    532                                 o.setAttribute('disabled', empty); 
    533                         } 
    534531                                 
    535532                        let states = { 
     
    538535                                is: function(s) this._state & s,   
    539536                                isOf: QueueItem.prototype.isOf, 
    540                                 count: this.selection.count 
     537                                count: this.selection.count, 
     538                                rows: this.rowCount, 
     539                                min: this.rowCount, 
     540                                max: 0 
    541541                        }; 
    542542                        for (let d in this.selected) { 
    543543                                states._state |= d.state; 
    544544                                states.resumable |= d.resumable; 
     545                                states.min = Math.min(d.position, states.min); 
     546                                states.max = Math.max(d.position, states.max); 
    545547                        } 
    546548                        let cur = this.current; 
     
    571573                        modifySome($('export'), function(d) !!d.count); 
    572574                        modifySome($('addchunk', 'removechunk', 'force'), function(d) d.isOf(QUEUED, RUNNING, PAUSED, CANCELED)); 
     575                        modifySome($('movetop', 'moveup', 'toolmovetop', 'toolmoveup'), function(d) d.min > 0);  
     576                        modifySome($('movedown', 'movebottom', 'toolmovedown', 'toolmovebottom'), function(d) d.max != d.rows - 1);   
    573577                } 
    574578                catch (ex) {