X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplugins%2Fsearchplugin%2FSearchPlugin.cpp;h=10165f0976277e6b6a85943d4f6ca7c55c8d90c0;hb=cced647c88d92e05fde31cce0cc6a53a268c1954;hp=f4ded6d33b1f9a92eb61527cff0d4aec5f4cd4cc;hpb=d27c2db830de9a65d6a419479ee598cbf3697746;p=qtrapids diff --git a/src/plugins/searchplugin/SearchPlugin.cpp b/src/plugins/searchplugin/SearchPlugin.cpp index f4ded6d..10165f0 100644 --- a/src/plugins/searchplugin/SearchPlugin.cpp +++ b/src/plugins/searchplugin/SearchPlugin.cpp @@ -1,3 +1,23 @@ +/*************************************************************************** + * Copyright (C) 2009 by Lassi Väätämöinen * + * lassi.vaatamoinen@ixonos.com * + * * + * 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include #include #include @@ -13,12 +33,73 @@ namespace qtrapids { +<<<<<<< .mine + SearchPlugin::SearchPlugin() : + comboBox_(NULL), searchLine_(NULL), searchButton_(NULL), host_(NULL) + { + // TODO: Parse engine descriptions. + // -Add engines to model + // -Show model in comboBox + + } + + 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(this, 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(this, resultWidget); + } + } +======= SearchPlugin::SearchPlugin() : comboBox_(NULL), searchLine_(NULL), searchButton_(NULL), host_(NULL) { // TODO: Parse engine descriptions. // -Add engines to model // -Show model in comboBox +>>>>>>> .r31 }