diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-06-17 08:04:13 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-06-17 08:04:13 +0000 |
commit | 5eca837c7b35dc6c7a22d32e482399c897f0a566 (patch) | |
tree | 99e213d0dad916335c4092b9b958bdb60340c402 | |
parent | 3d87e7f7150c40fb4434bb4be05665da0a8915dc (diff) | |
download | sequelpro-5eca837c7b35dc6c7a22d32e482399c897f0a566.tar.gz sequelpro-5eca837c7b35dc6c7a22d32e482399c897f0a566.tar.bz2 sequelpro-5eca837c7b35dc6c7a22d32e482399c897f0a566.zip |
• if a text string is dragged on tab this tab will be selected and the corresponding db doc switches to Custom Query editor to be able eg to drag a query from one tab to another one
-rw-r--r-- | Frameworks/PSMTabBar/PSMTabBarControl.m | 8 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.h | 1 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 8 |
3 files changed, 16 insertions, 1 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 5b72f1e6..fdd30396 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -305,7 +305,7 @@ { delegate = object; - NSMutableArray *types = [NSMutableArray arrayWithObject:@"PSMTabBarControlItemPBType"]; + NSMutableArray *types = [NSMutableArray arrayWithObjects:@"PSMTabBarControlItemPBType", NSStringPboardType,nil]; //Update the allowed drag types if ([self delegate] && [[self delegate] respondsToSelector:@selector(allowedDraggedTypesForTabView:)]) { @@ -1499,6 +1499,12 @@ userInfo:sender repeats:NO] retain]; } + //If user drags a text string to a tab switch to Custom Query Editor + if (![[[cell representedObject] identifier] isCustomQuerySelected] + && [[[sender draggingPasteboard] types] indexOfObject:NSStringPboardType] != NSNotFound) { + [[[cell representedObject] identifier] performSelector:@selector(viewQuery:) withObject:nil]; + NSLog(@"A"); + } } return NSDragOperationCopy; } diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index 3ca3ad6f..7ce9d573 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -312,6 +312,7 @@ - (IBAction)viewRelations:(id)sender; - (IBAction)viewTriggers:(id)sender; - (IBAction)addConnectionToFavorites:(id)sender; +- (BOOL)isCustomQuerySelected; // Titlebar methods - (void)setStatusIconToImageWithName:(NSString *)imagePath; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index c5381114..a36591e8 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3469,6 +3469,14 @@ } /** + * Return YES if Custom Query is active. + */ +- (BOOL)isCustomQuerySelected +{ + return [[self selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarCustomQuery]; +} + +/** * Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required. */ - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo |