From: Mitchell Livingston Date: Fri, 25 Apr 2008 22:29:51 +0000 (+0000) Subject: now that a blank url cannot be entered in the url sheet, no need to check that X-Git-Tag: 1.20~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e99fbcbcbcdd315c2432dd9ac8bed69f30d3ca2d;p=transmission now that a blank url cannot be entered in the url sheet, no need to check that --- diff --git a/macosx/Controller.m b/macosx/Controller.m index 2cccd652b..cf31bb10e 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -954,7 +954,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi - (void) controlTextDidChange: (NSNotification *) notification { - [fURLSheetOpenButton setEnabled: ![[fURLSheetTextField stringValue] isEqual: @""]]; + [fURLSheetOpenButton setEnabled: ![[fURLSheetTextField stringValue] isEqualToString: @""]]; } - (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo @@ -964,27 +964,24 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi return; NSString * urlString = [fURLSheetTextField stringValue]; - if (![urlString isEqualToString: @""]) + if ([urlString rangeOfString: @"://"].location == NSNotFound) { - if ([urlString rangeOfString: @"://"].location == NSNotFound) + if ([urlString rangeOfString: @"."].location == NSNotFound) { - if ([urlString rangeOfString: @"."].location == NSNotFound) - { - int beforeCom; - if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound) - urlString = [NSString stringWithFormat: @"http://www.%@.com/%@", - [urlString substringToIndex: beforeCom], - [urlString substringFromIndex: beforeCom + 1]]; - else - urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString]; - } + int beforeCom; + if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound) + urlString = [NSString stringWithFormat: @"http://www.%@.com/%@", + [urlString substringToIndex: beforeCom], + [urlString substringFromIndex: beforeCom + 1]]; else - urlString = [@"http://" stringByAppendingString: urlString]; + urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString]; } - - NSURL * url = [NSURL URLWithString: urlString]; - [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO]; + else + urlString = [@"http://" stringByAppendingString: urlString]; } + + NSURL * url = [NSURL URLWithString: urlString]; + [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO]; } - (void) createFile: (id) sender