]> granicus.if.org Git - transmission/commitdiff
now that a blank url cannot be entered in the url sheet, no need to check that
authorMitchell Livingston <livings124@transmissionbt.com>
Fri, 25 Apr 2008 22:29:51 +0000 (22:29 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Fri, 25 Apr 2008 22:29:51 +0000 (22:29 +0000)
macosx/Controller.m

index 2cccd652b85bb39d34a53e9a0e3e67b9d382afcc..cf31bb10eafb2c75b9c1c56c5e0a8e74c6c9da4d 100644 (file)
@@ -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