Ignore:
Timestamp:
Feb 10, 2011, 12:51:25 AM (11 years ago)
Author:
livings124
Message:

move the "open torrent URL" sheet into its own xib file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r11849 r11867  
    3737#import "GroupsController.h"
    3838#import "AboutWindowController.h"
     39#import "URLSheetWindowController.h"
    3940#import "AddWindowController.h"
    4041#import "AddMagnetWindowController.h"
     
    12261227- (void) openURLShowSheet: (id) sender
    12271228{
    1228     [NSApp beginSheet: fURLSheetWindow modalForWindow: fWindow modalDelegate: self
    1229             didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil];
    1230 }
    1231 
    1232 - (void) openURLEndSheet: (id) sender
    1233 {
    1234     [fURLSheetWindow orderOut: sender];
    1235     [NSApp endSheet: fURLSheetWindow returnCode: 1];
    1236 }
    1237 
    1238 - (void) openURLCancelEndSheet: (id) sender
    1239 {
    1240     [fURLSheetWindow orderOut: sender];
    1241     [NSApp endSheet: fURLSheetWindow returnCode: 0];
    1242 }
    1243 
    1244 - (void) controlTextDidChange: (NSNotification *) notification
    1245 {
    1246     if ([notification object] != fURLSheetTextField)
    1247         return;
    1248    
    1249     NSString * string = [fURLSheetTextField stringValue];
    1250     BOOL enable = YES;
    1251     if ([string isEqualToString: @""])
    1252         enable = NO;
    1253     else
    1254     {
    1255         NSRange prefixRange = [string rangeOfString: @"://"];
    1256         if (prefixRange.location != NSNotFound && [string length] == NSMaxRange(prefixRange))
    1257             enable = NO;
    1258     }
    1259    
    1260     [fURLSheetOpenButton setEnabled: enable];
    1261 }
    1262 
    1263 - (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
    1264 {
    1265     [fURLSheetTextField selectText: self];
     1229    [[[URLSheetWindowController alloc] initWithController: self] beginSheetForWindow: fWindow];
     1230}
     1231
     1232#warning need to remember sheet text between runs
     1233- (void) urlSheetDidEnd: (URLSheetWindowController *) controller url: (NSString *) urlString returnCode: (NSInteger) returnCode
     1234{
    12661235    if (returnCode != 1)
    12671236        return;
    12681237   
    1269     NSString * urlString = [fURLSheetTextField stringValue];
    12701238    [self performSelectorOnMainThread: @selector(openURL:) withObject: urlString waitUntilDone: NO];
     1239    [controller release];
    12711240}
    12721241
Note: See TracChangeset for help on using the changeset viewer.