mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
remove Mac's custom code to show a warning when a folder contains extra data when deleting (in preparation of implementing [7473])
This commit is contained in:
parent
d7613a57f2
commit
2d6b6e6306
4 changed files with 0 additions and 69 deletions
|
@ -174,8 +174,6 @@
|
|||
<integer>50</integer>
|
||||
<key>UseIncompleteDownloadFolder</key>
|
||||
<false/>
|
||||
<key>WarningCheckContentsForRemove</key>
|
||||
<true/>
|
||||
<key>WarningCreatorBlankAddress</key>
|
||||
<true/>
|
||||
<key>WarningDuplicate</key>
|
||||
|
|
|
@ -635,7 +635,6 @@ tr_session * fHandle;
|
|||
[fDefaults removeObjectForKey: @"WarningCreatorBlankAddress"];
|
||||
[fDefaults removeObjectForKey: @"WarningRemoveBuiltInTracker"];
|
||||
[fDefaults removeObjectForKey: @"WarningInvalidOpen"];
|
||||
[fDefaults removeObjectForKey: @"WarningCheckContentsForRemove"];
|
||||
}
|
||||
|
||||
- (void) setQueue: (id) sender
|
||||
|
|
|
@ -453,72 +453,6 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
|||
|
||||
- (void) trashData
|
||||
{
|
||||
if ([self isFolder] && [fDefaults boolForKey: @"WarningCheckContentsForRemove"])
|
||||
{
|
||||
NSEnumerator * enumerator = [[NSFileManager defaultManager] enumeratorAtPath: [self dataLocation]];
|
||||
NSString * file;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
NSArray * actualComponents = [file pathComponents];
|
||||
if ([[actualComponents lastObject] hasPrefix: @"."])
|
||||
continue;
|
||||
|
||||
BOOL isExtra = YES;
|
||||
|
||||
NSEnumerator * nodeEnumerator = [fFlatFileList objectEnumerator];
|
||||
FileListNode * node;
|
||||
while ((node = [nodeEnumerator nextObject]))
|
||||
{
|
||||
NSArray * listedComponents = [[node fullPath] pathComponents];
|
||||
if ([listedComponents count]-1 < [actualComponents count])
|
||||
continue;
|
||||
|
||||
//remove first component (the folder name) and only include the same number of levels
|
||||
listedComponents = [listedComponents objectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(1, [actualComponents count])]];
|
||||
|
||||
if ([listedComponents isEqualToArray: actualComponents])
|
||||
{
|
||||
isExtra = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isExtra)
|
||||
continue;
|
||||
|
||||
NSLog(@"Extra file found: %@", file);
|
||||
|
||||
NSAlert * alert = [[NSAlert alloc] init];
|
||||
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"\"%@\" contains extra content.",
|
||||
"Delete folder with extra contents -> title"), [self name]]];
|
||||
[alert setInformativeText: NSLocalizedString(@"The directory contains data that is not part of the transfer."
|
||||
" Are you sure you want to move this directory to the trash?", "Delete folder with extra contents -> message")];
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"Trash", "Delete folder with extra contents -> button")];
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"Keep", "Delete folder with extra contents -> button")];
|
||||
|
||||
BOOL onLeopard = [NSApp isOnLeopardOrBetter];
|
||||
if (onLeopard)
|
||||
{
|
||||
[alert setShowsSuppressionButton: YES];
|
||||
[[alert suppressionButton] setTitle: NSLocalizedString(@"Do not check directory contents again",
|
||||
"Delete folder with extra contents -> button")];
|
||||
}
|
||||
else
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"Never Check", "Delete folder with extra contents -> button")];
|
||||
|
||||
NSInteger result = [alert runModal];
|
||||
if ((onLeopard ? [[alert suppressionButton] state] == NSOnState : result == NSAlertThirdButtonReturn))
|
||||
[fDefaults setBool: NO forKey: @"WarningCheckContentsForRemove"];
|
||||
[alert release];
|
||||
|
||||
if (result == NSAlertSecondButtonReturn)
|
||||
return;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self trashFile: [self dataLocation]];
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue