Module: deluge
Branch: 1.3-stable
Commit: 35128cf18f11f744ea736df48aa914445b0fbeac

Author: Damien Churchill <[email protected]>
Date:   Thu Jul  1 14:21:37 2010 +0100

more improvements to the shift select

---

 .../ext-extensions/tree/MultiSelectionModelFix.js  |   23 +++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js 
b/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
index d699cce..943cd9c 100644
--- a/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
+++ b/deluge/ui/web/js/ext-extensions/tree/MultiSelectionModelFix.js
@@ -48,6 +48,9 @@ Ext.override(Ext.tree.MultiSelectionModel, {
                        var fi = parentNode.indexOf(node),
                                li = parentNode.indexOf(this.lastSelNode);
 
+                       // Select the last clicked node and wipe old selections
+                       this.select(this.lastSelNode, e, false, true);
+
                        // Swap the values if required
                        if (fi > li) {
                                fi = fi + li, li = fi - li, fi = fi - li;
@@ -57,7 +60,7 @@ Ext.override(Ext.tree.MultiSelectionModel, {
                        parentNode.eachChild(function(n) {
                                var i = parentNode.indexOf(n);
                                if (fi < i && i < li) {
-                                       this.select(n, e, true);
+                                       this.select(n, e, true, true);
                                }
                        }, this);
 
@@ -66,6 +69,24 @@ Ext.override(Ext.tree.MultiSelectionModel, {
                } else {
                        this.select(node, e, e.ctrlKey);
                }
+       },
+
+       select: function(node, e, keepExisting, suppressEvent) {
+               if(keepExisting !== true){
+                       this.clearSelections(true);
+               }         
+               if(this.isSelected(node)){
+                       this.lastSelNode = node;
+                       return node;
+               }         
+               this.selNodes.push(node);
+               this.selMap[node.id] = node;
+               this.lastSelNode = node;
+               node.ui.onSelectedChange(true);
+               if (suppressEvent !== true) {
+                       this.fireEvent('selectionchange', this, this.selNodes);
+               }
+        return node;
        }
 
 })

-- 
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.

Reply via email to