source: trunk/macosx/FileOutlineController.m @ 13143

Last change on this file since 13143 was 13143, checked in by livings124, 10 years ago

update the file table node search to (possibly) use concurrent enumeration

  • Property svn:keywords set to Date Rev Author Id
File size: 21.8 KB
Line 
1/******************************************************************************
2 * $Id: FileOutlineController.m 13143 2012-01-08 05:05:47Z livings124 $
3 *
4 * Copyright (c) 2008-2011 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#import "FileOutlineController.h"
26#import "Torrent.h"
27#import "FileOutlineView.h"
28#import "FilePriorityCell.h"
29#import "FileListNode.h"
30#import "NSApplicationAdditions.h"
31#import "NSMutableArrayAdditions.h"
32#import "NSStringAdditions.h"
33#import <Quartz/Quartz.h>
34
35#define ROW_SMALL_HEIGHT 18.0
36
37typedef enum
38{
39    FILE_CHECK_TAG,
40    FILE_UNCHECK_TAG
41} fileCheckMenuTag;
42
43typedef enum
44{
45    FILE_PRIORITY_HIGH_TAG,
46    FILE_PRIORITY_NORMAL_TAG,
47    FILE_PRIORITY_LOW_TAG
48} filePriorityMenuTag;
49
50@interface FileOutlineController (Private)
51
52- (NSMenu *) menu;
53
54- (NSUInteger) findFileNode: (FileListNode *) node inList: (NSArray *) list inRange: (NSRange) range currentParent: (FileListNode *) currentParent finalParent: (FileListNode **) parent;
55
56@end
57
58@implementation FileOutlineController
59
60- (void) awakeFromNib
61{
62    fFileList = [[NSMutableArray alloc] init];
63   
64    [fOutline setDoubleAction: @selector(revealFile:)];
65    [fOutline setTarget: self];
66   
67    //set table header tool tips
68    [[fOutline tableColumnWithIdentifier: @"Check"] setHeaderToolTip: NSLocalizedString(@"Download", "file table -> header tool tip")];
69    [[fOutline tableColumnWithIdentifier: @"Priority"] setHeaderToolTip: NSLocalizedString(@"Priority", "file table -> header tool tip")];
70   
71    [fOutline setMenu: [self menu]];
72   
73    [self setTorrent: nil];
74}
75
76- (void) dealloc
77{
78    [fFileList release];
79    [fFilterText release];
80   
81    [super dealloc];
82}
83
84- (FileOutlineView *) outlineView
85{
86    return fOutline;
87}
88
89- (void) setTorrent: (Torrent *) torrent
90{
91    fTorrent = torrent;
92   
93    [fFileList setArray: [fTorrent fileList]];
94   
95    [fFilterText release];
96    fFilterText = nil;
97   
98    [fOutline reloadData];
99    [fOutline deselectAll: nil]; //do this after reloading the data #4575
100}
101
102- (void) setFilterText: (NSString *) text
103{
104    NSArray * components = [text betterComponentsSeparatedByCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
105    if (!components || [components count] == 0)
106    {
107        text = nil;
108        components = nil;
109    }
110   
111    if ((!text && !fFilterText) || (text && fFilterText && [text isEqualToString: fFilterText]))
112        return;
113   
114    const BOOL onLion = [NSApp isOnLionOrBetter];
115   
116    if (onLion)
117        [fOutline beginUpdates];
118   
119    NSUInteger currentIndex = 0, totalCount = 0;
120    NSMutableArray * itemsToAdd = [NSMutableArray array];
121    NSMutableIndexSet * itemsToAddIndexes = [NSMutableIndexSet indexSet];
122   
123    NSMutableDictionary * removedIndexesForParents = nil; //ugly, but we can't modify the actual file nodes
124   
125    NSArray * tempList = !text ? [fTorrent fileList] : [fTorrent flatFileList];
126    for (FileListNode * item in tempList)
127    {
128        BOOL filter = NO;
129        if (components)
130        {
131            for (NSString * sub in components)
132                if ([[item name] rangeOfString: sub options: (NSCaseInsensitiveSearch | NSDiacriticInsensitiveSearch)].location == NSNotFound)
133                {
134                    filter = YES;
135                    break;
136                }
137        }
138       
139        if (!filter)
140        {
141            FileListNode * parent = nil;
142            NSUInteger previousIndex = ![item isFolder] ? [self findFileNode: item inList: fFileList inRange: NSMakeRange(currentIndex, [fFileList count]-currentIndex) currentParent: nil finalParent: &parent] : NSNotFound;
143           
144            if (previousIndex == NSNotFound)
145            {
146                [itemsToAdd addObject: item];
147                [itemsToAddIndexes addIndex: totalCount];
148            }
149            else
150            {
151                BOOL move = YES;
152                if (!parent)
153                {
154                    if (previousIndex != currentIndex)
155                        [fFileList moveObjectAtIndex: previousIndex toIndex: currentIndex];
156                    else
157                        move = NO;
158                }
159                else
160                {
161                    [fFileList insertObject: item atIndex: currentIndex];
162                   
163                    //figure out the index within the semi-edited table - UGLY
164                    if (!removedIndexesForParents)
165                        removedIndexesForParents = [NSMutableDictionary dictionary];
166                   
167                    NSMutableIndexSet * removedIndexes = [removedIndexesForParents objectForKey: parent];
168                    if (!removedIndexes)
169                    {
170                        removedIndexes = [NSMutableIndexSet indexSetWithIndex: previousIndex];
171                        [removedIndexesForParents setObject: removedIndexes forKey: parent];
172                    }
173                    else
174                    {
175                        [removedIndexes addIndex: previousIndex];
176                        previousIndex -= [removedIndexes countOfIndexesInRange: NSMakeRange(0, previousIndex)];
177                    }
178                }
179               
180                if (move && onLion)
181                    [fOutline moveItemAtIndex: previousIndex inParent: parent toIndex: currentIndex inParent: nil];
182               
183                ++currentIndex;
184            }
185           
186            ++totalCount;
187        }
188    }
189   
190    //remove trailing items - those are the unused
191    if (currentIndex  < [fFileList count])
192    {
193        const NSRange removeRange = NSMakeRange(currentIndex, [fFileList count]-currentIndex);
194        [fFileList removeObjectsInRange: removeRange];
195        if (onLion)
196            [fOutline removeItemsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: removeRange] inParent: nil withAnimation: NSTableViewAnimationSlideDown];
197    }
198   
199    //add new items
200    [fFileList insertObjects: itemsToAdd atIndexes: itemsToAddIndexes];
201    if (onLion)
202        [fOutline insertItemsAtIndexes: itemsToAddIndexes inParent: nil withAnimation: NSTableViewAnimationSlideUp];
203   
204    if (onLion)
205        [fOutline endUpdates];
206    else
207        [fOutline reloadData];
208   
209    [fFilterText release];
210    fFilterText = [text retain];
211}
212
213- (void) refresh
214{
215    [fTorrent updateFileStat];
216   
217    [fOutline setNeedsDisplay: YES];
218}
219
220- (void) outlineViewSelectionDidChange: (NSNotification *) notification
221{
222    if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible])
223        [[QLPreviewPanel sharedPreviewPanel] reloadData];
224}
225
226- (NSInteger) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
227{
228    if (!item)
229        return fFileList ? [fFileList count] : 0;
230    else
231    {
232        FileListNode * node = (FileListNode *)item;
233        return [node isFolder] ? [[node children] count] : 0;
234    }
235}
236
237- (BOOL) outlineView: (NSOutlineView *) outlineView isItemExpandable: (id) item
238{
239    return [(FileListNode *)item isFolder];
240}
241
242- (id) outlineView: (NSOutlineView *) outlineView child: (NSInteger) index ofItem: (id) item
243{
244    return [(item ? [(FileListNode *)item children] : fFileList) objectAtIndex: index];
245}
246
247- (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
248{
249    if ([[tableColumn identifier] isEqualToString: @"Check"])
250        return [NSNumber numberWithInteger: [fTorrent checkForFiles: [(FileListNode *)item indexes]]];
251    else
252        return item;
253}
254
255- (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn item: (id) item
256{
257    NSString * identifier = [tableColumn identifier];
258    if ([identifier isEqualToString: @"Check"])
259        [cell setEnabled: [fTorrent canChangeDownloadCheckForFiles: [(FileListNode *)item indexes]]];
260    else if ([identifier isEqualToString: @"Priority"])
261    {
262        [cell setRepresentedObject: item];
263       
264        NSInteger hoveredRow = [fOutline hoveredRow];
265        [(FilePriorityCell *)cell setHovered: hoveredRow != -1 && hoveredRow == [fOutline rowForItem: item]];
266    }
267    else;
268}
269
270- (void) outlineView: (NSOutlineView *) outlineView setObjectValue: (id) object forTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
271{
272    NSString * identifier = [tableColumn identifier];
273    if ([identifier isEqualToString: @"Check"])
274    {
275        NSIndexSet * indexSet;
276        if ([NSEvent modifierFlags] & NSAlternateKeyMask)
277            indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])];
278        else
279            indexSet = [(FileListNode *)item indexes];
280       
281        [fTorrent setFileCheckState: [object intValue] != NSOffState ? NSOnState : NSOffState forIndexes: indexSet];
282        [fOutline setNeedsDisplay: YES];
283       
284        [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
285    }
286}
287
288- (NSString *) outlineView: (NSOutlineView *) outlineView typeSelectStringForTableColumn: (NSTableColumn *) tableColumn item: (id) item
289{
290    return [(FileListNode *)item name];
291}
292
293- (NSString *) outlineView: (NSOutlineView *) outlineView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
294        tableColumn: (NSTableColumn *) tableColumn item: (id) item mouseLocation: (NSPoint) mouseLocation
295{
296    NSString * ident = [tableColumn identifier];
297    if ([ident isEqualToString: @"Name"])
298    {
299        NSString * path = [fTorrent fileLocation: item];
300        if (!path)
301            path = [[(FileListNode *)item path] stringByAppendingPathComponent: [(FileListNode *)item name]];
302        return path;
303    }
304    else if ([ident isEqualToString: @"Check"])
305    {
306        switch ([cell state])
307        {
308            case NSOffState:
309                return NSLocalizedString(@"Don't Download", "files tab -> tooltip");
310            case NSOnState:
311                return NSLocalizedString(@"Download", "files tab -> tooltip");
312            case NSMixedState:
313                return NSLocalizedString(@"Download Some", "files tab -> tooltip");
314        }
315    }
316    else if ([ident isEqualToString: @"Priority"])
317    {
318        NSSet * priorities = [fTorrent filePrioritiesForIndexes: [(FileListNode *)item indexes]];
319        switch ([priorities count])
320        {
321            case 0:
322                return NSLocalizedString(@"Priority Not Available", "files tab -> tooltip");
323            case 1:
324                switch ([[priorities anyObject] intValue])
325                {
326                    case TR_PRI_LOW:
327                        return NSLocalizedString(@"Low Priority", "files tab -> tooltip");
328                    case TR_PRI_HIGH:
329                        return NSLocalizedString(@"High Priority", "files tab -> tooltip");
330                    case TR_PRI_NORMAL:
331                        return NSLocalizedString(@"Normal Priority", "files tab -> tooltip");
332                }
333                break;
334            default:
335                return NSLocalizedString(@"Multiple Priorities", "files tab -> tooltip");
336        }
337    }
338    else;
339   
340    return nil;
341}
342
343- (CGFloat) outlineView: (NSOutlineView *) outlineView heightOfRowByItem: (id) item
344{
345    if ([(FileListNode *)item isFolder])
346        return ROW_SMALL_HEIGHT;
347    else
348        return [outlineView rowHeight];
349}
350
351- (void) setCheck: (id) sender
352{
353    NSInteger state = [sender tag] == FILE_UNCHECK_TAG ? NSOffState : NSOnState;
354   
355    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
356    NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
357    for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
358        [itemIndexes addIndexes: [[fOutline itemAtRow: i] indexes]];
359   
360    [fTorrent setFileCheckState: state forIndexes: itemIndexes];
361    [fOutline setNeedsDisplay: YES];
362}
363
364- (void) setOnlySelectedCheck: (id) sender
365{
366    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
367    NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
368    for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
369        [itemIndexes addIndexes: [[fOutline itemAtRow: i] indexes]];
370   
371    [fTorrent setFileCheckState: NSOnState forIndexes: itemIndexes];
372   
373    NSMutableIndexSet * remainingItemIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrent fileCount])];
374    [remainingItemIndexes removeIndexes: itemIndexes];
375    [fTorrent setFileCheckState: NSOffState forIndexes: remainingItemIndexes];
376   
377    [fOutline setNeedsDisplay: YES];
378}
379
380- (void) setPriority: (id) sender
381{
382    tr_priority_t priority;
383    switch ([sender tag])
384    {
385        case FILE_PRIORITY_HIGH_TAG:
386            priority = TR_PRI_HIGH;
387            break;
388        case FILE_PRIORITY_NORMAL_TAG:
389            priority = TR_PRI_NORMAL;
390            break;
391        case FILE_PRIORITY_LOW_TAG:
392            priority = TR_PRI_LOW;
393    }
394   
395    NSIndexSet * indexSet = [fOutline selectedRowIndexes];
396    NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
397    for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
398        [itemIndexes addIndexes: [[fOutline itemAtRow: i] indexes]];
399   
400    [fTorrent setFilePriority: priority forIndexes: itemIndexes];
401    [fOutline setNeedsDisplay: YES];
402}
403
404- (void) revealFile: (id) sender
405{
406    NSIndexSet * indexes = [fOutline selectedRowIndexes];
407    NSMutableArray * paths = [NSMutableArray arrayWithCapacity: [indexes count]];
408    for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
409    {
410        NSString * path = [fTorrent fileLocation: [fOutline itemAtRow: i]];
411        if (path)
412            [paths addObject: [NSURL fileURLWithPath: path]];
413    }
414   
415    if ([paths count] > 0)
416        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: paths];
417}
418
419#warning make real view controller (Leopard-only) so that Command-R will work
420- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
421{
422    if (!fTorrent)
423        return NO;
424   
425    SEL action = [menuItem action];
426   
427    if (action == @selector(revealFile:))
428    {
429        NSIndexSet * indexSet = [fOutline selectedRowIndexes];
430        for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
431            if ([fTorrent fileLocation: [fOutline itemAtRow: i]] != nil)
432                return YES;
433        return NO;
434    }
435   
436    if (action == @selector(setCheck:))
437    {
438        if ([fOutline numberOfSelectedRows] == 0)
439            return NO;
440       
441        NSIndexSet * indexSet = [fOutline selectedRowIndexes];
442        NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
443        for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
444            [itemIndexes addIndexes: [[fOutline itemAtRow: i] indexes]];
445       
446        NSInteger state = ([menuItem tag] == FILE_CHECK_TAG) ? NSOnState : NSOffState;
447        return [fTorrent checkForFiles: itemIndexes] != state && [fTorrent canChangeDownloadCheckForFiles: itemIndexes];
448    }
449   
450    if (action == @selector(setOnlySelectedCheck:))
451    {
452        if ([fOutline numberOfSelectedRows] == 0)
453            return NO;
454       
455        NSIndexSet * indexSet = [fOutline selectedRowIndexes];
456        NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
457        for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
458            [itemIndexes addIndexes: [[fOutline itemAtRow: i] indexes]];
459       
460        return [fTorrent canChangeDownloadCheckForFiles: itemIndexes];
461    }
462   
463    if (action == @selector(setPriority:))
464    {
465        if ([fOutline numberOfSelectedRows] == 0)
466        {
467            [menuItem setState: NSOffState];
468            return NO;
469        }
470       
471        //determine which priorities are checked
472        NSIndexSet * indexSet = [fOutline selectedRowIndexes];
473        tr_priority_t priority;
474        switch ([menuItem tag])
475        {
476            case FILE_PRIORITY_HIGH_TAG:
477                priority = TR_PRI_HIGH;
478                break;
479            case FILE_PRIORITY_NORMAL_TAG:
480                priority = TR_PRI_NORMAL;
481                break;
482            case FILE_PRIORITY_LOW_TAG:
483                priority = TR_PRI_LOW;
484                break;
485        }
486       
487        BOOL current = NO, canChange = NO;
488        for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
489        {
490            NSIndexSet * fileIndexSet = [[fOutline itemAtRow: i] indexes];
491            if (![fTorrent canChangeDownloadCheckForFiles: fileIndexSet])
492                continue;
493           
494            canChange = YES;
495            if ([fTorrent hasFilePriority: priority forIndexes: fileIndexSet])
496            {
497                current = YES;
498                break;
499            }
500        }
501       
502        [menuItem setState: current ? NSOnState : NSOffState];
503        return canChange;
504    }
505   
506    return YES;
507}
508
509@end
510
511@implementation FileOutlineController (Private)
512
513- (NSMenu *) menu
514{
515    NSMenu * menu = [[NSMenu alloc] initWithTitle: @"File Outline Menu"];
516   
517    //check and uncheck
518    NSMenuItem * item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Check Selected", "File Outline -> Menu")
519                            action: @selector(setCheck:) keyEquivalent: @""];
520    [item setTarget: self];
521    [item setTag: FILE_CHECK_TAG];
522    [menu addItem: item];
523    [item release];
524   
525    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Uncheck Selected", "File Outline -> Menu")
526            action: @selector(setCheck:) keyEquivalent: @""];
527    [item setTarget: self];
528    [item setTag: FILE_UNCHECK_TAG];
529    [menu addItem: item];
530    [item release];
531   
532    //only check selected
533    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Only Check Selected", "File Outline -> Menu")
534            action: @selector(setOnlySelectedCheck:) keyEquivalent: @""];
535    [item setTarget: self];
536    [menu addItem: item];
537    [item release];
538   
539    [menu addItem: [NSMenuItem separatorItem]];
540   
541    //priority
542    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Priority", "File Outline -> Menu") action: NULL keyEquivalent: @""];
543    NSMenu * priorityMenu = [[NSMenu alloc] initWithTitle: @"File Priority Menu"];
544    [item setSubmenu: priorityMenu];
545    [menu addItem: item];
546    [item release];
547   
548    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"High", "File Outline -> Priority Menu")
549            action: @selector(setPriority:) keyEquivalent: @""];
550    [item setTarget: self];
551    [item setTag: FILE_PRIORITY_HIGH_TAG];
552    [item setImage: [NSImage imageNamed: @"PriorityHighTemplate.png"]];
553    [priorityMenu addItem: item];
554    [item release];
555   
556    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Normal", "File Outline -> Priority Menu")
557            action: @selector(setPriority:) keyEquivalent: @""];
558    [item setTarget: self];
559    [item setTag: FILE_PRIORITY_NORMAL_TAG];
560    [item setImage: [NSImage imageNamed: @"PriorityNormalTemplate.png"]];
561    [priorityMenu addItem: item];
562    [item release];
563   
564    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Low", "File Outline -> Priority Menu")
565            action: @selector(setPriority:) keyEquivalent: @""];
566    [item setTarget: self];
567    [item setTag: FILE_PRIORITY_LOW_TAG];
568    [item setImage: [NSImage imageNamed: @"PriorityLowTemplate.png"]];
569    [priorityMenu addItem: item];
570    [item release];
571   
572    [priorityMenu release];
573   
574    [menu addItem: [NSMenuItem separatorItem]];
575   
576    //reveal in finder
577    item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"Show in Finder", "File Outline -> Menu")
578            action: @selector(revealFile:) keyEquivalent: @""];
579    [item setTarget: self];
580    [menu addItem: item];
581    [item release];
582   
583    return [menu autorelease];
584}
585
586- (NSUInteger) findFileNode: (FileListNode *) node inList: (NSArray *) list inRange: (NSRange) range currentParent: (FileListNode *) currentParent finalParent: (FileListNode **) parent
587{
588    NSAssert(![node isFolder], @"Looking up folder node!");
589   
590    __block NSUInteger retIndex = NSNotFound;
591   
592    [list enumerateObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: range] options: NSEnumerationConcurrent usingBlock: ^(id checkNode, NSUInteger index, BOOL * stop) {
593        if ([checkNode isEqualTo: node])
594        {
595            *parent = currentParent;
596            retIndex = index;
597            *stop = YES;
598        }
599        else if ([checkNode isFolder] && [[checkNode indexes] containsIndex: [[node indexes] firstIndex]])
600        {
601            const NSUInteger subIndex = [self findFileNode: node inList: [checkNode children] inRange: NSMakeRange(0, [[checkNode children] count]) currentParent: checkNode finalParent: parent];
602            NSAssert(subIndex != NSNotFound, @"We didn't find an expected file node.");
603            retIndex = subIndex;
604            *stop = YES;
605        }
606    }];
607   
608    return retIndex;
609}
610
611@end
Note: See TracBrowser for help on using the repository browser.