summaryrefslogtreecommitdiff
path: root/src/urlbar/urlresolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/urlresolver.cpp')
-rw-r--r--src/urlbar/urlresolver.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index b6d7e598..6743727b 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -59,6 +59,7 @@
// ------------------------------------------------------------------------
+KService::Ptr UrlResolver::_searchEngine;
QRegExp UrlResolver::_browseRegexp;
QRegExp UrlResolver::_searchEnginesRegexp;
@@ -67,6 +68,8 @@ UrlResolver::UrlResolver(const QString &typedUrl)
: QObject()
, _typedString(typedUrl.trimmed())
{
+ if (!_searchEngine ) _searchEngine = SearchEngine::defaultEngine();
+
if ( _browseRegexp.isEmpty() )
{
kDebug() << "browse regexp empty. Setting value..";
@@ -107,7 +110,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)
}
_searchEnginesRegexp = QRegExp(reg);
}
-
+
computeSuggestions();
}
@@ -330,7 +333,15 @@ void UrlResolver::computeQurlFromUserInput()
//webSearches
void UrlResolver::computeWebSearches()
{
- _webSearches = (UrlSearchList() << UrlSearchItem(UrlSearchItem::Search, QString(), QString()));
+ QString query = _typedString;
+ KService::Ptr engine = SearchEngine::fromString(_typedString);
+ if (engine)
+ {
+ query = query.remove(0, _typedString.indexOf(SearchEngine::delimiter()) + 1);
+ _searchEngine = engine;
+ }
+
+ _webSearches = (UrlSearchList() << UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(_searchEngine, query), _searchEngine->name()));
}
@@ -375,7 +386,7 @@ void UrlResolver::computeSuggestions()
SLOT(suggestionsReceived(const QString &, const QStringList &)));
Application::opensearchManager()->requestSuggestion(_typedString);
- }
+ }
}