Diffstat (limited to 'noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
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 | |||
@@ -45,24 +45,31 @@ StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* | |||
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()); |
@@ -111,25 +118,25 @@ void StockTickerPluginWidget::getStocks( const char *blah) { | |||
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"); |
@@ -234,13 +241,15 @@ void StockTickerPluginWidget::DefProxy(void) { | |||
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 | } |