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,22 +1,22 @@ | |||
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 | ||
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 | |||
@@ -8,25 +8,25 @@ | |||
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 { |
@@ -37,23 +37,24 @@ 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 | |||
@@ -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 | } |
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 | |||
@@ -49,16 +49,16 @@ public: | |||
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 |