Changeset 5961


Ignore:
Timestamp:
May 29, 2008, 12:18:10 AM (14 years ago)
Author:
livings124
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r5935 r5961  
    331.30 (2008/mm/dd)
    44http://trac.transmissionbt.com/query?group=component&milestone=1.30&order=severity
     5- All Platforms
     6   + Creation of torrent files with no tracker (for easier creation for some tracker sites)
    57- Mac
    68   + Quick Look integration in the main window and inspector's file tab
  • trunk/macosx/CreatorWindowController.m

    r5960 r5961  
    2424
    2525#import "CreatorWindowController.h"
     26#import "NSApplicationAdditions.h"
    2627#import "NSStringAdditions.h"
    2728#include "utils.h" //tr_httpParseURL
     
    3334- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
    3435
     36- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo;
    3537- (void) createReal;
    3638- (void) checkProgress;
     
    206208- (void) create: (id) sender
    207209{
    208     /*if ([[fTrackerField stringValue] isEqualToString: @""] && [fDefaults boolForKey: @"WarningCreatorBlankAddress"])
    209     {
    210     }
    211     else*/
     210    if ([[fTrackerField stringValue] isEqualToString: @""] && [fDefaults boolForKey: @"WarningCreatorBlankAddress"])
     211    {
     212        NSAlert * alert = [[NSAlert alloc] init];
     213        [alert setMessageText: NSLocalizedString(@"The tracker address is blank.", "Create torrent -> blank address -> title")];
     214        [alert setInformativeText: NSLocalizedString(@"The torrent file will not be able to be opened."
     215            " A torrent file with no tracker address is only useful when you plan to upload the file to a tracker website"
     216            " that will add the address for you.", "Create torrent -> blank address -> message")];
     217        [alert addButtonWithTitle: NSLocalizedString(@"Create", "Create torrent -> blank address -> button")];
     218        [alert addButtonWithTitle: NSLocalizedString(@"Cancel", "Create torrent -> blank address -> button")];
     219       
     220        if ([NSApp isOnLeopardOrBetter])
     221            [alert setShowsSuppressionButton: YES];
     222        else
     223            [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent disk space alert -> button")];
     224
     225        [alert beginSheetModalForWindow: [self window] modalDelegate: self
     226            didEndSelector: @selector(createBlankAddressAlertDidEnd:returnCode:contextInfo:) contextInfo: nil];
     227    }
     228    else
    212229        [self createReal];
    213230}
     
    267284        [fLocationField setToolTip: fLocation];
    268285    }
     286}
     287
     288- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo
     289{
     290    if (([NSApp isOnLeopardOrBetter] ? [[alert suppressionButton] state] == NSOnState : returnCode == NSAlertThirdButtonReturn))
     291        [[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningCreatorBlankAddress"];
     292   
     293    [alert release];
     294   
     295    if (returnCode == NSAlertFirstButtonReturn)
     296        [self performSelectorOnMainThread: @selector(createReal) withObject: nil waitUntilDone: NO];
    269297}
    270298
Note: See TracChangeset for help on using the changeset viewer.