aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-03-17 23:03:25 +0000
committerstuconnolly <stuart02@gmail.com>2012-03-17 23:03:25 +0000
commitbe3263f8158cb6f3dfa1005f49beefa7e494b852 (patch)
tree07aee34c6e5fff1cfe693b38195b2232a054196a
parente2fbd102c251671d42c33c5e748ceb06c4926ceb (diff)
downloadsequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.tar.gz
sequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.tar.bz2
sequelpro-be3263f8158cb6f3dfa1005f49beefa7e494b852.zip
Fix drag and drop of items that aren't selected.
-rw-r--r--Source/SPConnectionController.h1
-rw-r--r--Source/SPConnectionControllerDelegate.m16
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj2
3 files changed, 11 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) {
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index f6620f05..3caecf65 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -760,6 +760,7 @@
17B7B698101611C800F057DE /* build-mysql-client.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "build-mysql-client.sh"; sourceTree = "<group>"; };
17C058860FC9FC390077E9CF /* SPNarrowDownCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPNarrowDownCompletion.h; sourceTree = "<group>"; };
17C058870FC9FC390077E9CF /* SPNarrowDownCompletion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPNarrowDownCompletion.m; sourceTree = "<group>"; };
+ 17C265C114F175CD00371D7C /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
17CC97F110B4ABE90034CD7A /* SPAboutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPAboutController.h; sourceTree = "<group>"; };
17CC97F210B4ABE90034CD7A /* SPAboutController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPAboutController.m; sourceTree = "<group>"; };
17CC97F610B4AC6C0034CD7A /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Interfaces/English.lproj/AboutPanel.xib; sourceTree = "<group>"; };
@@ -2378,6 +2379,7 @@
2A37F4AAFDCFA73011CA2CEA /* sequel-pro */ = {
isa = PBXGroup;
children = (
+ 17C265C114F175CD00371D7C /* LICENSE */,
1791346512F75CC1000B27C1 /* README */,
17E641420EF01E8A001BC333 /* Source */,
380F4EF20FC0B67A00B0BFD7 /* Unit Tests */,