Ignore:
Timestamp:
11/27/13 15:29:04 (11 years ago)
Author:
jts21
Message:

Updated JfxBrowser to use search engine variable, and also fixed some logic errors in it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r543 r544  
    1919import org.expeditee.gui.FreeItems;
    2020import org.expeditee.gui.MessageBay;
     21import org.expeditee.gui.UserSettings;
    2122import org.expeditee.items.Text;
    2223
     
    292293                        // TODO: can/should we support other protocols such as ftp ???
    293294                        if(!(textLower.startsWith("http://") || text.startsWith("https://"))) {
    294                                 // check if it's a search (will be a search if there is a ' ' before the first '.')
    295                                 // TODO: maybe support changing the default search engine (using a settings frame like the proxy settings frame)
     295                                // check if it's a search
    296296                                int firstSpace = text.indexOf(" ");
    297297                                int firstDot = text.indexOf(".");
    298                                 if(firstSpace != -1 && firstSpace < firstDot) {
     298                                int firstSlash = text.indexOf('/');
     299                                int firstQuestion = text.indexOf('?');
     300                                if(firstDot == -1 ||                                        // no '.' and no protocol -> search
     301                                        (firstSpace != -1 && firstSpace <= firstDot + 1) || // ' ' before '.'         -> search
     302                                        (firstSlash == -1 && firstQuestion == -1)) {        // no '/' or '?'          -> search
    299303                                        // make it a search
    300                                         text = "https://duckduckgo.com/?q=" + text;
     304                                        text = UserSettings.searchEngine + text;
    301305                                } else {
    302306                                        // add the missing protocol
Note: See TracChangeset for help on using the changeset viewer.