diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2010-04-24 23:11:34 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-05 00:00:22 +0200 |
commit | 0d72818e60c9e9f79d0036373bbfbe8d54580890 (patch) | |
tree | 954aa02f541cf98f5d23e2e5b99e244bdb97703e | |
parent | Javascript protocol fix (diff) | |
download | rekonq-0d72818e60c9e9f79d0036373bbfbe8d54580890.tar.xz |
if the url of an item have the same domaine name as the typed string, it is moved at top of the list
-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(); }; |