summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/searchengine.cpp70
-rw-r--r--src/settings/settings_general.ui69
2 files changed, 28 insertions, 111 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;
+
}
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui
index 92e409a2..dccf479a 100644
--- a/src/settings/settings_general.ui
+++ b/src/settings/settings_general.ui
@@ -149,75 +149,6 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Search Engine</string>
- </property>
- <layout class="QFormLayout" name="formLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string>Default search engine:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="kcfg_searchEngine">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>google</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>altavista</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>lycos</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>wikipedia</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>wolfram</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Download Manager</string>