-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index cc1bbbb..a7f98be 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -41,44 +41,44 @@ StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* | |||
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 | // Config cfg( "stockticker"); | ||
58 | // cfg.setGroup("Timer"); | ||
59 | // timerDelay= cfg.readNumEntry("Delay",0); | ||
60 | // if(timerDelay > 0 ) | ||
61 | // startTimer(timerDelay*60000); | ||
62 | // qDebug("timer ^ set for %d",(timerDelay*60000)/60000); | ||
57 | 63 | ||
58 | Config cfg( "stockticker"); | ||
59 | cfg.setGroup("Timer"); | ||
60 | timerDelay= cfg.readNumEntry("Delay",0); | ||
61 | if(timerDelay > 0) | ||
62 | startTimer(timerDelay*60000); | ||
63 | |||
64 | } | 64 | } |
65 | 65 | ||
66 | void StockTickerPluginWidget::doStocks() { | 66 | void StockTickerPluginWidget::doStocks() { |
67 | |||
68 | Config cfg( "stockticker"); | 67 | Config cfg( "stockticker"); |
68 | |||
69 | cfg.setGroup( "Symbols" ); | 69 | cfg.setGroup( "Symbols" ); |
70 | QString symbollist; | 70 | QString symbollist; |
71 | symbollist = cfg.readEntry("Symbols", ""); | 71 | symbollist = cfg.readEntry("Symbols", ""); |
72 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 72 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
73 | // qDebug(symbollist); | 73 | // qDebug(symbollist); |
74 | 74 | ||
75 | getStocks( symbollist.latin1()); | 75 | getStocks( symbollist.latin1()); |
76 | 76 | ||
77 | stocktickerTicker->setText( output ); | 77 | stocktickerTicker->setText( output ); |
78 | } | 78 | } |
79 | 79 | ||
80 | void StockTickerPluginWidget::getStocks( const char *blah) { | 80 | void StockTickerPluginWidget::getStocks( const char *blah) { |
81 | 81 | ||
82 | stock *stocks_quotes=NULL; | 82 | stock *stocks_quotes=NULL; |
83 | stock *stocks_tmp; | 83 | stock *stocks_tmp; |
84 | 84 | ||
@@ -235,22 +235,26 @@ void StockTickerPluginWidget::DefProxy(void) { | |||
235 | proxy = getenv("http_proxy"); | 235 | proxy = getenv("http_proxy"); |
236 | if(proxy) { | 236 | if(proxy) { |
237 | /* printf("proxy set\n"); */ | 237 | /* printf("proxy set\n"); */ |
238 | error = set_proxy(proxy); | 238 | error = set_proxy(proxy); |
239 | if (error) { | 239 | if (error) { |
240 | // printf("Proxy error (%d)\n", error); | 240 | // printf("Proxy error (%d)\n", error); |
241 | QString tempString; | 241 | QString tempString; |
242 | tempString.sprintf("Proxy error (%d)\n", error); | 242 | tempString.sprintf("Proxy error (%d)\n", error); |
243 | output = tempString; | 243 | output = tempString; |
244 | return; | 244 | return; |
245 | // exit(1); | 245 | // exit(1); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 250 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { |
251 | qDebug("timer"); | ||
252 | killTimer(e->timerId()); | 251 | killTimer(e->timerId()); |
253 | doStocks(); | 252 | doStocks(); |
253 | Config cfg( "stockticker"); | ||
254 | cfg.setGroup("Timer"); | ||
255 | timerDelay= cfg.readNumEntry("Delay",0); | ||
254 | if(timerDelay > 0) | 256 | if(timerDelay > 0) |
255 | startTimer(timerDelay*60000); | 257 | startTimer(timerDelay*60000); |
258 | qDebug("timer set for %d",(timerDelay*60000)/60000); | ||
259 | |||
256 | } | 260 | } |