From 36c061403637d5fefc1473ac3b668e54b1341871 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 29 Jan 2012 20:21:03 +0000 Subject: Fix minor copying and saving console view content issues. --- Source/SPQueryController.m | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'Source/SPQueryController.m') 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 -- cgit v1.2.3