summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp182
1 files changed, 182 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
new file mode 100644
index 0000000..1334e7d
--- a/dev/null
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
@@ -0,0 +1,182 @@
1/*
2 * stocktickeRconfig.cpp
3 *
4 * copyright : (c) 2002 by ljp
5 * email : llornkcor@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "stocktickerconfig.h"
18#include <opie/todayconfigwidget.h>
19
20#include <qpe/config.h>
21
22#include <qapplication.h>
23
24#include <qspinbox.h>
25#include <qcheckbox.h>
26#include <qlayout.h>
27#include <qlineedit.h>
28#include <qlayout.h>
29#include <qvariant.h>
30#include <qpushbutton.h>
31#include <qwhatsthis.h>
32#include <qlabel.h>
33#include <qpe/config.h>
34#include <qstringlist.h>
35#include <qmainwindow.h>
36
37#include <stdlib.h>
38
39StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name)
40 : TodayConfigWidget(parent, name ) {
41
42 QGridLayout *layout = new QGridLayout( this );
43 layout->setSpacing(6);
44 layout->setMargin( 2);
45
46 LineEdit1 = new QLineEdit( this, "LineEdit1" );
47 LineEdit1->setFocus();
48// QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here."));
49
50 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3);
51
52 Config cfg( "stockticker");
53 cfg.setGroup( "Symbols" );
54 QString symbollist;
55 symbollist = cfg.readEntry("Symbols", "");
56 LineEdit1->setText(symbollist);
57
58 QLabel *label;
59 label = new QLabel(this);
60 label->setText( tr("Enter stock symbols seperated\nby a space."));
61 label->setMaximumHeight(60);
62 layout->addMultiCellWidget( label, 1, 1, 0, 3);
63
64 cfg.setGroup( "Fields" );
65
66 timeCheck= new QCheckBox ( "Time",this );
67 timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1));
68 layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 );
69// QWhatsThis::add( timeCheck, tr("Toggles Time Field"));
70
71 dateCheck= new QCheckBox ( "Date", this );
72 dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1));
73 layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 );
74// QWhatsThis::add(dateCheck, tr("Toggles date field"));
75
76 symbolCheck= new QCheckBox ( "Symbol", this );
77 symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1));
78 layout->addMultiCellWidget( symbolCheck, 3, 3, 0, 0 );
79// QWhatsThis::add(symbolCheck, tr("Toggles Symbol field"));
80
81 nameCheck= new QCheckBox ( "Name", this );
82 nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1));
83 layout->addMultiCellWidget( nameCheck, 3, 3, 1, 1 );
84// QWhatsThis::add(nameCheck, tr("Toggles Name field"));
85
86 currentPriceCheck= new QCheckBox ( "Current Price", this );
87 currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1));
88 layout->addMultiCellWidget( currentPriceCheck, 4, 4, 0, 0 );
89// QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field"));
90
91
92 lastPriceCheck= new QCheckBox ( "Last Price", this );
93 lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1));
94 layout->addMultiCellWidget(lastPriceCheck, 4, 4, 1, 1);
95// QWhatsThis::add(lastPriceCheck, tr("Toggles last price field"));
96
97 openPriceCheck= new QCheckBox ( "Open Price", this);
98 openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1));
99 layout->addMultiCellWidget( openPriceCheck, 5, 5, 0, 0 );
100// QWhatsThis::add(openPriceCheck, tr("Toggles opening price field"));
101
102 minPriceCheck= new QCheckBox ( "Min Price", this );
103 minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1));
104 layout->addMultiCellWidget( minPriceCheck, 5, 5, 1, 1);
105// QWhatsThis::add(minPriceCheck, tr("Toggles minamum price field"));
106
107 maxPriceCheck= new QCheckBox ( "Max Price", this);
108 maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1));
109 layout->addMultiCellWidget( maxPriceCheck, 6, 6, 0, 0 );
110// QWhatsThis::add(maxPriceCheck, tr("Toggles maximum price field"));
111
112 variationCheck= new QCheckBox ( "Variation", this );
113 variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1));
114 layout->addMultiCellWidget( variationCheck, 6, 6, 1, 1 );
115// QWhatsThis::add(variationCheck, tr("Toggles daily variation field"));
116
117 volumeCheck= new QCheckBox ( "Volume", this );
118 volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1));
119 layout->addMultiCellWidget( volumeCheck , 7, 7, 0, 0);
120// QWhatsThis::add(volumeCheck, tr("Toggles volume field"));
121
122 timerDelaySpin = new QSpinBox( this, "timer spin" );
123 QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) );
124 timerDelaySpin->setMaxValue( 60);
125
126 cfg.setGroup("Timer");
127 timerDelaySpin->setValue( cfg.readNumEntry("Delay",0));
128 layout->addMultiCellWidget( timerDelaySpin , 8, 8, 0, 0);
129
130 QLabel *label2;
131 label2 = new QLabel(this);
132 label2->setText( tr("Minutes between stock\nprice lookups."));
133 label2->setMaximumHeight(60);
134 layout->addMultiCellWidget( label2, 8, 8, 1, 1);
135
136// lookupButton = new QPushButton(this, "LookupButton");
137// lookupButton->setText(tr("Symbol Lookup"));
138// connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup()));
139// layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0);
140
141 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
142 layout->addItem( spacer, 10, 0 );
143
144}
145
146
147void StocktickerPluginConfig::writeConfig() {
148 Config cfg( "stockticker");
149 cfg.setGroup( "Symbols" );
150 QString outText = text().upper();
151 outText.stripWhiteSpace();
152 cfg.writeEntry("Symbols", outText );
153 cfg.setGroup( "Fields" );
154 cfg.writeEntry("timeCheck",timeCheck->isChecked());
155 cfg.writeEntry("dateCheck",dateCheck->isChecked());
156 cfg.writeEntry("symbolCheck",symbolCheck->isChecked());
157 cfg.writeEntry("nameCheck",nameCheck->isChecked());
158 cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked());
159 cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked());
160 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked());
161 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked());
162 cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked());
163 cfg.writeEntry("variationCheck",variationCheck->isChecked());
164 cfg.writeEntry("volumeCheck",volumeCheck->isChecked());
165
166 cfg.setGroup("Timer");
167 cfg.writeEntry("Delay",timerDelaySpin->value());
168
169 cfg.write();
170}
171
172StocktickerPluginConfig::~StocktickerPluginConfig() {
173}
174
175QString StocktickerPluginConfig::text() const {
176 return LineEdit1->text();
177}
178
179void StocktickerPluginConfig::doLookup() {
180
181 system("stockticker");
182}