- Search plugin interface changed: enum constants to define widget types to allow...
[qtrapids] / src / plugins / searchplugin / SearchPlugin.cpp
index 10165f0..27417f1 100644 (file)
@@ -33,7 +33,6 @@
 
 namespace qtrapids
 {
-<<<<<<< .mine
        SearchPlugin::SearchPlugin() : 
                comboBox_(NULL), searchLine_(NULL), searchButton_(NULL), host_(NULL)
        {
@@ -65,7 +64,7 @@ namespace qtrapids
                        connect(searchButton_, SIGNAL(clicked()), this, SLOT(on_searchButton_clicked()));
                        //connect(this, SIGNAL(searchResult(QWidget*)), this, SLOT(on_searchResult(QWidget*)));
                        
-                       host_->setGui(this, pluginWidget);
+                       host_->setGui(pluginWidget, qtrapids::PluginHostInterface::BASE_WIDGET);
                }
        }
        
@@ -89,71 +88,9 @@ namespace qtrapids
        {
                qDebug() << "on_searchResult()";
                if (host_) {
-                       host_->addPluginWidget(this, resultWidget);
+                       host_->addPluginWidget(resultWidget, qtrapids::PluginHostInterface::TAB_PAGE);
                }
        }
-=======
-SearchPlugin::SearchPlugin() :
-        comboBox_(NULL), searchLine_(NULL), searchButton_(NULL), host_(NULL)
-{
-    // TODO: Parse engine descriptions.
-    // -Add engines to model
-    // -Show model in comboBox
->>>>>>> .r31
-
-}
-
-void SearchPlugin::initialize(PluginHostInterface* host)
-{
-    host_ = host;
-
-    if (host_ != NULL)
-    {
-
-        QWidget *pluginWidget = new QWidget;
-        QVBoxLayout *vbox = new QVBoxLayout;
-        QHBoxLayout *hbox = new QHBoxLayout;
-        comboBox_ = new QComboBox;
-        searchLine_ = new QLineEdit;
-        searchButton_ = new QPushButton("Search");
-
-        hbox->addWidget(searchLine_);
-        hbox->addWidget(searchButton_);
-        vbox->addWidget(comboBox_);
-        vbox->addLayout(hbox);
-        pluginWidget->setLayout(vbox);
-
-        connect(searchButton_, SIGNAL(clicked()), this, SLOT(on_searchButton_clicked()));
-        //connect(this, SIGNAL(searchResult(QWidget*)), this, SLOT(on_searchResult(QWidget*)));
-
-        host_->setGui(pluginWidget);
-    }
-}
-
-QWidget* SearchPlugin::getGui()
-{
-    return NULL;
-}
-
-void SearchPlugin::on_searchButton_clicked()
-{
-    QUrl searchUrl(QString("http://www.google.fi/search?q="
-                           + searchLine_->text()));
-    qDebug() << searchUrl;
-    QWebView *result = new QWebView;
-    result->load(searchUrl);
-
-    on_searchResult((QWidget*)result);
-}
-
-void SearchPlugin::on_searchResult(QWidget* resultWidget)
-{
-    qDebug() << "on_searchResult()";
-    if (host_)
-    {
-        host_->addPluginWidget(resultWidget);
-    }
-}
 
 } // namespace qtrapids