Changeset 3902
- Timestamp:
- 03/15/06 21:31:03 (3 years ago)
- Files:
-
- WiredClient/trunk/WCFile.h (modified) (1 diff)
- WiredClient/trunk/WCFile.m (modified) (2 diffs)
- WiredClient/trunk/WCFiles.m (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCFile.h
r3585 r3902 63 63 + (id)fileWithDirectory:(NSString *)path; 64 64 + (id)fileWithPath:(NSString *)path; 65 + (id)fileWithPath:(NSString *)path type:(WCFileType)type; 65 66 + (id)fileWithListArguments:(NSArray *)arguments; 66 67 + (id)fileWithInfoArguments:(NSArray *)arguments; WiredClient/trunk/WCFile.m
r3585 r3902 229 229 230 230 + (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 { 231 243 WCFile *file; 232 244 233 245 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]; 247 247 [file _setPath:path]; 248 248 … … 381 381 382 382 - (NSString *)description { 383 return [NSSWF:@"<%@ %p>{path = %@ }",383 return [NSSWF:@"<%@ %p>{path = %@, type = %d}", 384 384 [self className], 385 385 self, 386 [self path]]; 386 [self path], 387 [self type]]; 387 388 } 388 389 WiredClient/trunk/WCFiles.m
r3656 r3902 53 53 - (void)_updateMenu; 54 54 - (void)_updateFiles; 55 - (void)_updateStatus; 55 56 - (void)_showList; 56 57 - (void)_showBrowser; … … 307 308 308 309 - (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 { 309 336 NSEnumerator *enumerator; 310 337 NSArray *files; … … 313 340 314 341 files = [self _files]; 315 enumerator = [files objectEnumerator];342 enumerator = [files objectEnumerator]; 316 343 317 344 while((file = [enumerator nextObject])) { … … 338 365 [NSString humanReadableStringForSize:size]]]; 339 366 } 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:self355 selector:@selector(filesShouldReload:)356 name:WCFilesShouldReload];357 358 [_progressIndicator stopAnimation:self];359 360 [self _makeFirstResponder];361 367 } 362 368 … … 420 426 [self _validate]; 421 427 [self _updateMenu]; 428 [self _updateStatus]; 422 429 423 430 [[self window] setTitle:[[self _currentPath] path] withSubtitle:[[self connection] name]]; … … 552 559 WCAccount *account; 553 560 WCFileType type; 554 561 555 562 account = [[self connection] account]; 556 563 type = [[self _currentPath] type]; … … 1356 1363 1357 1364 - (void)browserDidSingleClick:(id)sender { 1358 WCFile * path;1365 WCFile *file; 1359 1366 1360 1367 if(![[self connection] isConnected]) … … 1363 1370 [self _validate]; 1364 1371 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]]; 1369 1376 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 } 1372 1381 } else { 1373 if(![[ pathpath] isEqualToString:[[self _currentPath] path]])1374 [self _changeDirectory: path];1382 if(![[file path] isEqualToString:[[self _currentPath] path]]) 1383 [self _changeDirectory:file]; 1375 1384 } 1376 1385 }
