Add individual file sizes to info's file table.

This commit is contained in:
Mitchell Livingston 2006-08-20 18:32:55 +00:00
parent 8bc4cefa2d
commit a99e6ab33a
3 changed files with 15 additions and 6 deletions

View File

@ -469,11 +469,13 @@
}
else
{
NSString * file = [fFiles objectAtIndex: row];
NSDictionary * file = [fFiles objectAtIndex: row];
if ([ident isEqualToString: @"Icon"])
return [[NSWorkspace sharedWorkspace] iconForFileType: [file pathExtension]];
return [[NSWorkspace sharedWorkspace] iconForFileType: [[file objectForKey: @"Name"] pathExtension]];
else if ([ident isEqualToString: @"Size"])
return [NSString stringForFileSize: [[file objectForKey: @"Size"] unsignedIntValue]];
else
return [file lastPathComponent];
return [[file objectForKey: @"Name"] lastPathComponent];
}
}
@ -496,7 +498,7 @@
rect: (NSRectPointer) rect tableColumn: (NSTableColumn *) column
row: (int) row mouseLocation: (NSPoint) mouseLocation
{
return tableView == fFileTable ? [fFiles objectAtIndex: row] : nil;
return tableView == fFileTable ? [[fFiles objectAtIndex: row] objectForKey: @"Name"] : nil;
}
- (NSArray *) peerSortDescriptors

View File

@ -630,10 +630,17 @@
- (NSArray *) fileList
{
int count = fInfo->fileCount, i;
tr_file_t file;
NSMutableArray * files = [NSMutableArray arrayWithCapacity: count];
for (i = 0; i < count; i++)
[files addObject: [[self downloadFolder] stringByAppendingPathComponent:
[NSString stringWithUTF8String: fInfo->files[i].name]]];
{
file = fInfo->files[i];
[files addObject: [NSDictionary dictionaryWithObjectsAndKeys: [[self downloadFolder]
stringByAppendingPathComponent: [NSString stringWithUTF8String: file.name]], @"Name",
[NSNumber numberWithUnsignedInt: file.length], @"Size", nil]];
}
return files;
}