Changeset 13323


Ignore:
Timestamp:
May 28, 2012, 7:43:53 PM (9 years ago)
Author:
livings124
Message:

#4923 "Open when created" might not be respected

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CreatorWindowController.h

    r13319 r13323  
    4444   
    4545    NSTimer * fTimer;
    46     BOOL fStarted;
     46    BOOL fStarted, fOpenWhenCreated;
    4747   
    4848    NSUserDefaults * fDefaults;
  • trunk/macosx/CreatorWindowController.m

    r13319 r13323  
    3737+ (NSURL *) chooseFile;
    3838
     39- (void) updateLocationField;
    3940- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo;
    4041- (void) createReal;
     
    184185        fLocation = [[NSURL alloc] initFileURLWithPath: [[location stringByExpandingTildeInPath] stringByAppendingPathComponent: [name stringByAppendingPathExtension: @"torrent"]]];
    185186    }
    186     NSString * pathString = [fLocation path];
    187     [fLocationField setStringValue: [pathString stringByAbbreviatingWithTildeInPath]];
    188     [fLocationField setToolTip: pathString];
     187    [self updateLocationField];
    189188   
    190189    //set previously saved values
     
    235234- (void) window: (NSWindow *) window didDecodeRestorableState: (NSCoder *) coder
    236235{
    237     #warning done in 3 places - make a separate method
    238236    [fLocation release];
    239237    fLocation = [[coder decodeObjectForKey: @"TRCreatorLocation"] retain];
    240     NSString * pathString = [fLocation path];
    241     [fLocationField setStringValue: [pathString stringByAbbreviatingWithTildeInPath]];
    242     [fLocationField setToolTip: pathString];
     238    [self updateLocationField];
    243239   
    244240    [fTrackers release];
     
    270266            [fLocation release];
    271267            fLocation = [[panel URL] retain];
    272            
    273             NSString * pathString = [fLocation path];
    274             [fLocationField setStringValue: [pathString stringByAbbreviatingWithTildeInPath]];
    275             [fLocationField setToolTip: pathString];
     268            [self updateLocationField];
    276269        }
    277270    }];
     
    453446
    454447@implementation CreatorWindowController (Private)
     448
     449- (void) updateLocationField
     450{
     451    NSString * pathString = [fLocation path];
     452    [fLocationField setStringValue: [pathString stringByAbbreviatingWithTildeInPath]];
     453    [fLocationField setToolTip: pathString];
     454}
    455455
    456456+ (NSURL *) chooseFile
     
    540540    [fDefaults setBool: [fPrivateCheck state] == NSOnState forKey: @"CreatorPrivate"];
    541541    [fDefaults setBool: [fOpenCheck state] == NSOnState forKey: @"CreatorOpen"];
     542    fOpenWhenCreated = [fOpenCheck state] == NSOnState; //need this since the check box might not exist, and value in prefs might have changed from another creator window
    542543    [fDefaults setURL: [fLocation URLByDeletingLastPathComponent] forKey: @"CreatorLocationURL"];
    543544   
    544545    [[NSNotificationCenter defaultCenter] postNotificationName: @"BeginCreateTorrentFile" object: fLocation userInfo: nil];
    545     tr_makeMetaInfo(fInfo, [[fLocation path] UTF8String], trackerInfo, [fTrackers count], [[fCommentView string] UTF8String],
    546                     [fPrivateCheck state] == NSOnState);
     546    tr_makeMetaInfo(fInfo, [[fLocation path] UTF8String], trackerInfo, [fTrackers count], [[fCommentView string] UTF8String], [fPrivateCheck state] == NSOnState);
    547547    tr_free(trackerInfo);
    548548   
     
    562562        {
    563563            case TR_MAKEMETA_OK:
    564                 #warning this isn't safe - what if another window changes it after hitting the create button on this window?
    565                 if ([fDefaults boolForKey: @"CreatorOpen"])
     564                if (fOpenWhenCreated)
    566565                {
    567566                    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [fLocation path], @"File",
Note: See TracChangeset for help on using the changeset viewer.