small adjustments to the file inspector's dnd/priority code

This commit is contained in:
Mitchell Livingston 2010-02-12 01:32:09 +00:00
parent 7bbdb14b50
commit f885922a58
1 changed files with 21 additions and 19 deletions

View File

@ -1340,7 +1340,7 @@ int trashDataFile(const char * filename)
BOOL onState = NO, offState = NO; BOOL onState = NO, offState = NO;
for (NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) for (NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
{ {
if ( !fInfo->files[index].dnd || ![self canChangeDownloadCheckForFile: index]) if (!fInfo->files[index].dnd || ![self canChangeDownloadCheckForFile: index])
onState = YES; onState = YES;
else else
offState = YES; offState = YES;
@ -1379,7 +1379,7 @@ int trashDataFile(const char * filename)
- (BOOL) hasFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet - (BOOL) hasFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet
{ {
for (NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index]) for (NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
if ((priority == fInfo->files[index].priority) && [self canChangeDownloadCheckForFile: index]) if (priority == fInfo->files[index].priority && [self canChangeDownloadCheckForFile: index])
return YES; return YES;
return NO; return NO;
} }
@ -1394,24 +1394,26 @@ int trashDataFile(const char * filename)
if (![self canChangeDownloadCheckForFile: index]) if (![self canChangeDownloadCheckForFile: index])
continue; continue;
const tr_priority_t priority = fInfo->files[index].priority; const NSInteger priority = fInfo->files[index].priority;
if (priority == TR_PRI_LOW) switch (priority)
{ {
if (low) case TR_PRI_LOW:
continue; if (low)
low = YES; continue;
} low = YES;
else if (priority == TR_PRI_HIGH) break;
{ case TR_PRI_NORMAL:
if (high) if (normal)
continue; continue;
high = YES; normal = YES;
} break;
else case TR_PRI_HIGH:
{ if (high)
if (normal) continue;
continue; high = YES;
normal = YES; break;
default:
NSAssert2(NO, @"Unknown priority %d for file index %d", priority, index);
} }
[priorities addObject: [NSNumber numberWithInteger: priority]]; [priorities addObject: [NSNumber numberWithInteger: priority]];