reveal files in files table works again

This commit is contained in:
Mitchell Livingston 2007-01-17 17:29:42 +00:00
parent 839a026fe7
commit 93c55ebc5c
2 changed files with 19 additions and 17 deletions

View File

@ -640,9 +640,8 @@
return tableView != fPeerTable; return tableView != fPeerTable;
} }
- (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell - (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
rect: (NSRectPointer) rect tableColumn: (NSTableColumn *) column tableColumn: (NSTableColumn *) column row: (int) row mouseLocation: (NSPoint) mouseLocation
row: (int) row mouseLocation: (NSPoint) mouseLocation
{ {
if (tableView == fPeerTable) if (tableView == fPeerTable)
{ {
@ -705,7 +704,7 @@
if ([[tableColumn identifier] isEqualToString: @"Size"]) if ([[tableColumn identifier] isEqualToString: @"Size"])
return ![[item objectForKey: @"IsFolder"] boolValue] return ![[item objectForKey: @"IsFolder"] boolValue]
? [[[item objectForKey: @"Size"] stringValue] stringByAppendingString: NSLocalizedString(@" bytes", ? [[[item objectForKey: @"Size"] stringValue] stringByAppendingString: NSLocalizedString(@" bytes",
"Inspector -> Files tab -> table row tooltip")] : @""; "Inspector -> Files tab -> table row tooltip")] : nil;
else else
return [item objectForKey: @"Name"]; return [item objectForKey: @"Name"];
} }
@ -740,13 +739,12 @@
if (!fFiles) if (!fFiles)
return; return;
#warning get working NSString * folder = [[fTorrents objectAtIndex: 0] downloadFolder];
/*Torrent * torrent = [fTorrents objectAtIndex: 0]; NSIndexSet * indexes = [fFileOutline selectedRowIndexes];
NSEnumerator * enumerator = [[fFiles objectsAtIndexes: [fFileOutline selectedRowIndexes]] objectEnumerator]; int i;
NSDictionary * file; for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
while ((file = [enumerator nextObject])) [[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent:
[[NSWorkspace sharedWorkspace] selectFile: [[torrent downloadFolder] [[fFileOutline itemAtRow: i] objectForKey: @"Path"]] inFileViewerRootedAtPath: nil];
stringByAppendingPathComponent: [file objectForKey: @"Name"]] inFileViewerRootedAtPath: nil];*/
} }
- (void) setLimitCustom: (id) sender - (void) setLimitCustom: (id) sender

View File

@ -43,7 +43,8 @@
checkDownload: (NSNumber *) checkDownload downloadLimit: (NSNumber *) downloadLimit checkDownload: (NSNumber *) checkDownload downloadLimit: (NSNumber *) downloadLimit
waitToStart: (NSNumber *) waitToStart orderValue: (NSNumber *) orderValue; waitToStart: (NSNumber *) waitToStart orderValue: (NSNumber *) orderValue;
- (void) insertPath: (NSMutableArray *) components withParent: (NSMutableArray *) parent fileSize: (uint64_t) size; - (void) insertPath: (NSMutableArray *) components withParent: (NSMutableArray *) parent
previousPath: (NSString *) previousPath fileSize: (uint64_t) size;
- (NSImage *) advancedBar; - (NSImage *) advancedBar;
- (void) trashFile: (NSString *) path; - (void) trashFile: (NSString *) path;
@ -1078,7 +1079,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (fInfo->multifile) if (fInfo->multifile)
[pathComponents removeObjectAtIndex: 0]; [pathComponents removeObjectAtIndex: 0];
[self insertPath: pathComponents withParent: files fileSize: file->length]; [self insertPath: pathComponents withParent: files previousPath: @"" fileSize: file->length];
[pathComponents autorelease]; [pathComponents autorelease];
} }
return files; return files;
@ -1212,7 +1213,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return self; return self;
} }
- (void) insertPath: (NSMutableArray *) components withParent: (NSMutableArray *) parent fileSize: (uint64_t) size - (void) insertPath: (NSMutableArray *) components withParent: (NSMutableArray *) parent
previousPath: (NSString *) previousPath fileSize: (uint64_t) size
{ {
NSString * name = [components objectAtIndex: 0]; NSString * name = [components objectAtIndex: 0];
BOOL isFolder = [components count] > 1; BOOL isFolder = [components count] > 1;
@ -1226,12 +1228,14 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
break; break;
} }
NSString * currentPath = [previousPath stringByAppendingPathComponent: name];
//create new folder or item if it doesn't already exist //create new folder or item if it doesn't already exist
if (!dict) if (!dict)
{ {
#warning put full path for item
dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: name, @"Name", dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: name, @"Name",
[NSNumber numberWithBool: isFolder], @"IsFolder", nil]; [NSNumber numberWithBool: isFolder], @"IsFolder",
currentPath, @"Path", nil];
if (isFolder) if (isFolder)
[dict setObject: [NSMutableArray array] forKey: @"Children"]; [dict setObject: [NSMutableArray array] forKey: @"Children"];
else else
@ -1243,7 +1247,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (isFolder) if (isFolder)
{ {
[components removeObjectAtIndex: 0]; [components removeObjectAtIndex: 0];
[self insertPath: components withParent: [dict objectForKey: @"Children"] fileSize: size]; [self insertPath: components withParent: [dict objectForKey: @"Children"] previousPath: currentPath fileSize: size];
} }
} }