Changeset 7364


Ignore:
Timestamp:
Dec 13, 2008, 10:49:46 PM (12 years ago)
Author:
livings124
Message:

merge the group location selection code

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/AddWindowController.m

    r7363 r7364  
    6868       
    6969        fGroupValue = [torrent groupValue];
    70        
    71         #warning factor in if there already is a destination
    72         // set the group’s download location if there is one
    73         if (!fLockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
    74             [self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
    7570    }
    7671    return self;
  • trunk/macosx/Controller.m

    r7363 r7364  
    824824        //determine download location
    825825        NSString * location;
     826        BOOL lockDestination = NO; //don't override the location with a group location if it has a hardcoded path
    826827        if (path)
     828        {
    827829            location = [path stringByExpandingTildeInPath];
     830            lockDestination = YES;
     831        }
    828832        else if ([fDefaults boolForKey: @"DownloadLocationConstant"])
    829833            location = [[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath];
     
    843847            continue;
    844848       
     849        //change the location if the group calls for it (this has to wait until after the torrent is create)
     850        if (!lockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]])
     851        {
     852            location = [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]];
     853            [torrent changeDownloadFolder: location];
     854        }
     855       
    845856        //verify the data right away if it was newly created
    846857        if (type == ADD_CREATED)
    847858            [torrent resetCache];
    848859       
    849         //don't override the location with a group location if it was a created torrent
    850         BOOL lockDestination = location && type == ADD_CREATED;
    851        
    852860        //add it to the "File -> Open Recent" menu
    853861        [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: torrentPath]];
     
    863871        {
    864872            [torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];
    865            
    866             #warning move into torrent init?
    867             if (!lockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]])
    868                 [torrent changeDownloadFolder: [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]]];
    869873           
    870874            [torrent update];
  • trunk/macosx/GroupsController.m

    r7362 r7364  
    171171- (BOOL) usesCustomDownloadLocationForIndex: (NSInteger) index
    172172{
    173     NSInteger orderIndex = [self rowValueForIndex: index];
    174     return orderIndex != -1 ? [[[fGroups objectAtIndex: orderIndex] objectForKey: @"UsesCustomDownloadLocation"] boolValue] : NO;
     173    if (![self customDownloadLocationForIndex: index])
     174        return NO;
     175
     176    NSInteger orderIndex = [self rowValueForIndex: index];
     177    return [[[fGroups objectAtIndex: orderIndex] objectForKey: @"UsesCustomDownloadLocation"] boolValue];
    175178}
    176179
Note: See TracChangeset for help on using the changeset viewer.