diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-02-26 22:41:56 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-02-26 22:41:56 +0000 |
commit | b91ee5c9ee79e2407b85155748ad35d698cca574 (patch) | |
tree | 4adbbb51e212013fbcd07d7b73047dd6ec0e4374 /Source/TableDocument.m | |
parent | 947cb3e7725ee0e67cd0b2a22c34c5c1122d6cc3 (diff) | |
download | sequelpro-b91ee5c9ee79e2407b85155748ad35d698cca574.tar.gz sequelpro-b91ee5c9ee79e2407b85155748ad35d698cca574.tar.bz2 sequelpro-b91ee5c9ee79e2407b85155748ad35d698cca574.zip |
• REPAIR, OPTIMIZE, ANALYZE, FLUSH, CHECKSUM now can be applied to more than one selected item in the TablesList; if no error alert OK, if not or for CHECKSUM list the output in a table view
- while sheet is open showing the accessory table user can press ⌘C for copying it
- added missing NSLocalizeStrings
• fixed a tiny issue for $SP_SELECTED_TABLES
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 369 |
1 files changed, 281 insertions, 88 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index d940e39a..69e3a337 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1929,8 +1929,6 @@ [alert setAccessoryView:statusTableAccessoryView]; [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; } - - } /** @@ -1938,17 +1936,26 @@ */ - (IBAction)analyzeTable:(id)sender { - MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"ANALYZE TABLE %@", [[self table] backtickQuotedString]]]; + + NSArray *selectedItems = [tablesListInstance selectedTableItems]; + id message = nil; + + if([selectedItems count] == 0) return; + + MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"ANALYZE TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]]; + + NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]]; // Check for errors, only displaying if the connection hasn't been terminated if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to analyze selected items", @"unable to analyze selected items message") : NSLocalizedString(@"Unable to analyze table", @"unable to analyze table message"); if ([mySQLConnection isConnected]) { - [[NSAlert alertWithMessageText:@"Unable to analyze table" + [[NSAlert alertWithMessageText:mText defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to analyze the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]] + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while analyzing the %@.\n\nMySQL said:%@",@"an error occurred while analyzing the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]] beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:NULL @@ -1958,24 +1965,47 @@ return; } - // Process result - NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; + NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary]; + BOOL statusOK = YES; + for(id res in result) { + if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) { + statusOK = NO; + break; + } + } - NSString *message = @""; + // Process result + if([selectedItems count] == 1) { + message = @""; - message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully analyzed table" : @"Analyze table failed."; + NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; - message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]]; + message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully analyzed table.",@"analyze table successfully passed message") : NSLocalizedString(@"Analyze table failed.", @"analyze table failed message"); - [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Analyze table '%@'", [self table]] - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:message] - beginSheetModalForWindow:tableWindow - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]]; + } else if(statusOK) { + message = NSLocalizedString(@"Successfully analyzed all selected items.",@"successfully analyzed all selected items message"); + } + + if(message) { + [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Analyze %@", what] + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message] + beginSheetModalForWindow:tableWindow + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; + } else { + message = NSLocalizedString(@"MySQL said:",@"mysql said message"); + statusValues = [result retain]; + NSAlert *alert = [[NSAlert new] autorelease]; + [alert setInformativeText:message]; + [alert setMessageText:NSLocalizedString(@"Error while analyzing selected items", @"error while analyzing selected items message")]; + [alert setAccessoryView:statusTableAccessoryView]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; + } } /** @@ -1983,17 +2013,26 @@ */ - (IBAction)optimizeTable:(id)sender { - MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"OPTIMIZE TABLE %@", [[self table] backtickQuotedString]]]; + + NSArray *selectedItems = [tablesListInstance selectedTableItems]; + id message = nil; + + if([selectedItems count] == 0) return; + + MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"OPTIMIZE TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]]; + + NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]]; // Check for errors, only displaying if the connection hasn't been terminated if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to optimze selected items", @"unable to optimze selected items message") : NSLocalizedString(@"Unable to optimze table", @"unable to optimze table message"); if ([mySQLConnection isConnected]) { - [[NSAlert alertWithMessageText:@"Unable to optimize table" + [[NSAlert alertWithMessageText:mText defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to optimize the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]] + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while optimzing the %@.\n\nMySQL said:%@",@"an error occurred while trying to optimze the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]] beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:NULL @@ -2003,24 +2042,47 @@ return; } + NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary]; + BOOL statusOK = YES; + for(id res in result) { + if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) { + statusOK = NO; + break; + } + } + // Process result - NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; + if([selectedItems count] == 1) { + message = @""; - NSString *message = @""; + NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; - message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully optimized table" : @"Optimize table failed."; + message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully optimized table.",@"optimize table successfully passed message") : NSLocalizedString(@"Optimize table failed.", @"optimize table failed message"); - message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]]; + message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]]; + } else if(statusOK) { + message = NSLocalizedString(@"Successfully optimized all selected items.",@"successfully optimized all selected items message"); + } - [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Optimize table '%@'", [self table]] - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:message] - beginSheetModalForWindow:tableWindow - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + if(message) { + [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Optimize %@", what] + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message] + beginSheetModalForWindow:tableWindow + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; + } else { + message = NSLocalizedString(@"MySQL said:",@"mysql said message"); + statusValues = [result retain]; + NSAlert *alert = [[NSAlert new] autorelease]; + [alert setInformativeText:message]; + [alert setMessageText:NSLocalizedString(@"Error while optimizing selected items", @"error while optimizing selected items message")]; + [alert setAccessoryView:statusTableAccessoryView]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; + } } /** @@ -2028,17 +2090,25 @@ */ - (IBAction)repairTable:(id)sender { - MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"REPAIR TABLE %@", [[self table] backtickQuotedString]]]; + NSArray *selectedItems = [tablesListInstance selectedTableItems]; + id message = nil; + + if([selectedItems count] == 0) return; + + MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"REPAIR TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]]; + + NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]]; // Check for errors, only displaying if the connection hasn't been terminated if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to repair selected items", @"unable to repair selected items message") : NSLocalizedString(@"Unable to repair table", @"unable to repair table message"); if ([mySQLConnection isConnected]) { - [[NSAlert alertWithMessageText:@"Unable to repair table" + [[NSAlert alertWithMessageText:mText defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to repair the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]] + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while repairing the %@.\n\nMySQL said:%@",@"an error occurred while trying to repair the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]] beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:NULL @@ -2048,24 +2118,47 @@ return; } + NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary]; + BOOL statusOK = YES; + for(id res in result) { + if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) { + statusOK = NO; + break; + } + } + // Process result - NSDictionary *result = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; + if([selectedItems count] == 1) { + message = @""; - NSString *message = @""; + NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; - message = ([[result objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? @"Successfully repaired table" : @"Repair table failed."; + message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully repaired table.",@"repair table successfully passed message") : NSLocalizedString(@"Repair table failed.", @"repair table failed message"); - message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [result objectForKey:@"Msg_text"]]; + message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]]; + } else if(statusOK) { + message = NSLocalizedString(@"Successfully repaired all selected items.",@"successfully repaired all selected items message"); + } - [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Repair table '%@'", [self table]] - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:message] - beginSheetModalForWindow:tableWindow - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + if(message) { + [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Repair %@", what] + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message] + beginSheetModalForWindow:tableWindow + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; + } else { + message = NSLocalizedString(@"MySQL said:",@"mysql said message"); + statusValues = [result retain]; + NSAlert *alert = [[NSAlert new] autorelease]; + [alert setInformativeText:message]; + [alert setMessageText:NSLocalizedString(@"Error while repairing selected items", @"error while repairing selected items message")]; + [alert setAccessoryView:statusTableAccessoryView]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; + } } /** @@ -2073,35 +2166,75 @@ */ - (IBAction)flushTable:(id)sender { - [mySQLConnection queryString:[NSString stringWithFormat:@"FLUSH TABLE %@", [[self table] backtickQuotedString]]]; + NSArray *selectedItems = [tablesListInstance selectedTableItems]; + id message = nil; + + if([selectedItems count] == 0) return; + + MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"FLUSH TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]]; + + NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]]; // Check for errors, only displaying if the connection hasn't been terminated if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { + NSString *mText = ([selectedItems count]>1) ? NSLocalizedString(@"Unable to flush selected items", @"unable to flush selected items message") : NSLocalizedString(@"Unable to flush table", @"unable to flush table message"); if ([mySQLConnection isConnected]) { - [[NSAlert alertWithMessageText:@"Unable to flush table" + [[NSAlert alertWithMessageText:mText defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while trying to flush the table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]] + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while flushing the %@.\n\nMySQL said:%@",@"an error occurred while trying to flush the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]] beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:NULL - contextInfo:NULL]; + contextInfo:NULL]; } return; } - [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Flush table '%@'", [self table]] - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:@"Table was successfully flushed"] - beginSheetModalForWindow:tableWindow - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary]; + BOOL statusOK = YES; + for(id res in result) { + if(![[res objectForKey:@"Msg_type"] isEqualToString:@"status"]) { + statusOK = NO; + break; + } + } + + // Process result + if([selectedItems count] == 1) { + message = @""; + + NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; + + message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully flushed table.",@"flush table successfully passed message") : NSLocalizedString(@"Flush table failed.", @"flush table failed message"); + + message = [NSString stringWithFormat:@"%@\n\nMySQL said: %@", message, [lastresult objectForKey:@"Msg_text"]]; + } else if(statusOK) { + message = NSLocalizedString(@"Successfully flushed all selected items.",@"successfully flushed all selected items message"); + } + + if(message) { + [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Flush %@", what] + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message] + beginSheetModalForWindow:tableWindow + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; + } else { + message = NSLocalizedString(@"MySQL said:",@"mysql said message"); + statusValues = [result retain]; + NSAlert *alert = [[NSAlert new] autorelease]; + [alert setInformativeText:message]; + [alert setMessageText:NSLocalizedString(@"Error while flushing selected items", @"error while flushing selected items message")]; + [alert setAccessoryView:statusTableAccessoryView]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; + } } /** @@ -2109,37 +2242,54 @@ */ - (IBAction)checksumTable:(id)sender { - MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"CHECKSUM TABLE %@", [[self table] backtickQuotedString]]]; + NSArray *selectedItems = [tablesListInstance selectedTableItems]; + id message = nil; + + if([selectedItems count] == 0) return; + + MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"CHECKSUM TABLE %@", [selectedItems componentsJoinedAndBacktickQuoted]]]; + + NSString *what = ([selectedItems count]>1) ? NSLocalizedString(@"selected items", @"selected items") : [NSString stringWithFormat:@"%@ '%@'", NSLocalizedString(@"table", @"table"), [self table]]; // Check for errors, only displaying if the connection hasn't been terminated if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { if ([mySQLConnection isConnected]) { - [[NSAlert alertWithMessageText:@"Unable to perform checksum" + [[NSAlert alertWithMessageText:NSLocalizedString(@"Unable to perform the checksum", @"unable to perform the checksum") defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"An error occurred while performing the checksum on table '%@'. Please try again.\n\n%@", [self table], [mySQLConnection getLastErrorMessage]]] + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while performing the checksum on %@.\n\nMySQL said:%@",@"an error occurred while performing the checksum on the %@.\n\nMySQL said:%@"), what, [mySQLConnection getLastErrorMessage]]] beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } + return; } // Process result - NSString *result = [[[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject] objectForKey:@"Checksum"]; - - [[NSAlert alertWithMessageText:[NSString stringWithFormat:@"Checksum table '%@'", [self table]] - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:[NSString stringWithFormat:@"Table checksum: %@", result]] - beginSheetModalForWindow:tableWindow - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + if([selectedItems count] == 1) { + message = [[[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject] objectForKey:@"Checksum"]; + [[NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Checksum %@",@"checksum %@ message"), what] + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Table checksum: %@",@"table checksum: %@"), message]] + beginSheetModalForWindow:tableWindow + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; + } else { + NSDictionary *result = [theResult fetch2DResultAsType:MCPTypeDictionary]; + statusValues = [result retain]; + NSAlert *alert = [[NSAlert new] autorelease]; + [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Checksums of %@",@"Checksums of %@ message"), what]]; + [alert setMessageText:NSLocalizedString(@"Table checksum",@"table checksum message")]; + [alert setAccessoryView:statusTableAccessoryView]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"statusError"]; + } } /** @@ -2984,17 +3134,18 @@ // table menu items if ([menuItem action] == @selector(showCreateTableSyntax:) || - [menuItem action] == @selector(copyCreateTableSyntax:) || - [menuItem action] == @selector(analyzeTable:) || - [menuItem action] == @selector(optimizeTable:) || - [menuItem action] == @selector(repairTable:) || - [menuItem action] == @selector(flushTable:) || - [menuItem action] == @selector(checksumTable:)) + [menuItem action] == @selector(copyCreateTableSyntax:)) { return ([self table] != nil && [[self table] isNotEqualTo:@""]); } - if ([menuItem action] == @selector(checkTable:)) { + if ([menuItem action] == @selector(analyzeTable:) || + [menuItem action] == @selector(optimizeTable:) || + [menuItem action] == @selector(repairTable:) || + [menuItem action] == @selector(flushTable:) || + [menuItem action] == @selector(checkTable:) || + [menuItem action] == @selector(checksumTable:)) + { return ([[[tablesListInstance valueForKeyPath:@"tablesListView"] selectedRowIndexes] count]) ? YES:NO; } @@ -3745,13 +3896,27 @@ { if(statusTableView && aTableView == statusTableView && rowIndex < [statusValues count]) { if ([[aTableColumn identifier] isEqualToString:@"table_name"]) { - return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"]; + if([[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"]) + return [[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"]; + else if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"]) + return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Table"]; + return @""; } else if ([[aTableColumn identifier] isEqualToString:@"msg_status"]) { - return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"]; + if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"]) + return [[[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_type"] capitalizedString]; + return @""; } else if ([[aTableColumn identifier] isEqualToString:@"msg_text"]) { - return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"]; + if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"]) { + [[aTableColumn headerCell] setStringValue:NSLocalizedString(@"Message",@"message column title")]; + return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Msg_text"]; + } + else if([[statusValues objectAtIndex:rowIndex] objectForKey:@"Checksum"]) { + [[aTableColumn headerCell] setStringValue:@"Checksum"]; + return [[statusValues objectAtIndex:rowIndex] objectForKey:@"Checksum"]; + } + return @""; } } return nil; @@ -3762,6 +3927,34 @@ return NO; } + +#pragma mark - +#pragma mark status accessory view + +- (IBAction)copyChecksumFromSheet:(id)sender +{ + NSMutableString *tmp = [NSMutableString string]; + for(id row in statusValues) + if([row objectForKey:@"Msg_type"]) + [tmp appendFormat:@"%@\t%@\t%@\n", [[row objectForKey:@"Table"] description], + [[row objectForKey:@"Msg_type"] description], + [[row objectForKey:@"Msg_text"] description]]; + else + [tmp appendFormat:@"%@\t%@\n", [[row objectForKey:@"Table"] description], + [[row objectForKey:@"Checksum"] description]]; + if ( [tmp length] ) + { + NSPasteboard *pb = [NSPasteboard generalPasteboard]; + + [pb declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType, + NSStringPboardType, nil] + owner:nil]; + + [pb setString:tmp forType:NSStringPboardType]; + [pb setString:tmp forType:NSTabularTextPboardType]; + } +} + #pragma mark - /** |