Changeset 5704


Ignore:
Timestamp:
Apr 25, 2008, 10:29:51 PM (14 years ago)
Author:
livings124
Message:

now that a blank url cannot be entered in the url sheet, no need to check that

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r5703 r5704  
    955955- (void) controlTextDidChange: (NSNotification *) notification
    956956{
    957     [fURLSheetOpenButton setEnabled: ![[fURLSheetTextField stringValue] isEqual: @""]];
     957    [fURLSheetOpenButton setEnabled: ![[fURLSheetTextField stringValue] isEqualToString: @""]];
    958958}
    959959
     
    965965   
    966966    NSString * urlString = [fURLSheetTextField stringValue];
    967     if (![urlString isEqualToString: @""])
    968     {
    969         if ([urlString rangeOfString: @"://"].location == NSNotFound)
    970         {
    971             if ([urlString rangeOfString: @"."].location == NSNotFound)
    972             {
    973                 int beforeCom;
    974                 if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
    975                     urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
    976                                     [urlString substringToIndex: beforeCom],
    977                                     [urlString substringFromIndex: beforeCom + 1]];
    978                 else
    979                     urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString];
    980             }
     967    if ([urlString rangeOfString: @"://"].location == NSNotFound)
     968    {
     969        if ([urlString rangeOfString: @"."].location == NSNotFound)
     970        {
     971            int beforeCom;
     972            if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
     973                urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
     974                                [urlString substringToIndex: beforeCom],
     975                                [urlString substringFromIndex: beforeCom + 1]];
    981976            else
    982                 urlString = [@"http://" stringByAppendingString: urlString];
    983         }
    984        
    985         NSURL * url = [NSURL URLWithString: urlString];
    986         [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO];
    987     }
     977                urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString];
     978        }
     979        else
     980            urlString = [@"http://" stringByAppendingString: urlString];
     981    }
     982   
     983    NSURL * url = [NSURL URLWithString: urlString];
     984    [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO];
    988985}
    989986
Note: See TracChangeset for help on using the changeset viewer.