summaryrefslogtreecommitdiff
path: root/src/urlbar/urlresolver.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-02 10:32:09 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-02 10:32:09 +0200
commitad83718d864898600356031acc39ebfe403eeaad (patch)
treee9b9be2a72aadbca1fba96ab4406b660f66b240c /src/urlbar/urlresolver.cpp
parentfix memory leak when delete current job in opensearchmanager (diff)
parentbig commit: fix fast typing (diff)
downloadrekonq-ad83718d864898600356031acc39ebfe403eeaad.tar.xz
Merge commit 'refs/merge-requests/195' of git://gitorious.org/rekonq/mainline into m195
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);
- }
+ }
}