Commit f33a098e authored by Dimitrios Christidis's avatar Dimitrios Christidis Committed by Andrea Diamantini
Browse files

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: default avatarAndrea Diamantini <adjam7@gmail.com>
parent e637cc96
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment