00001 #include "inputDialog.h"
00002 #include "helpwindow.h"
00003
00004
00005 #include <opie2/odebug.h>
00006 #include <qpe/config.h>
00007 using namespace Opie::Core;
00008
00009
00010 #include <qapplication.h>
00011 #include <qlayout.h>
00012 #include <qcheckbox.h>
00013 #include <qlineedit.h>
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qwhatsthis.h>
00017 #include <qlabel.h>
00018 #include <qlayout.h>
00019 #include <qstringlist.h>
00020 #include <qmainwindow.h>
00021
00022
00023 #include <stdlib.h>
00024
00025 InputDialog::InputDialog( )
00026 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) {
00027 setCaption( tr("Symbol Lookup"));
00028
00029 QGridLayout *layout = new QGridLayout( this );
00030 layout->setSpacing(6);
00031 layout->setMargin( 2);
00032
00033 LineEdit1 = new QLineEdit( this, "LineEdit1" );
00034 LineEdit1->setFocus();
00035
00036 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3);
00037
00038 QLabel *label;
00039 label = new QLabel(this);
00040 label->setText( tr("Enter something to lookup / search."));
00041 label->setMaximumHeight(60);
00042 layout->addMultiCellWidget( label, 1, 1, 0, 3);
00043
00044 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup()));
00045 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
00046 layout->addItem( spacer, 8, 0 );
00047
00048 }
00049
00050 InputDialog::~InputDialog() {
00051 }
00052
00053 void InputDialog::doLookup() {
00054
00055
00056 QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\"";
00057 QString tempHtml = "/tmp/stockticker.html";
00058 QString cmd = "wget -O "+tempHtml+" "+url;
00059 odebug << cmd << oendl;
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 system(cmd.latin1());
00071 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
00072 StockLookup->setCaption("Symbol");
00073 StockLookup->showMaximized();
00074 StockLookup->show();
00075 LineEdit1->text();
00076
00077
00078 }
00079
00080 void InputDialog::showBrowser(OProcess*) {
00081 odebug << "BLAH" << oendl;
00082 QString tempHtml = "/tmp/stockticker.html";
00083
00084 HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup");
00085 StockLookup->setCaption("Symbol");
00086 StockLookup->showMaximized();
00087 StockLookup->show();
00088 LineEdit1->text();
00089
00090 }