when using the add dialog, delete the torrent file (if set in preferences)

This commit is contained in:
Mitchell Livingston
2008-01-04 06:31:41 +00:00
parent ce18bc26ae
commit 1647bd629a
4 changed files with 29 additions and 12 deletions

View File

@@ -745,6 +745,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
NSString * torrentPath;
tr_info info;
NSEnumerator * enumerator = [filenames objectEnumerator];
BOOL showWindow = [fDefaults boolForKey: @"DownloadAsk"];
while ((torrentPath = [enumerator nextObject]))
{
NSString * location;
@@ -768,14 +769,19 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
tr_metainfoFree(&info);
tr_ctorFree(ctor);
if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location deleteTorrentFile: deleteTorrent lib: fLib]))
if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location
deleteTorrentFile: showWindow ? TORRENT_FILE_SAVE : deleteTorrent lib: fLib]))
continue;
//add it to the "File -> Open Recent" menu
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: torrentPath]];
if ([fDefaults boolForKey: @"DownloadAsk"])
[[[AddWindowController alloc] initWithTorrent: torrent destination: location controller: self] showWindow: self];
if (showWindow)
{
AddWindowController * addController = [[AddWindowController alloc] initWithTorrent: torrent destination: location
controller: self deleteTorrent: deleteTorrent];
[addController showWindow: self];
}
else
{
[torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];