4 files changed, 17 insertions, 7 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index 28ef072..5281373 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 ticker.h \ | 5 | HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.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 ticker.cpp \ | 10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.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 |
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/stocktickerplugin.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp index 24c151b..2eb1697 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp | |||
@@ -1,59 +1,60 @@ | |||
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 | #include "stocktickerconfig.h" | |
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 new StocktickerPluginConfig( wid , "Stockticker" ); |
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 | |
58 | return true; | 58 | return true; |
59 | } | 59 | } |
60 | |||
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index aabb4d2..e178338 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -9,163 +9,170 @@ | |||
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 | #include <qtimer.h> |
26 | 26 | ||
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
30 | 30 | ||
31 | #include "ticker.h" | 31 | #include "ticker.h" |
32 | 32 | ||
33 | extern "C" { | 33 | extern "C" { |
34 | #include "libstocks/stocks.h" | 34 | #include "libstocks/stocks.h" |
35 | } | 35 | } |
36 | 36 | ||
37 | #include "stocktickerpluginwidget.h" | 37 | #include "stocktickerpluginwidget.h" |
38 | 38 | ||
39 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 39 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
40 | : QWidget(parent, name ) { | 40 | : QWidget(parent, name ) { |
41 | init(); | 41 | init(); |
42 | startTimer(1000); | 42 | startTimer(1000); |
43 | } | 43 | } |
44 | 44 | ||
45 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 45 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
46 | } | 46 | } |
47 | 47 | ||
48 | void StockTickerPluginWidget::init() { | 48 | void StockTickerPluginWidget::init() { |
49 | 49 | ||
50 | QHBoxLayout* layout = new QHBoxLayout( this ); | 50 | QHBoxLayout* layout = new QHBoxLayout( this ); |
51 | 51 | ||
52 | stocktickerTicker = new Ticker(this); | 52 | stocktickerTicker = new Ticker(this); |
53 | stocktickerTicker->setMinimumHeight(15); | 53 | stocktickerTicker->setMinimumHeight(15); |
54 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); | 54 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); |
55 | 55 | ||
56 | layout->addWidget( stocktickerTicker); | 56 | layout->addWidget( stocktickerTicker); |
57 | |||
58 | Config cfg( "stockticker"); | ||
59 | cfg.setGroup("Timer"); | ||
60 | timerDelay= cfg.readNumEntry("Delay",0); | ||
61 | if(timerDelay > 0) | ||
62 | startTimer(timerDelay*60000); | ||
63 | |||
57 | } | 64 | } |
58 | 65 | ||
59 | void StockTickerPluginWidget::doStocks() { | 66 | void StockTickerPluginWidget::doStocks() { |
60 | 67 | ||
61 | Config cfg( "stockticker"); | 68 | Config cfg( "stockticker"); |
62 | cfg.setGroup( "Symbols" ); | 69 | cfg.setGroup( "Symbols" ); |
63 | QString symbollist; | 70 | QString symbollist; |
64 | symbollist = cfg.readEntry("Symbols", ""); | 71 | symbollist = cfg.readEntry("Symbols", ""); |
65 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 72 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
66 | // qDebug(symbollist); | 73 | // qDebug(symbollist); |
67 | 74 | ||
68 | getStocks( symbollist.latin1()); | 75 | getStocks( symbollist.latin1()); |
69 | 76 | ||
70 | stocktickerTicker->setText( output ); | 77 | stocktickerTicker->setText( output ); |
71 | } | 78 | } |
72 | 79 | ||
73 | void StockTickerPluginWidget::getStocks( const char *blah) { | 80 | void StockTickerPluginWidget::getStocks( const char *blah) { |
74 | 81 | ||
75 | stock *stocks_quotes=NULL; | 82 | stock *stocks_quotes=NULL; |
76 | stock *stocks_tmp; | 83 | stock *stocks_tmp; |
77 | 84 | ||
78 | QString tempString; | 85 | QString tempString; |
79 | output = ""; | 86 | output = ""; |
80 | 87 | ||
81 | libstocks_return_code error; | 88 | libstocks_return_code error; |
82 | 89 | ||
83 | Config cfg( "stockticker"); | 90 | Config cfg( "stockticker"); |
84 | cfg.setGroup( "Fields" ); | 91 | cfg.setGroup( "Fields" ); |
85 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 92 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
86 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 93 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
87 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 94 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
88 | 95 | ||
89 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 96 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
90 | 97 | ||
91 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 98 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
92 | dodateCheck=cfg.readBoolEntry("dateCheck",1); | 99 | dodateCheck=cfg.readBoolEntry("dateCheck",1); |
93 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 100 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
94 | donameCheck=cfg.readBoolEntry("nameCheck",1); | 101 | donameCheck=cfg.readBoolEntry("nameCheck",1); |
95 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); | 102 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); |
96 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); | 103 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); |
97 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); | 104 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); |
98 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); | 105 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); |
99 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); | 106 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); |
100 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); | 107 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); |
101 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); | 108 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); |
102 | 109 | ||
103 | DefProxy(); | 110 | DefProxy(); |
104 | char *stock_liste = (char *)blah; | 111 | char *stock_liste = (char *)blah; |
105 | /* Get the stocks and process errors */ | 112 | /* Get the stocks and process errors */ |
106 | error = get_stocks( stock_liste, &stocks_quotes); | 113 | error = get_stocks( stock_liste, &stocks_quotes); |
107 | 114 | ||
108 | if (error) { | 115 | if (error) { |
109 | printf("Error in getting stocks (%d)\n", error); | 116 | printf("Error in getting stocks (%d)\n", error); |
110 | tempString.sprintf("Error in getting stocks (%d)\n", error); | 117 | tempString.sprintf("Error in getting stocks (%d)\n", error); |
111 | output =tempString; | 118 | output =tempString; |
112 | return; | 119 | return; |
113 | // exit(1); | 120 | // exit(1); |
114 | } | 121 | } |
115 | 122 | ||
116 | stocks_tmp = stocks_quotes; | 123 | stocks_tmp = stocks_quotes; |
117 | 124 | ||
118 | /* Displays the stocks */ | 125 | /* Displays the stocks */ |
119 | while(stocks_tmp!=0){ | 126 | while(stocks_tmp!=0){ |
120 | 127 | ||
121 | if (stocks_tmp->Time) { | 128 | if (stocks_tmp->Time) { |
122 | // printf("%s ", stocks_tmp->Time); | 129 | // printf("%s ", stocks_tmp->Time); |
123 | tempString.sprintf("|| %s ", stocks_tmp->Time); | 130 | tempString.sprintf("| %s ", stocks_tmp->Time); |
124 | tempString.replace(QRegExp("\""),""); | 131 | tempString.replace(QRegExp("\""),""); |
125 | if( dotimeCheck) | 132 | if( dotimeCheck) |
126 | output +=tempString; | 133 | output +=tempString; |
127 | } | 134 | } |
128 | if (stocks_tmp->Date) { | 135 | if (stocks_tmp->Date) { |
129 | // printf("%s ", stocks_tmp->Date); | 136 | // printf("%s ", stocks_tmp->Date); |
130 | tempString.sprintf("| %s ", stocks_tmp->Date); | 137 | tempString.sprintf("| %s ", stocks_tmp->Date); |
131 | tempString.replace(QRegExp("\""),""); | 138 | tempString.replace(QRegExp("\""),""); |
132 | if(dodateCheck) | 139 | if(dodateCheck) |
133 | output +=tempString; | 140 | output +=tempString; |
134 | } | 141 | } |
135 | // printf("\n"); | 142 | // printf("\n"); |
136 | 143 | ||
137 | // printf("----------------------------------------\n"); | 144 | // printf("----------------------------------------\n"); |
138 | 145 | ||
139 | if ( strlen(stocks_tmp->Symbol) > 20 ) { | 146 | if ( strlen(stocks_tmp->Symbol) > 20 ) { |
140 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); | 147 | // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol); |
141 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 148 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
142 | if(dosymbolCheck) | 149 | if(dosymbolCheck) |
143 | output +=tempString; | 150 | output +=tempString; |
144 | } | 151 | } |
145 | else { | 152 | else { |
146 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); | 153 | // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol); |
147 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); | 154 | tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol); |
148 | if(dosymbolCheck) | 155 | if(dosymbolCheck) |
149 | output +=tempString; | 156 | output +=tempString; |
150 | } | 157 | } |
151 | 158 | ||
152 | if (stocks_tmp->Name) { | 159 | if (stocks_tmp->Name) { |
153 | if ( strlen(stocks_tmp->Name) > 20 ) { | 160 | if ( strlen(stocks_tmp->Name) > 20 ) { |
154 | // printf("| Name %.20s |\n",stocks_tmp->Name); | 161 | // printf("| Name %.20s |\n",stocks_tmp->Name); |
155 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 162 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
156 | tempString.stripWhiteSpace(); | 163 | tempString.stripWhiteSpace(); |
157 | if(donameCheck) | 164 | if(donameCheck) |
158 | output +=tempString; | 165 | output +=tempString; |
159 | } else { | 166 | } else { |
160 | // printf("| Name | %-20s |\n",stocks_tmp->Name); | 167 | // printf("| Name | %-20s |\n",stocks_tmp->Name); |
161 | tempString.sprintf("| Name %s ",stocks_tmp->Name); | 168 | tempString.sprintf("| Name %s ",stocks_tmp->Name); |
162 | tempString.stripWhiteSpace(); | 169 | tempString.stripWhiteSpace(); |
163 | if(donameCheck) | 170 | if(donameCheck) |
164 | output +=tempString; | 171 | output +=tempString; |
165 | } | 172 | } |
166 | } | 173 | } |
167 | else { | 174 | else { |
168 | // printf("| Name | |\n"); | 175 | // printf("| Name | |\n"); |
169 | tempString.sprintf("| Name | |"); | 176 | tempString.sprintf("| Name | |"); |
170 | if(donameCheck) | 177 | if(donameCheck) |
171 | output +=tempString; | 178 | output +=tempString; |
@@ -198,49 +205,51 @@ void StockTickerPluginWidget::getStocks( const char *blah) { | |||
198 | 205 | ||
199 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 206 | // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
200 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); | 207 | tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); |
201 | if(dovariationCheck) | 208 | if(dovariationCheck) |
202 | output +=tempString; | 209 | output +=tempString; |
203 | 210 | ||
204 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); | 211 | // printf("| Volume | %-9d |\n", stocks_tmp->Volume); |
205 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); | 212 | tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); |
206 | if(dovolumeCheck) | 213 | if(dovolumeCheck) |
207 | output +=tempString; | 214 | output +=tempString; |
208 | 215 | ||
209 | // printf("----------------------------------------\n\n"); | 216 | // printf("----------------------------------------\n\n"); |
210 | tempString.sprintf("||==++==|"); | 217 | tempString.sprintf("||==++==|"); |
211 | output +=tempString; | 218 | output +=tempString; |
212 | 219 | ||
213 | /* Simple function which help to browse in the stocks list */ | 220 | /* Simple function which help to browse in the stocks list */ |
214 | stocks_tmp = next_stock(stocks_tmp); | 221 | stocks_tmp = next_stock(stocks_tmp); |
215 | } | 222 | } |
216 | 223 | ||
217 | /* frees stocks */ | 224 | /* frees stocks */ |
218 | free_stocks(stocks_quotes); | 225 | free_stocks(stocks_quotes); |
219 | 226 | ||
220 | } | 227 | } |
221 | 228 | ||
222 | void StockTickerPluginWidget::DefProxy(void) { | 229 | void StockTickerPluginWidget::DefProxy(void) { |
223 | char *proxy; | 230 | char *proxy; |
224 | libstocks_return_code error; | 231 | libstocks_return_code error; |
225 | 232 | ||
226 | /* Proxy support */ | 233 | /* Proxy support */ |
227 | /* Checks for "http_proxy" environment variable */ | 234 | /* Checks for "http_proxy" environment variable */ |
228 | proxy = getenv("http_proxy"); | 235 | proxy = getenv("http_proxy"); |
229 | if(proxy) { | 236 | if(proxy) { |
230 | /* printf("proxy set\n"); */ | 237 | /* printf("proxy set\n"); */ |
231 | error = set_proxy(proxy); | 238 | error = set_proxy(proxy); |
232 | if (error) { | 239 | if (error) { |
233 | // printf("Proxy error (%d)\n", error); | 240 | // printf("Proxy error (%d)\n", error); |
234 | QString tempString; | 241 | QString tempString; |
235 | tempString.sprintf("Proxy error (%d)\n", error); | 242 | tempString.sprintf("Proxy error (%d)\n", error); |
236 | output = tempString; | 243 | output = tempString; |
237 | return; | 244 | return; |
238 | // exit(1); | 245 | // exit(1); |
239 | } | 246 | } |
240 | } | 247 | } |
241 | } | 248 | } |
242 | 249 | ||
243 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 250 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { |
244 | killTimer(e->timerId()); | 251 | killTimer(e->timerId()); |
245 | doStocks(); | 252 | doStocks(); |
253 | if(timerDelay > 0) | ||
254 | startTimer(timerDelay*1000); | ||
246 | } | 255 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 6a15f56..8f3441d 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h | |||
@@ -13,52 +13,52 @@ | |||
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; | 41 | class QTimer; |
42 | 42 | ||
43 | class StockTickerPluginWidget : public QWidget { | 43 | class StockTickerPluginWidget : public QWidget { |
44 | 44 | ||
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | 46 | ||
47 | public: | 47 | public: |
48 | StockTickerPluginWidget( QWidget *parent, const char *name ); | 48 | StockTickerPluginWidget( QWidget *parent, const char *name ); |
49 | ~StockTickerPluginWidget(); | 49 | ~StockTickerPluginWidget(); |
50 | QString output; | 50 | QString output; |
51 | 51 | ||
52 | protected slots: | 52 | protected slots: |
53 | void doStocks(); | 53 | void doStocks(); |
54 | 54 | ||
55 | private: | 55 | private: |
56 | Ticker *stocktickerTicker; | 56 | Ticker *stocktickerTicker; |
57 | void timerEvent( QTimerEvent * ); | 57 | void timerEvent( QTimerEvent * ); |
58 | void init(); | 58 | void init(); |
59 | void getStocks( const char *stock_liste); | 59 | void getStocks( const char *stock_liste); |
60 | void DefProxy(void); | 60 | void DefProxy(void); |
61 | 61 | int timerDelay; | |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #endif | 64 | #endif |