summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
Unidiff
Diffstat (limited to 'noncore/todayplugins/stockticker/stockticker/inputDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stockticker/inputDialog.cpp143
1 files changed, 143 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
new file mode 100644
index 0000000..ad841f2
--- a/dev/null
+++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
@@ -0,0 +1,143 @@
1#include "inputDialog.h"
2
3#include <qapplication.h>
4
5#include <qcheckbox.h>
6#include <qlayout.h>
7#include <qlineedit.h>
8#include <qlayout.h>
9#include <qvariant.h>
10#include <qpushbutton.h>
11#include <qwhatsthis.h>
12#include <qlabel.h>
13#include <qpe/config.h>
14#include <qstringlist.h>
15#include <qmainwindow.h>
16
17
18InputDialog::InputDialog( )
19 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) {
20 setCaption( tr("Enter Stock Symbols"));
21
22 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
23
24 QGridLayout *layout = new QGridLayout( this );
25 layout->setSpacing(6);
26 layout->setMargin( 2);
27
28 LineEdit1 = new QLineEdit( this, "LineEdit1" );
29 LineEdit1->setFocus();
30 QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here."));
31
32 layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3);
33
34 Config cfg( "stockticker");
35 cfg.setGroup( "Symbols" );
36 QString symbollist;
37 symbollist = cfg.readEntry("Symbols", "");
38 LineEdit1->setText(symbollist);
39
40 QLabel *label;
41 label = new QLabel(this);
42 label->setText( tr("Enter stock symbols seperated\nby a space."));
43 label->setMaximumHeight(60);
44 layout->addMultiCellWidget( label, 1, 1, 0, 3);
45
46 cfg.setGroup( "Fields" );
47
48 timeCheck= new QCheckBox ( "Time",this );
49 timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1));
50 layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 );
51 QWhatsThis::add( timeCheck, tr("Toggles Time Field"));
52
53 dateCheck= new QCheckBox ( "Date", this );
54 dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1));
55 layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 );
56 QWhatsThis::add(dateCheck, tr("Toggles date field"));
57
58 symbolCheck= new QCheckBox ( "Symbol", this );
59 symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1));
60 layout->addMultiCellWidget( symbolCheck, 3, 3, 0, 0 );
61 QWhatsThis::add(symbolCheck, tr("Toggles Symbol field"));
62
63 nameCheck= new QCheckBox ( "Name", this );
64 nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1));
65 layout->addMultiCellWidget( nameCheck, 3, 3, 1, 1 );
66 QWhatsThis::add(nameCheck, tr("Toggles Name field"));
67
68 currentPriceCheck= new QCheckBox ( "Current Price", this );
69 currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1));
70 layout->addMultiCellWidget( currentPriceCheck, 4, 4, 0, 0 );
71 QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field"));
72
73
74 lastPriceCheck= new QCheckBox ( "Last Price", this );
75 lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1));
76 layout->addMultiCellWidget(lastPriceCheck, 4, 4, 1, 1);
77 QWhatsThis::add(lastPriceCheck, tr("Toggles last price field"));
78
79 openPriceCheck= new QCheckBox ( "Open Price", this);
80 openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1));
81 layout->addMultiCellWidget( openPriceCheck, 5, 5, 0, 0 );
82 QWhatsThis::add(openPriceCheck, tr("Toggles opening price field"));
83
84 minPriceCheck= new QCheckBox ( "Min Price", this );
85 minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1));
86 layout->addMultiCellWidget( minPriceCheck, 5, 5, 1, 1);
87 QWhatsThis::add(minPriceCheck, tr("Toggles minamum price field"));
88
89 maxPriceCheck= new QCheckBox ( "Max Price", this);
90 maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1));
91 layout->addMultiCellWidget( maxPriceCheck, 6, 6, 0, 0 );
92 QWhatsThis::add(maxPriceCheck, tr("Toggles maximum price field"));
93
94 variationCheck= new QCheckBox ( "Variation", this );
95 variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1));
96 layout->addMultiCellWidget( variationCheck, 6, 6, 1, 1 );
97 QWhatsThis::add(variationCheck, tr("Toggles daily variation field"));
98
99 volumeCheck= new QCheckBox ( "Volume", this );
100 volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1));
101 layout->addMultiCellWidget( volumeCheck , 7, 7, 0, 0);
102 QWhatsThis::add(volumeCheck, tr("Toggles volume field"));
103
104
105 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
106 layout->addItem( spacer, 8, 0 );
107
108}
109
110QString InputDialog::text() const {
111 return LineEdit1->text();
112}
113
114InputDialog::~InputDialog() {
115}
116
117void InputDialog::cleanUp(){
118 Config cfg( "stockticker");
119 cfg.setGroup( "Symbols" );
120 QString outText = text().upper();
121 outText.stripWhiteSpace();
122 cfg.writeEntry("Symbols", outText );
123 qDebug( "<<<<<<<<<<<>>>>>>>>>>>>"+text());
124
125 cfg.setGroup( "Fields" );
126
127 cfg.writeEntry("timeCheck",timeCheck->isChecked());
128 cfg.writeEntry("dateCheck",dateCheck->isChecked());
129 cfg.writeEntry("symbolCheck",symbolCheck->isChecked());
130 cfg.writeEntry("nameCheck",nameCheck->isChecked());
131 cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked());
132 cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked());
133 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked());
134 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked());
135 cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked());
136 cfg.writeEntry("variationCheck",variationCheck->isChecked());
137 cfg.writeEntry("volumeCheck",volumeCheck->isChecked());
138
139
140 cfg.write();
141}
142
143