- Search plugin parses opensearch.xml files and adds them to combobox
[qtrapids] / src / plugins / searchplugin / SearchPlugin.h
index 0b6a158..1b16330 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef SEARCHPLUGIN_H
 #define SEARCHPLUGIN_H
 
-
+#include <vector>
 #include <QObject>
 
 #include "PluginInterface.h"
@@ -31,6 +31,7 @@ class QPushButton;
 class QLineEdit;
 class QWebView;
 class DownloadManager;
+class QDir;
 
 namespace qtrapids
 {
@@ -40,28 +41,35 @@ class SearchPlugin : public PluginInterface
        Q_OBJECT
        Q_INTERFACES(qtrapids::PluginInterface)
 
-public:
-       SearchPlugin();
-       virtual void initialize(PluginHostInterface* host);
-       virtual QWidget* getGui();
-
-signals:
-       void searchResult(QWidget* resultwidget);
+       public:
+               SearchPlugin();
+               
+               /// @brief Initializes the SearchPlugin
+               /// @param info info.directory is used to search for searchengine description files. 
+               virtual void initialize(PluginHostInterface* host, Info info);
+               virtual QWidget* getGui();
 
-private slots:
-       void on_searchButton_clicked();
-       void on_searchResult(QWidget* resultWidget);
-       void on_loadFinished(bool ok);
-       void on_linkClicked(const QUrl& url);
-       void on_downloadFinished(QString filepath);
-private:
-       QComboBox *comboBox_;
-       QLineEdit *searchLine_;
-       QPushButton *searchButton_;
-       QWebView *result_; // Do not delete, plugin host takes ownership
-       DownloadManager *dlManager_;
-       PluginHostInterface* host_;
+       signals:
+               void searchResult(QWidget* resultwidget);
 
+       private slots:
+               void on_searchButton_clicked();
+               void on_searchResult(QWidget* resultWidget);
+               void on_loadFinished(bool ok);
+               void on_linkClicked(const QUrl& url);
+               void on_downloadFinished(QString filepath);
+               
+       private:
+               void ParseSearchEngineDescriptions(const QDir& dir);
+                       
+       private:
+               QComboBox *comboBox_; // Holds the search engine names. Combobox index maps to engineTemplates_ index
+               QLineEdit *searchLine_;
+               QPushButton *searchButton_;
+               QWebView *result_; // Do not delete, plugin host takes ownership
+               DownloadManager *dlManager_;
+               PluginHostInterface* host_;
+               std::vector<QString> engineTemplates_; // Holds the search URL templates
 };
 
 } // namespace qtrapids