show a warning when create a torrent file with a blank address

This commit is contained in:
Mitchell Livingston 2008-05-29 00:18:10 +00:00
parent aed40c4318
commit 7dd1199620
2 changed files with 32 additions and 2 deletions

2
NEWS
View File

@ -2,6 +2,8 @@ NEWS file for Transmission <http://www.transmissionbt.com/>
1.30 (2008/mm/dd)
http://trac.transmissionbt.com/query?group=component&milestone=1.30&order=severity
- All Platforms
+ Creation of torrent files with no tracker (for easier creation for some tracker sites)
- Mac
+ Quick Look integration in the main window and inspector's file tab
+ Transfers can be dragged to different groups

View File

@ -23,6 +23,7 @@
*****************************************************************************/
#import "CreatorWindowController.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#include "utils.h" //tr_httpParseURL
@ -32,6 +33,7 @@
- (void) updateEnableOpenCheckForTrackerField;
- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo;
- (void) createReal;
- (void) checkProgress;
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
@ -205,10 +207,25 @@
- (void) create: (id) sender
{
/*if ([[fTrackerField stringValue] isEqualToString: @""] && [fDefaults boolForKey: @"WarningCreatorBlankAddress"])
if ([[fTrackerField stringValue] isEqualToString: @""] && [fDefaults boolForKey: @"WarningCreatorBlankAddress"])
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: NSLocalizedString(@"The tracker address is blank.", "Create torrent -> blank address -> title")];
[alert setInformativeText: NSLocalizedString(@"The torrent file will not be able to be opened."
" A torrent file with no tracker address is only useful when you plan to upload the file to a tracker website"
" that will add the address for you.", "Create torrent -> blank address -> message")];
[alert addButtonWithTitle: NSLocalizedString(@"Create", "Create torrent -> blank address -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Cancel", "Create torrent -> blank address -> button")];
if ([NSApp isOnLeopardOrBetter])
[alert setShowsSuppressionButton: YES];
else
[alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent disk space alert -> button")];
[alert beginSheetModalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(createBlankAddressAlertDidEnd:returnCode:contextInfo:) contextInfo: nil];
}
else*/
else
[self createReal];
}
@ -268,6 +285,17 @@
}
}
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo
{
if (([NSApp isOnLeopardOrBetter] ? [[alert suppressionButton] state] == NSOnState : returnCode == NSAlertThirdButtonReturn))
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningCreatorBlankAddress"];
[alert release];
if (returnCode == NSAlertFirstButtonReturn)
[self performSelectorOnMainThread: @selector(createReal) withObject: nil waitUntilDone: NO];
}
- (void) createReal
{
[fTracker release]; //incase a previous create was aborted