Changeset 9016


Ignore:
Timestamp:
Aug 30, 2009, 5:50:05 PM (13 years ago)
Author:
livings124
Message:

#2370 On 10.6, revaling files in Finder will select multiple files in the same directory

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r8969 r9016  
    4444#import "FilterButton.h"
    4545#import "BonjourController.h"
     46#import "NSApplicationAdditions.h"
    4647#import "NSStringAdditions.h"
    4748#import "ExpandedPathToPathTransformer.h"
     
    14101411- (void) revealFile: (id) sender
    14111412{
    1412     for (Torrent * torrent in [fTableView selectedTorrents])
    1413         [torrent revealData];
     1413    NSArray * selected = [fTableView selectedTorrents];
     1414    if ([NSApp isOnSnowLeopardOrBetter])
     1415    {
     1416        NSMutableArray * paths = [NSMutableArray arrayWithCapacity: [selected count]];
     1417        for (Torrent * torrent in [fTableView selectedTorrents])
     1418            [paths addObject: [NSURL fileURLWithPath: [torrent dataLocation]]];
     1419       
     1420        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: paths];
     1421    }
     1422    else
     1423    {
     1424        for (Torrent * torrent in selected)
     1425            [[NSWorkspace sharedWorkspace] selectFile: [torrent dataLocation] inFileViewerRootedAtPath: nil];
     1426    }
    14141427}
    14151428
     
    40584071    if (([type isEqualToString: GROWL_DOWNLOAD_COMPLETE] || [type isEqualToString: GROWL_SEEDING_COMPLETE])
    40594072            && (location = [clickContext objectForKey: @"Location"]))
    4060         [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
     4073    {
     4074        if ([NSApp isOnSnowLeopardOrBetter])
     4075        {
     4076            NSURL * file = [NSURL fileURLWithPath: location];
     4077            [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
     4078        }
     4079        else
     4080            [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
     4081    }
    40614082}
    40624083
  • trunk/macosx/FileOutlineController.m

    r9015 r9016  
    2828#import "FilePriorityCell.h"
    2929#import "FileListNode.h"
     30#import "NSApplicationAdditions.h"
    3031#import "QuickLookController.h"
    3132
     
    314315    NSString * folder = [fTorrent downloadFolder];
    315316    NSIndexSet * indexes = [fOutline selectedRowIndexes];
    316     for (NSInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
    317         [[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent:
    318             [[fOutline itemAtRow: i] fullPath]] inFileViewerRootedAtPath: nil];
     317    if ([NSApp isOnSnowLeopardOrBetter])
     318    {
     319        NSMutableArray * paths = [NSMutableArray arrayWithCapacity: [indexes count]];
     320        for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
     321            [paths addObject: [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [[fOutline itemAtRow: i] fullPath]]]];
     322       
     323        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: paths];
     324    }
     325    else
     326    {
     327        for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
     328            [[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent: [[fOutline itemAtRow: i] fullPath]]
     329                inFileViewerRootedAtPath: nil];
     330    }
    319331}
    320332
  • trunk/macosx/InfoWindowController.m

    r9014 r9016  
    11791179{
    11801180    if ([fTorrents count] > 0)
    1181         [[fTorrents objectAtIndex: 0] revealData];
     1181    {
     1182        Torrent * torrent = [fTorrents objectAtIndex: 0];
     1183        if ([NSApp isOnSnowLeopardOrBetter])
     1184        {
     1185            NSURL * file = [NSURL fileURLWithPath: [torrent dataLocation]];
     1186            [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
     1187        }
     1188        else
     1189            [[NSWorkspace sharedWorkspace] selectFile: [torrent dataLocation] inFileViewerRootedAtPath: nil];
     1190    }
    11821191}
    11831192
  • trunk/macosx/Torrent.h

    r8870 r9016  
    117117- (void) setPriority: (tr_priority_t) priority;
    118118
    119 - (void) revealData;
    120119+ (void) trashFile: (NSString *) path;
    121120- (void) trashData;
  • trunk/macosx/Torrent.m

    r9010 r9016  
    435435{
    436436    return tr_torrentSetPriority(fHandle, priority);
    437 }
    438 
    439 - (void) revealData
    440 {
    441     [[NSWorkspace sharedWorkspace] selectFile: [self dataLocation] inFileViewerRootedAtPath: nil];
    442437}
    443438
Note: See TracChangeset for help on using the changeset viewer.