diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/listitem.cpp | 11 | ||||
-rw-r--r-- | src/urlbar/urlsuggester.cpp | 25 |
2 files changed, 26 insertions, 10 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 52f05f1b..e5adeec4 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -460,8 +460,15 @@ void SearchListItem::changeSearchEngine(KService::Ptr engine) { // NOTE: This to let rekonq loading text typed in the requested engine on click. // There probably is a better way to do it. I just cannot see it now... - UrlSuggestionItem item = UrlSuggestionItem(UrlSuggestionItem::Search, SearchEngine::buildQuery(engine, m_text), m_text); - SearchListItem sItem(item, m_text, this); + + // remove the xx: part... + QString separator = SearchEngine::delimiter(); + QString text = m_text.section(separator, 1, 1); + + // create a new item && load it... + UrlSuggestionItem item = UrlSuggestionItem(UrlSuggestionItem::Search, SearchEngine::buildQuery(engine, text), text); + + SearchListItem sItem(item, text, this); emit itemClicked(&sItem, Qt::LeftButton, Qt::NoModifier); } 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; } |