summaryrefslogtreecommitdiff
path: root/src/searchengine.cpp
diff options
context:
space:
mode:
authorThijs Heus <thijsheus@gmail.com>2010-06-07 14:27:56 +0200
committerThijs Heus <thijsheus@gmail.com>2010-06-07 14:27:56 +0200
commit80c7e876028deefd944c5e5a9b783b68a02f9e90 (patch)
tree69bbe87cb64e12a63d30fab94d3750cf45484775 /src/searchengine.cpp
parentMerge commit 'refs/merge-requests/133' of git://gitorious.org/rekonq/mainline... (diff)
downloadrekonq-80c7e876028deefd944c5e5a9b783b68a02f9e90.tar.xz
Link webshortcuts default engine into urlbar default engine - without
crashing with SE=None
Diffstat (limited to 'src/searchengine.cpp')
-rw-r--r--src/searchengine.cpp70
1 files changed, 28 insertions, 42 deletions
diff --git a/src/searchengine.cpp b/src/searchengine.cpp
index 0d2c6aea..0a66bb64 100644
--- a/src/searchengine.cpp
+++ b/src/searchengine.cpp
@@ -115,53 +115,39 @@ KService::List SearchEngine::favorites()
return m_favorites;
}
-
void SearchEngine::loadFavorites()
{
- KConfig config("kuriikwsfilterrc"); //Share with konqueror
- KConfigGroup cg = config.group("General");
- QStringList favoriteEngines;
- favoriteEngines << "wikipedia" << "google"; //defaults
- favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
-
- KService::List favorites;
- KService::Ptr service;
- foreach(const QString &engine, favoriteEngines)
- {
- service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
- if (service)
- favorites << service;
- }
-
- m_favorites = favorites;
+ KConfig config("kuriikwsfilterrc"); //Share with konqueror
+ KConfigGroup cg = config.group("General");
+ QStringList favoriteEngines;
+ favoriteEngines << "google"; //defaults
+ favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
+
+ KService::List favorites;
+ KService::Ptr service;
+ foreach(const QString &engine, favoriteEngines)
+ {
+ service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
+ if (service)
+ favorites << service;
+ }
+
+ m_favorites = favorites;
}
KService::Ptr SearchEngine::defaultEngine()
{
- int n = ReKonfig::searchEngine();
- QString engine;
- switch (n)
- {
- case 0:
- engine = QL1S("google");
- break;
- case 1:
- engine = QL1S("altavista");
- break;
- case 2:
- engine = QL1S("lycos");
- break;
- case 3:
- engine = QL1S("wikipedia");
- break;
- case 4:
- engine = QL1S("wolfram");
- break;
- default:
- engine = QL1S("google");
- break;
- }
-
- return KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
+ KConfig config("kuriikwsfilterrc"); //Share with konqueror
+ KConfigGroup cg = config.group("General");
+ QString d = cg.readEntry("DefaultSearchEngine");
+ KService::Ptr service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
+ if (!service)
+ {
+ d = QL1S("google");
+ service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
+ }
+
+ return service;
+
}