Changeset 1109 for trunk/macosx


Ignore:
Timestamp:
Nov 19, 2006, 10:04:49 PM (15 years ago)
Author:
livings124
Message:

better url auto-completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1103 r1109  
    734734        {
    735735            int start = NSMaxRange([urlString rangeOfString: @"://"]);
    736             urlString = [NSString stringWithFormat: @"%@www.%@.com", [urlString substringToIndex: start],
     736            int beforeCom;
     737            if ((beforeCom = [urlString rangeOfString: @"/" options: 0
     738                                range: NSMakeRange(start, [urlString length] - start)].location) != NSNotFound)
     739                urlString = [NSString stringWithFormat: @"%@www.%@.com/%@", [urlString substringToIndex: start],
     740                                    [urlString substringWithRange: NSMakeRange(start, beforeCom - start)],
     741                                    [urlString substringFromIndex: beforeCom + 1]];
     742            else
     743                urlString = [NSString stringWithFormat: @"%@www.%@.com", [urlString substringToIndex: start],
    737744                                    [urlString substringFromIndex: start]];
    738745        }
    739        
     746        NSLog(urlString);
    740747        NSURL * url = [NSURL URLWithString: urlString];
    741748        [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO];
Note: See TracChangeset for help on using the changeset viewer.