diff options
author | stuconnolly <stuart02@gmail.com> | 2010-12-11 21:52:44 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-12-11 21:52:44 +0000 |
commit | 1ddca4732c3aa46698b8fad25ce1294db3cd32fb (patch) | |
tree | 177ce5977ef37ea98ceae04bbce2f9ba73a0da4d /Source/SPCustomQuery.m | |
parent | 66f0041a06b8710cd3ed3b5ff2c8cbb54004efba (diff) | |
parent | cb2baf9cb4ce1e33e6756969b1f71eb0e011f2c8 (diff) | |
download | sequelpro-1ddca4732c3aa46698b8fad25ce1294db3cd32fb.tar.gz sequelpro-1ddca4732c3aa46698b8fad25ce1294db3cd32fb.tar.bz2 sequelpro-1ddca4732c3aa46698b8fad25ce1294db3cd32fb.zip |
Bring outlineview branch up to date with trunk (r2989:3005).
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r-- | Source/SPCustomQuery.m | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index ef38461c..e8420b7c 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -2342,6 +2342,13 @@ if([columnDefinition objectForKey:@"null"]) allowNULL = (![[columnDefinition objectForKey:@"null"] integerValue]); + [fieldEditor setEditedFieldInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [columnDefinition objectForKey:@"org_name"], @"colName", + [columnDefinition objectForKey:@"org_table"], @"tableName", + [self usedQuery], @"usedQuery", + @"query", @"tableSource", + nil]]; + [fieldEditor setTextMaxLength:fieldLength]; [fieldEditor setFieldType:(fieldType==nil) ? @"" : fieldType]; [fieldEditor setFieldEncoding:(fieldEncoding==nil) ? @"" : fieldEncoding]; @@ -2386,6 +2393,54 @@ #pragma mark TableView notifications /** + * Check triggering of Bundle command for row selection changes + */ +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + + // Check our notification object is our table content view + if ([aNotification object] != customQueryView) return; + + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + for(NSString* cmdPath in triggeredCommands) { + NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; + NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; + [aMenuItem setTag:0]; + [aMenuItem setToolTip:[data objectAtIndex:0]]; + + // For HTML output check if corresponding window already exists + BOOL stopTrigger = NO; + if([[data objectAtIndex:2] length]) { + BOOL correspondingWindowFound = NO; + NSString *uuid = [data objectAtIndex:2]; + for(id win in [NSApp windows]) { + if([[[[win delegate] class] description] isEqualToString:@"SPBundleHTMLOutputController"]) { + if([[[win delegate] windowUUID] isEqualToString:uuid]) { + correspondingWindowFound = YES; + break; + } + } + } + if(!correspondingWindowFound) stopTrigger = YES; + } + if(!stopTrigger) { + if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { + if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; + } + } + } + +} + +/** * Saves the new column size in the preferences for columns which map to fields */ - (void)tableViewColumnDidResize:(NSNotification *)aNotification |