diff options
author | stuconnolly <stuart02@gmail.com> | 2012-03-17 23:03:25 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-03-17 23:03:25 +0000 |
commit | be3263f8158cb6f3dfa1005f49beefa7e494b852 (patch) | |
tree | 07aee34c6e5fff1cfe693b38195b2232a054196a /Source | |
parent | e2fbd102c251671d42c33c5e748ceb06c4926ceb (diff) | |
download | sequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.tar.gz sequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.tar.bz2 sequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.zip |
Fix drag and drop of items that aren't selected.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConnectionController.h | 1 | ||||
-rw-r--r-- | Source/SPConnectionControllerDelegate.m | 16 |
2 files changed, 9 insertions, 8 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index a069253b..e8ee5e9d 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -172,6 +172,7 @@ BOOL favoriteNameFieldWasTouched; #ifndef SP_REFACTOR /* ivars */ + NSArray *draggedNodes; NSImage *folderImage; SPTreeNode *favoritesRoot; diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index 5230ff5a..c0bdf5d8 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -168,12 +168,14 @@ static NSString *SPDatabaseImage = @"database-small"; return NO; } - + [pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:self]; - //[pboard setData:[NSKeyedArchiver archivedDataWithRootObject:items] forType:SPFavoritesPasteboardDragType]; - [pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType]; + + BOOL result = [pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType]; - return YES; + draggedNodes = items; + + return result; } - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index @@ -213,11 +215,9 @@ static NSString *SPDatabaseImage = @"database-small"; [menuItem setState:NSOffState]; } - NSArray *nodes = [self selectedFavoriteNodes]; - - //NSArray *nodes = [NSKeyedUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:SPFavoritesPasteboardDragType]]; + NSArray *nodes = draggedNodes; - //if (![nodes count]) return acceptedDrop; + if (![nodes count]) return acceptedDrop; if ([node isGroup]) { if (index == NSOutlineViewDropOnItemIndex) { |