author | llornkcor <llornkcor> | 2002-11-01 16:11:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-01 16:11:54 (UTC) |
commit | f351da898f4dce9ad3fd8ee76d84912365dcb5ac (patch) (unidiff) | |
tree | cf131772846e5a3408a513f6432e83897b738328 | |
parent | 9e4d914ade0af86707531a80e93a870e52738ce6 (diff) | |
download | opie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.zip opie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.tar.gz opie-f351da898f4dce9ad3fd8ee76d84912365dcb5ac.tar.bz2 |
added timer delay
3 files changed, 11 insertions, 1 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp index baf8198..24c151b 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp | |||
@@ -1,58 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerplugin.cpp | 2 | * stocktickerplugin.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 | 17 | ||
18 | #include "stocktickerplugin.h" | 18 | #include "stocktickerplugin.h" |
19 | #include "stocktickerpluginwidget.h" | 19 | #include "stocktickerpluginwidget.h" |
20 | 20 | ||
21 | 21 | ||
22 | StockTickerPlugin::StockTickerPlugin() { | 22 | StockTickerPlugin::StockTickerPlugin() { |
23 | } | 23 | } |
24 | 24 | ||
25 | StockTickerPlugin::~StockTickerPlugin() { | 25 | StockTickerPlugin::~StockTickerPlugin() { |
26 | } | 26 | } |
27 | 27 | ||
28 | QString StockTickerPlugin::pluginName() const { | 28 | QString StockTickerPlugin::pluginName() const { |
29 | return QObject::tr( "StockTicker plugin" ); | 29 | return QObject::tr( "StockTicker plugin" ); |
30 | } | 30 | } |
31 | 31 | ||
32 | double StockTickerPlugin::versionNumber() const { | 32 | double StockTickerPlugin::versionNumber() const { |
33 | return 0.6; | 33 | return 0.6; |
34 | } | 34 | } |
35 | 35 | ||
36 | QString StockTickerPlugin::pixmapNameWidget() const { | 36 | QString StockTickerPlugin::pixmapNameWidget() const { |
37 | return "pass"; | 37 | return "pass"; |
38 | } | 38 | } |
39 | 39 | ||
40 | QWidget* StockTickerPlugin::widget( QWidget * wid ) { | 40 | QWidget* StockTickerPlugin::widget( QWidget * wid ) { |
41 | return new StockTickerPluginWidget( wid, "StockTicker " ); | 41 | return new StockTickerPluginWidget( wid, "StockTicker " ); |
42 | } | 42 | } |
43 | 43 | ||
44 | QString StockTickerPlugin::pixmapNameConfig() const { | 44 | QString StockTickerPlugin::pixmapNameConfig() const { |
45 | return 0l; | 45 | return 0l; |
46 | } | 46 | } |
47 | 47 | ||
48 | TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { | 48 | TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { |
49 | return 0l; | 49 | return 0l; |
50 | } | 50 | } |
51 | 51 | ||
52 | QString StockTickerPlugin::appName() const { | 52 | QString StockTickerPlugin::appName() const { |
53 | return "stockticker"; | 53 | return "stockticker"; |
54 | } | 54 | } |
55 | 55 | ||
56 | bool StockTickerPlugin::excludeFromRefresh() const { | 56 | bool StockTickerPlugin::excludeFromRefresh() const { |
57 | //return false; | ||
57 | return true; | 58 | return true; |
58 | } | 59 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index 3eaade4..6d53a91 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -1,239 +1,246 @@ | |||
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 <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | #include <qtl.h> | 18 | #include <qtl.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | #include <qobject.h> | 21 | #include <qobject.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | #include <qtimer.h> | ||
25 | 26 | ||
26 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
27 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
28 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
29 | 30 | ||
30 | #include "ticker.h" | 31 | #include "ticker.h" |
31 | 32 | ||
32 | extern "C" { | 33 | extern "C" { |
33 | #include "libstocks/stocks.h" | 34 | #include "libstocks/stocks.h" |
34 | } | 35 | } |
35 | 36 | ||
36 | #include "stocktickerpluginwidget.h" | 37 | #include "stocktickerpluginwidget.h" |
37 | 38 | ||
38 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 39 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
39 | : QWidget(parent, name ) { | 40 | : QWidget(parent, name ) { |
40 | init(); | 41 | init(); |
42 | startTimer(1000); | ||
41 | } | 43 | } |
42 | 44 | ||
43 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 45 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
44 | } | 46 | } |
45 | 47 | ||
46 | void StockTickerPluginWidget::init() { | 48 | void StockTickerPluginWidget::init() { |
47 | 49 | ||
48 | QHBoxLayout* layout = new QHBoxLayout( this ); | 50 | QHBoxLayout* layout = new QHBoxLayout( this ); |
49 | 51 | ||
50 | stocktickerTicker = new Ticker(this); | 52 | stocktickerTicker = new Ticker(this); |
51 | stocktickerTicker->setMinimumHeight(15); | 53 | stocktickerTicker->setMinimumHeight(15); |
52 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); | 54 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); |
53 | 55 | ||
54 | layout->addWidget( stocktickerTicker); | 56 | layout->addWidget( stocktickerTicker); |
55 | } | 57 | } |
56 | 58 | ||
57 | void StockTickerPluginWidget::doStocks() { | 59 | void StockTickerPluginWidget::doStocks() { |
58 | 60 | ||
59 | Config cfg( "stockticker"); | 61 | Config cfg( "stockticker"); |
60 | cfg.setGroup( "Symbols" ); | 62 | cfg.setGroup( "Symbols" ); |
61 | QString symbollist; | 63 | QString symbollist; |
62 | symbollist = cfg.readEntry("Symbols", ""); | 64 | symbollist = cfg.readEntry("Symbols", ""); |
63 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 65 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
64 | // qDebug(symbollist); | 66 | // qDebug(symbollist); |
65 | 67 | ||
66 | getStocks( symbollist.latin1()); | 68 | getStocks( symbollist.latin1()); |
67 | 69 | ||
68 | stocktickerTicker->setText( output ); | 70 | stocktickerTicker->setText( output ); |
69 | } | 71 | } |
70 | 72 | ||
71 | void StockTickerPluginWidget::getStocks( const char *blah) { | 73 | void StockTickerPluginWidget::getStocks( const char *blah) { |
72 | 74 | ||
73 | stock *stocks_quotes=NULL; | 75 | stock *stocks_quotes=NULL; |
74 | stock *stocks_tmp; | 76 | stock *stocks_tmp; |
75 | 77 | ||
76 | QString tempString; | 78 | QString tempString; |
77 | output = ""; | 79 | output = ""; |
78 | 80 | ||
79 | libstocks_return_code error; | 81 | libstocks_return_code error; |
80 | 82 | ||
81 | Config cfg( "stockticker"); | 83 | Config cfg( "stockticker"); |
82 | cfg.setGroup( "Fields" ); | 84 | cfg.setGroup( "Fields" ); |
83 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 85 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
84 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 86 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
85 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 87 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
86 | 88 | ||
87 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 89 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
88 | 90 | ||
89 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 91 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
90 | dodateCheck=cfg.readBoolEntry("dateCheck",1); | 92 | dodateCheck=cfg.readBoolEntry("dateCheck",1); |
91 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 93 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
92 | donameCheck=cfg.readBoolEntry("nameCheck",1); | 94 | donameCheck=cfg.readBoolEntry("nameCheck",1); |
93 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); | 95 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); |
94 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); | 96 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); |
95 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); | 97 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); |
96 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); | 98 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); |
97 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); | 99 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); |
98 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); | 100 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); |
99 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); | 101 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); |
100 | 102 | ||
101 | DefProxy(); | 103 | DefProxy(); |
102 | char *stock_liste = (char *)blah; | 104 | char *stock_liste = (char *)blah; |
103 | /* Get the stocks and process errors */ | 105 | /* Get the stocks and process errors */ |
104 | error = get_stocks( stock_liste, &stocks_quotes); | 106 | error = get_stocks( stock_liste, &stocks_quotes); |
105 | 107 | ||
106 | if (error) { | 108 | if (error) { |
107 | printf("Error in getting stocks (%d)\n", error); | 109 | printf("Error in getting stocks (%d)\n", error); |
108 | tempString.sprintf("Error in getting stocks (%d)\n", error); | 110 | tempString.sprintf("Error in getting stocks (%d)\n", error); |
109 | output =tempString; | 111 | output =tempString; |
110 | return; | 112 | return; |
111 | // exit(1); | 113 | // exit(1); |
112 | } | 114 | } |
113 | 115 | ||
114 | stocks_tmp = stocks_quotes; | 116 | stocks_tmp = stocks_quotes; |
115 | 117 | ||
116 | /* Displays the stocks */ | 118 | /* Displays the stocks */ |
117 | while(stocks_tmp!=0){ | 119 | while(stocks_tmp!=0){ |
118 | 120 | ||
119 | if (stocks_tmp->Time) { | 121 | if (stocks_tmp->Time) { |
120 | // printf("%s ", stocks_tmp->Time); | 122 | // printf("%s ", stocks_tmp->Time); |
121 | tempString.sprintf("|| %s ", stocks_tmp->Time); | 123 | tempString.sprintf("|| %s ", stocks_tmp->Time); |
122 | tempString.replace(QRegExp("\""),""); | 124 | tempString.replace(QRegExp("\""),""); |
123 | if( dotimeCheck) | 125 | if( dotimeCheck) |
124 | output +=tempString; | 126 | output +=tempString; |
125 | } | 127 | } |
126 | if (stocks_tmp->Date) { | 128 | if (stocks_tmp->Date) { |
127 | // printf("%s ", stocks_tmp->Date); | 129 | // printf("%s ", stocks_tmp->Date); |
128 | tempString.sprintf("| %s ", stocks_tmp->Date); | 130 | tempString.sprintf("| %s ", stocks_tmp->Date); |
129 | tempString.replace(QRegExp("\""),""); | 131 | tempString.replace(QRegExp("\""),""); |
130 | if(dodateCheck) | 132 | if(dodateCheck) |
131 | output +=tempString; | 133 | output +=tempString; |
132 | } | 134 | } |
133 | // printf("\n"); | 135 | // printf("\n"); |
134 | 136 | ||
135 | // printf("----------------------------------------\n"); | 137 | // printf("----------------------------------------\n"); |
136 | 138 | ||
137 | if ( strlen(stocks_tmp->Symbol) > 20 ) { | 139 | if ( strlen(stocks_tmp->Symbol) > 20 ) { |
138 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); | 140 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); |
139 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 141 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
140 | if(dosymbolCheck) | 142 | if(dosymbolCheck) |
141 | output +=tempString; | 143 | output +=tempString; |
142 | } | 144 | } |
143 | else { | 145 | else { |
144 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); | 146 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); |
145 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 147 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
146 | if(dosymbolCheck) | 148 | if(dosymbolCheck) |
147 | output +=tempString; | 149 | output +=tempString; |
148 | } | 150 | } |
149 | 151 | ||
150 | if (stocks_tmp->Name) { | 152 | if (stocks_tmp->Name) { |
151 | if ( strlen(stocks_tmp->Name) > 20 ) { | 153 | if ( strlen(stocks_tmp->Name) > 20 ) { |
152 | // printf("| Name %.20s |\n",stocks_tmp->Name); | 154 | // printf("| Name %.20s |\n",stocks_tmp->Name); |
153 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 155 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
154 | tempString.stripWhiteSpace(); | 156 | tempString.stripWhiteSpace(); |
155 | if(donameCheck) | 157 | if(donameCheck) |
156 | output +=tempString; | 158 | output +=tempString; |
157 | } else { | 159 | } else { |
158 | // printf("| Name | %-20s |\n",stocks_tmp->Name); | 160 | // printf("| Name | %-20s |\n",stocks_tmp->Name); |
159 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 161 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
160 | tempString.stripWhiteSpace(); | 162 | tempString.stripWhiteSpace(); |
161 | if(donameCheck) | 163 | if(donameCheck) |
162 | output +=tempString; | 164 | output +=tempString; |
163 | } | 165 | } |
164 | } | 166 | } |
165 | else { | 167 | else { |
166 | // printf("| Name | |\n"); | 168 | // printf("| Name | |\n"); |
167 | tempString.sprintf("| Name | |"); | 169 | tempString.sprintf("| Name | |"); |
168 | if(donameCheck) | 170 | if(donameCheck) |
169 | output +=tempString; | 171 | output +=tempString; |
170 | } | 172 | } |
171 | 173 | ||
172 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); | 174 | // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice); |
173 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); | 175 | tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice); |
174 | if(docurrentPriceCheck) | 176 | if(docurrentPriceCheck) |
175 | output +=tempString; | 177 | output +=tempString; |
176 | 178 | ||
177 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); | 179 | // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice); |
178 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); | 180 | tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice); |
179 | if(dolastPriceCheck) | 181 | if(dolastPriceCheck) |
180 | output +=tempString; | 182 | output +=tempString; |
181 | 183 | ||
182 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); | 184 | // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice); |
183 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); | 185 | tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice); |
184 | if(doopenPriceCheck) | 186 | if(doopenPriceCheck) |
185 | output +=tempString; | 187 | output +=tempString; |
186 | 188 | ||
187 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); | 189 | // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice); |
188 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); | 190 | tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice); |
189 | if(dominPriceCheck) | 191 | if(dominPriceCheck) |
190 | output +=tempString; | 192 | output +=tempString; |
191 | 193 | ||
192 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); | 194 | // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice); |
193 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); | 195 | tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice); |
194 | if(domaxPriceCheck) | 196 | if(domaxPriceCheck) |
195 | output +=tempString; | 197 | output +=tempString; |
196 | 198 | ||
197 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 199 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
198 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 200 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
199 | if(dovariationCheck) | 201 | if(dovariationCheck) |
200 | output +=tempString; | 202 | output +=tempString; |
201 | 203 | ||
202 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); | 204 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); |
203 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); | 205 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); |
204 | if(dovolumeCheck) | 206 | if(dovolumeCheck) |
205 | output +=tempString; | 207 | output +=tempString; |
206 | 208 | ||
207 | // printf("----------------------------------------\n\n"); | 209 | // printf("----------------------------------------\n\n"); |
208 | tempString.sprintf("||==++=="); | 210 | tempString.sprintf("||==++=="); |
209 | output +=tempString; | 211 | output +=tempString; |
210 | 212 | ||
211 | /* Simple function which help to browse in the stocks list */ | 213 | /* Simple function which help to browse in the stocks list */ |
212 | stocks_tmp = next_stock(stocks_tmp); | 214 | stocks_tmp = next_stock(stocks_tmp); |
213 | } | 215 | } |
214 | 216 | ||
215 | /* frees stocks */ | 217 | /* frees stocks */ |
216 | free_stocks(stocks_quotes); | 218 | free_stocks(stocks_quotes); |
217 | 219 | ||
218 | } | 220 | } |
219 | 221 | ||
220 | void StockTickerPluginWidget::DefProxy(void) { | 222 | void StockTickerPluginWidget::DefProxy(void) { |
221 | char *proxy; | 223 | char *proxy; |
222 | libstocks_return_code error; | 224 | libstocks_return_code error; |
223 | 225 | ||
224 | /* Proxy support */ | 226 | /* Proxy support */ |
225 | /* Checks for "http_proxy" environment variable */ | 227 | /* Checks for "http_proxy" environment variable */ |
226 | proxy = getenv("http_proxy"); | 228 | proxy = getenv("http_proxy"); |
227 | if(proxy) { | 229 | if(proxy) { |
228 | /* printf("proxy set\n"); */ | 230 | /* printf("proxy set\n"); */ |
229 | error = set_proxy(proxy); | 231 | error = set_proxy(proxy); |
230 | if (error) { | 232 | if (error) { |
231 | // printf("Proxy error (%d)\n", error); | 233 | // printf("Proxy error (%d)\n", error); |
232 | QString tempString; | 234 | QString tempString; |
233 | tempString.sprintf("Proxy error (%d)\n", error); | 235 | tempString.sprintf("Proxy error (%d)\n", error); |
234 | output = tempString; | 236 | output = tempString; |
235 | return; | 237 | return; |
236 | // exit(1); | 238 | // exit(1); |
237 | } | 239 | } |
238 | } | 240 | } |
239 | } | 241 | } |
242 | |||
243 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | ||
244 | killTimer(e->timerId()); | ||
245 | doStocks(); | ||
246 | } | ||
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 6524ae4..6a15f56 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h | |||
@@ -1,62 +1,64 @@ | |||
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 <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | 24 | ||
25 | #include <opie/tododb.h> | 25 | #include <opie/tododb.h> |
26 | #include <opie/oclickablelabel.h> | 26 | #include <opie/oclickablelabel.h> |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <sys/uio.h> | 29 | #include <sys/uio.h> |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #include <stdio.h> | 31 | #include <stdio.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <string.h> | 33 | #include <string.h> |
34 | 34 | ||
35 | #include "ticker.h" | 35 | #include "ticker.h" |
36 | 36 | ||
37 | /* extern "C" { */ | 37 | /* extern "C" { */ |
38 | /* #include "stocks.h" */ | 38 | /* #include "stocks.h" */ |
39 | /* } */ | 39 | /* } */ |
40 | 40 | ||
41 | class QTimer; | ||
42 | |||
41 | class StockTickerPluginWidget : public QWidget { | 43 | class StockTickerPluginWidget : public QWidget { |
42 | 44 | ||
43 | Q_OBJECT | 45 | Q_OBJECT |
44 | 46 | ||
45 | public: | 47 | public: |
46 | StockTickerPluginWidget( QWidget *parent, const char *name ); | 48 | StockTickerPluginWidget( QWidget *parent, const char *name ); |
47 | ~StockTickerPluginWidget(); | 49 | ~StockTickerPluginWidget(); |
48 | QString output; | 50 | QString output; |
49 | 51 | ||
50 | protected slots: | 52 | protected slots: |
51 | void doStocks(); | 53 | void doStocks(); |
52 | 54 | ||
53 | private: | 55 | private: |
54 | Ticker *stocktickerTicker; | 56 | Ticker *stocktickerTicker; |
55 | 57 | void timerEvent( QTimerEvent * ); | |
56 | void init(); | 58 | void init(); |
57 | void getStocks( const char *stock_liste); | 59 | void getStocks( const char *stock_liste); |
58 | void DefProxy(void); | 60 | void DefProxy(void); |
59 | 61 | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | #endif | 64 | #endif |