summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-05 13:28:39 (UTC)
committer llornkcor <llornkcor>2002-11-05 13:28:39 (UTC)
commit0750e839e1d10069dbde7e669a345800f0ec088f (patch) (unidiff)
treeee5a3f70ffc192a7c530ae0f3c5731e31e236128
parenta7741f90c43f13371cd02bb4dd7e0c05208c04d5 (diff)
downloadopie-0750e839e1d10069dbde7e669a345800f0ec088f.zip
opie-0750e839e1d10069dbde7e669a345800f0ec088f.tar.gz
opie-0750e839e1d10069dbde7e669a345800f0ec088f.tar.bz2
changed layout and uncommented whatsthis
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp65
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp1
3 files changed, 34 insertions, 34 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
index 1334e7d..11b615b 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
@@ -1,182 +1,181 @@
1/* 1/*
2 * stocktickeRconfig.cpp 2 * stocktickeRconfig.cpp
3 * 3 *
4 * copyright : (c) 2002 by ljp 4 * copyright : (c) 2002 by ljp
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 "stocktickerconfig.h" 17#include "stocktickerconfig.h"
18#include <opie/todayconfigwidget.h> 18#include <opie/todayconfigwidget.h>
19 19
20#include <qpe/config.h> 20#include <qpe/config.h>
21 21
22#include <qapplication.h> 22#include <qapplication.h>
23 23
24#include <qspinbox.h> 24#include <qspinbox.h>
25#include <qcheckbox.h> 25#include <qcheckbox.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvariant.h> 29#include <qvariant.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <qmainwindow.h> 35#include <qmainwindow.h>
36 36
37#include <stdlib.h> 37#include <stdlib.h>
38 38
39StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name) 39StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name)
40 : TodayConfigWidget(parent, name ) { 40 : TodayConfigWidget(parent, name ) {
41 41
42 QGridLayout *layout = new QGridLayout( this ); 42 QGridLayout *layout = new QGridLayout( this );
43 layout->setSpacing(6); 43 layout->setSpacing(2);
44 layout->setMargin( 2); 44 layout->setMargin( 2);
45 45
46 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 46 LineEdit1 = new QLineEdit( this, "LineEdit1" );
47 LineEdit1->setFocus(); 47 LineEdit1->setFocus();
48// QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); 48// QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here."));
49 49
50 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); 50 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 4);
51 51
52 Config cfg( "stockticker"); 52 Config cfg( "stockticker");
53 cfg.setGroup( "Symbols" ); 53 cfg.setGroup( "Symbols" );
54 QString symbollist; 54 QString symbollist;
55 symbollist = cfg.readEntry("Symbols", ""); 55 symbollist = cfg.readEntry("Symbols", "");
56 LineEdit1->setText(symbollist); 56 LineEdit1->setText(symbollist);
57 57
58 QLabel *label; 58 QLabel *label;
59 label = new QLabel(this); 59 label = new QLabel(this);
60 label->setText( tr("Enter stock symbols seperated\nby a space.")); 60 label->setText( tr("Enter stock symbols seperated\nby a space."));
61 label->setMaximumHeight(60); 61 label->setMaximumHeight(60);
62 layout->addMultiCellWidget( label, 1, 1, 0, 3); 62 layout->addMultiCellWidget( label, 1, 1, 0, 4);
63 63
64 cfg.setGroup( "Fields" ); 64 cfg.setGroup( "Fields" );
65 65
66 timeCheck= new QCheckBox ( "Time",this ); 66 timeCheck= new QCheckBox ( "Time",this );
67 timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); 67 timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1));
68 layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); 68 layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 );
69// QWhatsThis::add( timeCheck, tr("Toggles Time Field")); 69 QWhatsThis::add( timeCheck, tr("Toggles Time of current price field"));
70 70
71 dateCheck= new QCheckBox ( "Date", this ); 71 dateCheck= new QCheckBox ( "Date", this );
72 dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); 72 dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1));
73 layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); 73 layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 );
74// QWhatsThis::add(dateCheck, tr("Toggles date field")); 74 QWhatsThis::add(dateCheck, tr("Toggles date field"));
75 75
76 symbolCheck= new QCheckBox ( "Symbol", this ); 76 symbolCheck= new QCheckBox ( "Symbol", this );
77 symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); 77 symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1));
78 layout->addMultiCellWidget( symbolCheck, 3, 3, 0, 0 ); 78 layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 );
79// QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); 79 QWhatsThis::add(symbolCheck, tr("Toggles Symbol field"));
80 80
81 nameCheck= new QCheckBox ( "Name", this ); 81 nameCheck= new QCheckBox ( "Name", this );
82 nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); 82 nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1));
83 layout->addMultiCellWidget( nameCheck, 3, 3, 1, 1 ); 83 layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 );
84// QWhatsThis::add(nameCheck, tr("Toggles Name field")); 84 QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field"));
85 85
86 currentPriceCheck= new QCheckBox ( "Current Price", this ); 86 currentPriceCheck= new QCheckBox ( "Price", this );
87 currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); 87 currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1));
88 layout->addMultiCellWidget( currentPriceCheck, 4, 4, 0, 0 ); 88 layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 );
89// QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); 89 QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field"));
90
91 90
92 lastPriceCheck= new QCheckBox ( "Last Price", this ); 91 lastPriceCheck= new QCheckBox ( "Last Price", this );
93 lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); 92 lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1));
94 layout->addMultiCellWidget(lastPriceCheck, 4, 4, 1, 1); 93 layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2);
95// QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); 94 QWhatsThis::add(lastPriceCheck, tr("Toggles last price field"));
96 95
97 openPriceCheck= new QCheckBox ( "Open Price", this); 96 openPriceCheck= new QCheckBox ( "Open Price", this);
98 openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); 97 openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1));
99 layout->addMultiCellWidget( openPriceCheck, 5, 5, 0, 0 ); 98 layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 );
100// QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); 99 QWhatsThis::add(openPriceCheck, tr("Toggles opening price field"));
101 100
102 minPriceCheck= new QCheckBox ( "Min Price", this ); 101 minPriceCheck= new QCheckBox ( "Min Price", this );
103 minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); 102 minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1));
104 layout->addMultiCellWidget( minPriceCheck, 5, 5, 1, 1); 103 layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1);
105// QWhatsThis::add(minPriceCheck, tr("Toggles minamum price field")); 104 QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field"));
106 105
107 maxPriceCheck= new QCheckBox ( "Max Price", this); 106 maxPriceCheck= new QCheckBox ( "Max Price", this);
108 maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); 107 maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1));
109 layout->addMultiCellWidget( maxPriceCheck, 6, 6, 0, 0 ); 108 layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 );
110// QWhatsThis::add(maxPriceCheck, tr("Toggles maximum price field")); 109 QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field"));
111 110
112 variationCheck= new QCheckBox ( "Variation", this ); 111 variationCheck= new QCheckBox ( "Variation", this );
113 variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); 112 variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1));
114 layout->addMultiCellWidget( variationCheck, 6, 6, 1, 1 ); 113 layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 );
115// QWhatsThis::add(variationCheck, tr("Toggles daily variation field")); 114 QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field"));
116 115
117 volumeCheck= new QCheckBox ( "Volume", this ); 116 volumeCheck= new QCheckBox ( "Volume", this );
118 volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); 117 volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1));
119 layout->addMultiCellWidget( volumeCheck , 7, 7, 0, 0); 118 layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1);
120// QWhatsThis::add(volumeCheck, tr("Toggles volume field")); 119 QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field"));
121 120
122 timerDelaySpin = new QSpinBox( this, "timer spin" ); 121 timerDelaySpin = new QSpinBox( this, "timer spin" );
123 QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) ); 122 QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) );
124 timerDelaySpin->setMaxValue( 60); 123 timerDelaySpin->setMaxValue( 60);
125 124
126 cfg.setGroup("Timer"); 125 cfg.setGroup("Timer");
127 timerDelaySpin->setValue( cfg.readNumEntry("Delay",0)); 126 timerDelaySpin->setValue( cfg.readNumEntry("Delay",0));
128 layout->addMultiCellWidget( timerDelaySpin , 8, 8, 0, 0); 127 layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0);
129 128
130 QLabel *label2; 129 QLabel *label2;
131 label2 = new QLabel(this); 130 label2 = new QLabel(this);
132 label2->setText( tr("Minutes between stock\nprice lookups.")); 131 label2->setText( tr("Minutes between lookups."));
133 label2->setMaximumHeight(60); 132 label2->setMaximumHeight(60);
134 layout->addMultiCellWidget( label2, 8, 8, 1, 1); 133 layout->addMultiCellWidget( label2, 6, 6, 1, 2);
135 134
136// lookupButton = new QPushButton(this, "LookupButton"); 135// lookupButton = new QPushButton(this, "LookupButton");
137// lookupButton->setText(tr("Symbol Lookup")); 136// lookupButton->setText(tr("Symbol Lookup"));
138// connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); 137// connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup()));
139// layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); 138// layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0);
140 139
141 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); 140 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
142 layout->addItem( spacer, 10, 0 ); 141 layout->addItem( spacer, 8, 0 );
143 142
144} 143}
145 144
146 145
147void StocktickerPluginConfig::writeConfig() { 146void StocktickerPluginConfig::writeConfig() {
148 Config cfg( "stockticker"); 147 Config cfg( "stockticker");
149 cfg.setGroup( "Symbols" ); 148 cfg.setGroup( "Symbols" );
150 QString outText = text().upper(); 149 QString outText = text().upper();
151 outText.stripWhiteSpace(); 150 outText.stripWhiteSpace();
152 cfg.writeEntry("Symbols", outText ); 151 cfg.writeEntry("Symbols", outText );
153 cfg.setGroup( "Fields" ); 152 cfg.setGroup( "Fields" );
154 cfg.writeEntry("timeCheck",timeCheck->isChecked()); 153 cfg.writeEntry("timeCheck",timeCheck->isChecked());
155 cfg.writeEntry("dateCheck",dateCheck->isChecked()); 154 cfg.writeEntry("dateCheck",dateCheck->isChecked());
156 cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); 155 cfg.writeEntry("symbolCheck",symbolCheck->isChecked());
157 cfg.writeEntry("nameCheck",nameCheck->isChecked()); 156 cfg.writeEntry("nameCheck",nameCheck->isChecked());
158 cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); 157 cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked());
159 cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); 158 cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked());
160 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); 159 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked());
161 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); 160 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked());
162 cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); 161 cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked());
163 cfg.writeEntry("variationCheck",variationCheck->isChecked()); 162 cfg.writeEntry("variationCheck",variationCheck->isChecked());
164 cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); 163 cfg.writeEntry("volumeCheck",volumeCheck->isChecked());
165 164
166 cfg.setGroup("Timer"); 165 cfg.setGroup("Timer");
167 cfg.writeEntry("Delay",timerDelaySpin->value()); 166 cfg.writeEntry("Delay",timerDelaySpin->value());
168 167
169 cfg.write(); 168 cfg.write();
170} 169}
171 170
172StocktickerPluginConfig::~StocktickerPluginConfig() { 171StocktickerPluginConfig::~StocktickerPluginConfig() {
173} 172}
174 173
175QString StocktickerPluginConfig::text() const { 174QString StocktickerPluginConfig::text() const {
176 return LineEdit1->text(); 175 return LineEdit1->text();
177} 176}
178 177
179void StocktickerPluginConfig::doLookup() { 178void StocktickerPluginConfig::doLookup() {
180 179
181 system("stockticker"); 180 system("stockticker");
182} 181}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
index 4b950dc..33aed86 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
@@ -1,46 +1,46 @@
1/* 1/*
2 * stocktickerconfig.h 2 * stocktickerconfig.h
3 * 3 *
4 * copyright : (c) 2002 by LJP 4 * copyright : (c) 2002 by LJP
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#ifndef STOCKTICKER_PLUGIN_CONFIG_H 17#ifndef STOCKTICKER_PLUGIN_CONFIG_H
18#define STOCKTICKER_PLUGIN_CONFIG_H 18#define STOCKTICKER_PLUGIN_CONFIG_H
19 19
20#include <qwidget.h> 20#include <qwidget.h>
21#include <opie/todayconfigwidget.h> 21#include <opie/todayconfigwidget.h>
22#include <qstring.h> 22#include <qstring.h>
23 23
24class QLineEdit; 24class QLineEdit;
25class QCheckBox; 25class QCheckBox;
26class QPushButton; 26class QPushButton;
27class QCheckBox; 27class QCheckBox;
28class QSpinBox; 28class QSpinBox;
29 29
30class StocktickerPluginConfig : public TodayConfigWidget { 30class StocktickerPluginConfig : public TodayConfigWidget {
31 31//Q_OBJECT
32public: 32public:
33 StocktickerPluginConfig( QWidget *parent, const char *name ); 33 StocktickerPluginConfig( QWidget *parent, const char *name );
34 ~StocktickerPluginConfig(); 34 ~StocktickerPluginConfig();
35 QString text() const; 35 QString text() const;
36 void writeConfig(); 36 void writeConfig();
37private: 37private:
38 QLineEdit* LineEdit1; 38 QLineEdit* LineEdit1;
39 QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; 39 QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck;
40 QPushButton *lookupButton; 40 QPushButton *lookupButton;
41 QSpinBox *timerDelaySpin; 41 QSpinBox *timerDelaySpin;
42private slots: 42private slots:
43 void doLookup(); 43 void doLookup();
44 44
45}; 45};
46#endif 46#endif
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index 1d53344..45c5c53 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -196,96 +196,97 @@ void getStocks( const QString *blah) {
196 tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage); 196 tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage);
197 if(dovariationCheck) 197 if(dovariationCheck)
198 output +=tempString; 198 output +=tempString;
199 199
200// printf("| Volume | %-9d |\n", stocks_tmp->Volume); 200// printf("| Volume | %-9d |\n", stocks_tmp->Volume);
201 tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume); 201 tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume);
202 if(dovolumeCheck) 202 if(dovolumeCheck)
203 output +=tempString; 203 output +=tempString;
204 204
205// printf("----------------------------------------\n\n"); 205// printf("----------------------------------------\n\n");
206 tempString.sprintf("||==++==|"); 206 tempString.sprintf("||==++==|");
207 output +=tempString; 207 output +=tempString;
208 208
209 /* Simple function which help to browse in the stocks list */ 209 /* Simple function which help to browse in the stocks list */
210 stocks_tmp = next_stock(stocks_tmp); 210 stocks_tmp = next_stock(stocks_tmp);
211 } 211 }
212 212
213 /* frees stocks */ 213 /* frees stocks */
214 free_stocks(stocks_quotes); 214 free_stocks(stocks_quotes);
215 stocktickerTicker->setText( output ); 215 stocktickerTicker->setText( output );
216 216
217} 217}
218 218
219StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) 219StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name)
220 : QWidget(parent, name ) { 220 : QWidget(parent, name ) {
221 init(); 221 init();
222 startTimer(1000); 222 startTimer(1000);
223// checkConnection(); 223// checkConnection();
224} 224}
225 225
226StockTickerPluginWidget::~StockTickerPluginWidget() { 226StockTickerPluginWidget::~StockTickerPluginWidget() {
227} 227}
228 228
229void StockTickerPluginWidget::init() { 229void StockTickerPluginWidget::init() {
230 230
231 QHBoxLayout* layout = new QHBoxLayout( this ); 231 QHBoxLayout* layout = new QHBoxLayout( this );
232 stocktickerTicker = new OTicker(this); 232 stocktickerTicker = new OTicker(this);
233 stocktickerTicker->setMinimumHeight(15); 233 stocktickerTicker->setMinimumHeight(15);
234 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); 234 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() ));
235 layout->addWidget( stocktickerTicker); 235 layout->addWidget( stocktickerTicker);
236 wasError = true; 236 wasError = true;
237} 237}
238 238
239void StockTickerPluginWidget::doStocks() { 239void StockTickerPluginWidget::doStocks() {
240 Config cfg( "stockticker"); 240 Config cfg( "stockticker");
241 cfg.setGroup( "Symbols" ); 241 cfg.setGroup( "Symbols" );
242 QString symbollist; 242 QString symbollist;
243 symbollist = cfg.readEntry("Symbols", ""); 243 symbollist = cfg.readEntry("Symbols", "");
244 symbollist = cfg.readEntry("Symbols", "");
244 symbollist.replace(QRegExp(" "),"+");//seperated by + 245 symbollist.replace(QRegExp(" "),"+");//seperated by +
245 246
246// qDebug(symbollist); 247// qDebug(symbollist);
247 if (!symbollist.isEmpty()) { 248 if (!symbollist.isEmpty()) {
248 pthread_t thread1; 249 pthread_t thread1;
249 pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); 250 pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist);
250 } 251 }
251// pthread_join(thread1,NULL); 252// pthread_join(thread1,NULL);
252// getStocks( symbollist.latin1() ); 253// getStocks( symbollist.latin1() );
253} 254}
254 255
255//void StockTickerPluginWidget::DefProxy(void) { 256//void StockTickerPluginWidget::DefProxy(void) {
256// char *proxy; 257// char *proxy;
257// libstocks_return_code error; 258// libstocks_return_code error;
258 259
259// /* Proxy support */ 260// /* Proxy support */
260// /* Checks for "http_proxy" environment variable */ 261// /* Checks for "http_proxy" environment variable */
261// proxy = getenv("http_proxy"); 262// proxy = getenv("http_proxy");
262// if(proxy) { 263// if(proxy) {
263// /* printf("proxy set\n"); */ 264// /* printf("proxy set\n"); */
264// error = set_proxy(proxy); 265// error = set_proxy(proxy);
265// if (error) { 266// if (error) {
266// // printf("Proxy error (%d)\n", error); 267// // printf("Proxy error (%d)\n", error);
267// QString tempString; 268// QString tempString;
268// tempString.sprintf("Proxy error (%d)\n", error); 269// tempString.sprintf("Proxy error (%d)\n", error);
269// output = tempString; 270// output = tempString;
270// return; 271// return;
271// // exit(1); 272// // exit(1);
272// } 273// }
273// } 274// }
274//} 275//}
275 276
276void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { 277void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
277 killTimer(e->timerId()); 278 killTimer(e->timerId());
278 checkConnection(); 279 checkConnection();
279} 280}
280 281
281void StockTickerPluginWidget::checkConnection() { 282void StockTickerPluginWidget::checkConnection() {
282// qDebug("checking connection"); 283// qDebug("checking connection");
283// Sock = new QSocket( this ); 284// Sock = new QSocket( this );
284 285
285// if( wasError) 286// if( wasError)
286// stocktickerTicker->setText("Checking connection"); 287// stocktickerTicker->setText("Checking connection");
287 288
288// if(Sock->state() == QSocket::Idle) { 289// if(Sock->state() == QSocket::Idle) {
289// Sock->connectToHost("finance.yahoo.com", 80); 290// Sock->connectToHost("finance.yahoo.com", 80);
290// connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); 291// connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) );
291// connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); 292// connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) );