#2794 Don't apply auto-grouping until torrent is demagnetized

This commit is contained in:
Mitchell Livingston
2012-10-30 00:22:10 +00:00
parent 7e2f344ff6
commit 1e0f36fda0
7 changed files with 91 additions and 36 deletions

View File

@@ -37,7 +37,7 @@
- (void) confirmAdd;
- (void) setDestinationPath: (NSString *) destination;
- (void) setDestinationPath: (NSString *) destination determinationType: (TorrentDeterminationType) determinationType;
- (void) setGroupsMenu;
- (void) changeGroupValue: (id) sender;
@@ -58,6 +58,7 @@
fController = controller;
fGroupValue = [torrent groupValue];
fGroupDeterminationType = TorrentDeterminationAutomatic;
}
return self;
}
@@ -88,7 +89,7 @@
[fStartCheck setState: [[NSUserDefaults standardUserDefaults] boolForKey: @"AutoStartDownload"] ? NSOnState : NSOffState];
if (fDestination)
[self setDestinationPath: fDestination];
[self setDestinationPath: fDestination determinationType: TorrentDeterminationAutomatic];
else
{
[fLocationField setStringValue: @""];
@@ -189,7 +190,7 @@
[panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton)
[self setDestinationPath: [[[panel URLs] objectAtIndex: 0] path]];
[self setDestinationPath: [[[panel URLs] objectAtIndex: 0] path] determinationType:TorrentDeterminationUserSpecified];
else
{
if (!fDestination)
@@ -251,6 +252,7 @@
if (![fGroupPopUp selectItemWithTag: fGroupValue])
{
fGroupValue = -1;
fGroupDeterminationType = TorrentDeterminationAutomatic;
[fGroupPopUp selectItemWithTag: fGroupValue];
}
}
@@ -261,7 +263,7 @@
- (void) confirmAdd
{
[fTorrent setGroupValue: fGroupValue];
[fTorrent setGroupValue: fGroupValue determinationType: fGroupDeterminationType];
if ([fStartCheck state] == NSOnState)
[fTorrent startTransfer];
@@ -270,7 +272,7 @@
[fController askOpenMagnetConfirmed: self add: YES]; //ensure last, since it releases this controller
}
- (void) setDestinationPath: (NSString *) destination
- (void) setDestinationPath: (NSString *) destination determinationType: (TorrentDeterminationType) determinationType
{
destination = [destination stringByExpandingTildeInPath];
if (!fDestination || ![fDestination isEqualToString: destination])
@@ -278,7 +280,7 @@
[fDestination release];
fDestination = [destination retain];
[fTorrent changeDownloadFolderBeforeUsing: fDestination];
[fTorrent changeDownloadFolderBeforeUsing: fDestination determinationType: determinationType];
}
[fLocationField setStringValue: [fDestination stringByAbbreviatingWithTildeInPath]];
@@ -298,12 +300,13 @@
- (void) changeGroupValue: (id) sender
{
NSInteger previousGroup = fGroupValue;
fGroupValue = [sender tag];
fGroupValue = [sender tag];
fGroupDeterminationType = TorrentDeterminationUserSpecified;
if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue])
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue] determinationType: TorrentDeterminationAutomatic];
else if ([fDestination isEqualToString: [[GroupsController groups] customDownloadLocationForIndex: previousGroup]])
[self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"]];
[self setDestinationPath: [[NSUserDefaults standardUserDefaults] stringForKey: @"DownloadFolder"] determinationType: TorrentDeterminationAutomatic];
else;
}