Ignore:
Timestamp:
Feb 8, 2013, 11:26:07 PM (8 years ago)
Author:
livings124
Message:

properly enable/disable the rename confirm button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileRenameSheetController.m

    r13986 r13989  
    1919@property (nonatomic, copy) CompletionBlock completionHandler;
    2020
     21@property (nonatomic, copy) NSString * originalName;
     22
    2123@end
    2224
     
    2729@synthesize node = _node;
    2830@synthesize completionHandler = _completionHandler;
     31@synthesize originalName = _originalName;
    2932@synthesize labelField = _labelField;
    3033@synthesize inputField = _inputField;
     
    7679    [_node release];
    7780    [_completionHandler release];
     81    [_originalName release];
    7882    [super dealloc];
    7983}
     
    8387    [super windowDidLoad];
    8488   
    85     NSString * name = [self.node name] ?: [self.torrent name];
    86     NSString * label = [NSString stringWithFormat: NSLocalizedString(@"Rename the file \"%@\":", "rename sheet label"), name];
     89    self.originalName = [self.node name] ?: [self.torrent name];
     90    NSString * label = [NSString stringWithFormat: NSLocalizedString(@"Rename the file \"%@\":", "rename sheet label"), self.originalName];
    8791    [self.labelField setStringValue: label];
    8892   
    89     [self.inputField setStringValue: name];
     93    [self.inputField setStringValue: self.originalName];
    9094    [self.renameButton setEnabled: NO];
    9195   
     
    120124- (void) controlTextDidChange: (NSNotification *) notification
    121125{
    122     [self.renameButton setEnabled: ![[self.inputField stringValue] isEqualToString: @""] && ![[self.inputField stringValue] isEqualToString: [self.torrent name]]];
     126    [self.renameButton setEnabled: ![[self.inputField stringValue] isEqualToString: @""] && ![[self.inputField stringValue] isEqualToString: self.originalName]];
    123127}
    124128
Note: See TracChangeset for help on using the changeset viewer.