Adium

Changeset 24109

Show
Ignore:
Timestamp:
06/30/2008 10:26:08 AM (5 months ago)
Author:
evands
Message:

Fixed drag&drop to the bottom of groups. This bug has been around forever. Round of applause to jas8522 for superb steps to reproduce which made this easy to fix :) Fixes #10257

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/AIListController.m

    r24010 r24109  
    576576                        if (!item && [[adium contactController] useContactListGroups]) { 
    577577                                /* The user is hovering on the contact list itself. 
    578                                  * If groups are shown at all, assuming we have any items in the list at all, she is hovering just below 
    579                                  * a group or an item in a group. 
    580                                  * Do this right by shifting the drop to object above. 
     578                                 * If groups are shown at all, assuming we have any items in the list at all, she is hovering near but not in a group. 
     579                                 *   If (index > 0), the drag is below the end of a group. That group is at (index - 1) in the outline view's root. 
     580                                 *   If (index == 0), the drag is at the very top of the contact list. 
     581                                 * Do this right by shifting the drop to that group. 
     582                                 * 
     583                                 *  
    581584                                 */ 
    582                                 id itemAboveProposedIndex = [outlineView itemAtRow:(index - 1)]; 
    583                                 if (!itemAboveProposedIndex) { 
    584                                         //At the very end, presumably 
    585                                        itemAboveProposedIndex = [outlineView itemAtRow:([outlineView numberOfRows] - 1)]; 
    586                                 } 
    587                                  
    588                                 if ([itemAboveProposedIndex isKindOfClass:[AIListGroup class]]) { 
    589                                         [outlineView setDropItem:itemAboveProposedIndex dropChildIndex:NSOutlineViewDropOnItemIndex]; 
    590                                 } else { 
    591                                         [outlineView setDropItem:[itemAboveProposedIndex containingObject] dropChildIndex:NSOutlineViewDropOnItemIndex];                                         
    592                                 } 
    593                                  
     585                                id itemAboveProposedIndex = [[outlineView dataSource] outlineView:outlineView 
     586                                                                                                                                                       child:((index > 0) ? (index - 1) : 0) 
     587                                                                                                                                                  ofItem:nil]; 
     588                                if (![itemAboveProposedIndex isKindOfClass:[AIListGroup class]]) 
     589                                       itemAboveProposedIndex = [itemAboveProposedIndex containingObject]; 
     590 
     591                                index = ((index > 0) ? 
     592                                                [[outlineView dataSource] outlineView:outlineView numberOfChildrenOfItem:itemAboveProposedIndex] : 
     593                                                NSOutlineViewDropOnItemIndex); 
     594 
     595                                [outlineView setDropItem:itemAboveProposedIndex 
     596                                                 dropChildIndex:index]; 
    594597                        } 
    595598                }