summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitrios Christidis <dchristidis@ceid.upatras.gr>2013-02-12 11:56:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-02-12 15:51:55 +0100
commitf33a098efb93291a83e155cc1126652804fee3da (patch)
treeb4c28d89748ad5d5c86a68554f066b2031de8eee
parentOoops... one g more (diff)
downloadrekonq-f33a098efb93291a83e155cc1126652804fee3da.tar.xz
Honor configuration for Web Shortcuts.
Rekonq will no longer ignore options "Enable Web shortcuts" and "Use preferred shortcuts only". This commit also removes the conditional compilation directives introduced in commit 14e028 as rekonq 2.x now depends on 4.9. BUG: 309470 REVIEW: 108902 Signed-off-by: Andrea Diamantini <adjam7@gmail.com>
-rw-r--r--src/searchengine.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/searchengine.cpp b/src/searchengine.cpp
index 742e9bc1..19529d30 100644
--- a/src/searchengine.cpp
+++ b/src/searchengine.cpp
@@ -37,6 +37,8 @@ struct SearchEnginePrivate
{
SearchEnginePrivate() : isLoaded(false) {}
bool isLoaded;
+ bool isEnabled;
+ bool usePreferredOnly;
QString delimiter;
KService::List favorites;
KService::Ptr defaultEngine;
@@ -51,16 +53,15 @@ void SearchEngine::reload()
KConfig config("kuriikwsfilterrc"); //Shared with konqueror
KConfigGroup cg = config.group("General");
+ d->isEnabled = cg.readEntry("EnableWebShortcuts", true);
+ d->usePreferredOnly = cg.readEntry("UsePreferredWebShortcutsOnly", false);
+
//load delimiter
d->delimiter = cg.readEntry("KeywordDelimiter", ":");
// load favorite engines
QStringList favoriteEngines;
-#if KDE_IS_VERSION(4,9,0)
favoriteEngines = cg.readEntry("PreferredWebShortcuts", favoriteEngines);
-#else
- favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
-#endif
KService::List favorites;
KService::Ptr service;
@@ -76,11 +77,7 @@ void SearchEngine::reload()
// load default engine
QString dse;
-#if KDE_IS_VERSION(4,9,0)
dse = cg.readEntry("DefaultWebShortcut");
-#else
- dse = cg.readEntry("DefaultSearchEngine");
-#endif
d->defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(dse));
@@ -117,10 +114,18 @@ KService::Ptr SearchEngine::defaultEngine()
KService::Ptr SearchEngine::fromString(const QString &text)
{
- KService::List providers = KServiceTypeTrader::self()->query("SearchProvider");
+ KService::Ptr service;
+
+ // first, the easy part...
+ if (!d->isEnabled)
+ return service;
+
+ KService::List providers = (d->usePreferredOnly)
+ ? SearchEngine::favorites()
+ : KServiceTypeTrader::self()->query("SearchProvider");
+
int i = 0;
bool found = false;
- KService::Ptr service;
while (!found && i < providers.size())
{
QStringList list = providers.at(i)->property("Keys").toStringList();