diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-11-07 22:31:43 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-11-07 22:31:43 +0100 |
commit | 23fdf29c98c402e96e7cb14eecba30671bc72d64 (patch) | |
tree | 2732854f3ded89546f86ce479654c569549a9ba4 /src/opensearch/searchengine.cpp | |
parent | First bunch of fixes for the suggestions. (diff) | |
download | rekonq-23fdf29c98c402e96e7cb14eecba30671bc72d64.tar.xz |
Let suggestions work also without search engines ones.
Diffstat (limited to 'src/opensearch/searchengine.cpp')
-rw-r--r-- | src/opensearch/searchengine.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/opensearch/searchengine.cpp b/src/opensearch/searchengine.cpp index 44e35e33..4378a26c 100644 --- a/src/opensearch/searchengine.cpp +++ b/src/opensearch/searchengine.cpp @@ -57,7 +57,7 @@ void SearchEngine::reload() favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines); KService::List favorites; KService::Ptr service; - foreach(const QString &engine, favoriteEngines) + Q_FOREACH(const QString &engine, favoriteEngines) { service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine)); if (service) @@ -74,11 +74,6 @@ void SearchEngine::reload() //load default engine QString d = cg.readEntry("DefaultSearchEngine"); m_defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d)); -// if (!m_defaultEngine) -// { -// d = QL1S("google"); -// m_defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d)); -// } m_loaded = true; } @@ -120,7 +115,7 @@ KService::Ptr SearchEngine::fromString(const QString &text) while (!found && i < providers.size()) { QStringList list = providers.at(i)->property("Keys").toStringList(); - foreach(const QString &key, list) + Q_FOREACH(const QString &key, list) { const QString searchPrefix = key + delimiter(); if (text.startsWith(searchPrefix)) @@ -141,18 +136,14 @@ QString SearchEngine::extractQuery(const QString &text) QString query = text; KService::Ptr engine = SearchEngine::fromString(text); - // WARNING: this lets rekonq hangs on kde: urlbar typing.. -// if (engine) -// { -// query = query.remove(0, text.indexOf(SearchEngine::delimiter()) + 1); -// } - return query; } QString SearchEngine::buildQuery(KService::Ptr engine, const QString &text) { + if(!engine) + return QString(); QString query = engine->property("Query").toString(); query = query.replace("\\{@}", KUrl::toPercentEncoding(text)); return query; |