diff options
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 |