From eef469a3de4310eb31ed2017e5fe216669c05699 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 25 Jun 2007 01:15:25 +0000 Subject: [PATCH] don't allow single-file torrents to have priority/download check changed --- macosx/Torrent.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 53877c29c..36068f893 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1338,7 +1338,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 int index; for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) { - if (tr_torrentGetFilePriority(fHandle, index) != TR_PRI_DND || [self fileProgress: index] >= 1.0) + if (tr_torrentGetFilePriority(fHandle, index) != TR_PRI_DND + || [self canChangeDownloadCheckForFiles: [NSIndexSet indexSetWithIndex: index]]) onState = YES; else offState = YES; @@ -1351,6 +1352,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet { + if ([self fileCount] <= 1) + return NO; + int index; for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) if ([self fileProgress: index] < 1.0) @@ -1413,7 +1417,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 int index; for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) if (priority == [[[fFlatFileList objectAtIndex: index] objectForKey: @"Priority"] intValue] - && [self fileProgress: index] < 1.0) + && [self canChangeDownloadCheckForFiles: [NSIndexSet indexSetWithIndex: index]]) return YES; return NO; }