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

View File

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