Ignore:
Timestamp:
Nov 30, 2008, 7:23:15 PM (12 years ago)
Author:
livings124
Message:

patch from ciaran for #757 to add separate download locations for each group (when added)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsController.m

    r7189 r7210  
    167167}
    168168
     169- (BOOL) usesCustomDownloadLocationForIndex: (NSInteger) index
     170{
     171    NSInteger orderIndex = [self rowValueForIndex: index];
     172    return orderIndex != -1 ? [[[fGroups objectAtIndex: orderIndex] objectForKey: @"UsesCustomDownloadLocation"] boolValue] : NO;
     173}
     174
     175- (void) setUsesCustomDownloadLocation: (BOOL) useCustomLocation forIndex: (NSInteger) index
     176{
     177    NSMutableDictionary * dict = [fGroups objectAtIndex: [self rowValueForIndex: index]];
     178   
     179    [dict setObject: [NSNumber numberWithBool:useCustomLocation] forKey: @"UsesCustomDownloadLocation"];
     180   
     181    [[GroupsController groups] saveGroups];
     182    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
     183}
     184
     185- (NSString *) customDownloadLocationForIndex: (NSInteger) index
     186{
     187    NSInteger orderIndex = [self rowValueForIndex: index];
     188    return orderIndex != -1 ? [[fGroups objectAtIndex: orderIndex] objectForKey: @"CustomDownloadLocation"] : nil;
     189}
     190
     191- (void) setCustomDownloadLocation: (NSString *) location forIndex: (NSInteger) index
     192{
     193    NSMutableDictionary * dict = [fGroups objectAtIndex: [self rowValueForIndex: index]];
     194   
     195    if (location)
     196        [dict setObject: location forKey: @"CustomDownloadLocation"];
     197    else
     198        [dict removeObjectForKey: @"CustomDownloadLocation"];
     199   
     200    [[GroupsController groups] saveGroups];
     201    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
     202}
     203
    169204- (void) addNewGroup
    170205{
Note: See TracChangeset for help on using the changeset viewer.