Changeset 3902

Show
Ignore:
Timestamp:
03/15/06 21:31:03 (3 years ago)
Author:
morris
Message:

Correctly update status bar when selecting an upload folder in column view

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/WCFile.h

    r3585 r3902  
    6363+ (id)fileWithDirectory:(NSString *)path; 
    6464+ (id)fileWithPath:(NSString *)path; 
     65+ (id)fileWithPath:(NSString *)path type:(WCFileType)type; 
    6566+ (id)fileWithListArguments:(NSArray *)arguments; 
    6667+ (id)fileWithInfoArguments:(NSArray *)arguments; 
  • WiredClient/trunk/WCFile.m

    r3585 r3902  
    229229 
    230230+ (id)fileWithDirectory:(NSString *)path { 
     231        return [self fileWithPath:path type:WCFileDirectory]; 
     232} 
     233 
     234 
     235 
     236+ (id)fileWithPath:(NSString *)path { 
     237        return [self fileWithPath:path type:WCFileFile]; 
     238} 
     239 
     240 
     241 
     242+ (id)fileWithPath:(NSString *)path type:(WCFileType)type { 
    231243        WCFile          *file; 
    232244         
    233245        file = [[self alloc] init]; 
    234         [file _setType:WCFileDirectory]; 
    235         [file _setPath:path]; 
    236          
    237         return [file autorelease]; 
    238 
    239  
    240  
    241  
    242 + (id)fileWithPath:(NSString *)path { 
    243         WCFile          *file; 
    244          
    245         file = [[self alloc] init]; 
    246         [file _setType:WCFileFile]; 
     246        [file _setType:type]; 
    247247        [file _setPath:path]; 
    248248         
     
    381381 
    382382- (NSString *)description { 
    383         return [NSSWF:@"<%@ %p>{path = %@}", 
     383        return [NSSWF:@"<%@ %p>{path = %@, type = %d}", 
    384384                [self className], 
    385385                self, 
    386                 [self path]]; 
     386                [self path], 
     387                [self type]]; 
    387388} 
    388389 
  • WiredClient/trunk/WCFiles.m

    r3656 r3902  
    5353- (void)_updateMenu; 
    5454- (void)_updateFiles; 
     55- (void)_updateStatus; 
    5556- (void)_showList; 
    5657- (void)_showBrowser; 
     
    307308 
    308309- (void)_updateFiles { 
     310        [self _updateStatus]; 
     311        [self _sortFiles]; 
     312 
     313        [_filesTableView reloadData]; 
     314        [_filesBrowser reloadColumn:[_filesBrowser lastColumn]]; 
     315        [[_filesBrowser matrixInColumn:[_filesBrowser lastColumn]] setMenu:[_filesBrowser menu]]; 
     316 
     317        if(_selectPath) { 
     318                [_filesTableView selectRowWithStringValue:[_selectPath lastPathComponent]]; 
     319                 
     320                [_selectPath release]; 
     321                _selectPath = NULL; 
     322        } 
     323         
     324        [[self connection] addObserver:self 
     325                                                  selector:@selector(filesShouldReload:) 
     326                                                          name:WCFilesShouldReload]; 
     327 
     328        [_progressIndicator stopAnimation:self]; 
     329         
     330        [self _makeFirstResponder]; 
     331} 
     332 
     333 
     334 
     335- (void)_updateStatus { 
    309336        NSEnumerator            *enumerator; 
    310337        NSArray                         *files; 
     
    313340         
    314341        files = [self _files]; 
    315         enumerator     = [files objectEnumerator]; 
     342        enumerator = [files objectEnumerator]; 
    316343         
    317344        while((file = [enumerator nextObject])) { 
     
    338365                        [NSString humanReadableStringForSize:size]]]; 
    339366        } 
    340  
    341         [self _sortFiles]; 
    342  
    343         [_filesTableView reloadData]; 
    344         [_filesBrowser reloadColumn:[_filesBrowser lastColumn]]; 
    345         [[_filesBrowser matrixInColumn:[_filesBrowser lastColumn]] setMenu:[_filesBrowser menu]]; 
    346  
    347         if(_selectPath) { 
    348                 [_filesTableView selectRowWithStringValue:[_selectPath lastPathComponent]]; 
    349                  
    350                 [_selectPath release]; 
    351                 _selectPath = NULL; 
    352         } 
    353          
    354         [[self connection] addObserver:self 
    355                                                   selector:@selector(filesShouldReload:) 
    356                                                           name:WCFilesShouldReload]; 
    357  
    358         [_progressIndicator stopAnimation:self]; 
    359          
    360         [self _makeFirstResponder]; 
    361367} 
    362368 
     
    420426        [self _validate]; 
    421427        [self _updateMenu]; 
     428        [self _updateStatus]; 
    422429         
    423430        [[self window] setTitle:[[self _currentPath] path] withSubtitle:[[self connection] name]]; 
     
    552559        WCAccount               *account; 
    553560        WCFileType              type; 
    554  
     561         
    555562        account = [[self connection] account]; 
    556563        type = [[self _currentPath] type]; 
     
    13561363 
    13571364- (void)browserDidSingleClick:(id)sender { 
    1358         WCFile          *path
     1365        WCFile          *file
    13591366         
    13601367        if(![[self connection] isConnected]) 
     
    13631370        [self _validate]; 
    13641371         
    1365         path = [WCFile fileWithDirectory:[[_rootPath path] stringByAppendingPathComponent:[_filesBrowser path]]]; 
    1366  
    1367         if([[_filesBrowser selectedCell] isLeaf]) { 
    1368                 path = [WCFile fileWithDirectory:[[path path] stringByDeletingLastPathComponent]]; 
     1372        file = [[_filesBrowser selectedCell] representedObject]; 
     1373 
     1374        if(![file isFolder]) { 
     1375                file = [WCFile fileWithPath:[[file path] stringByDeletingLastPathComponent] type:[file type]]; 
    13691376                 
    1370                 if(![[path path] isEqualToString:[[self _currentPath] path]]) 
    1371                         [self _setDirectory:path]; 
     1377                if(![[file path] isEqualToString:[[self _currentPath] path]]) { 
     1378                        [self _setDirectory:file]; 
     1379                        [self _updateStatus]; 
     1380                } 
    13721381        } else { 
    1373                 if(![[path path] isEqualToString:[[self _currentPath] path]]) 
    1374                         [self _changeDirectory:path]; 
     1382                if(![[file path] isEqualToString:[[self _currentPath] path]]) 
     1383                        [self _changeDirectory:file]; 
    13751384        } 
    13761385}