-rw-r--r-- | noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index 42a3885..71dd7eb 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp | |||
@@ -1,87 +1,88 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qapplication.h> | 3 | #include <qapplication.h> |
4 | 4 | ||
5 | #include <qlayout.h> | ||
5 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
6 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
7 | #include <qvariant.h> | 8 | #include <qvariant.h> |
8 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
9 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
10 | #include <qlabel.h> | 11 | #include <qlabel.h> |
11 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
12 | #include <qstringlist.h> | 13 | #include <qstringlist.h> |
13 | #include <qmainwindow.h> | 14 | #include <qmainwindow.h> |
14 | #include "helpwindow.h" | 15 | #include "helpwindow.h" |
15 | 16 | ||
16 | #include <opie/oprocess.h> | 17 | #include <opie/oprocess.h> |
17 | 18 | ||
18 | #include <stdlib.h> | 19 | #include <stdlib.h> |
19 | // #include <sys/stat.h> | 20 | // #include <sys/stat.h> |
20 | // #include <unistd.h> | 21 | // #include <unistd.h> |
21 | 22 | ||
22 | InputDialog::InputDialog( ) | 23 | InputDialog::InputDialog( ) |
23 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { | 24 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { |
24 | setCaption( tr("Symbol Lookup")); | 25 | setCaption( tr("Symbol Lookup")); |
25 | 26 | ||
26 | QGridLayout *layout = new QGridLayout( this ); | 27 | QGridLayout *layout = new QGridLayout( this ); |
27 | layout->setSpacing(6); | 28 | layout->setSpacing(6); |
28 | layout->setMargin( 2); | 29 | layout->setMargin( 2); |
29 | 30 | ||
30 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
31 | LineEdit1->setFocus(); | 32 | LineEdit1->setFocus(); |
32 | 33 | ||
33 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); | 34 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); |
34 | 35 | ||
35 | QLabel *label; | 36 | QLabel *label; |
36 | label = new QLabel(this); | 37 | label = new QLabel(this); |
37 | label->setText( tr("Enter something to lookup / search.")); | 38 | label->setText( tr("Enter something to lookup / search.")); |
38 | label->setMaximumHeight(60); | 39 | label->setMaximumHeight(60); |
39 | layout->addMultiCellWidget( label, 1, 1, 0, 3); | 40 | layout->addMultiCellWidget( label, 1, 1, 0, 3); |
40 | 41 | ||
41 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); | 42 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); |
42 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 43 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
43 | layout->addItem( spacer, 8, 0 ); | 44 | layout->addItem( spacer, 8, 0 ); |
44 | 45 | ||
45 | } | 46 | } |
46 | 47 | ||
47 | InputDialog::~InputDialog() { | 48 | InputDialog::~InputDialog() { |
48 | } | 49 | } |
49 | 50 | ||
50 | void InputDialog::doLookup() { | 51 | void InputDialog::doLookup() { |
51 | // http://finance.yahoo.com/l?m=&s=siemens&t= | 52 | // http://finance.yahoo.com/l?m=&s=siemens&t= |
52 | 53 | ||
53 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; | 54 | QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; |
54 | QString tempHtml = "/tmp/stockticker.html"; | 55 | QString tempHtml = "/tmp/stockticker.html"; |
55 | QString cmd = "wget -O "+tempHtml+" "+url; | 56 | QString cmd = "wget -O "+tempHtml+" "+url; |
56 | qDebug(cmd); | 57 | qDebug(cmd); |
57 | 58 | ||
58 | 59 | ||
59 | /* | 60 | /* |
60 | OProcess proc; | 61 | OProcess proc; |
61 | proc << "/usr/bin/wget"; | 62 | proc << "/usr/bin/wget"; |
62 | proc<<"-O"<< tempHtml<< url; | 63 | proc<<"-O"<< tempHtml<< url; |
63 | 64 | ||
64 | connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); | 65 | connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); |
65 | proc.start( OProcess::NotifyOnExit); | 66 | proc.start( OProcess::NotifyOnExit); |
66 | */ | 67 | */ |
67 | system(cmd.latin1()); | 68 | system(cmd.latin1()); |
68 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 69 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
69 | StockLookup->setCaption("Symbol"); | 70 | StockLookup->setCaption("Symbol"); |
70 | StockLookup->showMaximized(); | 71 | StockLookup->showMaximized(); |
71 | StockLookup->show(); | 72 | StockLookup->show(); |
72 | LineEdit1->text(); | 73 | LineEdit1->text(); |
73 | 74 | ||
74 | 75 | ||
75 | } | 76 | } |
76 | 77 | ||
77 | void InputDialog::showBrowser(OProcess*) { | 78 | void InputDialog::showBrowser(OProcess*) { |
78 | qDebug("BLAH"); | 79 | qDebug("BLAH"); |
79 | QString tempHtml = "/tmp/stockticker.html"; | 80 | QString tempHtml = "/tmp/stockticker.html"; |
80 | 81 | ||
81 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); | 82 | HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); |
82 | StockLookup->setCaption("Symbol"); | 83 | StockLookup->setCaption("Symbol"); |
83 | StockLookup->showMaximized(); | 84 | StockLookup->showMaximized(); |
84 | StockLookup->show(); | 85 | StockLookup->show(); |
85 | LineEdit1->text(); | 86 | LineEdit1->text(); |
86 | 87 | ||
87 | } | 88 | } |