Changeset 7363


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

disable the group location matching when adding a just-created torrent

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/AddWindowController.h

    r7185 r7363  
    4242    Torrent * fTorrent;
    4343    NSString * fDestination;
     44    BOOL fLockDestination;
    4445   
    4546    BOOL fDeleteTorrent, fDeleteEnable;
     
    4950}
    5051
    51 - (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
    52         deleteTorrent: (torrentFileState) deleteTorrent;
     52- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path lockDestination: (BOOL) lockDestination
     53    controller: (Controller *) controller deleteTorrent: (torrentFileState) deleteTorrent;
    5354
    5455- (Torrent *) torrent;
  • trunk/macosx/AddWindowController.m

    r7315 r7363  
    5151@implementation AddWindowController
    5252
    53 #warning don't let group override destination if the destination is already specified (as in adding from creation)
    54 - (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
    55         deleteTorrent: (torrentFileState) deleteTorrent
     53- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path lockDestination: (BOOL) lockDestination
     54    controller: (Controller *) controller deleteTorrent: (torrentFileState) deleteTorrent
    5655{
    5756    if ((self = [super initWithWindowNibName: @"AddWindow"]))
     
    6059        if (path)
    6160            fDestination = [[path stringByExpandingTildeInPath] retain];
     61        fLockDestination = lockDestination;
    6262       
    6363        fController = controller;
     
    7171        #warning factor in if there already is a destination
    7272        // set the group’s download location if there is one
    73         if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue] &&
    74             [[GroupsController groups] customDownloadLocationForIndex: fGroupValue])
     73        if (!fLockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
    7574            [self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
    7675    }
     
    282281{
    283282    if (code == NSOKButton)
     283    {
     284        fLockDestination = NO;
    284285        [self setDestinationPath: [[openPanel filenames] objectAtIndex: 0]];
     286    }
    285287    else
    286288    {
     
    300302    NSInteger previousGroup = fGroupValue;
    301303    fGroupValue = [sender tag];
    302     if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue] &&
    303         [[GroupsController groups] customDownloadLocationForIndex: fGroupValue])
    304         [self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
    305     else if ([fDestination isEqualToString: [[GroupsController groups] customDownloadLocationForIndex: previousGroup]])
    306         [self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"]];
    307     else;
     304   
     305    if (!fLockDestination)
     306    {
     307        if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
     308            [self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
     309        else if ([fDestination isEqualToString: [[GroupsController groups] customDownloadLocationForIndex: previousGroup]])
     310            [self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"]];
     311        else;
     312    }
    308313}
    309314
  • trunk/macosx/Controller.m

    r7352 r7363  
    847847            [torrent resetCache];
    848848       
     849        //don't override the location with a group location if it was a created torrent
     850        BOOL lockDestination = location && type == ADD_CREATED;
     851       
    849852        //add it to the "File -> Open Recent" menu
    850853        [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: torrentPath]];
     
    854857        {
    855858            AddWindowController * addController = [[AddWindowController alloc] initWithTorrent: torrent destination: location
    856                                                     controller: self deleteTorrent: deleteTorrentFile];
     859                                                    lockDestination: lockDestination controller: self deleteTorrent: deleteTorrentFile];
    857860            [addController showWindow: self];
    858861        }
     
    862865           
    863866            #warning move into torrent init?
    864             if ([torrent groupValue] != -1 && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]]
    865                 && [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]])
     867            if (!lockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]])
    866868                [torrent changeDownloadFolder: [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]]];
    867869           
Note: See TracChangeset for help on using the changeset viewer.