<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>src/data/searchengines/Google.xml</filename>
    </added>
    <added>
      <filename>src/data/searchengines/searchengines.qrc</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,7 +5,7 @@ error(&quot;Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4&quot;
 }
 
 TEMPLATE = subdirs
-SUBDIRS  = src tools manualtests/googlesuggest
+SUBDIRS  = src tools
 
 unix {
     # this is an ugly work around to do .PHONY: doc</diff>
      <filename>arora.pro</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,6 @@ TEMPLATE      = subdirs
 SUBDIRS = bookmarks \
           downloadmanager \
           editview \
-          googlesuggest \
           history \
           lineedit \
           locationbar \</diff>
      <filename>manualtests/manualtests.pro</filename>
    </modified>
    <modified>
      <diff>@@ -108,6 +108,7 @@ include(utils/utils.pri)
 
 RESOURCES += \
     $$PWD/data/data.qrc \
+    $$PWD/data/searchengines/searchengines.qrc \
     $$PWD/htmls/htmls.qrc
 
 DISTFILES += ../AUTHORS \</diff>
      <filename>src/src.pri</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 /*
  * Copyright 2008 Benjamin C. Meyer &lt;ben@meyerhome.net&gt;
+ * Copyright 2009 Jakub Wieczorek &lt;faw217@gmail.com&gt;
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,8 +65,9 @@
 
 #include &quot;autosaver.h&quot;
 #include &quot;browserapplication.h&quot;
-#include &quot;googlesuggest.h&quot;
 #include &quot;networkaccessmanager.h&quot;
+#include &quot;opensearchengine.h&quot;
+#include &quot;opensearchmanager.h&quot;
 #include &quot;searchbutton.h&quot;
 
 #include &lt;qabstractitemview.h&gt;
@@ -83,6 +85,8 @@
  */
 ToolbarSearch::ToolbarSearch(QWidget *parent)
     : SearchLineEdit(parent)
+    , m_openSearchManager(0)
+    , m_suggestionsEnabled(true)
     , m_autosaver(new AutoSaver(this))
     , m_maxSavedSearches(10)
     , m_model(new QStandardItemModel(this))
@@ -94,11 +98,44 @@ ToolbarSearch::ToolbarSearch(QWidget *parent)
     searchButton()-&gt;setShowMenuTriangle(true);
     connect(searchButton(), SIGNAL(clicked()),
             completer(), SLOT(complete()));
+    m_openSearchManager = BrowserApplication::instance()-&gt;openSearchManager();
+
     completer()-&gt;setModel(m_model);
     completer()-&gt;setCompletionMode(QCompleter::UnfilteredPopupCompletion);
+
     connect(this, SIGNAL(returnPressed()), SLOT(searchNow()));
-    setInactiveText(QLatin1String(&quot;Google&quot;));
+
     load();
+
+    currentEngineChanged();
+}
+
+void ToolbarSearch::currentEngineChanged()
+{
+    if (m_suggestionsEnabled) {
+        if (m_openSearchManager-&gt;engineExists(m_currentEngine)) {
+            OpenSearchEngine *oldEngine = m_openSearchManager-&gt;engine(m_currentEngine);
+            disconnect(oldEngine, SIGNAL(suggestions(const QStringList &amp;)),
+                       this, SLOT(newSuggestions(const QStringList &amp;)));
+            disconnect(oldEngine, SIGNAL(iconChanged()),
+                       this, SLOT(engineIconChanged()));
+        }
+
+        OpenSearchEngine *newEngine = m_openSearchManager-&gt;current();
+        connect(newEngine, SIGNAL(suggestions(const QStringList &amp;)),
+                this, SLOT(newSuggestions(const QStringList &amp;)));
+        connect(newEngine, SIGNAL(iconChanged()),
+                this, SLOT(engineIconChanged()));
+    }
+
+    setInactiveText(m_openSearchManager-&gt;currentName());
+    searchButton()-&gt;setImage(m_openSearchManager-&gt;current()-&gt;icon().toImage());
+    m_currentEngine = m_openSearchManager-&gt;currentName();
+}
+
+void ToolbarSearch::engineIconChanged()
+{
+    searchButton()-&gt;setImage(m_openSearchManager-&gt;current()-&gt;icon().toImage());
 }
 
 void ToolbarSearch::completerActivated(const QModelIndex &amp;index)
@@ -155,14 +192,13 @@ void ToolbarSearch::load()
     settings.beginGroup(QLatin1String(&quot;toolbarsearch&quot;));
     m_recentSearches = settings.value(QLatin1String(&quot;recentSearches&quot;)).toStringList();
     m_maxSavedSearches = settings.value(QLatin1String(&quot;maximumSaved&quot;), m_maxSavedSearches).toInt();
-    bool useGoogleSuggest = settings.value(QLatin1String(&quot;useGoogleSuggest&quot;), true).toBool();
-    if (useGoogleSuggest) {
-        m_googleSuggest = new GoogleSuggest(this);
-        connect(m_googleSuggest, SIGNAL(suggestions(const QStringList &amp;, const QString &amp;)),
-                this, SLOT(newSuggestions(const QStringList &amp;)));
+
+    m_suggestionsEnabled = settings.value(QLatin1String(&quot;useSuggestions&quot;), true).toBool();
+    if (m_suggestionsEnabled) {
         connect(this, SIGNAL(textEdited(const QString &amp;)),
                 this, SLOT(textEdited(const QString &amp;)));
     }
+
     settings.endGroup();
     setupMenu();
 }
@@ -172,8 +208,6 @@ void ToolbarSearch::textEdited(const QString &amp;text)
     Q_UNUSED(text);
     // delay settings this to prevent BrowserApplication from creating
     // the object when it isn't needed on startup
-    if (!m_googleSuggest-&gt;networkAccessManager())
-        m_googleSuggest-&gt;setNetworkAccessManager(BrowserApplication::networkAccessManager());
     if (!m_suggestTimer) {
         m_suggestTimer = new QTimer(this);
         m_suggestTimer-&gt;setSingleShot(true);
@@ -186,7 +220,7 @@ void ToolbarSearch::textEdited(const QString &amp;text)
 
 void ToolbarSearch::getSuggestions()
 {
-    m_googleSuggest-&gt;suggest(text());
+    m_openSearchManager-&gt;current()-&gt;requestSuggestions(text());
 }
 
 void ToolbarSearch::searchNow()
@@ -205,13 +239,8 @@ void ToolbarSearch::searchNow()
         m_autosaver-&gt;changeOccurred();
     }
 
-    QUrl url(QLatin1String(&quot;http://www.google.com/search&quot;));
-    url.addEncodedQueryItem(QUrl::toPercentEncoding(QLatin1String(&quot;q&quot;)),
-            QUrl::toPercentEncoding(searchText));
-    url.addQueryItem(QLatin1String(&quot;ie&quot;), QLatin1String(&quot;UTF-8&quot;));
-    url.addQueryItem(QLatin1String(&quot;oe&quot;), QLatin1String(&quot;UTF-8&quot;));
-    url.addQueryItem(QLatin1String(&quot;client&quot;), QCoreApplication::applicationName());
-    emit search(url);
+    QUrl searchUrl = m_openSearchManager-&gt;current()-&gt;searchUrl(searchText);
+    emit search(searchUrl);
 }
 
 void ToolbarSearch::newSuggestions(const QStringList &amp;suggestions)</diff>
      <filename>src/toolbarsearch.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -67,6 +67,8 @@
 
 class AutoSaver;
 class GoogleSuggest;
+class OpenSearchEngine;
+class OpenSearchManager;
 class QModelIndex;
 class QStandardItem;
 class QStandardItemModel;
@@ -88,6 +90,8 @@ public slots:
     void searchNow();
 
 private slots:
+    void currentEngineChanged();
+    void engineIconChanged();
     void save();
     void textEdited(const QString &amp;);
     void newSuggestions(const QStringList &amp;suggestions);
@@ -104,11 +108,14 @@ private:
     void setupMenu();
     void retranslate();
 
+    OpenSearchManager *m_openSearchManager;
+    QString m_currentEngine;
+    bool m_suggestionsEnabled;
+
     AutoSaver *m_autosaver;
     int m_maxSavedSearches;
     QStringList m_recentSearches;
     QStringList m_suggestions;
-    GoogleSuggest *m_googleSuggest;
     QStandardItemModel *m_model;
 
     QStandardItem *m_suggestionsItem;</diff>
      <filename>src/toolbarsearch.h</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,6 @@ HEADERS += \
     editlistview.h \
     edittableview.h \
     edittreeview.h \
-    googlesuggest.h \
     lineedit.h \
     lineedit_p.h \
     proxystyle.h \
@@ -18,7 +17,6 @@ SOURCES += \
     editlistview.cpp \
     edittableview.cpp \
     edittreeview.cpp \
-    googlesuggest.cpp \
     lineedit.cpp \
     singleapplication.cpp \
     squeezelabel.cpp
\ No newline at end of file</diff>
      <filename>src/utils/utils.pri</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>manualtests/googlesuggest/.gitignore</filename>
    </removed>
    <removed>
      <filename>manualtests/googlesuggest/googlesuggest.pro</filename>
    </removed>
    <removed>
      <filename>manualtests/googlesuggest/main_googlesuggest.cpp</filename>
    </removed>
    <removed>
      <filename>src/utils/googlesuggest.cpp</filename>
    </removed>
    <removed>
      <filename>src/utils/googlesuggest.h</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>888db616478900a35d4dda1957b02de76f97a483</id>
    </parent>
  </parents>
  <author>
    <name>Jakub Wieczorek</name>
    <email>faw217@gmail.com</email>
  </author>
  <url>http://github.com/icefox/arora/commit/59cf73f1a8b61af04c5880c2ab23dcbecffb1cc6</url>
  <id>59cf73f1a8b61af04c5880c2ab23dcbecffb1cc6</id>
  <committed-date>2009-05-13T18:21:53-07:00</committed-date>
  <authored-date>2009-04-13T05:56:10-07:00</authored-date>
  <message>Remove Google suggestions code including the utility class and its manualtests. Replace it with suggestions provided by open search engines.
Add src/data/searchengines directory containing default engines that Arora will be shipped with.</message>
  <tree>7d6e4a5fa3c812ce899953f06b2a0ad33cd8d1ff</tree>
  <committer>
    <name>Benjamin C Meyer</name>
    <email>ben@meyerhome.net</email>
  </committer>
</commit>
