summaryrefslogtreecommitdiff
path: root/noncore/todayplugins
authorllornkcor <llornkcor>2002-11-01 17:07:12 (UTC)
committer llornkcor <llornkcor>2002-11-01 17:07:12 (UTC)
commit800932401b86a43cd52f9cbc2833b2795d1c955b (patch) (unidiff)
treefbf319da8ba850d8987b4e73707a1df3f3e682ce /noncore/todayplugins
parent9e5589036e37a54a70243617f38741b6c709aff1 (diff)
downloadopie-800932401b86a43cd52f9cbc2833b2795d1c955b.zip
opie-800932401b86a43cd52f9cbc2833b2795d1c955b.tar.gz
opie-800932401b86a43cd52f9cbc2833b2795d1c955b.tar.bz2
add lookup timer delay spin
Diffstat (limited to 'noncore/todayplugins') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro4
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerplugin.cpp7
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp11
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h2
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 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt debug 3CONFIG += qt debug
4 4
5HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.h \ 5HEADERS = 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
10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.cpp \ 10SOURCES = 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
18INCLUDEPATH += $(OPIEDIR)/include \ 18INCLUDEPATH += $(OPIEDIR)/include \
19 ../ ../library 19 ../ ../library
20DEPENDPATH += $(OPIEDIR)/include \ 20DEPENDPATH += $(OPIEDIR)/include \
21 ../ ../library 21 ../ ../library
22 22
23LIBS+= -lqpe -lopie 23LIBS+= -lqpe -lopie
24TMAKE_CFLAGS += -D__UNIX__ 24TMAKE_CFLAGS += -D__UNIX__
25 25
26DESTDIR = $(OPIEDIR)/plugins/today 26DESTDIR = $(OPIEDIR)/plugins/today
27TARGET = todaystocktickerplugin 27TARGET = 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
22StockTickerPlugin::StockTickerPlugin() { 22StockTickerPlugin::StockTickerPlugin() {
23} 23}
24 24
25StockTickerPlugin::~StockTickerPlugin() { 25StockTickerPlugin::~StockTickerPlugin() {
26} 26}
27 27
28QString StockTickerPlugin::pluginName() const { 28QString StockTickerPlugin::pluginName() const {
29 return QObject::tr( "StockTicker plugin" ); 29 return QObject::tr( "StockTicker plugin" );
30} 30}
31 31
32double StockTickerPlugin::versionNumber() const { 32double StockTickerPlugin::versionNumber() const {
33 return 0.6; 33 return 0.6;
34} 34}
35 35
36QString StockTickerPlugin::pixmapNameWidget() const { 36QString StockTickerPlugin::pixmapNameWidget() const {
37 return "pass"; 37 return "pass";
38} 38}
39 39
40QWidget* StockTickerPlugin::widget( QWidget * wid ) { 40QWidget* StockTickerPlugin::widget( QWidget * wid ) {
41 return new StockTickerPluginWidget( wid, "StockTicker " ); 41 return new StockTickerPluginWidget( wid, "StockTicker " );
42} 42}
43 43
44QString StockTickerPlugin::pixmapNameConfig() const { 44QString StockTickerPlugin::pixmapNameConfig() const {
45 return 0l; 45 return 0l;
46} 46}
47 47
48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) { 48TodayConfigWidget* StockTickerPlugin::configWidget( QWidget* wid ) {
49 return 0l; 49 return new StocktickerPluginConfig( wid , "Stockticker" );
50} 50}
51 51
52QString StockTickerPlugin::appName() const { 52QString StockTickerPlugin::appName() const {
53 return "stockticker"; 53 return "stockticker";
54} 54}
55 55
56bool StockTickerPlugin::excludeFromRefresh() const { 56bool StockTickerPlugin::excludeFromRefresh() const {
57//return false; 57
58return true; 58return 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
@@ -33,48 +33,55 @@
33extern "C" { 33extern "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
39StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) 39StockTickerPluginWidget::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
45StockTickerPluginWidget::~StockTickerPluginWidget() { 45StockTickerPluginWidget::~StockTickerPluginWidget() {
46} 46}
47 47
48void StockTickerPluginWidget::init() { 48void 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
59void StockTickerPluginWidget::doStocks() { 66void 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
73void StockTickerPluginWidget::getStocks( const char *blah) { 80void 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
@@ -99,49 +106,49 @@ void StockTickerPluginWidget::getStocks( const char *blah) {
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);
@@ -222,25 +229,27 @@ void StockTickerPluginWidget::getStocks( const char *blah) {
222void StockTickerPluginWidget::DefProxy(void) { 229void 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
243void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { 250void 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
@@ -37,28 +37,28 @@
37/* extern "C" { */ 37/* extern "C" { */
38/* #include "stocks.h" */ 38/* #include "stocks.h" */
39/* } */ 39/* } */
40 40
41class QTimer; 41class QTimer;
42 42
43class StockTickerPluginWidget : public QWidget { 43class StockTickerPluginWidget : public QWidget {
44 44
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
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
52protected slots: 52protected slots:
53 void doStocks(); 53 void doStocks();
54 54
55private: 55private:
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