Fix bug in browser context menu where proper clicked column was not taken into account.
authorMiltiadis Vasilakis <mvasilak@gmail.com>
Fri, 13 Apr 2012 00:27:26 +0000 (03:27 +0300)
committerMiltiadis Vasilakis <mvasilak@gmail.com>
Fri, 13 Apr 2012 00:27:26 +0000 (03:27 +0300)
pithos-macos/PithosBrowserController.m

index b8d04d3..1ab581a 100644 (file)
@@ -2149,15 +2149,26 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         NSInteger column = [browser clickedColumn];
         NSInteger row = [browser clickedRow];
         if ((column == -1) || (row == -1)) {
-            // General context menu
-            NSArray *menuNodesIndexPaths = [browser selectionIndexPaths];
-            if ([menuNodesIndexPaths count] == 0) {
-                menuNode = [browser parentForItemsInColumn:0];
-            } else if (([menuNodesIndexPaths count] != 1) || 
-                       ([[browser itemAtIndexPath:[menuNodesIndexPaths objectAtIndex:0]] class] == [PithosObjectNode class])) {
-                menuNode = [browser parentForItemsInColumn:([[menuNodesIndexPaths objectAtIndex:0] length] - 1)];
+            if (column == -1) {
+                // General context menu
+                NSArray *menuNodesIndexPaths = [browser selectionIndexPaths];
+                if ([menuNodesIndexPaths count] == 0) {
+                    menuNode = [browser parentForItemsInColumn:0];
+                } else if (([menuNodesIndexPaths count] != 1) || 
+                           ([[browser itemAtIndexPath:[menuNodesIndexPaths objectAtIndex:0]] class] == [PithosObjectNode class])) {
+                    menuNode = [browser parentForItemsInColumn:([[menuNodesIndexPaths objectAtIndex:0] length] - 1)];
+                } else {
+                    menuNode = [browser itemAtIndexPath:[menuNodesIndexPaths objectAtIndex:0]];
+                }
             } else {
-                menuNode = [browser itemAtIndexPath:[menuNodesIndexPaths objectAtIndex:0]];
+                menuNode = [browser parentForItemsInColumn:column];
+                if ([menuNode class] == [PithosObjectNode class]) {
+                    // Node context menu
+                    menuNodes = [NSMutableArray arrayWithObject:menuNode];
+                    nodeContextMenu = YES;
+                }
+                // else 
+                // General context menu
             }
         } else {
             // Node context menu