diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-11-25 11:53:23 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:06 +0100 |
commit | 8e4af035abb73745427c32d563ed873810e6dd8b (patch) | |
tree | e141eab7c0e0bf24a2f2933e7e350b693333b1b0 /src/urlbar/urlsuggester.cpp | |
parent | Let "Removed" string translatable (diff) | |
download | rekonq-8e4af035abb73745427c32d563ed873810e6dd8b.tar.xz |
Improve suggestions, step 1
- fast response on kde short url type
- fix secondary url load
- let resolved urls typed (eg: kde.org) being first result
Diffstat (limited to 'src/urlbar/urlsuggester.cpp')
-rw-r--r-- | src/urlbar/urlsuggester.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/urlbar/urlsuggester.cpp b/src/urlbar/urlsuggester.cpp index 6b9ccb13..efa0249b 100644 --- a/src/urlbar/urlsuggester.cpp +++ b/src/urlbar/urlsuggester.cpp @@ -163,10 +163,18 @@ UrlSuggestionList UrlSuggester::orderedSearchItems() return list; } + // NOTE: this sets _isKDEShortUrl. + // IF it is true we can just suggest it + computeWebSearches(); + + if (_isKDEShortUrl) + { + return _webSearches; + } + //compute lists computeHistory(); computeQurlFromUserInput(); - computeWebSearches(); computeBookmarks(); return orderLists(); @@ -184,12 +192,9 @@ UrlSuggestionList UrlSuggester::orderLists() UrlSuggestionList browseSearch; QString lowerTypedString = _typedString.toLower(); - if (_isKDEShortUrl) - { - // KDE short url case (typed gg:kde): we need just the web search - browseSearch << _webSearches; - } - else if (_browseRegexp.indexIn(lowerTypedString) != -1) + bool textIsUrl = (_browseRegexp.indexIn(lowerTypedString) != -1); + + if (textIsUrl) { // browse url case (typed kde.org): show resolved url before browseSearch << _qurlFromUserInput; @@ -264,7 +269,11 @@ UrlSuggestionList UrlSuggester::orderLists() // and finally, results UrlSuggestionList list; - list += relevant + browseSearch + _history + _bookmarks; + if (textIsUrl) + list += browseSearch + relevant + _history + _bookmarks; + else + list += relevant + browseSearch + _history + _bookmarks; + return list; } |