diff options
author | stuconnolly <stuart02@gmail.com> | 2012-01-29 20:21:03 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-01-29 20:21:03 +0000 |
commit | 36c061403637d5fefc1473ac3b668e54b1341871 (patch) | |
tree | 162b84d6ebc411f7b3acb20b9af558dbde3d3652 | |
parent | 3668ca91ff3f9432b23772171aec58bc289459e2 (diff) | |
download | sequelpro-36c061403637d5fefc1473ac3b668e54b1341871.tar.gz sequelpro-36c061403637d5fefc1473ac3b668e54b1341871.tar.bz2 sequelpro-36c061403637d5fefc1473ac3b668e54b1341871.zip |
Fix minor copying and saving console view content issues.
-rw-r--r-- | Source/SPQueryConsoleDataSource.m | 2 | ||||
-rw-r--r-- | Source/SPQueryController.m | 37 |
2 files changed, 23 insertions, 16 deletions
diff --git a/Source/SPQueryConsoleDataSource.m b/Source/SPQueryConsoleDataSource.m index 29a8dc7a..a8b289d9 100644 --- a/Source/SPQueryConsoleDataSource.m +++ b/Source/SPQueryConsoleDataSource.m @@ -43,7 +43,7 @@ static NSUInteger SPMessageTruncateCharacterLength = 256; } /** - * Table view delegate method. Returns the specific object for the request column and row. + * Table view delegate method. Returns the specific object for the requested column and row. */ - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index a3c46160..c2c0c1d6 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -144,9 +144,9 @@ static SPQueryController *sharedQueryController = nil; NSIndexSet *rows = [consoleTableView selectedRowIndexes]; NSUInteger i = [rows firstIndex]; - - BOOL dateColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:SPTableViewDateColumnID] isHidden]; - BOOL connectionColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:SPTableViewConnectionColumnID] isHidden]; + + BOOL includeTimestamps = ![[consoleTableView tableColumnWithIdentifier:SPTableViewDateColumnID] isHidden]; + BOOL includeConnections = ![[consoleTableView tableColumnWithIdentifier:SPTableViewConnectionColumnID] isHidden]; [string setString:@""]; @@ -154,15 +154,20 @@ static SPQueryController *sharedQueryController = nil; { if (i < [messagesVisibleSet count]) { SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i); - - // If the timestamp column is not hidden we need to include them in the copy - if (!dateColumnIsHidden) - [string appendFormat:@"/* %@ %@ ", [dateFormatter stringFromDate:[message messageDate]], (connectionColumnIsHidden) ? @"*/ ": @""]; - - - // If the connection column is not hidden we need to include them in the copy - if (!connectionColumnIsHidden) - [string appendFormat:@"%@%@ */ ",(dateColumnIsHidden) ? @"/* " : @"", [message messageConnection]]; + + if (includeTimestamps || includeConnections) [string appendString:@"/* "]; + + if (includeTimestamps) { + [string appendString:[dateFormatter stringFromDate:[message messageDate]]]; + [string appendString:@" "]; + } + + if (includeConnections) { + [string appendString:[message messageConnection]]; + [string appendString:@" "]; + } + + if (includeTimestamps || includeConnections) [string appendString:@"*/ "]; [string appendFormat:@"%@\n", [message message]]; } @@ -297,7 +302,7 @@ static SPQueryController *sharedQueryController = nil; { #ifndef SP_REFACTOR if (returnCode == NSOKButton) { - [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton integerValue] connections:[includeConnectionButton integerValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] connections:[includeConnectionButton state]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; } #endif } @@ -528,12 +533,14 @@ static SPQueryController *sharedQueryController = nil; // If the timestamp column is not hidden we need to include them in the copy if (timeStamps) { - [consoleString appendFormat:@"%@ ", [dateFormatter stringFromDate:[message messageDate]]]; + [consoleString appendString:[dateFormatter stringFromDate:[message messageDate]]]; + [consoleString appendString:@" "]; } // If the connection column is not hidden we need to include them in the copy if (connections) { - [consoleString appendFormat:@"%@ ", [message messageConnection]]; + [consoleString appendString:[message messageConnection]]; + [consoleString appendString:@" "]; } // Close the comment |