diff options
-rw-r--r-- | Source/SPProcessListController.m | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 3745d4e0..5ca669df 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -697,8 +697,29 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id"; for (i = 0; i < [processList numOfRows]; i++) { - [processes addObject:[processList fetchRowAsDictionary]]; + //MCPKit currently returns numbers as NSString, which will break sorting of numbers in this case. + NSMutableDictionary *rowsFixed = [[processList fetchRowAsDictionary] mutableCopy]; + + id idColumn = [rowsFixed objectForKey:@"Id"]; + //Id is a signed int(11) - this is a signed 32 bit int value + if(idColumn != nil && [idColumn isKindOfClass:[NSString class]]) { + int numRaw = [(NSString *)idColumn intValue]; + NSNumber *num = [NSNumber numberWithInt:numRaw]; + [rowsFixed setObject:num forKey:@"Id"]; + } + + id timeColumn = [rowsFixed objectForKey:@"Time"]; + //Time is a signed int(7) - this is the same 32 bit int value + if(timeColumn != nil && [timeColumn isKindOfClass:[NSString class]]) { + int numRaw = [(NSString *)timeColumn intValue]; + NSNumber *num = [NSNumber numberWithInt:numRaw]; + [rowsFixed setObject:num forKey:@"Time"]; + } + + [processes addObject:[[rowsFixed copy] autorelease]]; + [rowsFixed release]; } + } // Update the UI on the main thread |