diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/urlresolver.cpp | 46 | ||||
-rw-r--r-- | src/urlbar/urlresolver.h | 2 |
2 files changed, 39 insertions, 9 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 5e055903..e86adc62 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -75,17 +75,21 @@ UrlSearchList UrlResolver::orderedSearchItems() // catch first 3 results from the two resulting lists :) UrlSearchList list; + + if(isHttp()) + { + list << qurlFromUserInputResolution(); + list << webSearchesResolution(); + } + else + { + list << webSearchesResolution(); + list << qurlFromUserInputResolution(); + } -// if(isHttp()) -// { -// list << qurlFromUserInputResolution(); -// } - - list << qurlFromUserInputResolution(); - list << webSearchesResolution(); - + if (_typedString.length() >= 2) - { + { int firstResults = list.count(); int checkPoint = 9 - firstResults; @@ -128,6 +132,8 @@ UrlSearchList UrlResolver::orderedSearchItems() } } + list = placeTypedDomaineNameOnTop(list); + return list; } @@ -215,3 +221,25 @@ UrlSearchList UrlResolver::bookmarksResolution() return list; } + + +UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list) +{ + int i=0; + bool found = false; + + while(i<list.count() && !found) + { + UrlSearchItem item = list.at(i); + if (item.url.url().contains("."+_typedString+".") || item.url.url().contains("/"+_typedString+".")) + { + list.removeAt(i); + list.insert(0,item); + found = true; + } + i++; + } + + return list; +} + diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 0b519989..7a8262b3 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -82,6 +82,8 @@ private: UrlSearchList historyResolution(); UrlSearchList qurlFromUserInputResolution(); UrlSearchList bookmarksResolution(); + UrlSearchList placeTypedDomaineNameOnTop(UrlSearchList list); + bool isHttp(); }; |