disable the group location matching when adding a just-created torrent
This commit is contained in:
parent
3368de5d44
commit
359e462091
|
@ -41,6 +41,7 @@
|
|||
|
||||
Torrent * fTorrent;
|
||||
NSString * fDestination;
|
||||
BOOL fLockDestination;
|
||||
|
||||
BOOL fDeleteTorrent, fDeleteEnable;
|
||||
NSInteger fGroupValue;
|
||||
|
@ -48,8 +49,8 @@
|
|||
NSTimer * fTimer;
|
||||
}
|
||||
|
||||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
|
||||
deleteTorrent: (torrentFileState) deleteTorrent;
|
||||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path lockDestination: (BOOL) lockDestination
|
||||
controller: (Controller *) controller deleteTorrent: (torrentFileState) deleteTorrent;
|
||||
|
||||
- (Torrent *) torrent;
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@
|
|||
|
||||
@implementation AddWindowController
|
||||
|
||||
#warning don't let group override destination if the destination is already specified (as in adding from creation)
|
||||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
|
||||
deleteTorrent: (torrentFileState) deleteTorrent
|
||||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path lockDestination: (BOOL) lockDestination
|
||||
controller: (Controller *) controller deleteTorrent: (torrentFileState) deleteTorrent
|
||||
{
|
||||
if ((self = [super initWithWindowNibName: @"AddWindow"]))
|
||||
{
|
||||
fTorrent = torrent;
|
||||
if (path)
|
||||
fDestination = [[path stringByExpandingTildeInPath] retain];
|
||||
fLockDestination = lockDestination;
|
||||
|
||||
fController = controller;
|
||||
|
||||
|
@ -70,8 +70,7 @@
|
|||
|
||||
#warning factor in if there already is a destination
|
||||
// set the group’s download location if there is one
|
||||
if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue] &&
|
||||
[[GroupsController groups] customDownloadLocationForIndex: fGroupValue])
|
||||
if (!fLockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
|
||||
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
|
||||
}
|
||||
return self;
|
||||
|
@ -281,7 +280,10 @@
|
|||
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo
|
||||
{
|
||||
if (code == NSOKButton)
|
||||
{
|
||||
fLockDestination = NO;
|
||||
[self setDestinationPath: [[openPanel filenames] objectAtIndex: 0]];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fDestination)
|
||||
|
@ -299,12 +301,15 @@
|
|||
{
|
||||
NSInteger previousGroup = fGroupValue;
|
||||
fGroupValue = [sender tag];
|
||||
if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue] &&
|
||||
[[GroupsController groups] customDownloadLocationForIndex: fGroupValue])
|
||||
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
|
||||
else if ([fDestination isEqualToString: [[GroupsController groups] customDownloadLocationForIndex: previousGroup]])
|
||||
[self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"]];
|
||||
else;
|
||||
|
||||
if (!fLockDestination)
|
||||
{
|
||||
if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
|
||||
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
|
||||
else if ([fDestination isEqualToString: [[GroupsController groups] customDownloadLocationForIndex: previousGroup]])
|
||||
[self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"]];
|
||||
else;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) sameNameAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
|
||||
|
|
|
@ -846,6 +846,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
if (type == ADD_CREATED)
|
||||
[torrent resetCache];
|
||||
|
||||
//don't override the location with a group location if it was a created torrent
|
||||
BOOL lockDestination = location && type == ADD_CREATED;
|
||||
|
||||
//add it to the "File -> Open Recent" menu
|
||||
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: torrentPath]];
|
||||
|
||||
|
@ -853,7 +856,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
if (showWindow || !location)
|
||||
{
|
||||
AddWindowController * addController = [[AddWindowController alloc] initWithTorrent: torrent destination: location
|
||||
controller: self deleteTorrent: deleteTorrentFile];
|
||||
lockDestination: lockDestination controller: self deleteTorrent: deleteTorrentFile];
|
||||
[addController showWindow: self];
|
||||
}
|
||||
else
|
||||
|
@ -861,8 +864,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];
|
||||
|
||||
#warning move into torrent init?
|
||||
if ([torrent groupValue] != -1 && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]]
|
||||
&& [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]])
|
||||
if (!lockDestination && [[GroupsController groups] usesCustomDownloadLocationForIndex: [torrent groupValue]])
|
||||
[torrent changeDownloadFolder: [[GroupsController groups] customDownloadLocationForIndex: [torrent groupValue]]];
|
||||
|
||||
[torrent update];
|
||||
|
|
Loading…
Reference in New Issue