#4712 Gray out the 'Display a window when adding a magnet link' option, whenever 'Same directory as torrent' is selected

This commit is contained in:
Mitchell Livingston
2013-08-10 02:29:12 +00:00
parent e7117b43dc
commit f450f27b26
3 changed files with 493 additions and 359 deletions

View File

@@ -110,6 +110,9 @@
if ([fDefaults boolForKey: @"AutoImport"] && (autoPath = [fDefaults stringForKey: @"AutoImportDirectory"]))
[[(Controller *)[NSApp delegate] fileWatcherQueue] addPath: [autoPath stringByExpandingTildeInPath] notifyingAbout: VDKQueueNotifyAboutWrite];
//set special-handling of magnet link add window checkbox
[self updateShowAddMagnetWindowField];
//set blocklist scheduler
[[BlocklistScheduler scheduler] updateSchedule];
@@ -820,6 +823,7 @@
- (void) setDownloadLocation: (id) sender
{
[fDefaults setBool: [fFolderPopUp indexOfSelectedItem] == DOWNLOAD_FOLDER forKey: @"DownloadLocationConstant"];
[self updateShowAddMagnetWindowField];
}
- (void) folderSheetShow: (id) sender
@@ -839,7 +843,8 @@
NSString * folder = [[[panel URLs] objectAtIndex: 0] path];
[fDefaults setObject: folder forKey: @"DownloadFolder"];
[fDefaults setObject: @"Constant" forKey: @"DownloadChoice"];
[fDefaults setBool: YES forKey: @"DownloadLocationConstant"];
[self updateShowAddMagnetWindowField];
tr_sessionSetDownloadDir(fHandle, [folder UTF8String]);
}
@@ -908,6 +913,26 @@
tr_sessionSetIncompleteFileNamingEnabled(fHandle, [fDefaults boolForKey: @"RenamePartialFiles"]);
}
- (void) setShowAddMagnetWindow: (id) sender
{
[fDefaults setBool: ([fShowMagnetAddWindowCheck state] == NSOnState) forKey: @"MagnetOpenAsk"];
}
- (void) updateShowAddMagnetWindowField
{
if (![fDefaults boolForKey: @"DownloadLocationConstant"])
{
//always show the add window for magnet links when the download location is the same as the torrent file
[fShowMagnetAddWindowCheck setState: NSOnState];
[fShowMagnetAddWindowCheck setEnabled: NO];
}
else
{
[fShowMagnetAddWindowCheck setState: [fDefaults boolForKey: @"MagnetOpenAsk"]];
[fShowMagnetAddWindowCheck setEnabled: YES];
}
}
- (void) setDoneScriptEnabled: (id) sender
{
if ([fDefaults boolForKey: @"DoneScriptEnabled"] && ![[NSFileManager defaultManager] fileExistsAtPath: [fDefaults stringForKey:@"DoneScriptPath"]])