Changeset 917
- Timestamp:
- 12/08/04 15:13:25 (4 years ago)
- Files:
-
- Footagehead/trunk/FHController.m (modified) (16 diffs)
- Footagehead/trunk/FHFile.h (modified) (4 diffs)
- Footagehead/trunk/FHFile.m (modified) (4 diffs)
- Footagehead/trunk/FHFileHandler.h (modified) (2 diffs)
- Footagehead/trunk/FHFileHandler.m (modified) (7 diffs)
- Footagehead/trunk/FHGalleryHandler.m (modified) (5 diffs)
- Footagehead/trunk/FHHTMLHandler.m (modified) (7 diffs)
- Footagehead/trunk/FHHandler.h (modified) (5 diffs)
- Footagehead/trunk/FHHandler.m (modified) (15 diffs)
- Footagehead/trunk/FHImageHandler.m (modified) (4 diffs)
- Footagehead/trunk/FHRangeHandler.m (modified) (8 diffs)
- Footagehead/trunk/FHSettings.m (modified) (2 diffs)
- Footagehead/trunk/Footagehead.xcode/project.pbxproj (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHController.m
r913 r917 1 /* $Id: FHController.m,v 1.2 3 2004/12/04 18:41:24morris Exp $ */1 /* $Id: FHController.m,v 1.24 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 44 44 - (FHFile *) fileAtIndex:(unsigned int)index; 45 45 46 - (void) loadURL:( NSURL *)url withHint:(FHHandlerHint)hint selectRow:(int)row;46 - (void) loadURL:(ZAURL *)url withHint:(FHHandlerHint)hint selectRow:(int)row; 47 47 - (void) loadFile:(FHFile *)file; 48 48 … … 169 169 170 170 - (void)applicationDidFinishLaunching:(NSNotification *)notification { 171 NSURL *url;171 ZAURL *url; 172 172 int hint; 173 173 … … 176 176 // --- if option redirect to home 177 177 if((GetCurrentKeyModifiers() & optionKey) != 0) { 178 [FHSettings setObject:[[ NSURL fileURLWithPath:NSHomeDirectory()] absoluteString] forKey:FHOpenURL];178 [FHSettings setObject:[[ZAURL fileURLWithPath:NSHomeDirectory()] string] forKey:FHOpenURL]; 179 179 180 180 hint = FHHandlerHintFile; … … 183 183 if(_openLast) { 184 184 // --- get url of last open directory 185 url = [ NSURL URLWithString:[FHSettings objectForKey:FHOpenURL]];185 url = [ZAURL URLWithString:[FHSettings objectForKey:FHOpenURL]]; 186 186 187 187 if([url isFileURL] && ![[NSFileManager defaultManager] directoryExistsAtPath:[url path]]) { 188 url = [ NSURL fileURLWithPath:NSHomeDirectory()];188 url = [ZAURL fileURLWithPath:NSHomeDirectory()]; 189 189 hint = FHHandlerHintNone; 190 190 } … … 201 201 - (void)applicationWillTerminate:(NSNotification *)notification { 202 202 // --- save settings 203 [FHSettings setObject:[[_handler URL] absoluteString] forKey:FHOpenURL];203 [FHSettings setObject:[[_handler URL] string] forKey:FHOpenURL]; 204 204 [FHSettings setInt:[_handler hint] forKey:FHOpenHint]; 205 205 … … 217 217 218 218 - (BOOL)application:(NSApplication *)application openFile:(NSString *)path { 219 /* NSString *folderPath, *filename = NULL; 220 221 // --- get path to the folder 222 if([[NSFileManager defaultManager] directoryExistsAtPath:path]) { 223 folderPath = path; 224 } else { 225 filename = [path lastPathComponent]; 226 folderPath = [path stringByDeletingLastPathComponent]; 227 } 228 229 // -- load files 230 [self startSpinning]; 231 [_handler release]; 232 _handler = [[FHHandler alloc] initWithURL:[NSURL fileURLWithPath:folderPath]]; 233 [_browserView insertFiles:[_handler files]]; 234 235 // --- select file 236 if(filename) 237 [_browserView selectCellAtRow:[_browserView indexOfCellWithName:filename] column:0]; 238 else 239 [_browserView selectCellAtRow:0 column:0]; 240 241 // --- adjust interface 242 [self selectRow:[_browserView selectedRow]]; 243 [self update]; 244 [self stopSpinning]; 245 _openLast = NO; 246 */ 219 [self loadURL:[ZAURL fileURLWithPath:path] withHint:FHHandlerHintFile selectRow:0]; 220 247 221 return YES; 248 222 } … … 373 347 - (void)openURLPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 374 348 NSString *string; 375 NSRange range;376 349 377 350 [_openURLPanel close]; … … 381 354 [FHSettings setInt:[[_openURLExtractMatrix selectedCell] tag] forKey:FHExtract]; 382 355 383 // --- fix schemeless356 // --- load files 384 357 string = [_openURLTextView string]; 385 range = [string rangeOfString:@"://"]; 386 387 if(range.location == NSNotFound) 388 string = [NSString stringWithFormat:@"http://%@", string]; 389 390 // --- load files 391 [self loadURL:[NSURL URLWithString:string] withHint:FHHandlerHintNone selectRow:0]; 358 [self loadURL:[ZAURL URLWithString:string scheme:@"http"] withHint:FHHandlerHintNone selectRow:0]; 392 359 } 393 360 } … … 503 470 504 471 - (IBAction)openParent:(id)sender { 505 NSURL *parentURL;506 472 NSString *name; 507 508 parentURL = [_handler parentURL]; 509 510 if(![parentURL isEqual:[_handler relativeURL]]) { 511 name = [[[_handler relativeURL] path] lastPathComponent]; 512 [self loadURL:[_handler parentURL] withHint:FHHandlerHintNone selectRow:0]; 473 ZAURL *url; 474 475 url = [_handler parentURL]; 476 477 if(![url isEqual:[_handler URL]]) { 478 name = [[[_handler URL] path] lastPathComponent]; 479 [self loadURL:url withHint:FHHandlerHintNone selectRow:0]; 513 480 [_tableView selectRowWithStringValue:name]; 514 481 } … … 531 498 [self loadURL:[file URL] withHint:FHHandlerHintNone selectRow:0]; 532 499 else 533 [[NSWorkspace sharedWorkspace] openURL:[ fileURL]];500 [[NSWorkspace sharedWorkspace] openURL:[[file URL] URL]]; 534 501 } 535 502 … … 708 675 #pragma mark - 709 676 710 - (void)loadURL:( NSURL *)url withHint:(FHHandlerHint)hint selectRow:(int)row {677 - (void)loadURL:(ZAURL *)url withHint:(FHHandlerHint)hint selectRow:(int)row { 711 678 BOOL select; 712 679 … … 771 738 [_lock unlockWithCondition:0]; 772 739 773 if(row == 0 || row >= lastRow + 5 || row < lastRow) {740 if(row >= 0 && (row == 0 || row >= lastRow + 5 || row < lastRow)) { 774 741 count = [files count]; 775 742 … … 800 767 continue; 801 768 802 image = [[NSImage alloc] initWithContentsOfURL:[ fileURL]];769 image = [[NSImage alloc] initWithContentsOfURL:[[file URL] URL]]; 803 770 [file setImage:[image smoothedImage]]; 804 771 [image release]; … … 897 864 item = [[NSMenuItem alloc] initWithTitle:name action:@selector(openMenu:) keyEquivalent:keyEquivalent]; 898 865 [item setImage:icon]; 899 [item setRepresentedObject:[ NSURL fileURLWithPath:path]];866 [item setRepresentedObject:[ZAURL fileURLWithPath:path]]; 900 867 [[_menu menu] addItem:item]; 901 868 _menuItems++; … … 1001 968 item = [[NSMenuItem alloc] initWithTitle:name action:@selector(openMenu:) keyEquivalent:@""]; 1002 969 [item setImage:icon]; 1003 [item setRepresentedObject:[ NSURL fileURLWithPath:path]];970 [item setRepresentedObject:[ZAURL fileURLWithPath:path]]; 1004 971 [_menu insertItem:item atIndex:i]; 1005 972 _menuItems++; Footagehead/trunk/FHFile.h
r915 r917 1 /* $Id: FHFile.h,v 1. 5 2004/12/04 20:27:00morris Exp $ */1 /* $Id: FHFile.h,v 1.6 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 31 31 @interface FHFile : ZAObject <NSCoding> { 32 32 NSString *_name; 33 NSURL *_url;33 ZAURL *_url; 34 34 NSString *_path; 35 35 NSString *_extension; … … 43 43 44 44 45 - (id) initWithURL:( NSURL *)url isDirectory:(BOOL)isDirectory index:(int)index;46 - (id) initWithURL:( NSURL *)url isDirectory:(BOOL)isDirectory index:(int)index hint:(FHHandlerHint)hint;45 - (id) initWithURL:(ZAURL *)url isDirectory:(BOOL)isDirectory index:(int)index; 46 - (id) initWithURL:(ZAURL *)url isDirectory:(BOOL)isDirectory index:(int)index hint:(FHHandlerHint)hint; 47 47 48 48 - (void) setImage:(NSImage *)image; … … 53 53 54 54 - (NSString *) name; 55 - ( NSURL *) URL;55 - (ZAURL *) URL; 56 56 - (NSString *) path; 57 57 - (NSString *) extension; Footagehead/trunk/FHFile.m
r911 r917 1 /* $Id: FHFile.m,v 1. 5 2004/12/04 16:34:23morris Exp $ */1 /* $Id: FHFile.m,v 1.6 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 32 32 @implementation FHFile 33 33 34 - (id)initWithURL:( NSURL *)url isDirectory:(BOOL)directory index:(int)index {34 - (id)initWithURL:(ZAURL *)url isDirectory:(BOOL)directory index:(int)index { 35 35 return [self initWithURL:url isDirectory:directory index:(int)index hint:FHHandlerHintNone]; 36 36 } … … 38 38 39 39 40 - (id)initWithURL:( NSURL *)url isDirectory:(BOOL)directory index:(int)index hint:(FHHandlerHint)hint {40 - (id)initWithURL:(ZAURL *)url isDirectory:(BOOL)directory index:(int)index hint:(FHHandlerHint)hint { 41 41 BOOL local; 42 42 … … 177 177 178 178 179 - ( NSURL *)URL {179 - (ZAURL *)URL { 180 180 return _url; 181 181 } Footagehead/trunk/FHFileHandler.h
r901 r917 1 /* $Id: FHFileHandler.h,v 1. 3 2004/12/03 12:29:49morris Exp $ */1 /* $Id: FHFileHandler.h,v 1.4 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 29 29 #import "FHHandler.h" 30 30 31 @interface FHFileHandler : FHHandler { 32 NSURL *_relativeURL; 33 } 31 @interface FHFileHandler : FHHandler 34 32 35 33 @end Footagehead/trunk/FHFileHandler.m
r905 r917 1 /* $Id: FHFileHandler.m,v 1. 8 2004/12/03 14:57:04morris Exp $ */1 /* $Id: FHFileHandler.m,v 1.9 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 @implementation FHFileHandler 34 34 35 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {35 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 36 36 if([url isFileURL]) { 37 37 if([[NSFileManager defaultManager] directoryExistsAtPath:[url path]]) … … 44 44 45 45 46 + (BOOL)handlesURLAsDirectory:( NSURL *)url {46 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 47 47 return YES; 48 }49 50 51 52 #pragma mark -53 54 - (void)dealloc {55 [_relativeURL release];56 57 [super dealloc];58 48 } 59 49 … … 64 54 - (NSArray *)files { 65 55 NSEnumerator *enumerator; 66 NSURL *url;67 56 NSArray *types, *files; 68 57 NSString *name, *root, *path; 69 58 FHFile *file; 59 ZAURL *url; 70 60 LSItemInfoRecord itemInfoRecord; 71 61 BOOL isDirectory; 72 62 int i = 0; 73 63 74 64 if(!_loadedFiles) { 75 65 types = [NSImage FHImageFileTypes]; … … 79 69 80 70 while((name = [enumerator nextObject])) { 71 path = [root stringByAppendingPathComponent:name]; 72 81 73 if([name hasPrefix:@"."] ) 82 74 continue; 83 75 84 path = [root stringByAppendingPathComponent:name]; 85 86 if([name isEqualToString:@".FootageheadPath"]) { 87 _relativeURL = [[NSURL alloc] initWithString: 88 [[NSString stringWithContentsOfFile:path] stringByAddingURLPercentEscapes]]; 89 } 90 91 url = [NSURL fileURLWithPath:path]; 76 url = [ZAURL fileURLWithPath:path]; 92 77 isDirectory = [FHHandler URLIsDirectory:url]; 93 78 … … 97 82 } 98 83 99 LSCopyItemInfoForURL((CFURLRef) url, kLSRequestBasicFlagsOnly, &itemInfoRecord);84 LSCopyItemInfoForURL((CFURLRef) [url URL], kLSRequestBasicFlagsOnly, &itemInfoRecord); 100 85 101 86 if(itemInfoRecord.flags & kLSItemInfoIsInvisible) … … 112 97 return _files; 113 98 } 114 115 116 117 - (BOOL)isLocal {118 if(_relativeURL)119 return [_relativeURL isFileURL];120 121 return [super isLocal];122 }123 124 125 126 #pragma mark -127 128 - (NSURL *)parentURL {129 NSString *path, *root;130 131 path = [[[self relativeURL] path] stringByReplacingURLPercentEscapes];132 root = [[[self URL] path] stringByAppendingPathComponent:@".FootageheadRoot"];133 134 if([NSString stringWithContentsOfFile:root])135 return [NSURL fileURLWithPath:path];136 137 return [NSURL fileURLWithPath:[path stringByDeletingLastPathComponent]];138 }139 140 141 142 - (NSURL *)relativeURL {143 NSString *filePath, *path;144 145 filePath = [[[[self URL] path] stringByDeletingLastPathComponent]146 stringByAppendingPathComponent:@".FootageheadPath"];147 path = [NSString stringWithContentsOfFile:filePath];148 149 path = path || !_relativeURL ? [[self URL] path] : [_relativeURL path];150 151 return [NSURL fileURLWithPath:path];152 }153 154 155 156 - (NSArray *)displayURLComponents {157 NSEnumerator *enumerator;158 NSMutableArray *components;159 NSString *path, *component, *label;160 161 if(_relativeURL && ![_relativeURL isFileURL])162 return [NSArray arrayWithObject:[_relativeURL absoluteString]];163 164 components = [NSMutableArray arrayWithCapacity:10];165 path = _relativeURL ? [_relativeURL path] : [[self URL] path];166 enumerator = [[[path stringByReplacingURLPercentEscapes] pathComponents] objectEnumerator];167 label = [NSString string];168 169 while((component = [enumerator nextObject])) {170 label = [label stringByAppendingString:component];171 172 if(![label hasSuffix:@"/"])173 label = [label stringByAppendingString:@"/"];174 175 [components addObject:label];176 }177 178 return components;179 }180 181 182 183 - (NSArray *)fullURLComponents {184 NSEnumerator *enumerator;185 NSMutableArray *components;186 NSString *path, *component, *label;187 188 if(_relativeURL && ![_relativeURL isFileURL])189 return [NSArray arrayWithObject:_relativeURL];190 191 components = [NSMutableArray arrayWithCapacity:10];192 path = _relativeURL ? [_relativeURL path] : [[self URL] path];193 enumerator = [[path pathComponents] objectEnumerator];194 label = [NSString string];195 196 while((component = [enumerator nextObject])) {197 label = [label stringByAppendingString:component];198 199 if(![label hasSuffix:@"/"])200 label = [label stringByAppendingString:@"/"];201 202 [components addObject:[NSURL fileURLWithPath:label]];203 }204 205 return components;206 }207 99 208 100 @end Footagehead/trunk/FHGalleryHandler.m
r905 r917 1 /* $Id: FHGalleryHandler.m,v 1. 4 2004/12/03 14:57:04morris Exp $ */1 /* $Id: FHGalleryHandler.m,v 1.5 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 #import "FHSettings.h" 34 34 35 #warning FHGalleryHandler is disabled 36 #if 0 37 35 38 @implementation FHGalleryHandler 36 39 37 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {40 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 38 41 return NO; 39 42 } … … 41 44 42 45 43 + (BOOL)handlesURLAsDirectory:( NSURL *)url {46 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 44 47 return NO; 45 48 } … … 49 52 #pragma mark - 50 53 51 - (id)initWithURL:(NSURL *)url hint:(FHHandlerHint)hint { 54 - (id)initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint { 55 NSString *string, 56 52 57 self = [super initWithURL:url hint:hint]; 53 58 … … 244 249 245 250 @end 251 252 #endif Footagehead/trunk/FHHTMLHandler.m
r903 r917 1 /* $Id: FHHTMLHandler.m,v 1. 7 2004/12/03 14:56:07morris Exp $ */1 /* $Id: FHHTMLHandler.m,v 1.8 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 35 35 @implementation FHHTMLHandler 36 36 37 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {37 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 38 38 NSString *extension; 39 39 … … 52 52 53 53 54 + (BOOL)handlesURLAsDirectory:( NSURL *)url {54 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 55 55 return NO; 56 56 } … … 60 60 #pragma mark - 61 61 62 - (id)initWithURL:( NSURL *)url hint:(FHHandlerHint)hint {62 - (id)initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint { 63 63 self = [super initWithURL:url hint:hint]; 64 64 65 if([[[url path] pathExtension] isEqualToString:@""] && ![[url absoluteString] hasSuffix:@"/"]) { 66 [_url release]; 67 _url = [[NSURL URLWithString:[NSString stringWithFormat:@"%@/", [url absoluteString]]] retain]; 65 if([[[_url path] pathExtension] isEqualToString:@""]) { 66 if(![[_url string] hasSuffix:@"/"]) { 67 url = [ZAURL URLWithString:[[_url string] stringByAppendingString:@"/"]]; 68 69 [url retain]; 70 [_url release]; 71 72 _url = url; 73 } 68 74 } 69 75 70 _html = [[NSString alloc] initWithContentsOfURL: _url];76 _html = [[NSString alloc] initWithContentsOfURL:[_url URL]]; 71 77 72 78 if([_html containsSubstring:@"gallery.footer"]) { 73 79 [self release]; 74 80 75 return [ [FHGalleryHandler alloc] initWithURL:url];81 return [(FHGalleryHandler *) [FHGalleryHandler alloc] initWithURL:_url]; 76 82 } 77 83 … … 96 102 NSString *token, *link; 97 103 NSScanner *scanner; 98 NSURL *url;99 104 FHFile *file; 105 ZAURL *url; 100 106 BOOL isDirectory; 101 107 unsigned int length; … … 141 147 } 142 148 143 url = [[NSURL URLWithString:link relativeToURL:[self URL]] absoluteURL]; 149 link = [link stringByReplacingURLPercentEscapes]; 150 151 if([link containsSubstring:@"://"]) { 152 url = [ZAURL URLWithString:link]; 153 } else { 154 url = [[[self URL] copy] autorelease]; 155 156 if([link hasPrefix:@"/"]) 157 [url setPath:link]; 158 else 159 [url setPath:[[url path] stringByAppendingPathComponent:link]]; 160 } 144 161 145 162 if([[url path] isEqualToString:@"/"]) … … 164 181 } 165 182 166 167 168 #pragma mark -169 170 - (NSURL *)parentURL {171 NSString *string;172 NSRange range;173 174 string = [_url absoluteString];175 176 while([string hasSuffix:@"/"])177 string = [string substringToIndex:[string length] - 1];178 179 range = [string rangeOfString:@"/" options:NSBackwardsSearch];180 181 if(range.location == NSNotFound)182 return [self URL];183 184 string = [string substringToIndex:range.location + 1];185 186 if([string hasSuffix:@"://"])187 return [self URL];188 189 return [NSURL URLWithString:string];190 }191 192 183 @end Footagehead/trunk/FHHandler.h
r915 r917 1 /* $Id: FHHandler.h,v 1. 5 2004/12/04 20:27:00morris Exp $ */1 /* $Id: FHHandler.h,v 1.6 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 FHHandlerHintGallery, 34 34 FHHandlerHintImage, 35 FHHandlerHintRange, 36 FHHandlerHintRAR, 37 FHHandlerHintZip 35 FHHandlerHintRange 38 36 }; 39 37 typedef enum FHHandlerHint FHHandlerHint; … … 42 40 NSMutableArray *_files; 43 41 NSMutableArray *_images; 44 NSURL *_url;42 ZAURL *_url; 45 43 46 44 FHHandlerHint _hint; … … 51 49 52 50 53 + (BOOL) handlesURL:( NSURL *)url isPrimary:(BOOL)primary;54 + (BOOL) handlesURLAsDirectory:( NSURL *)url;55 + (BOOL) URLIsDirectory:( NSURL *)url;51 + (BOOL) handlesURL:(ZAURL *)url isPrimary:(BOOL)primary; 52 + (BOOL) handlesURLAsDirectory:(ZAURL *)url; 53 + (BOOL) URLIsDirectory:(ZAURL *)url; 56 54 57 - (id) initWithURL:( NSURL *)url;58 - (id) initWithURL:( NSURL *)url hint:(FHHandlerHint)hint;55 - (id) initWithURL:(ZAURL *)url; 56 - (id) initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint; 59 57 60 58 - (NSArray *) files; … … 65 63 - (FHHandlerHint) hint; 66 64 67 - (NSURL *) URL; 68 - (NSURL *) parentURL; 69 - (NSURL *) relativeURL; 65 - (ZAURL *) URL; 66 - (ZAURL *) parentURL; 70 67 - (NSArray *) displayURLComponents; 71 68 - (NSArray *) fullURLComponents; Footagehead/trunk/FHHandler.m
r901 r917 1 /* $Id: FHHandler.m,v 1. 5 2004/12/03 12:29:49morris Exp $ */1 /* $Id: FHHandler.m,v 1.6 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 34 34 #import "FHImageHandler.h" 35 35 #import "FHRangeHandler.h" 36 #import "FHRARHandler.h"37 #import "FHZipHandler.h"38 36 39 37 static NSDictionary *FHHandlerHints; … … 49 47 [FHFileHandler class], 50 48 [NSNumber numberWithInt:FHHandlerHintFile], 51 [FHGalleryHandler class], 52 [NSNumber numberWithInt:FHHandlerHintGallery], 49 // [FHGalleryHandler class], 50 // [NSNumber numberWithInt:FHHandlerHintGallery], 51 [FHRangeHandler class], 52 [NSNumber numberWithInt:FHHandlerHintRange], 53 53 [FHImageHandler class], 54 54 [NSNumber numberWithInt:FHHandlerHintImage], 55 [FHRangeHandler class],56 [NSNumber numberWithInt:FHHandlerHintRange],57 [FHRARHandler class],58 [NSNumber numberWithInt:FHHandlerHintRAR],59 [FHZipHandler class],60 [NSNumber numberWithInt:FHHandlerHintZip],61 55 NULL]; 62 56 … … 64 58 [FHHTMLHandler class], 65 59 [FHFileHandler class], 66 [FHGalleryHandler class], 60 // [FHGalleryHandler class], 61 [FHRangeHandler class], 67 62 [FHImageHandler class], 68 [FHRangeHandler class],69 [FHRARHandler class],70 [FHZipHandler class],71 63 NULL]; 72 64 } … … 75 67 76 68 77 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {69 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 78 70 [self doesNotRecognizeSelector:_cmd]; 79 71 return NO; … … 82 74 83 75 84 + (BOOL)handlesURLAsDirectory:( NSURL *)url {76 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 85 77 [self doesNotRecognizeSelector:_cmd]; 86 78 return NO; … … 89 81 90 82 91 + (BOOL)URLIsDirectory:( NSURL *)url {83 + (BOOL)URLIsDirectory:(ZAURL *)url { 92 84 Class class; 93 85 int i, count; … … 129 121 130 122 131 - (id)initWithURL:( NSURL *)url {123 - (id)initWithURL:(ZAURL *)url { 132 124 return [self initWithURL:url hint:FHHandlerHintNone]; 133 125 } … … 135 127 136 128 137 - (id)initWithURL:( NSURL *)url hint:(FHHandlerHint)hint {129 - (id)initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint { 138 130 self = [super init]; 139 131 … … 213 205 #pragma mark - 214 206 215 - ( NSURL *)URL {207 - (ZAURL *)URL { 216 208 return _url; 217 209 } … … 219 211 220 212 221 - (NSURL *)parentURL { 222 return [self URL]; 223 } 224 225 226 227 - (NSURL *)relativeURL { 228 return [self URL]; 213 - (ZAURL *)parentURL { 214 ZAURL *url; 215 216 url = [[self URL] copy]; 217 [url setPath:[[[self URL] path] stringByDeletingLastPathComponent]]; 218 219 return [url autorelease]; 229 220 } 230 221 … … 232 223 233 224 - (NSArray *)displayURLComponents { 234 return [NSArray arrayWithObject:[[[self URL] absoluteString] stringByReplacingURLPercentEscapes]]; 225 NSEnumerator *enumerator; 226 NSMutableArray *components; 227 NSString *path, *component; 228 ZAURL *url; 229 230 url = [self URL]; 231 path = [[url path] retain]; 232 [url setPath:@"/"]; 233 234 enumerator = [[path pathComponents] objectEnumerator]; 235 components = [NSMutableArray arrayWithCapacity:10]; 236 237 while((component = [enumerator nextObject])) { 238 if([component isEqualToString:@"/"]) 239 continue; 240 241 [url setPath:[[url path] stringByAppendingPathComponent:component]]; 242 [components addObject:[url humanReadableString]]; 243 } 244 245 [url setPath:path]; 246 [path release]; 247 248 return components; 235 249 } 236 250 … … 238 252 239 253 - (NSArray *)fullURLComponents { 240 return [NSArray arrayWithObject:[self URL]]; 254 NSEnumerator *enumerator; 255 NSMutableArray *components; 256 NSString *path, *component; 257 ZAURL *url; 258 259 url = [self URL]; 260 path = [[url path] retain]; 261 [url setPath:@"/"]; 262 263 enumerator = [[path pathComponents] objectEnumerator]; 264 components = [NSMutableArray arrayWithCapacity:10]; 265 266 while((component = [enumerator nextObject])) { 267 if([component isEqualToString:@"/"]) 268 continue; 269 270 [url setPath:[[url path] stringByAppendingPathComponent:component]]; 271 [components addObject:[[url copy] autorelease]]; 272 } 273 274 [url setPath:path]; 275 [path release]; 276 277 return components; 241 278 } 242 279 … … 247 284 @implementation FHPlaceholderHandler 248 285 249 - (id)initWithURL:( NSURL *)url {286 - (id)initWithURL:(ZAURL *)url { 250 287 return [self initWithURL:url hint:FHHandlerHintNone]; 251 288 } … … 253 290 254 291 255 - (id)initWithURL:( NSURL *)url hint:(FHHandlerHint)hint {292 - (id)initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint { 256 293 NSZone *zone; 257 294 Class class; Footagehead/trunk/FHImageHandler.m
r905 r917 1 /* $Id: FHImageHandler.m,v 1. 4 2004/12/03 14:57:04morris Exp $ */1 /* $Id: FHImageHandler.m,v 1.5 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 @implementation FHImageHandler 34 34 35 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {35 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 36 36 NSString *extension; 37 37 … … 48 48 49 49 50 + (BOOL)handlesURLAsDirectory:( NSURL *)url {50 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 51 51 return NO; 52 52 } … … 60 60 61 61 if(!_loadedFiles) { 62 file = [[FHFile alloc] initWithURL: _urlisDirectory:NO index:0];62 file = [[FHFile alloc] initWithURL:[self URL] isDirectory:NO index:0]; 63 63 [_files addObject:file]; 64 64 [file release]; Footagehead/trunk/FHRangeHandler.m
r905 r917 1 /* $Id: FHRangeHandler.m,v 1. 4 2004/12/03 14:57:04morris Exp $ */1 /* $Id: FHRangeHandler.m,v 1.5 2004/12/08 14:13:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 @implementation FHRangeHandler 34 34 35 + (BOOL)handlesURL:( NSURL *)url isPrimary:(BOOL)primary {35 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 36 36 NSString *string; 37 37 … … 49 49 50 50 51 + (BOOL)handlesURLAsDirectory:( NSURL *)url {51 + (BOOL)handlesURLAsDirectory:(ZAURL *)url { 52 52 return NO; 53 53 } … … 57 57 #pragma mark - 58 58 59 - (id)initWithURL:( NSURL *)url hint:(FHHandlerHint)hint {59 - (id)initWithURL:(ZAURL *)url hint:(FHHandlerHint)hint { 60 60 NSMutableString *mutableString; 61 61 NSString *string, *start, *stop, *token; … … 68 68 69 69 _links = [[NSMutableArray allo
