| 1 | #import "PrefController.h" |
|---|
| 2 | |
|---|
| 3 | @implementation PrefController |
|---|
| 4 | |
|---|
| 5 | // init |
|---|
| 6 | // 1 |
|---|
| 7 | - (id)init { |
|---|
| 8 | NSLog(@"PrefController - init -- called \n"); |
|---|
| 9 | if (self = [super init]) { |
|---|
| 10 | [self setToolbar:[[NSToolbar alloc] initWithIdentifier:@"preferencePanes"]]; |
|---|
| 11 | [self setItems:[[NSMutableDictionary alloc] init]]; |
|---|
| 12 | [self setMyCollections:[[NSMutableDictionary alloc] init]]; |
|---|
| 13 | [self setAllowedPanels:[[NSMutableArray alloc] init]]; |
|---|
| 14 | [self setService:[[NSString alloc] init]]; |
|---|
| 15 | } |
|---|
| 16 | return self; |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | // 2 |
|---|
| 20 | - (void)awakeFromNib { |
|---|
| 21 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:@"NSWindowWillCloseNotification" object:myWindow]; |
|---|
| 22 | |
|---|
| 23 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 24 | [self setService:[userDefaults objectForKey:@"service type"]]; |
|---|
| 25 | |
|---|
| 26 | // Set the general pref view control values |
|---|
| 27 | [enable_growl setObjectValue:[userDefaults objectForKey:@"enable_growl"]]; |
|---|
| 28 | [save_login setObjectValue:[userDefaults objectForKey:@"save_login"]]; |
|---|
| 29 | |
|---|
| 30 | if ([self service]) { |
|---|
| 31 | if ([[self service] isEqualToString:@"TypePad"]) { |
|---|
| 32 | [self init_typepad]; |
|---|
| 33 | } |
|---|
| 34 | if ([[self service] isEqualToString:@"Vox"]) { |
|---|
| 35 | [self init_vox]; |
|---|
| 36 | } |
|---|
| 37 | } else { |
|---|
| 38 | [self init_generic]; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | toolbar = [[NSToolbar alloc] initWithIdentifier:@"preferencePanes"]; |
|---|
| 42 | [toolbar setDelegate:self]; |
|---|
| 43 | [toolbar setAllowsUserCustomization:NO]; |
|---|
| 44 | [toolbar setAutosavesConfiguration:NO]; |
|---|
| 45 | [myWindow setToolbar:toolbar]; |
|---|
| 46 | [toolbar release]; |
|---|
| 47 | |
|---|
| 48 | [myWindow center]; |
|---|
| 49 | |
|---|
| 50 | [self switchViews:nil]; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | /* dealloc */ |
|---|
| 54 | - (void) dealloc { |
|---|
| 55 | [toolbar release]; toolbar = nil; |
|---|
| 56 | [items release]; items = nil; |
|---|
| 57 | [allowedPanels release]; allowedPanels = nil; |
|---|
| 58 | [service release]; service = nil; |
|---|
| 59 | [myCollections release]; myCollections = nil; |
|---|
| 60 | [super dealloc]; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | - (void) init_generic { |
|---|
| 64 | [items setObject:[self newItem:@"General" image:@"General"] forKey:@"General"]; |
|---|
| 65 | allowedPanels = [NSArray arrayWithObjects:@"General", NSToolbarFlexibleSpaceItemIdentifier, nil]; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | - (void) init_typepad { |
|---|
| 69 | [items setObject:[self newItem:@"General" image:@"General"] forKey:@"General"]; |
|---|
| 70 | [items setObject:[self newItem:@"Image" image:@"Weblog"] forKey:@"Image"]; |
|---|
| 71 | [items setObject:[self newItem:@"Text" image:@"Gallery"] forKey:@"Text"]; |
|---|
| 72 | allowedPanels = [NSArray arrayWithObjects:@"General", @"Image", @"Text", NSToolbarFlexibleSpaceItemIdentifier, nil]; |
|---|
| 73 | |
|---|
| 74 | [tp_image_dropdown removeAllItems]; |
|---|
| 75 | [tp_text_dropdown removeAllItems]; |
|---|
| 76 | |
|---|
| 77 | id key; |
|---|
| 78 | TypePad *tp = [[[TypePad alloc] init] autorelease]; |
|---|
| 79 | // TypePadAccount *uacc = [[tp accounts] objectForKey:[self defaultaccount]]; |
|---|
| 80 | |
|---|
| 81 | // set the items that need blogs |
|---|
| 82 | // NSArray *blogs = [tp defaultAccountWeblogs]; |
|---|
| 83 | NSEnumerator *blog_enumerator = [[tp defaultAccountWeblogs] objectEnumerator]; |
|---|
| 84 | while (key = [blog_enumerator nextObject]) { |
|---|
| 85 | TypePadWeblog *tpobj = key; |
|---|
| 86 | [myCollections setObject:[tpobj weblogID] forKey:[NSString stringWithFormat:@"Weblog: %@", [tpobj weblogTitle]]]; |
|---|
| 87 | [tp_image_dropdown addItemWithTitle:[NSString stringWithFormat:@"Weblog: %@", [tpobj weblogTitle]]]; |
|---|
| 88 | [tp_text_dropdown addItemWithTitle:[NSString stringWithFormat:@"Weblog: %@", [tpobj weblogTitle]]]; |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | // set the items that need galleries - defaultAccountGalleries |
|---|
| 92 | // NSArray *galleries = [tp defaultAccountGalleries]; |
|---|
| 93 | NSEnumerator *gallery_enumerator = [[tp defaultAccountGalleries] objectEnumerator]; |
|---|
| 94 | while (key = [gallery_enumerator nextObject]) { |
|---|
| 95 | TypePadGallery *tpobj = key; |
|---|
| 96 | [myCollections setObject:[tpobj galleryID] forKey:[NSString stringWithFormat:@"Gallery: %@", [tpobj galleryTitle]]]; |
|---|
| 97 | [tp_image_dropdown addItemWithTitle:[NSString stringWithFormat:@"Gallery: %@", [tpobj galleryTitle]]]; |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | if ([tp_image_dropdown numberOfItems] == 0) { |
|---|
| 101 | [tp_image_dropdown setState:NSOffState]; |
|---|
| 102 | } |
|---|
| 103 | if ([tp_text_dropdown numberOfItems] == 0) { |
|---|
| 104 | [tp_text_dropdown setState:NSOffState]; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 108 | if ([userDefaults objectForKey:@"image destination id"]) { |
|---|
| 109 | if ([[userDefaults objectForKey:@"image destination type"] isEqualToString:@"1"]) { |
|---|
| 110 | [tp_image_dropdown selectItemWithTitle:[NSString stringWithFormat:@"Weblog: %@", [userDefaults objectForKey:@"image destination title"]]]; |
|---|
| 111 | } |
|---|
| 112 | if ([[userDefaults objectForKey:@"image destination type"] isEqualToString:@"2"]) { |
|---|
| 113 | [tp_image_dropdown selectItemWithTitle:[NSString stringWithFormat:@"Gallery: %@", [userDefaults objectForKey:@"image destination title"]]]; |
|---|
| 114 | } |
|---|
| 115 | } |
|---|
| 116 | if ([userDefaults objectForKey:@"text destination id"]) { |
|---|
| 117 | if ([[userDefaults objectForKey:@"text destination type"] isEqualToString:@"1"]) { |
|---|
| 118 | [tp_text_dropdown selectItemWithTitle:[NSString stringWithFormat:@"Weblog: %@", [userDefaults objectForKey:@"text destination title"]]]; |
|---|
| 119 | } |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | - (void) init_vox { |
|---|
| 125 | [items setObject:[self newItem:@"General" image:@"General"] forKey:@"General"]; |
|---|
| 126 | [items setObject:[self newItem:@"Audio" image:@"Weblog"] forKey:@"Audio"]; |
|---|
| 127 | [items setObject:[self newItem:@"Image" image:@"Gallery"] forKey:@"Image"]; |
|---|
| 128 | [items setObject:[self newItem:@"Text" image:@"Weblog"] forKey:@"Text"]; |
|---|
| 129 | allowedPanels = [NSArray arrayWithObjects:@"General", @"Audio", @"Image", @"Text", NSToolbarFlexibleSpaceItemIdentifier, nil]; |
|---|
| 130 | |
|---|
| 131 | [vx_image_dropdown removeAllItems]; |
|---|
| 132 | [vx_text_dropdown removeAllItems]; |
|---|
| 133 | |
|---|
| 134 | id key; |
|---|
| 135 | Vox *vx = [[[Vox alloc] init] autorelease]; |
|---|
| 136 | // TypePadAccount *uacc = [[tp accounts] objectForKey:[self defaultaccount]]; |
|---|
| 137 | |
|---|
| 138 | // set the items that need blogs |
|---|
| 139 | // NSArray *blogs = [tp defaultAccountWeblogs]; |
|---|
| 140 | NSEnumerator *col_enumerator = [[vx defaultAccountCollections] objectEnumerator]; |
|---|
| 141 | while (key = [col_enumerator nextObject]) { |
|---|
| 142 | VoxCollection *voxcol = key; |
|---|
| 143 | [myCollections setObject:[voxcol collectionID] forKey:[NSString stringWithFormat:@"Collection: %@", [voxcol collectionTitle]]]; |
|---|
| 144 | NSLog(@"Mapping collection '%@' to id '%@'", [voxcol collectionTitle], [voxcol collectionID]); |
|---|
| 145 | [vx_image_dropdown addItemWithTitle:[NSString stringWithFormat:@"Collection: %@", [voxcol collectionTitle]]]; |
|---|
| 146 | [vx_text_dropdown addItemWithTitle:[NSString stringWithFormat:@"Collection: %@", [voxcol collectionTitle]]]; |
|---|
| 147 | } |
|---|
| 148 | if ([vx_image_dropdown numberOfItems] == 0) { |
|---|
| 149 | [vx_image_dropdown setState:NSOffState]; |
|---|
| 150 | } |
|---|
| 151 | if ([vx_text_dropdown numberOfItems] == 0) { |
|---|
| 152 | [vx_text_dropdown setState:NSOffState]; |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 156 | if ([userDefaults objectForKey:@"vox image destination id"]) { |
|---|
| 157 | if ([[userDefaults objectForKey:@"vox image destination type"] isEqualToString:@"1"]) { |
|---|
| 158 | [tp_image_dropdown selectItemWithTitle:[NSString stringWithFormat:@"Collection: %@", [userDefaults objectForKey:@"vox image destination title"]]]; |
|---|
| 159 | } |
|---|
| 160 | } |
|---|
| 161 | if ([userDefaults objectForKey:@"vox text destination id"]) { |
|---|
| 162 | if ([[userDefaults objectForKey:@"vox text destination type"] isEqualToString:@"1"]) { |
|---|
| 163 | [tp_text_dropdown selectItemWithTitle:[NSString stringWithFormat:@"Collection: %@", [userDefaults objectForKey:@"vox text destination title"]]]; |
|---|
| 164 | } |
|---|
| 165 | } |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | - (NSToolbarItem *) newItem:(NSString *) name image:(NSString *) image { |
|---|
| 169 | NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:name] autorelease]; |
|---|
| 170 | [item setPaletteLabel:name]; |
|---|
| 171 | [item setLabel:name]; |
|---|
| 172 | [item setToolTip:@""]; |
|---|
| 173 | [item setImage:[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:image ofType:@"tiff"]]]; |
|---|
| 174 | [item setTarget:self]; |
|---|
| 175 | [item setAction:@selector(switchViews:)]; |
|---|
| 176 | return item; |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag { |
|---|
| 180 | return [items objectForKey:itemIdentifier]; |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)theToolbar { |
|---|
| 184 | return [self toolbarDefaultItemIdentifiers:theToolbar]; |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)theToolbar { |
|---|
| 188 | return [self allowedPanels]; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | - (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar { |
|---|
| 192 | return [items allKeys]; |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | - (void)switchViews:(NSToolbarItem *)item { |
|---|
| 196 | |
|---|
| 197 | NSString *sender; |
|---|
| 198 | if (item == nil){ |
|---|
| 199 | sender = @"General"; |
|---|
| 200 | [toolbar setSelectedItemIdentifier:sender]; |
|---|
| 201 | } else { |
|---|
| 202 | sender = [item label]; |
|---|
| 203 | } |
|---|
| 204 | NSView *prefsView; |
|---|
| 205 | [myWindow setTitle:sender]; |
|---|
| 206 | if([sender isEqualToString:@"General"]){ |
|---|
| 207 | prefsView = PrefsGeneral; |
|---|
| 208 | }else if([sender isEqualToString:@"Audio"]){ |
|---|
| 209 | prefsView = PrefsVoxAudio; |
|---|
| 210 | }else if([sender isEqualToString:@"Image"]){ |
|---|
| 211 | prefsView = [[self service] isEqualToString:@"TypePad"] ? PrefsTypePadImage : PrefsVoxImage; |
|---|
| 212 | }else if([sender isEqualToString:@"Text"]){ |
|---|
| 213 | prefsView = [[self service] isEqualToString:@"TypePad"] ? PrefsTypePadText : PrefsVoxText; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | NSView *tempView = [[NSView alloc] initWithFrame:[[myWindow contentView] frame]]; |
|---|
| 217 | [myWindow setContentView:tempView]; |
|---|
| 218 | [tempView release]; |
|---|
| 219 | |
|---|
| 220 | NSRect newFrame = [myWindow frame]; |
|---|
| 221 | newFrame.size.height = [prefsView frame].size.height + ([myWindow frame].size.height - [[myWindow contentView] frame].size.height); |
|---|
| 222 | newFrame.size.width = [prefsView frame].size.width; |
|---|
| 223 | newFrame.origin.y += ([[myWindow contentView] frame].size.height - [prefsView frame].size.height); |
|---|
| 224 | |
|---|
| 225 | [myWindow setShowsResizeIndicator:NO]; |
|---|
| 226 | [myWindow setFrame:newFrame display:YES animate:YES]; |
|---|
| 227 | [myWindow setContentView:prefsView]; |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | - (void) windowWillClose:(id) sender { |
|---|
| 231 | NSLog(@"Window closed\n"); |
|---|
| 232 | [self save_generic]; |
|---|
| 233 | if ([self service]) { |
|---|
| 234 | if ([[self service] isEqualToString:@"TypePad"]) { |
|---|
| 235 | [self save_typepad]; |
|---|
| 236 | } |
|---|
| 237 | if ([[self service] isEqualToString:@"Vox"]) { |
|---|
| 238 | [self save_vox]; |
|---|
| 239 | } |
|---|
| 240 | } |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | /* toolbar */ |
|---|
| 244 | - (NSToolbar *) toolbar { return toolbar; } |
|---|
| 245 | |
|---|
| 246 | /* -setToolbar: */ |
|---|
| 247 | - (void) setToolbar: (NSToolbar *) Toolbar { |
|---|
| 248 | //NSLog(@"in -setToolbar:, old value of toolbar: %@, changed to: %@", toolbar, Toolbar); |
|---|
| 249 | if (toolbar != Toolbar) { |
|---|
| 250 | [toolbar autorelease]; |
|---|
| 251 | toolbar = [Toolbar retain]; |
|---|
| 252 | } |
|---|
| 253 | } |
|---|
| 254 | |
|---|
| 255 | /* items */ |
|---|
| 256 | - (NSMutableDictionary *) items { return items; } |
|---|
| 257 | |
|---|
| 258 | /* -setItems: */ |
|---|
| 259 | - (void) setItems: (NSMutableDictionary *) Items { |
|---|
| 260 | //NSLog(@"in -setItems:, old value of items: %@, changed to: %@", items, Items); |
|---|
| 261 | if (items != Items) { |
|---|
| 262 | [items autorelease]; |
|---|
| 263 | items = [Items retain]; |
|---|
| 264 | } |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | /* allowedPanels */ |
|---|
| 268 | - (NSMutableArray *) allowedPanels { return allowedPanels; } |
|---|
| 269 | |
|---|
| 270 | /* -setAllowedPanels: */ |
|---|
| 271 | - (void) setAllowedPanels: (NSMutableArray *) AllowedPanels { |
|---|
| 272 | //NSLog(@"in -setAllowedPanels:, old value of allowedPanels: %@, changed to: %@", allowedPanels, AllowedPanels); |
|---|
| 273 | if (allowedPanels != AllowedPanels) { |
|---|
| 274 | [allowedPanels autorelease]; |
|---|
| 275 | allowedPanels = [AllowedPanels retain]; |
|---|
| 276 | } |
|---|
| 277 | } |
|---|
| 278 | |
|---|
| 279 | /* service */ |
|---|
| 280 | - (NSString *) service { return service; } |
|---|
| 281 | |
|---|
| 282 | /* -setService: */ |
|---|
| 283 | - (void) setService: (NSString *) Service { |
|---|
| 284 | //NSLog(@"in -setService:, old value of service: %@, changed to: %@", service, Service); |
|---|
| 285 | if (service != Service) { |
|---|
| 286 | [service autorelease]; |
|---|
| 287 | service = [Service retain]; |
|---|
| 288 | } |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | /* myCollections */ |
|---|
| 292 | - (NSMutableDictionary *) myCollections { return myCollections; } |
|---|
| 293 | |
|---|
| 294 | /* -setMyCollections: */ |
|---|
| 295 | - (void) setMyCollections: (NSMutableDictionary *) MyCollections { |
|---|
| 296 | //NSLog(@"in -setMyCollections:, old value of myCollections: %@, changed to: %@", myCollections, MyCollections); |
|---|
| 297 | if (myCollections != MyCollections) { |
|---|
| 298 | [myCollections autorelease]; |
|---|
| 299 | myCollections = [MyCollections retain]; |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | - (void) save_generic { |
|---|
| 304 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 305 | [userDefaults setObject:[enable_growl objectValue] forKey:@"enable_growl"]; |
|---|
| 306 | [userDefaults setObject:[save_login objectValue] forKey:@"save_login"]; |
|---|
| 307 | } |
|---|
| 308 | |
|---|
| 309 | - (void) save_typepad { |
|---|
| 310 | NSLog(@"- (void) save_typepad -- called\n"); |
|---|
| 311 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 312 | if ([tp_image_dropdown numberOfItems] > 0) { |
|---|
| 313 | NSArray *image_target = [self parseTargetType:[tp_image_dropdown titleOfSelectedItem]]; |
|---|
| 314 | if ([image_target count] > 0) { |
|---|
| 315 | [userDefaults setObject:[image_target objectAtIndex:0] forKey:@"image destination type"]; |
|---|
| 316 | [userDefaults setObject:[image_target objectAtIndex:1] forKey:@"image destination id"]; |
|---|
| 317 | [userDefaults setObject:[image_target objectAtIndex:2] forKey:@"image destination title"]; |
|---|
| 318 | } |
|---|
| 319 | } |
|---|
| 320 | if ([tp_text_dropdown numberOfItems] > 0) { |
|---|
| 321 | NSArray *text_target = [self parseTargetType:[tp_text_dropdown titleOfSelectedItem]]; |
|---|
| 322 | if ([text_target count] > 0) { |
|---|
| 323 | [userDefaults setObject:[text_target objectAtIndex:0] forKey:@"text destination type"]; |
|---|
| 324 | [userDefaults setObject:[text_target objectAtIndex:1] forKey:@"text destination id"]; |
|---|
| 325 | [userDefaults setObject:[text_target objectAtIndex:2] forKey:@"text destination title"]; |
|---|
| 326 | } |
|---|
| 327 | } |
|---|
| 328 | [userDefaults synchronize]; |
|---|
| 329 | } |
|---|
| 330 | |
|---|
| 331 | - (void) save_vox { |
|---|
| 332 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
|---|
| 333 | if ([vx_image_dropdown numberOfItems] > 0) { |
|---|
| 334 | NSArray *image_target = [self parseTargetType:[vx_image_dropdown titleOfSelectedItem]]; |
|---|
| 335 | if ([image_target count] > 0) { |
|---|
| 336 | [userDefaults setObject:[image_target objectAtIndex:0] forKey:@"vox image destination type"]; |
|---|
| 337 | [userDefaults setObject:[image_target objectAtIndex:1] forKey:@"vox image destination id"]; |
|---|
| 338 | [userDefaults setObject:[image_target objectAtIndex:2] forKey:@"vox image destination title"]; |
|---|
| 339 | } |
|---|
| 340 | } |
|---|
| 341 | if ([vx_text_dropdown numberOfItems] > 0) { |
|---|
| 342 | NSArray *text_target = [self parseTargetType:[vx_text_dropdown titleOfSelectedItem]]; |
|---|
| 343 | if ([text_target count] > 0) { |
|---|
| 344 | [userDefaults setObject:[text_target objectAtIndex:0] forKey:@"vox text destination type"]; |
|---|
| 345 | [userDefaults setObject:[text_target objectAtIndex:1] forKey:@"vox text destination id"]; |
|---|
| 346 | [userDefaults setObject:[text_target objectAtIndex:2] forKey:@"vox text destination title"]; |
|---|
| 347 | } |
|---|
| 348 | } |
|---|
| 349 | [userDefaults synchronize]; |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | - (NSArray *) parseTargetType: (NSString *) title { |
|---|
| 353 | NSMutableArray *ret = [[[NSMutableArray alloc] initWithCapacity:3] autorelease]; |
|---|
| 354 | if ([title rangeOfString:@"Weblog: "].location != NSNotFound) { |
|---|
| 355 | [ret addObject:@"1"]; |
|---|
| 356 | [ret addObject:[myCollections objectForKey:title]]; |
|---|
| 357 | [ret addObject:[title substringFromIndex:8]]; |
|---|
| 358 | } |
|---|
| 359 | if ([title rangeOfString:@"Gallery: "].location != NSNotFound) { |
|---|
| 360 | [ret addObject:@"2"]; |
|---|
| 361 | [ret addObject:[myCollections objectForKey:title]]; |
|---|
| 362 | [ret addObject:[title substringFromIndex:9]]; |
|---|
| 363 | } |
|---|
| 364 | if ([title rangeOfString:@"TypeList: "].location != NSNotFound) { |
|---|
| 365 | [ret addObject:@"3"]; |
|---|
| 366 | [ret addObject:[myCollections objectForKey:title]]; |
|---|
| 367 | [ret addObject:[title substringFromIndex:10]]; |
|---|
| 368 | } |
|---|
| 369 | if ([title rangeOfString:@"Collection: "].location != NSNotFound) { |
|---|
| 370 | [ret addObject:@"1"]; |
|---|
| 371 | [ret addObject:[myCollections objectForKey:title]]; |
|---|
| 372 | [ret addObject:[title substringFromIndex:12]]; |
|---|
| 373 | } |
|---|
| 374 | return ret; |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | @end |
|---|