-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index 5ddf03c..a740b58 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -39,24 +39,25 @@ extern "C" { | |||
39 | 39 | ||
40 | #include <pthread.h> | 40 | #include <pthread.h> |
41 | 41 | ||
42 | #include "stocktickerpluginwidget.h" | 42 | #include "stocktickerpluginwidget.h" |
43 | 43 | ||
44 | QString output; | 44 | QString output; |
45 | OTicker *stocktickerTicker; | 45 | OTicker *stocktickerTicker; |
46 | 46 | ||
47 | void getStocks( const char *blah) { | 47 | void getStocks(char *blah) { |
48 | 48 | ||
49 | // stocktickerTicker->setText( "Downloading stock data."); | 49 | // stocktickerTicker->setText( "Downloading stock data."); |
50 | stock *stocks_quotes=NULL; | 50 | stock *stocks_quotes=NULL; |
51 | stock *stocks_tmp; | 51 | stock *stocks_tmp; |
52 | char *stock_liste = blah; | 52 | QCString stock_liste = blah; |
53 | ::free ( blah ); | ||
53 | // char *stock_liste = (char *)blah->latin1(); | 54 | // char *stock_liste = (char *)blah->latin1(); |
54 | qDebug("%s", stock_liste ); | 55 | qDebug("%s", stock_liste.data() ); |
55 | QString tempString; | 56 | QString tempString; |
56 | output = ""; | 57 | output = ""; |
57 | 58 | ||
58 | libstocks_return_code error; | 59 | libstocks_return_code error; |
59 | 60 | ||
60 | Config cfg( "stockticker"); | 61 | Config cfg( "stockticker"); |
61 | cfg.setGroup( "Fields" ); | 62 | cfg.setGroup( "Fields" ); |
62 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 63 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
@@ -95,17 +96,17 @@ void getStocks( const char *blah) { | |||
95 | output = tempString; | 96 | output = tempString; |
96 | return; | 97 | return; |
97 | // exit(1); | 98 | // exit(1); |
98 | } | 99 | } |
99 | } | 100 | } |
100 | } | 101 | } |
101 | // char *stock_liste = (char *)blah; | 102 | // char *stock_liste = (char *)blah; |
102 | /* Get the stocks and process errors */ | 103 | /* Get the stocks and process errors */ |
103 | error = get_stocks( stock_liste, &stocks_quotes); | 104 | error = get_stocks( stock_liste.data(), &stocks_quotes); |
104 | 105 | ||
105 | if (error) { | 106 | if (error) { |
106 | printf("Error in getting stocks (%d)\n", error); | 107 | printf("Error in getting stocks (%d)\n", error); |
107 | tempString.sprintf("Error in getting stocks (%d)\n", error); | 108 | tempString.sprintf("Error in getting stocks (%d)\n", error); |
108 | output =tempString; | 109 | output =tempString; |
109 | return; | 110 | return; |
110 | // exit(1); | 111 | // exit(1); |
111 | } | 112 | } |
@@ -247,18 +248,18 @@ void StockTickerPluginWidget::doStocks() { | |||
247 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 248 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
248 | 249 | ||
249 | cfg.setGroup("Timer"); | 250 | cfg.setGroup("Timer"); |
250 | stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); | 251 | stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); |
251 | stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); | 252 | stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); |
252 | 253 | ||
253 | if (!symbollist.isEmpty()) { | 254 | if (!symbollist.isEmpty()) { |
254 | pthread_t thread1; | 255 | pthread_t thread1; |
255 | char *blah = symbollist.latin1(); | 256 | char *blah = ::strdup(symbollist.latin1()); |
256 | pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, blah); | 257 | pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, (void *) blah); |
257 | } | 258 | } |
258 | } | 259 | } |
259 | 260 | ||
260 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 261 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { |
261 | killTimer(e->timerId()); | 262 | killTimer(e->timerId()); |
262 | checkConnection(); | 263 | checkConnection(); |
263 | } | 264 | } |
264 | 265 | ||