| 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 | * |
|---|
| 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]; |
|---|