3 files changed, 142 insertions, 71 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index 4b7b177..13c846b 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro | |||
@@ -1,27 +1,27 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt debug | 3 | CONFIG += qt debug |
4 | 4 | ||
5 | HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ | 5 | HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ |
6 | ../libstocks/csv.h \ | 6 | ../libstocks/csv.h \ |
7 | ../libstocks/http.h \ | 7 | ../libstocks/http.h \ |
8 | ../libstocks/lists.h \ | 8 | ../libstocks/lists.h \ |
9 | ../libstocks/stocks.h | 9 | ../libstocks/stocks.h |
10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ | 10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ |
11 | ../libstocks/csv.c \ | 11 | ../libstocks/csv.c \ |
12 | ../libstocks/currency.c \ | 12 | ../libstocks/currency.c \ |
13 | ../libstocks/history.c \ | 13 | ../libstocks/history.c \ |
14 | ../libstocks/http.c \ | 14 | ../libstocks/http.c \ |
15 | ../libstocks/lists.c \ | 15 | ../libstocks/lists.c \ |
16 | ../libstocks/stocks.c | 16 | ../libstocks/stocks.c |
17 | 17 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include \ | 18 | INCLUDEPATH += $(OPIEDIR)/include \ |
19 | ../ ../library | 19 | ../ ../library |
20 | DEPENDPATH += $(OPIEDIR)/include \ | 20 | DEPENDPATH += $(OPIEDIR)/include \ |
21 | ../ ../library | 21 | ../ ../library |
22 | 22 | ||
23 | LIBS+= -lqpe -lopie | 23 | LIBS+= -lqpe -lopie -lpthread |
24 | TMAKE_CFLAGS += -D__UNIX__ | 24 | TMAKE_CFLAGS += -D__UNIX__ |
25 | 25 | ||
26 | DESTDIR = $(OPIEDIR)/plugins/today | 26 | DESTDIR = $(OPIEDIR)/plugins/today |
27 | TARGET = todaystocktickerplugin | 27 | TARGET = todaystocktickerplugin |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index 8830472..572a720 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -1,129 +1,124 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.cpp | 2 | * stocktickerpluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by L.J. Potter | 4 | * copyright : (c) 2002 by L.J. Potter |
5 | * email : llornkcor@handhelds.org | 5 | * email : llornkcor@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include <qsocket.h> | ||
17 | #include <qvaluelist.h> | 18 | #include <qvaluelist.h> |
18 | #include <qtl.h> | 19 | #include <qtl.h> |
19 | #include <qstring.h> | 20 | #include <qstring.h> |
20 | #include <qstringlist.h> | 21 | #include <qstringlist.h> |
21 | #include <qobject.h> | 22 | #include <qobject.h> |
22 | #include <qlayout.h> | 23 | #include <qlayout.h> |
23 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
24 | #include <qregexp.h> | 25 | #include <qregexp.h> |
25 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qmessagebox.h> | ||
26 | 28 | ||
27 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | 30 | #include <qpe/timestring.h> |
29 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | #include <qpe/network.h> | ||
30 | 33 | ||
31 | #include <opie/oticker.h> | 34 | #include <opie/oticker.h> |
32 | //#include "ticker.h" | ||
33 | 35 | ||
34 | extern "C" { | 36 | extern "C" { |
35 | #include "libstocks/stocks.h" | 37 | #include "libstocks/stocks.h" |
36 | } | 38 | } |
37 | 39 | ||
38 | #include "stocktickerpluginwidget.h" | 40 | #include <pthread.h> |
39 | |||
40 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | ||
41 | : QWidget(parent, name ) { | ||
42 | init(); | ||
43 | startTimer(1000); | ||
44 | } | ||
45 | |||
46 | StockTickerPluginWidget::~StockTickerPluginWidget() { | ||
47 | } | ||
48 | 41 | ||
49 | void StockTickerPluginWidget::init() { | 42 | #include "stocktickerpluginwidget.h" |
50 | |||
51 | QHBoxLayout* layout = new QHBoxLayout( this ); | ||
52 | |||
53 | stocktickerTicker = new OTicker(this); | ||
54 | stocktickerTicker->setMinimumHeight(15); | ||
55 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); | ||
56 | |||
57 | layout->addWidget( stocktickerTicker); | ||
58 | |||
59 | } | ||
60 | |||
61 | void StockTickerPluginWidget::doStocks() { | ||
62 | Config cfg( "stockticker"); | ||
63 | cfg.setGroup( "Symbols" ); | ||
64 | QString symbollist; | ||
65 | symbollist = cfg.readEntry("Symbols", ""); | ||
66 | symbollist.replace(QRegExp(" "),"+");//seperated by + | ||
67 | // qDebug(symbollist); | ||
68 | 43 | ||
69 | getStocks( symbollist.latin1()); | 44 | QString output; |
70 | 45 | OTicker *stocktickerTicker; | |
71 | stocktickerTicker->setText( output ); | ||
72 | } | ||
73 | 46 | ||
74 | void StockTickerPluginWidget::getStocks( const char *blah) { | 47 | void getStocks( const QString *blah) { |
75 | 48 | ||
49 | // stocktickerTicker->setText( "Downloading stock data."); | ||
76 | stock *stocks_quotes=NULL; | 50 | stock *stocks_quotes=NULL; |
77 | stock *stocks_tmp; | 51 | stock *stocks_tmp; |
78 | 52 | qDebug("%s", blah->latin1()); | |
79 | QString tempString; | 53 | QString tempString; |
80 | output = ""; | 54 | output = ""; |
81 | 55 | ||
82 | libstocks_return_code error; | 56 | libstocks_return_code error; |
83 | 57 | ||
84 | Config cfg( "stockticker"); | 58 | Config cfg( "stockticker"); |
85 | cfg.setGroup( "Fields" ); | 59 | cfg.setGroup( "Fields" ); |
86 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 60 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
87 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 61 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
88 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 62 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
89 | 63 | ||
90 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 64 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
91 | 65 | ||
92 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 66 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
93 | dodateCheck=cfg.readBoolEntry("dateCheck",1); | 67 | dodateCheck=cfg.readBoolEntry("dateCheck",1); |
94 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 68 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
95 | donameCheck=cfg.readBoolEntry("nameCheck",1); | 69 | donameCheck=cfg.readBoolEntry("nameCheck",1); |
96 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); | 70 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); |
97 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); | 71 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); |
98 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); | 72 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); |
99 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); | 73 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); |
100 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); | 74 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); |
101 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); | 75 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); |
102 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); | 76 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); |
103 | 77 | ||
104 | DefProxy(); | 78 | // DefProxy(); |
105 | char *stock_liste = (char *)blah; | 79 | { |
80 | char *proxy; | ||
81 | libstocks_return_code error; | ||
82 | |||
83 | /* Proxy support */ | ||
84 | /* Checks for "http_proxy" environment variable */ | ||
85 | proxy = getenv("http_proxy"); | ||
86 | if(proxy) { | ||
87 | /* printf("proxy set\n"); */ | ||
88 | error = set_proxy(proxy); | ||
89 | if (error) { | ||
90 | printf("Proxy error (%d)\n", error); | ||
91 | QString tempString; | ||
92 | tempString.sprintf("Proxy error (%d)\n", error); | ||
93 | output = tempString; | ||
94 | return; | ||
95 | // exit(1); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | char *stock_liste = (char *)blah->latin1(); | ||
100 | // char *stock_liste = (char *)blah; | ||
106 | /* Get the stocks and process errors */ | 101 | /* Get the stocks and process errors */ |
107 | error = get_stocks( stock_liste, &stocks_quotes); | 102 | error = get_stocks( stock_liste, &stocks_quotes); |
108 | 103 | ||
109 | if (error) { | 104 | if (error) { |
110 | printf("Error in getting stocks (%d)\n", error); | 105 | printf("Error in getting stocks (%d)\n", error); |
111 | tempString.sprintf("Error in getting stocks (%d)\n", error); | 106 | tempString.sprintf("Error in getting stocks (%d)\n", error); |
112 | output =tempString; | 107 | output =tempString; |
113 | return; | 108 | return; |
114 | // exit(1); | 109 | // exit(1); |
115 | } | 110 | } |
116 | 111 | ||
117 | stocks_tmp = stocks_quotes; | 112 | stocks_tmp = stocks_quotes; |
118 | 113 | ||
119 | /* Displays the stocks */ | 114 | /* Displays the stocks */ |
120 | while(stocks_tmp!=0){ | 115 | while(stocks_tmp!=0){ |
121 | 116 | ||
122 | if (stocks_tmp->Time) { | 117 | if (stocks_tmp->Time) { |
123 | // printf("%s ", stocks_tmp->Time); | 118 | // printf("%s ", stocks_tmp->Time); |
124 | tempString.sprintf("| %s ", stocks_tmp->Time); | 119 | tempString.sprintf("| %s ", stocks_tmp->Time); |
125 | tempString.replace(QRegExp("\""),""); | 120 | tempString.replace(QRegExp("\""),""); |
126 | if( dotimeCheck) | 121 | if( dotimeCheck) |
127 | output +=tempString; | 122 | output +=tempString; |
128 | } | 123 | } |
129 | if (stocks_tmp->Date) { | 124 | if (stocks_tmp->Date) { |
@@ -196,59 +191,139 @@ void StockTickerPluginWidget::getStocks( const char *blah) { | |||
196 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); | 191 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); |
197 | if(domaxPriceCheck) | 192 | if(domaxPriceCheck) |
198 | output +=tempString; | 193 | output +=tempString; |
199 | 194 | ||
200 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 195 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
201 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 196 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
202 | if(dovariationCheck) | 197 | if(dovariationCheck) |
203 | output +=tempString; | 198 | output +=tempString; |
204 | 199 | ||
205 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); | 200 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); |
206 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); | 201 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); |
207 | if(dovolumeCheck) | 202 | if(dovolumeCheck) |
208 | output +=tempString; | 203 | output +=tempString; |
209 | 204 | ||
210 | // printf("----------------------------------------\n\n"); | 205 | // printf("----------------------------------------\n\n"); |
211 | tempString.sprintf("||==++==|"); | 206 | tempString.sprintf("||==++==|"); |
212 | output +=tempString; | 207 | output +=tempString; |
213 | 208 | ||
214 | /* Simple function which help to browse in the stocks list */ | 209 | /* Simple function which help to browse in the stocks list */ |
215 | stocks_tmp = next_stock(stocks_tmp); | 210 | stocks_tmp = next_stock(stocks_tmp); |
216 | } | 211 | } |
217 | 212 | ||
218 | /* frees stocks */ | 213 | /* frees stocks */ |
219 | free_stocks(stocks_quotes); | 214 | free_stocks(stocks_quotes); |
215 | stocktickerTicker->setText( output ); | ||
220 | 216 | ||
221 | } | 217 | } |
222 | 218 | ||
223 | void StockTickerPluginWidget::DefProxy(void) { | 219 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
224 | char *proxy; | 220 | : QWidget(parent, name ) { |
225 | libstocks_return_code error; | 221 | init(); |
222 | startTimer(1000); | ||
223 | // checkConnection(); | ||
224 | } | ||
226 | 225 | ||
227 | /* Proxy support */ | 226 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
228 | /* Checks for "http_proxy" environment variable */ | 227 | } |
229 | proxy = getenv("http_proxy"); | 228 | |
230 | if(proxy) { | 229 | void StockTickerPluginWidget::init() { |
231 | /* printf("proxy set\n"); */ | 230 | |
232 | error = set_proxy(proxy); | 231 | QHBoxLayout* layout = new QHBoxLayout( this ); |
233 | if (error) { | 232 | stocktickerTicker = new OTicker(this); |
234 | // printf("Proxy error (%d)\n", error); | 233 | stocktickerTicker->setMinimumHeight(15); |
235 | QString tempString; | 234 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); |
236 | tempString.sprintf("Proxy error (%d)\n", error); | 235 | layout->addWidget( stocktickerTicker); |
237 | output = tempString; | 236 | wasError = true; |
238 | return; | 237 | } |
239 | // exit(1); | 238 | |
240 | } | 239 | void StockTickerPluginWidget::doStocks() { |
240 | Config cfg( "stockticker"); | ||
241 | cfg.setGroup( "Symbols" ); | ||
242 | QString symbollist; | ||
243 | symbollist = cfg.readEntry("Symbols", ""); | ||
244 | symbollist.replace(QRegExp(" "),"+");//seperated by + | ||
245 | |||
246 | // qDebug(symbollist); | ||
247 | if (!symbollist.isEmpty()) { | ||
248 | pthread_t thread1; | ||
249 | pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); | ||
241 | } | 250 | } |
251 | // pthread_join(thread1,NULL); | ||
252 | // getStocks( symbollist.latin1() ); | ||
253 | } | ||
254 | |||
255 | void StockTickerPluginWidget::DefProxy(void) { | ||
256 | // char *proxy; | ||
257 | // libstocks_return_code error; | ||
258 | |||
259 | // /* Proxy support */ | ||
260 | // /* Checks for "http_proxy" environment variable */ | ||
261 | // proxy = getenv("http_proxy"); | ||
262 | // if(proxy) { | ||
263 | // /* printf("proxy set\n"); */ | ||
264 | // error = set_proxy(proxy); | ||
265 | // if (error) { | ||
266 | // // printf("Proxy error (%d)\n", error); | ||
267 | // QString tempString; | ||
268 | // tempString.sprintf("Proxy error (%d)\n", error); | ||
269 | // output = tempString; | ||
270 | // return; | ||
271 | // // exit(1); | ||
272 | // } | ||
273 | // } | ||
274 | } | ||
275 | |||
276 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | ||
277 | killTimer(e->timerId()); | ||
278 | checkConnection(); | ||
279 | } | ||
280 | |||
281 | void StockTickerPluginWidget::checkConnection() { | ||
282 | // qDebug("checking connection"); | ||
283 | // Sock = new QSocket( this ); | ||
284 | |||
285 | // if( wasError) | ||
286 | // stocktickerTicker->setText("Checking connection"); | ||
287 | |||
288 | // if(Sock->state() == QSocket::Idle) { | ||
289 | // Sock->connectToHost("finance.yahoo.com", 80); | ||
290 | // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); | ||
291 | // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); | ||
292 | // } else { | ||
293 | // qDebug("State is not Idle"); | ||
294 | isConnected(); | ||
295 | // } | ||
242 | } | 296 | } |
243 | 297 | ||
244 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 298 | void StockTickerPluginWidget::isConnected() { |
245 | killTimer(e->timerId()); | 299 | // qDebug("We connect, so ok to grab stocks"); |
246 | doStocks(); | 300 | doStocks(); |
301 | |||
247 | Config cfg( "stockticker"); | 302 | Config cfg( "stockticker"); |
248 | cfg.setGroup("Timer"); | 303 | cfg.setGroup("Timer"); |
249 | timerDelay= cfg.readNumEntry("Delay",0); | 304 | timerDelay= cfg.readNumEntry("Delay",0); |
250 | if(timerDelay > 0) | 305 | if(timerDelay > 0) |
251 | startTimer(timerDelay*60000); | 306 | startTimer(timerDelay*60000); |
252 | qDebug("timer set for %d",(timerDelay*60000)/60000); | 307 | qDebug("timer set for %d",(timerDelay*60000)/60000); |
253 | 308 | wasError = false; | |
309 | |||
310 | // Sock->close(); | ||
311 | } | ||
312 | |||
313 | void StockTickerPluginWidget::socketError(int errcode) { | ||
314 | switch(errcode) { | ||
315 | case QSocket::ErrConnectionRefused: | ||
316 | output = tr("Connection refused."); | ||
317 | break; | ||
318 | case QSocket::ErrHostNotFound: | ||
319 | output = tr("Could not find server."); | ||
320 | break; | ||
321 | case QSocket::ErrSocketRead : | ||
322 | output = tr("Socket read error."); | ||
323 | break; | ||
324 | }; | ||
325 | stocktickerTicker->setText( output ); | ||
326 | wasError = true; | ||
327 | // Sock->close(); | ||
328 | |||
254 | } | 329 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 26472fa..c8de806 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h | |||
@@ -1,65 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.h | 2 | * stocktickerpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by L.J. Potter | 4 | * copyright : (c) 2002 by L.J. Potter |
5 | * email : lornkcor@handhelds.org | 5 | * email : lornkcor@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #ifndef STOCKTICKERL_PLUGIN_WIDGET_H | 18 | #ifndef STOCKTICKERL_PLUGIN_WIDGET_H |
19 | #define STOCKTICKERL_PLUGIN_WIDGET_H | 19 | #define STOCKTICKERL_PLUGIN_WIDGET_H |
20 | 20 | ||
21 | #include <qsocket.h> | ||
21 | #include <qstring.h> | 22 | #include <qstring.h> |
22 | #include <qwidget.h> | 23 | #include <qwidget.h> |
23 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
24 | 25 | ||
25 | #include <opie/tododb.h> | 26 | #include <opie/tododb.h> |
26 | #include <opie/oclickablelabel.h> | 27 | #include <opie/oclickablelabel.h> |
27 | #include <opie/oticker.h> | 28 | #include <opie/oticker.h> |
28 | 29 | ||
29 | #include <sys/types.h> | 30 | #include <sys/types.h> |
30 | #include <sys/uio.h> | 31 | #include <sys/uio.h> |
31 | #include <unistd.h> | 32 | #include <unistd.h> |
32 | #include <stdio.h> | 33 | #include <stdio.h> |
33 | #include <stdlib.h> | 34 | #include <stdlib.h> |
34 | #include <string.h> | 35 | #include <string.h> |
35 | 36 | ||
36 | //#include "ticker.h" | ||
37 | |||
38 | /* extern "C" { */ | ||
39 | /* #include "stocks.h" */ | ||
40 | /* } */ | ||
41 | |||
42 | class QTimer; | 37 | class QTimer; |
43 | 38 | ||
44 | class StockTickerPluginWidget : public QWidget { | 39 | class StockTickerPluginWidget : public QWidget { |
45 | 40 | ||
46 | Q_OBJECT | 41 | Q_OBJECT |
47 | 42 | ||
48 | public: | 43 | public: |
49 | StockTickerPluginWidget( QWidget *parent, const char *name ); | 44 | StockTickerPluginWidget( QWidget *parent, const char *name ); |
50 | ~StockTickerPluginWidget(); | 45 | ~StockTickerPluginWidget(); |
51 | QString output; | ||
52 | 46 | ||
53 | protected slots: | 47 | protected slots: |
54 | void doStocks(); | 48 | void doStocks(); |
55 | 49 | void isConnected(); | |
50 | void socketError(int); | ||
51 | void checkConnection(); | ||
56 | private: | 52 | private: |
57 | OTicker *stocktickerTicker; | 53 | bool wasError; |
54 | QSocket *Sock; | ||
58 | void timerEvent( QTimerEvent * ); | 55 | void timerEvent( QTimerEvent * ); |
59 | void init(); | 56 | void init(); |
60 | void getStocks( const char *stock_liste); | ||
61 | void DefProxy(void); | 57 | void DefProxy(void); |
62 | int timerDelay; | 58 | int timerDelay; |
63 | }; | 59 | }; |
64 | 60 | ||
65 | #endif | 61 | #endif |