Diffstat (limited to 'noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index a7f98be..8830472 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -1,116 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.cpp | 2 | * stocktickerpluginwidget.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 | #include <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | #include <qtl.h> | 18 | #include <qtl.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | #include <qobject.h> | 21 | #include <qobject.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | #include <qtimer.h> | 25 | #include <qtimer.h> |
26 | 26 | ||
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
30 | 30 | ||
31 | #include "ticker.h" | 31 | #include <opie/oticker.h> |
32 | //#include "ticker.h" | ||
32 | 33 | ||
33 | extern "C" { | 34 | extern "C" { |
34 | #include "libstocks/stocks.h" | 35 | #include "libstocks/stocks.h" |
35 | } | 36 | } |
36 | 37 | ||
37 | #include "stocktickerpluginwidget.h" | 38 | #include "stocktickerpluginwidget.h" |
38 | 39 | ||
39 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 40 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
40 | : QWidget(parent, name ) { | 41 | : QWidget(parent, name ) { |
41 | init(); | 42 | init(); |
42 | startTimer(1000); | 43 | startTimer(1000); |
43 | } | 44 | } |
44 | 45 | ||
45 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 46 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
46 | } | 47 | } |
47 | 48 | ||
48 | void StockTickerPluginWidget::init() { | 49 | void StockTickerPluginWidget::init() { |
49 | 50 | ||
50 | QHBoxLayout* layout = new QHBoxLayout( this ); | 51 | QHBoxLayout* layout = new QHBoxLayout( this ); |
51 | 52 | ||
52 | stocktickerTicker = new Ticker(this); | 53 | stocktickerTicker = new OTicker(this); |
53 | stocktickerTicker->setMinimumHeight(15); | 54 | stocktickerTicker->setMinimumHeight(15); |
54 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); | 55 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); |
55 | 56 | ||
56 | layout->addWidget( stocktickerTicker); | 57 | 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); | ||
63 | 58 | ||
64 | } | 59 | } |
65 | 60 | ||
66 | void StockTickerPluginWidget::doStocks() { | 61 | void StockTickerPluginWidget::doStocks() { |
67 | Config cfg( "stockticker"); | 62 | Config cfg( "stockticker"); |
68 | |||
69 | cfg.setGroup( "Symbols" ); | 63 | cfg.setGroup( "Symbols" ); |
70 | QString symbollist; | 64 | QString symbollist; |
71 | symbollist = cfg.readEntry("Symbols", ""); | 65 | symbollist = cfg.readEntry("Symbols", ""); |
72 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 66 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
73 | // qDebug(symbollist); | 67 | // qDebug(symbollist); |
74 | 68 | ||
75 | getStocks( symbollist.latin1()); | 69 | getStocks( symbollist.latin1()); |
76 | 70 | ||
77 | stocktickerTicker->setText( output ); | 71 | stocktickerTicker->setText( output ); |
78 | } | 72 | } |
79 | 73 | ||
80 | void StockTickerPluginWidget::getStocks( const char *blah) { | 74 | void StockTickerPluginWidget::getStocks( const char *blah) { |
81 | 75 | ||
82 | stock *stocks_quotes=NULL; | 76 | stock *stocks_quotes=NULL; |
83 | stock *stocks_tmp; | 77 | stock *stocks_tmp; |
84 | 78 | ||
85 | QString tempString; | 79 | QString tempString; |
86 | output = ""; | 80 | output = ""; |
87 | 81 | ||
88 | libstocks_return_code error; | 82 | libstocks_return_code error; |
89 | 83 | ||
90 | Config cfg( "stockticker"); | 84 | Config cfg( "stockticker"); |
91 | cfg.setGroup( "Fields" ); | 85 | cfg.setGroup( "Fields" ); |
92 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 86 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
93 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 87 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
94 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 88 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
95 | 89 | ||
96 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 90 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
97 | 91 | ||
98 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 92 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
99 | dodateCheck=cfg.readBoolEntry("dateCheck",1); | 93 | dodateCheck=cfg.readBoolEntry("dateCheck",1); |
100 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 94 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
101 | donameCheck=cfg.readBoolEntry("nameCheck",1); | 95 | donameCheck=cfg.readBoolEntry("nameCheck",1); |
102 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); | 96 | docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); |
103 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); | 97 | dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); |
104 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); | 98 | doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); |
105 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); | 99 | dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); |
106 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); | 100 | domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); |
107 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); | 101 | dovariationCheck=cfg.readBoolEntry("variationCheck",1); |
108 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); | 102 | dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); |
109 | 103 | ||
110 | DefProxy(); | 104 | DefProxy(); |
111 | char *stock_liste = (char *)blah; | 105 | char *stock_liste = (char *)blah; |
112 | /* Get the stocks and process errors */ | 106 | /* Get the stocks and process errors */ |
113 | error = get_stocks( stock_liste, &stocks_quotes); | 107 | error = get_stocks( stock_liste, &stocks_quotes); |
114 | 108 | ||
115 | if (error) { | 109 | if (error) { |
116 | printf("Error in getting stocks (%d)\n", error); | 110 | printf("Error in getting stocks (%d)\n", error); |