summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/qcheckbook.h37
-rw-r--r--noncore/apps/checkbook/qcheckentrybase.ui610
-rw-r--r--noncore/apps/checkbook/qcheckgraph.cpp258
-rw-r--r--noncore/apps/checkbook/qcheckgraph.h25
-rw-r--r--noncore/apps/checkbook/qcheckgraphbase.ui62
-rw-r--r--noncore/apps/checkbook/qcheckmainmenu.cpp74
-rw-r--r--noncore/apps/checkbook/qcheckmainmenu.h27
-rw-r--r--noncore/apps/checkbook/qcheckmmbase.ui80
-rw-r--r--noncore/apps/checkbook/qcheckname.cpp36
-rw-r--r--noncore/apps/checkbook/qcheckname.h15
-rw-r--r--noncore/apps/checkbook/qcheckview.cpp458
-rw-r--r--noncore/apps/checkbook/qcheckviewbase.ui122
-rw-r--r--noncore/apps/checkbook/qrestrictedcombo.cpp78
-rw-r--r--noncore/apps/checkbook/qrestrictedcombo.h96
-rw-r--r--noncore/apps/checkbook/qrestrictedline.cpp78
-rw-r--r--noncore/apps/checkbook/qrestrictedline.h96
16 files changed, 0 insertions, 2152 deletions
diff --git a/noncore/apps/checkbook/qcheckbook.h b/noncore/apps/checkbook/qcheckbook.h
deleted file mode 100644
index 52c0d40..0000000
--- a/noncore/apps/checkbook/qcheckbook.h
+++ b/dev/null
@@ -1,37 +0,0 @@
1#include "qcheckview.h"
2#include "qcheckgraph.h"
3#include "qcheckmainmenu.h"
4
5#include <qpe/resource.h>
6#include <qmainwindow.h>
7#include <qtoolbar.h>
8#include <qstring.h>
9#include "config.h"
10#include <qpopupmenu.h>
11
12class QCheckBook : public QMainWindow
13{
14 Q_OBJECT
15 public:
16 QCheckBook();
17 private slots:
18 void newCheck(const QString &filename);
19 void newGraph();
20 void close();
21 void initMainMenus();
22 private:
23 QCheckView *m_view;
24 QCheckGraph *m_view2;
25 QCheckMainMenu *m_view3;
26 QToolBar *bar;
27 QMenuBar *mbar;
28 int filemenuid;
29 QString m_filename;
30 QToolButton *nb1;
31 QToolButton *nb2;
32 QToolButton *nb3;
33 QToolButton *nb4;
34 bool initCheck;
35 bool initMM;
36 QPopupMenu *popup;
37};
diff --git a/noncore/apps/checkbook/qcheckentrybase.ui b/noncore/apps/checkbook/qcheckentrybase.ui
deleted file mode 100644
index efc35ff..0000000
--- a/noncore/apps/checkbook/qcheckentrybase.ui
+++ b/dev/null
@@ -1,610 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckEntryBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckEntryBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>224</width>
15 <height>291</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Account Transaction</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>5</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <spacer row="7" column="8" rowspan="1" colspan="4" >
38 <property>
39 <name>name</name>
40 <cstring>Spacer3</cstring>
41 </property>
42 <property stdset="1">
43 <name>orientation</name>
44 <enum>Horizontal</enum>
45 </property>
46 <property stdset="1">
47 <name>sizeType</name>
48 <enum>Expanding</enum>
49 </property>
50 <property>
51 <name>sizeHint</name>
52 <size>
53 <width>20</width>
54 <height>20</height>
55 </size>
56 </property>
57 </spacer>
58 <spacer row="3" column="1" rowspan="1" colspan="4" >
59 <property>
60 <name>name</name>
61 <cstring>Spacer5</cstring>
62 </property>
63 <property stdset="1">
64 <name>orientation</name>
65 <enum>Horizontal</enum>
66 </property>
67 <property stdset="1">
68 <name>sizeType</name>
69 <enum>Expanding</enum>
70 </property>
71 <property>
72 <name>sizeHint</name>
73 <size>
74 <width>20</width>
75 <height>20</height>
76 </size>
77 </property>
78 </spacer>
79 <widget row="5" column="5" >
80 <class>QLabel</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>TextLabel6</cstring>
84 </property>
85 <property stdset="1">
86 <name>font</name>
87 <font>
88 <family>adobe-helvetica</family>
89 <bold>1</bold>
90 </font>
91 </property>
92 <property stdset="1">
93 <name>text</name>
94 <string>$</string>
95 </property>
96 </widget>
97 <spacer row="4" column="6" >
98 <property>
99 <name>name</name>
100 <cstring>Spacer8</cstring>
101 </property>
102 <property stdset="1">
103 <name>orientation</name>
104 <enum>Horizontal</enum>
105 </property>
106 <property stdset="1">
107 <name>sizeType</name>
108 <enum>Expanding</enum>
109 </property>
110 <property>
111 <name>sizeHint</name>
112 <size>
113 <width>20</width>
114 <height>20</height>
115 </size>
116 </property>
117 </spacer>
118 <widget row="2" column="0" rowspan="1" colspan="3" >
119 <class>QLabel</class>
120 <property stdset="1">
121 <name>name</name>
122 <cstring>TextLabel2</cstring>
123 </property>
124 <property stdset="1">
125 <name>text</name>
126 <string>Category:</string>
127 </property>
128 </widget>
129 <spacer row="5" column="2" rowspan="1" colspan="3" >
130 <property>
131 <name>name</name>
132 <cstring>Spacer7</cstring>
133 </property>
134 <property stdset="1">
135 <name>orientation</name>
136 <enum>Horizontal</enum>
137 </property>
138 <property stdset="1">
139 <name>sizeType</name>
140 <enum>Expanding</enum>
141 </property>
142 <property>
143 <name>sizeHint</name>
144 <size>
145 <width>20</width>
146 <height>20</height>
147 </size>
148 </property>
149 </spacer>
150 <spacer row="5" column="11" >
151 <property>
152 <name>name</name>
153 <cstring>Spacer4</cstring>
154 </property>
155 <property stdset="1">
156 <name>orientation</name>
157 <enum>Horizontal</enum>
158 </property>
159 <property stdset="1">
160 <name>sizeType</name>
161 <enum>Expanding</enum>
162 </property>
163 <property>
164 <name>sizeHint</name>
165 <size>
166 <width>20</width>
167 <height>20</height>
168 </size>
169 </property>
170 </spacer>
171 <spacer row="2" column="3" rowspan="1" colspan="2" >
172 <property>
173 <name>name</name>
174 <cstring>Spacer6</cstring>
175 </property>
176 <property stdset="1">
177 <name>orientation</name>
178 <enum>Horizontal</enum>
179 </property>
180 <property stdset="1">
181 <name>sizeType</name>
182 <enum>Expanding</enum>
183 </property>
184 <property>
185 <name>sizeHint</name>
186 <size>
187 <width>20</width>
188 <height>20</height>
189 </size>
190 </property>
191 </spacer>
192 <widget row="5" column="6" rowspan="1" colspan="5" >
193 <class>QRestrictedLine</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>transAmount</cstring>
197 </property>
198 </widget>
199 <widget row="1" column="0" rowspan="1" colspan="5" >
200 <class>QLabel</class>
201 <property stdset="1">
202 <name>name</name>
203 <cstring>TextLabel1</cstring>
204 </property>
205 <property stdset="1">
206 <name>text</name>
207 <string>Description:</string>
208 </property>
209 </widget>
210 <widget row="3" column="0" >
211 <class>QLabel</class>
212 <property stdset="1">
213 <name>name</name>
214 <cstring>TextLabel3</cstring>
215 </property>
216 <property stdset="1">
217 <name>text</name>
218 <string>Type:</string>
219 </property>
220 </widget>
221 <widget row="5" column="0" rowspan="1" colspan="2" >
222 <class>QLabel</class>
223 <property stdset="1">
224 <name>name</name>
225 <cstring>TextLabel5</cstring>
226 </property>
227 <property stdset="1">
228 <name>text</name>
229 <string>Amount:</string>
230 </property>
231 </widget>
232 <widget row="2" column="5" rowspan="1" colspan="7" >
233 <class>QComboBox</class>
234 <item>
235 <property>
236 <name>text</name>
237 <string>Automobile</string>
238 </property>
239 </item>
240 <item>
241 <property>
242 <name>text</name>
243 <string>Bills</string>
244 </property>
245 </item>
246 <item>
247 <property>
248 <name>text</name>
249 <string>CDs</string>
250 </property>
251 </item>
252 <item>
253 <property>
254 <name>text</name>
255 <string>Clothing</string>
256 </property>
257 </item>
258 <item>
259 <property>
260 <name>text</name>
261 <string>Computer</string>
262 </property>
263 </item>
264 <item>
265 <property>
266 <name>text</name>
267 <string>DVDs</string>
268 </property>
269 </item>
270 <item>
271 <property>
272 <name>text</name>
273 <string>Eletronics</string>
274 </property>
275 </item>
276 <item>
277 <property>
278 <name>text</name>
279 <string>Entertainment</string>
280 </property>
281 </item>
282 <item>
283 <property>
284 <name>text</name>
285 <string>Food</string>
286 </property>
287 </item>
288 <item>
289 <property>
290 <name>text</name>
291 <string>Gasoline</string>
292 </property>
293 </item>
294 <item>
295 <property>
296 <name>text</name>
297 <string>Misc</string>
298 </property>
299 </item>
300 <item>
301 <property>
302 <name>text</name>
303 <string>Movies</string>
304 </property>
305 </item>
306 <item>
307 <property>
308 <name>text</name>
309 <string>Rent</string>
310 </property>
311 </item>
312 <item>
313 <property>
314 <name>text</name>
315 <string>Travel</string>
316 </property>
317 </item>
318 <property stdset="1">
319 <name>name</name>
320 <cstring>cmbCategory</cstring>
321 </property>
322 <property stdset="1">
323 <name>editable</name>
324 <bool>true</bool>
325 </property>
326 <property stdset="1">
327 <name>currentItem</name>
328 <number>0</number>
329 </property>
330 <property stdset="1">
331 <name>autoCompletion</name>
332 <bool>true</bool>
333 </property>
334 <property stdset="1">
335 <name>duplicatesEnabled</name>
336 <bool>false</bool>
337 </property>
338 </widget>
339 <widget row="4" column="0" rowspan="1" colspan="6" >
340 <class>QLabel</class>
341 <property stdset="1">
342 <name>name</name>
343 <cstring>TextLabel4</cstring>
344 </property>
345 <property stdset="1">
346 <name>text</name>
347 <string>Check Number:</string>
348 </property>
349 </widget>
350 <widget row="6" column="4" >
351 <class>QLabel</class>
352 <property stdset="1">
353 <name>name</name>
354 <cstring>TextLabel6_2</cstring>
355 </property>
356 <property stdset="1">
357 <name>font</name>
358 <font>
359 <family>adobe-helvetica</family>
360 <bold>1</bold>
361 </font>
362 </property>
363 <property stdset="1">
364 <name>text</name>
365 <string>$</string>
366 </property>
367 </widget>
368 <widget row="6" column="5" rowspan="1" colspan="4" >
369 <class>QRestrictedLine</class>
370 <property stdset="1">
371 <name>name</name>
372 <cstring>transFee</cstring>
373 </property>
374 </widget>
375 <widget row="6" column="0" rowspan="1" colspan="4" >
376 <class>QLabel</class>
377 <property stdset="1">
378 <name>name</name>
379 <cstring>TextLabel7</cstring>
380 </property>
381 <property stdset="1">
382 <name>text</name>
383 <string>Extra Fee:</string>
384 </property>
385 </widget>
386 <widget row="7" column="0" rowspan="1" colspan="8" >
387 <class>QLabel</class>
388 <property stdset="1">
389 <name>name</name>
390 <cstring>TextLabel8</cstring>
391 </property>
392 <property stdset="1">
393 <name>text</name>
394 <string>Additional Notes:</string>
395 </property>
396 </widget>
397 <widget row="1" column="5" rowspan="1" colspan="7" >
398 <class>QComboBox</class>
399 <property stdset="1">
400 <name>name</name>
401 <cstring>descriptionCombo</cstring>
402 </property>
403 <property stdset="1">
404 <name>editable</name>
405 <bool>true</bool>
406 </property>
407 <property stdset="1">
408 <name>maxCount</name>
409 <number>10</number>
410 </property>
411 <property stdset="1">
412 <name>insertionPolicy</name>
413 <enum>BeforeCurrent</enum>
414 </property>
415 <property stdset="1">
416 <name>autoCompletion</name>
417 <bool>true</bool>
418 </property>
419 <property stdset="1">
420 <name>duplicatesEnabled</name>
421 <bool>false</bool>
422 </property>
423 </widget>
424 <widget row="6" column="9" >
425 <class>QLabel</class>
426 <property stdset="1">
427 <name>name</name>
428 <cstring>TextLabel9</cstring>
429 </property>
430 <property stdset="1">
431 <name>minimumSize</name>
432 <size>
433 <width>0</width>
434 <height>0</height>
435 </size>
436 </property>
437 <property stdset="1">
438 <name>maximumSize</name>
439 <size>
440 <width>32767</width>
441 <height>32767</height>
442 </size>
443 </property>
444 <property stdset="1">
445 <name>caption</name>
446 <string></string>
447 </property>
448 <property stdset="1">
449 <name>text</name>
450 <string>Date:</string>
451 </property>
452 </widget>
453 <widget row="6" column="10" rowspan="1" colspan="2" >
454 <class>QRestrictedLine</class>
455 <property stdset="1">
456 <name>name</name>
457 <cstring>dateEdit</cstring>
458 </property>
459 </widget>
460 <widget row="4" column="7" rowspan="1" colspan="5" >
461 <class>QRestrictedLine</class>
462 <property stdset="1">
463 <name>name</name>
464 <cstring>checkNumber</cstring>
465 </property>
466 </widget>
467 <widget row="3" column="5" rowspan="1" colspan="7" >
468 <class>QComboBox</class>
469 <item>
470 <property>
471 <name>text</name>
472 <string>Debit Charge</string>
473 </property>
474 </item>
475 <item>
476 <property>
477 <name>text</name>
478 <string>Written Check</string>
479 </property>
480 </item>
481 <item>
482 <property>
483 <name>text</name>
484 <string>Transfer</string>
485 </property>
486 </item>
487 <item>
488 <property>
489 <name>text</name>
490 <string>Credit Card</string>
491 </property>
492 </item>
493 <property stdset="1">
494 <name>name</name>
495 <cstring>transType</cstring>
496 </property>
497 </widget>
498 <widget row="8" column="0" rowspan="1" colspan="12" >
499 <class>QMultiLineEdit</class>
500 <property stdset="1">
501 <name>name</name>
502 <cstring>additionalNotes</cstring>
503 </property>
504 </widget>
505 <widget row="0" column="0" rowspan="1" colspan="12" >
506 <class>QButtonGroup</class>
507 <property stdset="1">
508 <name>name</name>
509 <cstring>ButtonGroup3</cstring>
510 </property>
511 <property stdset="1">
512 <name>sizePolicy</name>
513 <sizepolicy>
514 <hsizetype>7</hsizetype>
515 <vsizetype>7</vsizetype>
516 </sizepolicy>
517 </property>
518 <property stdset="1">
519 <name>title</name>
520 <string></string>
521 </property>
522 <property>
523 <name>layoutMargin</name>
524 </property>
525 <property>
526 <name>layoutSpacing</name>
527 </property>
528 <grid>
529 <property stdset="1">
530 <name>margin</name>
531 <number>4</number>
532 </property>
533 <property stdset="1">
534 <name>spacing</name>
535 <number>0</number>
536 </property>
537 <widget row="0" column="1" >
538 <class>QRadioButton</class>
539 <property stdset="1">
540 <name>name</name>
541 <cstring>deposit</cstring>
542 </property>
543 <property stdset="1">
544 <name>sizePolicy</name>
545 <sizepolicy>
546 <hsizetype>1</hsizetype>
547 <vsizetype>1</vsizetype>
548 </sizepolicy>
549 </property>
550 <property stdset="1">
551 <name>text</name>
552 <string>Deposit</string>
553 </property>
554 </widget>
555 <widget row="0" column="0" >
556 <class>QRadioButton</class>
557 <property stdset="1">
558 <name>name</name>
559 <cstring>payment</cstring>
560 </property>
561 <property stdset="1">
562 <name>sizePolicy</name>
563 <sizepolicy>
564 <hsizetype>1</hsizetype>
565 <vsizetype>1</vsizetype>
566 </sizepolicy>
567 </property>
568 <property stdset="1">
569 <name>text</name>
570 <string>Payment</string>
571 </property>
572 <property stdset="1">
573 <name>checked</name>
574 <bool>true</bool>
575 </property>
576 </widget>
577 </grid>
578 </widget>
579 </grid>
580</widget>
581<customwidgets>
582 <customwidget>
583 <class>QRestrictedLine</class>
584 <header location="local">qrestrictedline.h</header>
585 <sizehint>
586 <width>-1</width>
587 <height>-1</height>
588 </sizehint>
589 <container>0</container>
590 <sizepolicy>
591 <hordata>5</hordata>
592 <verdata>5</verdata>
593 </sizepolicy>
594 <pixmap>image0</pixmap>
595 </customwidget>
596</customwidgets>
597<images>
598 <image>
599 <name>image0</name>
600 <data format="XPM.GZ" length="649">789c6dd23b0ec2300c00d03da7b0e22d42e9476c88232031222186c80c3074813220c4dd214dddd84dac0e759fe2386e1a07a7e3015c639e6318ef04740b0f70d7d730bccf97fdc7d8be87f8406737c62210606869dbb531f531a57f4a299d03a7e06c11cca1055508412c2889acc2ef425423b34840a645f28244936860d2c265d7923bae8b2f05cb35a91739002d2b5727d535cbe954a43ad1e22f700755caf7407cf4799fe286c47dbe3bf303014167a2</data>
601 </image>
602</images>
603<tabstops>
604 <tabstop>payment</tabstop>
605 <tabstop>descriptionCombo</tabstop>
606 <tabstop>cmbCategory</tabstop>
607 <tabstop>transType</tabstop>
608 <tabstop>additionalNotes</tabstop>
609</tabstops>
610</UI>
diff --git a/noncore/apps/checkbook/qcheckgraph.cpp b/noncore/apps/checkbook/qcheckgraph.cpp
deleted file mode 100644
index 5b21ad8..0000000
--- a/noncore/apps/checkbook/qcheckgraph.cpp
+++ b/dev/null
@@ -1,258 +0,0 @@
1#include "qcheckgraph.h"
2
3#include <qpainter.h>
4#include <qmessagebox.h>
5#include <qfontmetrics.h>
6#include <qdir.h>
7#include <qfile.h>
8#include <qstringlist.h>
9#include <qdatetime.h>
10#include <qmenubar.h>
11#include <qpopupmenu.h>
12
13QCheckGraph::QCheckGraph(const QString filename)
14 : QCheckGraphBase()
15{
16 QMenuBar *bar = new QMenuBar(this);
17 bar->setMargin(0);
18 QPopupMenu *popup = new QPopupMenu;
19 popup->insertItem("&Save Graph...", this, SLOT(saveGraphAsPicture()));
20 bar->insertItem("&File", popup);
21
22 pixmapready = false;
23 config = new Config(filename, Config::File);
24 QString forresult = "";
25 QString forresult2 = "";
26 int i = 1;
27 for (; forresult != "Not Found"; i++)
28 {
29 config->setGroup(QString::number(i));
30 forresult = config->readEntry("Description", QString("Not Found"));
31 forresult2 = config->readEntry("Category", QString("Not Found"));
32 if (forresult != "Not Found")
33 {
34 if (list.contains(forresult2) == 0)
35 {
36 config->setGroup("Totals");
37 QString larger = config->readEntry("Spent", QString("no"));
38 QString smaller = config->readEntry(forresult2, QString("no"));
39 if (larger != "no" && smaller != "no")
40 {
41 list << forresult2;
42 QString percentage = calculator(smaller, larger, true);
43
44 // Here we calculate how many pixels tall it will be by multiplying it by 200.
45 QString pixels = calculator(percentage, QString("200"), false);
46
47 // This is done because it really doesn't need to have a decimal... just an int, and
48 // QString rounds doubles up to the nearest whole number in order to convert
49 // to an int (which is correct).
50 pixels = pixels.remove(pixels.find('.'), pixels.length());
51
52 if (pixels.toInt() <= 5)
53 {
54 pixels = "6";
55 }
56
57 list2 << pixels;
58 }
59 }
60 } else {
61 continue;
62 }
63 // We want to break this loop on the 7th (remember, starts at 0->6 == 7) item.
64 if (list.count() == 6)
65 {
66 break;
67 }
68 }
69 for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
70 {
71 if ((*it).length() > 11)
72 {
73 (*it).truncate(8);
74 (*it).append("...");
75 }
76 }
77 graphPixmap();
78}
79
80void QCheckGraph::graphPixmap()
81{
82 pixmapready = false;
83 graph = QPixmap(240,250);
84 QPainter p;
85 p.begin(&graph);
86 p.fillRect(0, 0, 240, 300, QColor(255,255,255));
87 // Draw the graph lines
88
89 // Y
90 p.drawLine( 40, 50, 40, 252 );
91
92 // X
93 p.drawLine( 40, 252, 203, 252 );
94
95 // Y stepup lines
96 p.drawLine( 40, 50, 37, 50);
97 p.drawLine( 40, 70, 37, 70);
98 p.drawLine( 40, 90, 37, 90);
99 p.drawLine( 40, 110, 37, 110);
100 p.drawLine( 40, 130, 37, 130);
101 p.drawLine( 40, 150, 37, 150);
102 p.drawLine( 40, 170, 37, 170);
103 p.drawLine( 40, 190, 37, 190);
104 p.drawLine( 40, 210, 37, 210);
105 p.drawLine( 40, 230, 37, 230);
106 p.drawLine( 40, 245, 37, 245);
107
108
109 // Y stepup values
110 p.drawText((35 - p.fontMetrics().width("100")), (50 + (p.fontMetrics().height() / 2)), "100");
111 p.drawText((35 - p.fontMetrics().width("90")), (70 + (p.fontMetrics().height() / 2)), "90");
112 p.drawText((35 - p.fontMetrics().width("80")), (90 + (p.fontMetrics().height() / 2)), "80");
113 p.drawText((35 - p.fontMetrics().width("70")), (110 + (p.fontMetrics().height() / 2)), "70");
114 p.drawText((35 - p.fontMetrics().width("60")), (130 + (p.fontMetrics().height() / 2)), "60");
115 p.drawText((35 - p.fontMetrics().width("50")), (150 + (p.fontMetrics().height() / 2)), "50");
116 p.drawText((35 - p.fontMetrics().width("40")), (170 + (p.fontMetrics().height() / 2)), "40");
117 p.drawText((35 - p.fontMetrics().width("30")), (190 + (p.fontMetrics().height() / 2)), "30");
118 p.drawText((35 - p.fontMetrics().width("20")), (210 + (p.fontMetrics().height() / 2)), "20");
119 p.drawText((35 - p.fontMetrics().width("10")), (230 + (p.fontMetrics().height() / 2)), "10");
120 p.drawText((35 - p.fontMetrics().width("<10")), (245 + (p.fontMetrics().height() / 2)), "<10");
121
122 // Draw the axis[sic?] labels
123 QString ylabel = "Percentage";
124 int pixel = 100;
125 for (unsigned int i = 0; i != ylabel.length(); i++)
126 {
127 p.setBrush(QColor(0,0,0));
128 p.drawText(5,pixel, QString(ylabel[i]));
129 pixel = pixel + p.fontMetrics().height();
130 }
131 p.drawText(95, 265, "Category");
132
133 int i = 0;
134 // Hack: Using if()'s... switch was acting all wierd :{
135 QStringList::Iterator it2 = list2.begin();
136 for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
137 {
138 qWarning(QString::number(i));
139 if (i ==0)
140 {
141 // For the color code:
142 p.setBrush(QColor(255,0,0));
143 p.drawRect(8,12, 8, 8);
144
145 // Now the text:
146 p.setBrush(QColor(0,0,0));
147 p.drawText(18,20, (*it));
148
149 // Last, but not least, we have the actual bar graph height.
150 p.setBrush(QColor(255,0,0));
151 p.drawRect(47, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
152 }
153 if (i ==1)
154 {
155 p.setBrush(QColor(255,255,0));
156 p.drawRect(78,12, 8, 8);
157
158 p.setBrush(QColor(0,0,0));
159 p.drawText(88,20, (*it));
160
161 p.setBrush(QColor(255,255,0));
162 p.drawRect(70, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
163 }
164 if (i==2)
165 {
166 p.setBrush(QColor(0,255,0));
167 p.drawRect(153,12, 8, 8);
168 p.setBrush(QColor(0,0,0));
169 p.drawText(163,20, (*it));
170
171 p.setBrush(QColor(0,255,0));
172 p.drawRect(98, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
173 }
174 if (i==3)
175 {
176 p.setBrush(QColor(89,12,54));
177 p.drawRect(8,27, 8, 8);
178 p.setBrush(QColor(0,0,0));
179 p.drawText(18,35, (*it));
180
181 p.setBrush(QColor(89,12,54));
182 p.drawRect(126, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
183 }
184 if (i==4)
185 {
186 p.setBrush(QColor(0,0,255));
187 p.drawRect(78,27, 8, 8);
188 p.setBrush(QColor(0,0,0));
189 p.drawText(88,35, (*it));
190 p.setBrush(QColor(0,0,255));
191 p.drawRect(154, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
192 }
193 if (i==5)
194 {
195 p.setBrush(QColor(100,40,0));
196 p.drawRect(153,27, 8, 8);
197 p.setBrush(QColor(0,0,0));
198 p.drawText(163,35, (*it));
199 p.setBrush(QColor(100,40,0));
200 p.drawRect(182, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt());
201 }
202 i++;
203 it2++;
204 }
205
206 p.end();
207 pixmapready = true;
208 graphWidget->setBackgroundPixmap(graph);
209}
210
211QString QCheckGraph::calculator(QString largervalue, QString smallervalue, bool divide)
212{
213 //largervalue = largervalue.remove(largervalue.find(".", 0, false), 1);
214 //smallervalue = smallervalue.remove(smallervalue.find(".", 0, false), 1);
215
216 double largercents = largervalue.toDouble();
217 double smallercents = smallervalue.toDouble();
218
219 double finalammount = 0;
220
221 if (divide == true)
222 {
223 finalammount = (largercents / smallercents);
224 } else {
225 finalammount = (largercents * smallercents);
226 }
227
228 qWarning(QString::number(finalammount));
229
230 return QString::number(finalammount);
231}
232
233/*void QCheckGraph::paintEvent(QPaintEvent *e)
234{
235 if (pixmapready == true)
236 {
237 bitBlt((QPaintDevice *)(graphWidget), 0, 0, graph, 0,0);
238 QWidget::paintEvent(e);
239 }
240}
241*/
242void QCheckGraph::saveGraphAsPicture()
243{
244 QString homedir = QDir::homeDirPath();
245 QDate current = QDate::currentDate();
246 QString datestring = QString::number(current.month());
247 datestring.append(QString::number(current.day()));
248 datestring.append(QString::number(current.year()));
249 QString filename = homedir;
250 filename.append("/Documents/graph");
251 filename.append(datestring);
252 filename.append(".png");
253 graph.save(filename, "PNG", 85);
254 QString graphmessage = "<qt>The graph was saved as graph";
255 graphmessage.append(datestring);
256 graphmessage.append(".png. You may access it by returning to your home screen and clicking on the \"Documents\" tab in the upper right hand screen</qt>");
257 QMessageBox::information(0, "File Saved", graphmessage);
258}
diff --git a/noncore/apps/checkbook/qcheckgraph.h b/noncore/apps/checkbook/qcheckgraph.h
deleted file mode 100644
index 1cafef8..0000000
--- a/noncore/apps/checkbook/qcheckgraph.h
+++ b/dev/null
@@ -1,25 +0,0 @@
1#include <qstring.h>
2#include <qmainwindow.h>
3#include <qwidget.h>
4#include <qstringlist.h>
5#include <qpixmap.h>
6#include "config.h"
7
8#include "qcheckgraphbase.h"
9
10class QCheckGraph : public QCheckGraphBase
11{
12 Q_OBJECT
13 public:
14 QCheckGraph(const QString);
15 private:
16 QStringList list;
17 QStringList list2;
18 QString calculator(QString larger, QString smaller, bool divide);
19 QPixmap graph;
20 void graphPixmap();
21 bool pixmapready;
22 Config *config;
23 private slots:
24 void saveGraphAsPicture();
25};
diff --git a/noncore/apps/checkbook/qcheckgraphbase.ui b/noncore/apps/checkbook/qcheckgraphbase.ui
deleted file mode 100644
index 2763839..0000000
--- a/noncore/apps/checkbook/qcheckgraphbase.ui
+++ b/dev/null
@@ -1,62 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckGraphBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckGraphBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>236</width>
15 <height>285</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Account Graph</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>0</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>0</number>
30 </property>
31 <widget row="0" column="0" >
32 <class>QWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>graphWidget</cstring>
36 </property>
37 </widget>
38 </grid>
39</widget>
40<customwidgets>
41 <customwidget>
42 <class>QWidget</class>
43 <header location="global">qwidget.h</header>
44 <sizehint>
45 <width>-1</width>
46 <height>-1</height>
47 </sizehint>
48 <container>0</container>
49 <sizepolicy>
50 <hordata>5</hordata>
51 <verdata>5</verdata>
52 </sizepolicy>
53 <pixmap>image0</pixmap>
54 </customwidget>
55</customwidgets>
56<images>
57 <image>
58 <name>image0</name>
59 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
60 </image>
61</images>
62</UI>
diff --git a/noncore/apps/checkbook/qcheckmainmenu.cpp b/noncore/apps/checkbook/qcheckmainmenu.cpp
deleted file mode 100644
index 2382513..0000000
--- a/noncore/apps/checkbook/qcheckmainmenu.cpp
+++ b/dev/null
@@ -1,74 +0,0 @@
1#include "qcheckmainmenu.h"
2#include "qcheckname.h"
3
4QCheckMainMenu::QCheckMainMenu(QWidget *parent)
5 : QCheckMMBase(parent)
6{
7 init();
8}
9
10void QCheckMainMenu::init()
11{
12 lstCheckBooks->clear();
13 QString checkdirname = QDir::homeDirPath();
14 checkdirname.append("/.checkbooks");
15 QDir checkdir(checkdirname);
16 if (checkdir.exists() == true)
17 {
18 QStringList checkbooks = checkdir.entryList("*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time);
19 for (QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++)
20 {
21 (*it) = (*it).remove((*it).find('.'), (*it).length());
22 }
23 lstCheckBooks->insertStringList(checkbooks);
24 }
25 lstCheckBooks->clearSelection();
26 connect(lstCheckBooks, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotSelected(QListBoxItem *)));
27 lstCheckBooks->clearSelection();
28}
29
30void QCheckMainMenu::slotSelected(QListBoxItem *item)
31{
32 if (item != 0)
33 {
34 QString text = item->text();
35 if (text.isEmpty() == false)
36 {
37 text.append(".qcb");
38 QString checkdirname = QDir::homeDirPath();
39 checkdirname.append("/.checkbooks/");
40 text.prepend(checkdirname);
41 emit itemSelected(text);
42 }
43 }
44}
45
46void QCheckMainMenu::newClicked()
47{
48 QString checkname = QCheckName::getName();
49 if (checkname.isEmpty() == false)
50 {
51 QString checkdirname = QDir::homeDirPath();
52 checkdirname.append("/.checkbooks");
53 QDir checkdir(checkdirname);
54 if (checkdir.exists() == false)
55 {
56 checkdir.mkdir(checkdirname);
57 }
58 checkdirname.append("/");
59 checkdirname.append(checkname);
60 checkdirname.append(".qcb");
61 QFile file(checkdirname);
62 if (file.exists() == false)
63 {
64 file.open(IO_WriteOnly);
65 QTextStream os(&file);
66 os << "";
67 file.close();
68 }
69 QFileInfo fi(file);
70 QString noextension = fi.fileName();
71 noextension = noextension.remove(noextension.find('.'), noextension.length());
72 lstCheckBooks->insertItem(noextension);
73 }
74}
diff --git a/noncore/apps/checkbook/qcheckmainmenu.h b/noncore/apps/checkbook/qcheckmainmenu.h
deleted file mode 100644
index 456d3df..0000000
--- a/noncore/apps/checkbook/qcheckmainmenu.h
+++ b/dev/null
@@ -1,27 +0,0 @@
1#include <qwidget.h>
2#include <qtoolbutton.h>
3#include <qpopupmenu.h>
4#include <qfile.h>
5#include <qdir.h>
6#include <qtextstream.h>
7#include <qstring.h>
8#include <qlistbox.h>
9#include <qmessagebox.h>
10
11#include "qcheckmmbase.h"
12
13class QCheckMainMenu : public QCheckMMBase
14{
15 Q_OBJECT
16 public:
17 QCheckMainMenu(QWidget *);
18 signals:
19 void itemSelected(const QString &);
20 private:
21 void init();
22 private slots:
23 void slotSelected(QListBoxItem *);
24 public slots:
25 void newClicked();
26};
27
diff --git a/noncore/apps/checkbook/qcheckmmbase.ui b/noncore/apps/checkbook/qcheckmmbase.ui
deleted file mode 100644
index efde990..0000000
--- a/noncore/apps/checkbook/qcheckmmbase.ui
+++ b/dev/null
@@ -1,80 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckMMBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckMMBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>256</width>
15 <height>311</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Main Menu</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>7</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>3</number>
30 </property>
31 <widget row="0" column="0" >
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel2</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>Select from the check books below or click the "New" icon in the toolbar.</string>
40 </property>
41 <property stdset="1">
42 <name>alignment</name>
43 <set>WordBreak|AlignVCenter|AlignLeft</set>
44 </property>
45 <property>
46 <name>wordwrap</name>
47 </property>
48 </widget>
49 <widget row="1" column="0" >
50 <class>QListBox</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>lstCheckBooks</cstring>
54 </property>
55 </widget>
56 </grid>
57</widget>
58<customwidgets>
59 <customwidget>
60 <class>QWidget</class>
61 <header location="global">qwidget.h</header>
62 <sizehint>
63 <width>-1</width>
64 <height>-1</height>
65 </sizehint>
66 <container>0</container>
67 <sizepolicy>
68 <hordata>5</hordata>
69 <verdata>5</verdata>
70 </sizepolicy>
71 <pixmap>image0</pixmap>
72 </customwidget>
73</customwidgets>
74<images>
75 <image>
76 <name>image0</name>
77 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
78 </image>
79</images>
80</UI>
diff --git a/noncore/apps/checkbook/qcheckname.cpp b/noncore/apps/checkbook/qcheckname.cpp
deleted file mode 100644
index 0e4d71c..0000000
--- a/noncore/apps/checkbook/qcheckname.cpp
+++ b/dev/null
@@ -1,36 +0,0 @@
1#include "qcheckname.h"
2#include <qmessagebox.h>
3#include <qdialog.h>
4#include <qpushbutton.h>
5#include <qlineedit.h>
6#include "qrestrictedline.h"
7
8QCheckName::QCheckName()
9 : QCheckNameBase()
10{
11 connect(cmdDone, SIGNAL(clicked()), this, SLOT(clicked()));
12}
13
14QString QCheckName::getName()
15{
16 QCheckName qcn;
17 qcn.setWFlags(Qt::WType_Modal);
18 qcn.leText->setValidChars("abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ");
19 if (qcn.exec() == QDialog::Accepted)
20 {
21 return qcn.leText->text();
22 } else {
23 return QString("");
24 }
25}
26
27void QCheckName::clicked()
28{
29 if (leText->text().isEmpty() == false)
30 {
31 hide();
32 accept();
33 } else {
34 QMessageBox::critical(this, "Missing Information", "<qt>Please enter the name of your Check Book and try again.</qt>");
35 }
36}
diff --git a/noncore/apps/checkbook/qcheckname.h b/noncore/apps/checkbook/qcheckname.h
deleted file mode 100644
index c47c4f9..0000000
--- a/noncore/apps/checkbook/qcheckname.h
+++ b/dev/null
@@ -1,15 +0,0 @@
1#include "qchecknamebase.h"
2#include <qstring.h>
3#include <qwidget.h>
4
5class QCheckName : public QCheckNameBase
6{
7 Q_OBJECT
8 public:
9 QCheckName();
10 static QString getName();
11 private:
12 QWidget *m_parent;
13 private slots:
14 void clicked();
15};
diff --git a/noncore/apps/checkbook/qcheckview.cpp b/noncore/apps/checkbook/qcheckview.cpp
deleted file mode 100644
index ddc3fa9..0000000
--- a/noncore/apps/checkbook/qcheckview.cpp
+++ b/dev/null
@@ -1,458 +0,0 @@
1#include "qcheckview.h"
2
3#include <qpe/resource.h>
4#include <qregexp.h>
5#include <qlineedit.h>
6#include <qradiobutton.h>
7#include <qcombobox.h>
8#include <qapplication.h>
9#include <qpushbutton.h>
10#include <qdir.h>
11#include <qlabel.h>
12#include <qdatetime.h>
13#include <qmessagebox.h>
14#include <qcheckbox.h>
15#include <qfile.h>
16#include <qtextstream.h>
17#include <qbuttongroup.h>
18#include <qradiobutton.h>
19#include <qheader.h>
20
21QCheckView::QCheckView(QWidget *parent, QString filename)
22 : QCheckViewBase(parent)
23{
24 tblTransactions->setHScrollBarMode( QTable::AlwaysOff );
25 tblTransactions->setNumRows( 0 );
26 tblTransactions->setNumCols( 4 );
27 tblTransactions->setShowGrid( FALSE );
28 tblTransactions->horizontalHeader()->setLabel(0, "Num", 29);
29 tblTransactions->horizontalHeader()->setLabel(1, "Description", 81);
30 tblTransactions->horizontalHeader()->setLabel(2, "Date", 57);
31 tblTransactions->horizontalHeader()->setLabel(3, "Amount", 59);
32 tblTransactions->verticalHeader()->hide();
33 tblTransactions->setLeftMargin( 0 );
34 tblTransactions->setSelectionMode(QTable::NoSelection);
35
36 m_filename = filename;
37 load(filename);
38}
39
40void QCheckView::deleteClicked(int row, int col)
41{
42 QStringList existing;
43 QString rowText = tblTransactions->text(row, 0);
44 config->setGroup(rowText);
45 QString originalamount = config->readEntry("Amount", "0.00");
46
47 config->setGroup("Data");
48 int lastCheck = config->readNumEntry("LastCheck", 0);
49
50 qWarning(rowText);
51 config->setGroup(rowText);
52 QString payment = config->readEntry("Payment", "true");
53 if ( payment == QString("true") && rowText.toInt() <= lastCheck)
54 {
55 for(int i = row; i != (lastCheck); i++)
56 {
57 config->setGroup(tblTransactions->text(i, 0));
58 QString ibalance = config->readEntry("Balance", "0.00");
59 // this adds the old amount on to the transaction and then takes the new amount away
60 QString newbalance = calculator(ibalance, originalamount, false);
61 config->writeEntry("Balance", newbalance);
62
63 if (i == (lastCheck - 1))
64 {
65 config->setGroup("Totals");
66 config->writeEntry("Balance", newbalance);
67 break;
68 }
69 }
70 QString category = config->readEntry("Category", "Error");
71 if (category != QString("Error"))
72 {
73 config->setGroup("Totals");
74 config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), originalamount, true));
75 QString categorytotal = config->readEntry(category, QString("0"));
76 categorytotal = calculator(categorytotal, originalamount, true);
77 config->writeEntry(category, categorytotal);
78 }
79 }
80 if ( payment == QString("false") && rowText.toInt() <= lastCheck)
81 {
82 for(int i = row; i != (lastCheck); i++)
83 {
84 config->setGroup(tblTransactions->text(i, 0));
85 QString ibalance = config->readEntry("Balance", "0.00");
86 // this subtracts the old amount on to the transaction and then adds the new amount on
87 QString newbalance = calculator(ibalance, originalamount, true);
88 config->writeEntry("Balance", newbalance);
89
90 if (i == lastCheck - 1)
91 {
92 config->setGroup("Totals");
93 config->writeEntry("Balance", newbalance);
94 break;
95 }
96 }
97 config->setGroup("Totals");
98 config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), originalamount, true));
99 }
100 for (int i = rowText.toInt(); i != lastCheck; i++)
101 {
102 qWarning(QString::number(i +1));
103 config->setGroup(QString::number(i +1));
104 QString origamount = config->readEntry("Amount", "0");
105 qWarning(origamount);
106 QString origbalance = config->readEntry("Balance", "0");
107 QString origchecknumber = config->readEntry("CheckNumber", "0");
108 QString origcomments = config->readEntry("Comments", "");
109 QString origdate = config->readEntry("Date", "01/01/2000");
110 QString origdescription = config->readEntry("Description", "No Description");
111 QString origpayment = config->readEntry("Payment", "true");
112 QString origtransactionfee = config->readEntry("TransactionFee", "0");
113 QString origtype = config->readEntry("Type", "0");
114
115 if (config->hasKey("Category"))
116 {
117 QString origcategory = config->readEntry("Category", "No Category");
118 config->removeGroup();
119 config->setGroup(QString::number(i));
120 config->clearGroup();
121 config->writeEntry("Category", origcategory);
122 } else {
123 config->removeGroup();
124 config->setGroup(QString::number(i));
125 config->clearGroup();
126 }
127 config->writeEntry("Amount", origamount);
128 config->writeEntry("Balance", origbalance);
129 config->writeEntry("CheckNumber", origchecknumber);
130 config->writeEntry("Comments", origcomments);
131 config->writeEntry("Date", origdate);
132 config->writeEntry("Description", origdescription);
133 config->writeEntry("Payment", origpayment);
134 config->writeEntry("TransactionFee", origtransactionfee);
135 config->writeEntry("Type", origtype);
136 }
137 tblTransactions->clearCell(row, col);
138 labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00"))));
139 config->setGroup("Data");
140 config->writeEntry("LastCheck", QString::number(QString(config->readEntry("LastCheck", 0)).toInt() -1));
141 config->write();
142 delete qcd;
143 emit reload(m_filename);
144
145}
146
147void QCheckView::load(const QString filename)
148{
149 config = new Config(filename, Config::File);
150
151 connect(tblTransactions, SIGNAL(clicked(int, int, int, const QPoint &)), this, SLOT(tableClicked(int, int, int, const QPoint &)));
152
153 config->setGroup("Totals");
154 labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00"))));
155
156 config->setGroup("Data");
157 int lastCheck = config->readNumEntry("LastCheck", 1);
158 for (int i = 1; i != (lastCheck + 1); i++)
159 {
160 config->setGroup(QString::number(i));
161 QString item = config->readEntry("Description", QString("Not Found"));
162 if (item != "Not Found")
163 {
164 QTableItem *qti = new QTableItem(tblTransactions, QTableItem::Never, QString::number(i));
165 QTableItem *qti1 = new QTableItem(tblTransactions, QTableItem::Never, config->readEntry("Description", QString("None")));
166 QTableItem *qti2 = new QTableItem(tblTransactions, QTableItem::Never, config->readEntry("Date", QString("None")));
167 QTableItem *qti3 = new QTableItem(tblTransactions, QTableItem::Never, QString("$" + config->readEntry("Amount", QString("0.00"))));
168 int row = tblTransactions->numRows();
169 tblTransactions->setNumRows(row + 1);
170 tblTransactions->setItem(row,0, qti);
171 tblTransactions->setItem(row,1, qti1);
172 tblTransactions->setItem(row,2, qti2);
173 tblTransactions->setItem(row,3, qti3);
174 tblTransactions->updateCell(row, 0);
175 tblTransactions->updateCell(row, 1);
176 tblTransactions->updateCell(row, 2);
177 tblTransactions->updateCell(row, 3);
178 }
179 }
180}
181
182void QCheckView::editClicked(int row, int col)
183{
184 delete qcd;
185 QStringList existing;
186 QString rowText = tblTransactions->text(row, 0);
187 config->setGroup("Data");
188 QString recent = config->readEntry("Recent", "");
189
190 config->setGroup(rowText);
191 //We need the original amount to add or subtract to check's blanaces written after this edited check
192 QString originalamount = config->readEntry("Amount", "0.00");
193 QString originalcategory = config->readEntry("Category", "None");
194
195 existing << config->readEntry("Payment", "true") << config->readEntry("Description", "No Description Found") << config->readEntry("Category", "Misc.") << config->readEntry("Type", "0") << config->readEntry("CheckNumber", "0") << originalamount << config->readEntry("TransactionFee", "") << config->readEntry("Date", "01/01/2001") << config->readEntry("Comments", "") << recent;
196 QStringList result = QCheckEntry::popupEntry(existing);
197 if (result.isEmpty() == false)
198 {
199 config->setGroup("Data");
200 int lastCheck = config->readNumEntry("LastCheck", 0);
201 config->writeEntry("Recent", result[9]);
202
203 config->setGroup(rowText);
204
205 tblTransactions->setText(row, 1, result[1]);
206 tblTransactions->updateCell(row, 1);
207
208 tblTransactions->setText(row, 2, result[7]);
209 tblTransactions->updateCell(row, 2);
210
211 tblTransactions->setText(row, 3, QString("$" + result[5]));
212 tblTransactions->updateCell(row, 3);
213
214 // This is how the list looks:
215 // 0: true or false, true == payment, false == deposit
216 // 1: description of the transaction
217 // 2: category name
218 // 3: transaction type (stores the integer value of the index of the combobox)
219 // 4: check number of the transaction (if any)
220 // 5: transaction amount
221 // 6: transaction fee (e.g. service charge, or ATM charge).
222 // 7: date of the transaction
223 // 8: additional comments
224 config->writeEntry("Payment", result[0]);
225 config->writeEntry("Description", result[1]);
226 if (result[0] == QString("true"))
227 {
228 config->writeEntry("Category", result[2]);
229 }
230 config->writeEntry("Type", result[3]);
231 config->writeEntry("CheckNumber", result[4]);
232 config->writeEntry("Amount", result[5]);
233 config->writeEntry("TransactionFee", result[6]);
234 config->writeEntry("Date", result[7]);
235 config->writeEntry("Comments", result[8]);
236 if (result[0] == QString("true"))
237 {
238 if (rowText.toInt() <= lastCheck)
239 {
240 for(int i = (rowText.toInt() - 1); i != (lastCheck); i++)
241 {
242 config->setGroup(tblTransactions->text(i, 0));
243 QString ibalance = config->readEntry("Balance", "0.00");
244
245 // this adds the old amount on to the transaction and then takes the new amount away
246 QString newbalance = calculator(calculator(ibalance, originalamount, false), result[5], true);
247 config->writeEntry("Balance", newbalance);
248 if (i == (lastCheck - 1))
249 {
250 config->setGroup("Totals");
251 config->writeEntry("Balance", newbalance);
252 break;
253 }
254 }
255 }
256 config->setGroup("Totals");
257 config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), originalamount, true));
258 config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), result[5], false));
259
260 if (result[2] == originalcategory)
261 {
262 QString categorytotal = config->readEntry(result[2], QString("0"));
263 categorytotal = calculator(categorytotal, originalamount, true);
264 categorytotal = calculator(categorytotal, result[5], false);
265 config->writeEntry(result[2], categorytotal);
266 } else {
267 QString origtotal = config->readEntry(originalcategory, QString("0"));
268 QString origfinal = calculator(origtotal, result[5], true);
269 if (origfinal == "0" || origfinal == "0.00")
270 {
271 config->removeEntry(originalcategory);
272 } else {
273 config->writeEntry(originalcategory, origfinal);
274 }
275 QString categorytotal = config->readEntry(result[2], QString("0"));
276 categorytotal = calculator(categorytotal, originalamount, false);
277 config->writeEntry(result[2],categorytotal);
278 }
279 }
280 if (result[0] == QString("false"))
281 {
282 if (rowText.toInt() <= lastCheck)
283 {
284 for(int i = (rowText.toInt() - 1 ); i != (lastCheck); i++)
285 {
286 config->setGroup(tblTransactions->text(i, 0));
287 QString ibalance = config->readEntry("Balance", "0.00");
288
289 // this subtracts the old amount on to the transaction and then adds the new amount on
290 QString newbalance = calculator(calculator(ibalance, originalamount, true), result[5], false);
291 config->writeEntry("Balance", newbalance);
292 if (i == lastCheck - 1)
293 {
294 config->setGroup("Totals");
295 config->writeEntry("Balance", newbalance);
296 break;
297 }
298 }
299 }
300 config->setGroup("Totals");
301 config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), originalamount, true));
302 config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), result[5], false));
303 }
304 labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00"))));
305 config->write();
306 }
307}
308void QCheckView::tableClicked(int row, int col, int mouseButton, const QPoint &mousePos)
309{
310 if (tblTransactions->text(row, col).isEmpty() == false)
311 {
312 QStringList existing;
313 config->setGroup(tblTransactions->text(row, 0));
314 existing << config->readEntry("Payment", "true") << config->readEntry("Description", "No Description Found") << config->readEntry("Category", "Misc.") << config->readEntry("Type", "0") << config->readEntry("CheckNumber", "0") << config->readEntry("Amount", "0.00") << config->readEntry("TransactionFee", "0.00") << config->readEntry("Date", "01/01/2001") << config->readEntry("Comments", "") << config->readEntry("Balance", "0.00");
315 qcd = new QCheckDetails(row, col, existing);
316 qcd->showMaximized();
317 connect(qcd, SIGNAL(editClicked(int, int)), this, SLOT(editClicked(int, int)));
318 connect(qcd, SIGNAL(deleteClicked(int, int)), this, SLOT(deleteClicked(int, int)));
319 }
320}
321
322void QCheckView::newClicked()
323{
324 config->setGroup("Data");
325 QString recent = config->readEntry("Recent", "");
326 QStringList kindablank;
327 kindablank << recent;
328 QStringList result = QCheckEntry::popupEntry(kindablank);
329 if (result.count() > 1)
330 {
331 QTableItem *qti = new QTableItem(tblTransactions, QTableItem::Never, result[1]);
332 int row = tblTransactions->numRows();
333 tblTransactions->setNumRows(row + 1);
334 tblTransactions->setItem(row,1, qti);
335 tblTransactions->updateCell(row, 1);
336 config->setGroup("Data");
337 config->writeEntry("Recent", result[9]);
338 int lastCheck = config->readNumEntry("LastCheck", 0);
339 if (lastCheck == 0)
340 {
341 config->writeEntry("LastCheck", 1);
342 } else {
343 config->writeEntry("LastCheck", (lastCheck + 1));
344 }
345 QString number = QString::number(lastCheck + 1);
346 config->setGroup(number);
347
348 QTableItem *qti1 = new QTableItem(tblTransactions, QTableItem::Never, number);
349 tblTransactions->setItem(row, 0, qti1);
350 tblTransactions->updateCell(row, 0);
351
352 QTableItem *qti2 = new QTableItem(tblTransactions, QTableItem::Never, result[7]);
353 tblTransactions->setItem(row, 2, qti2);
354 tblTransactions->updateCell(row, 2);
355
356 QTableItem *qti3 = new QTableItem(tblTransactions, QTableItem::Never, QString("$" + result[5]));
357 tblTransactions->setItem(row, 3, qti3);
358 tblTransactions->updateCell(row, 3);
359
360 // This is how the list looks:
361 // 0: true or false, true == payment, false == deposit
362 // 1: description of the transaction
363 // 2: category name
364 // 3: transaction type (stores the integer value of the index of the combobox)
365 // 4: check number of the transaction (if any)
366 // 5: transaction amount
367 // 6: transaction fee (e.g. service charge, or ATM charge).
368 // 7: date of the transaction
369 config->writeEntry("Payment", result[0]);
370 config->writeEntry("Description", result[1]);
371 if (result[0] == QString("true"))
372 {
373 config->writeEntry("Category", result[2]);
374 }
375 config->writeEntry("Type", result[3]);
376 config->writeEntry("CheckNumber", result[4]);
377 config->writeEntry("Amount", result[5]);
378 config->writeEntry("TransactionFee", result[6]);
379 config->writeEntry("Date", result[7]);
380 config->writeEntry("Comments", result[8]);
381 config->setGroup("Totals");
382 if (result[0] == QString("true"))
383 {
384 QString totalspent = config->readEntry("Spent", QString("0"));
385 totalspent = calculator(totalspent, result[5], false);
386 config->writeEntry("Spent", totalspent);
387 QString balance = config->readEntry("Balance", QString("0"));
388 balance = calculator(balance, result[5], true);
389
390 // Make sure to add the fee on, if any
391 balance = calculator(balance, result[6], true);
392
393 config->writeEntry("Balance", balance);
394
395 config->setGroup(number);
396 config->writeEntry("Balance", balance);
397
398 config->setGroup("Totals");
399 QString categorytotal = config->readEntry(result[2], QString("0"));
400 categorytotal = calculator(categorytotal, result[5], false);
401 config->writeEntry(result[2], categorytotal);
402 }
403 if (result[0] == QString("false"))
404 {
405 QString totaldeposited = config->readEntry("Deposited", QString("0"));
406 totaldeposited = calculator(totaldeposited, result[5], false);
407 config->writeEntry("Deposited", totaldeposited);
408 QString balance = config->readEntry("Balance", QString("0"));
409 balance = calculator(balance, result[5], false);
410
411 // Make sure to add the fee on, if any
412 balance = calculator(balance, result[6], true);
413
414 config->writeEntry("Balance", balance);
415
416 config->setGroup(number);
417 config->writeEntry("Balance", balance);
418 }
419 }
420 config->setGroup("Totals");
421 labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00"))));
422 config->write();
423}
424
425QString QCheckView::calculator(QString largervalue, QString smallervalue, bool subtract)
426{
427 // This class provides a way to eliminate the ARM processor problem of not being able to handle
428 // decimals. I just take the two QString'ed numbers and find the decimal point, then I remove the decimal
429 // point seperating the number into two. Then I convert it to cents (times it times 100) and add/
430 // substract the two together. Put the decimals back in, and return.
431
432 largervalue = largervalue.remove(largervalue.find(".", 0, false), 1);
433 smallervalue = smallervalue.remove(smallervalue.find(".", 0, false), 1);
434
435 int largercents = largervalue.toInt();
436 int smallercents = smallervalue.toInt();
437
438 int finalammount = 0;
439
440 if (subtract == true)
441 {
442 finalammount = largercents - smallercents;
443 } else {
444 finalammount = largercents + smallercents;
445 }
446
447 QString returnvalue = QString::number(finalammount);
448 if (returnvalue.length() >= 2)
449 {
450 returnvalue.insert((returnvalue.length() - 2), ".");
451 } else {
452 if (returnvalue.length() == 1)
453 {
454 returnvalue.prepend("0.0");
455 }
456 }
457 return returnvalue;
458}
diff --git a/noncore/apps/checkbook/qcheckviewbase.ui b/noncore/apps/checkbook/qcheckviewbase.ui
deleted file mode 100644
index 00ed7dd..0000000
--- a/noncore/apps/checkbook/qcheckviewbase.ui
+++ b/dev/null
@@ -1,122 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckViewBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckViewBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>242</width>
15 <height>312</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Account Transactions</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>5</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>1</number>
30 </property>
31 <widget row="0" column="1" >
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>labelBalance</cstring>
36 </property>
37 <property stdset="1">
38 <name>frameShape</name>
39 <enum>MShape</enum>
40 </property>
41 <property stdset="1">
42 <name>frameShadow</name>
43 <enum>MShadow</enum>
44 </property>
45 <property stdset="1">
46 <name>text</name>
47 <string>$0.00</string>
48 </property>
49 <property stdset="1">
50 <name>alignment</name>
51 <set>AlignCenter</set>
52 </property>
53 <property>
54 <name>hAlign</name>
55 </property>
56 </widget>
57 <widget row="1" column="0" rowspan="1" colspan="2" >
58 <class>QTable</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>tblTransactions</cstring>
62 </property>
63 <property stdset="1">
64 <name>hScrollBarMode</name>
65 <enum>AlwaysOff</enum>
66 </property>
67 <property stdset="1">
68 <name>numRows</name>
69 <number>0</number>
70 </property>
71 <property stdset="1">
72 <name>numCols</name>
73 <number>4</number>
74 </property>
75 <property stdset="1">
76 <name>showGrid</name>
77 <bool>false</bool>
78 </property>
79 </widget>
80 <widget row="0" column="0" >
81 <class>QLabel</class>
82 <property stdset="1">
83 <name>name</name>
84 <cstring>TextLabel3</cstring>
85 </property>
86 <property stdset="1">
87 <name>text</name>
88 <string>Balance:</string>
89 </property>
90 <property stdset="1">
91 <name>alignment</name>
92 <set>AlignVCenter|AlignRight</set>
93 </property>
94 <property>
95 <name>hAlign</name>
96 </property>
97 </widget>
98 </grid>
99</widget>
100<customwidgets>
101 <customwidget>
102 <class>QWidget</class>
103 <header location="global">qwidget.h</header>
104 <sizehint>
105 <width>-1</width>
106 <height>-1</height>
107 </sizehint>
108 <container>0</container>
109 <sizepolicy>
110 <hordata>5</hordata>
111 <verdata>5</verdata>
112 </sizepolicy>
113 <pixmap>image0</pixmap>
114 </customwidget>
115</customwidgets>
116<images>
117 <image>
118 <name>image0</name>
119 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
120 </image>
121</images>
122</UI>
diff --git a/noncore/apps/checkbook/qrestrictedcombo.cpp b/noncore/apps/checkbook/qrestrictedcombo.cpp
deleted file mode 100644
index e1533f6..0000000
--- a/noncore/apps/checkbook/qrestrictedcombo.cpp
+++ b/dev/null
@@ -1,78 +0,0 @@
1/*
2 *
3 * $Id$
4 *
5 * Implementation of QRestrictedCombo
6 *
7 * Copyright (C) 1997 Michael Wiedmann, <mw@miwie.in-berlin.de>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the Free
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <qkeycode.h>
26
27#include "qrestrictedcombo.h"
28
29QRestrictedCombo::QRestrictedCombo( QWidget *parent,
30 const char *name,
31 const QString& valid )
32 : QComboBox( parent, name )
33{
34 qsValidChars = valid;
35}
36
37QRestrictedCombo::~QRestrictedCombo()
38{
39 ;
40}
41
42
43void QRestrictedCombo::keyPressEvent( QKeyEvent *e )
44{
45 // let QLineEdit process "special" keys and return/enter
46 // so that we still can use the default key binding
47 if (e->key() == Key_Enter || e->key() == Key_Return || e->key() == Key_Delete || e->ascii() < 32)
48 {
49 QComboBox::keyPressEvent(e);
50 return;
51 }
52
53 // do we have a list of valid chars &&
54 // is the pressed key in the list of valid chars?
55 if (!qsValidChars.isEmpty() && !qsValidChars.contains(e->ascii()))
56 {
57 // invalid char, emit signal and return
58 emit (invalidChar(e->key()));
59 return;
60 }
61 else
62 // valid char: let QLineEdit process this key as usual
63 QComboBox::keyPressEvent(e);
64
65 return;
66}
67
68
69void QRestrictedCombo::setValidChars( const QString& valid)
70{
71 qsValidChars = valid;
72}
73
74QString QRestrictedCombo::validChars() const
75{
76 return qsValidChars;
77}
78
diff --git a/noncore/apps/checkbook/qrestrictedcombo.h b/noncore/apps/checkbook/qrestrictedcombo.h
deleted file mode 100644
index 50ea59f..0000000
--- a/noncore/apps/checkbook/qrestrictedcombo.h
+++ b/dev/null
@@ -1,96 +0,0 @@
1/*
2 *
3 * Definition of QRestrictedCombo
4 *
5 * Copyright (C) 1997 Michael Wiedmann, <mw@miwie.in-berlin.de>
6 *
7 * Edited 2001 by Nick Betcher <nbetcher@usinternet.com> to work
8 * with Qt-only. Changed class name from LRestrictedLine to
9 * QRestrictedCombo in order to accomidate Combo Boxes.
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef QRESTRICTEDCOMBO_H
28#define QRESTRICTEDCOMBO_H
29
30#include <qcombobox.h>
31
32/**
33 * The QRestrictedCombo widget is a variant of @ref QComboBox which
34 * accepts only a restricted set of characters as input.
35 * All other characters will be discarded and the signal @ref #invalidChar()
36 * will be emitted for each of them.
37 *
38 * Valid characters can be passed as a QString to the constructor
39 * or set afterwards via @ref #setValidChars().
40 * The default key bindings of @ref QComboBox are still in effect.
41 *
42 * @short A line editor for restricted character sets.
43 * @author Michael Wiedmann <mw@miwie.in-berlin.de>
44 * @version 0.0.1
45 */
46class QRestrictedCombo : public QComboBox
47{
48 Q_OBJECT
49 Q_PROPERTY( QString validChars READ validChars WRITE setValidChars )
50
51public:
52
53 /**
54 * Constructor: This contructor takes three - optional - arguments.
55 * The first two parameters are simply passed on to @ref QLineEdit.
56 * @param parent pointer to the parent widget
57 * @param name pointer to the name of this widget
58 * @param valid pointer to set of valid characters
59 */
60 QRestrictedCombo( QWidget *parent=0, const char *name=0,
61 const QString& valid = QString::null);
62
63 /**
64 * Destructs the restricted line editor.
65 */
66 ~QRestrictedCombo();
67
68 /**
69 * All characters in the string valid are treated as
70 * acceptable characters.
71 */
72 void setValidChars(const QString& valid);
73 /**
74 * @return the string of acceptable characters.
75 */
76 QString validChars() const;
77
78signals:
79
80 /**
81 * Emitted when an invalid character was typed.
82 */
83 voidinvalidChar(int);
84
85protected:
86 /**
87 * @reimplemented
88 */
89 voidkeyPressEvent( QKeyEvent *e );
90
91private:
92 /// QString of valid characters for this line
93 QStringqsValidChars;
94};
95
96#endif // QRESTRICTEDCOMBO_H
diff --git a/noncore/apps/checkbook/qrestrictedline.cpp b/noncore/apps/checkbook/qrestrictedline.cpp
deleted file mode 100644
index 8508c33..0000000
--- a/noncore/apps/checkbook/qrestrictedline.cpp
+++ b/dev/null
@@ -1,78 +0,0 @@
1/*
2 *
3 * $Id$
4 *
5 * Implementation of QRestrictedLine
6 *
7 * Copyright (C) 1997 Michael Wiedmann, <mw@miwie.in-berlin.de>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the Free
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <qkeycode.h>
26
27#include "qrestrictedline.h"
28
29QRestrictedLine::QRestrictedLine( QWidget *parent,
30 const char *name,
31 const QString& valid )
32 : QLineEdit( parent, name )
33{
34 qsValidChars = valid;
35}
36
37QRestrictedLine::~QRestrictedLine()
38{
39 ;
40}
41
42
43void QRestrictedLine::keyPressEvent( QKeyEvent *e )
44{
45 // let QLineEdit process "special" keys and return/enter
46 // so that we still can use the default key binding
47 if (e->key() == Key_Enter || e->key() == Key_Return || e->key() == Key_Delete || e->ascii() < 32)
48 {
49 QLineEdit::keyPressEvent(e);
50 return;
51 }
52
53 // do we have a list of valid chars &&
54 // is the pressed key in the list of valid chars?
55 if (!qsValidChars.isEmpty() && !qsValidChars.contains(e->ascii()))
56 {
57 // invalid char, emit signal and return
58 emit (invalidChar(e->key()));
59 return;
60 }
61 else
62 // valid char: let QLineEdit process this key as usual
63 QLineEdit::keyPressEvent(e);
64
65 return;
66}
67
68
69void QRestrictedLine::setValidChars( const QString& valid)
70{
71 qsValidChars = valid;
72}
73
74QString QRestrictedLine::validChars() const
75{
76 return qsValidChars;
77}
78
diff --git a/noncore/apps/checkbook/qrestrictedline.h b/noncore/apps/checkbook/qrestrictedline.h
deleted file mode 100644
index 7e41cd9..0000000
--- a/noncore/apps/checkbook/qrestrictedline.h
+++ b/dev/null
@@ -1,96 +0,0 @@
1/*
2 *
3 * Definition of QRestrictedLine
4 *
5 * Copyright (C) 1997 Michael Wiedmann, <mw@miwie.in-berlin.de>
6 *
7 * Edited 2001 by Nick Betcher <nbetcher@usinternet.com> to work
8 * with Qt-only. Changed class name from QRestrictedLine to
9 * QRestrictedLine.
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef QRESTRICTEDLINE_H
28#define QRESTRICTEDLINE_H
29
30#include <qlineedit.h>
31
32/**
33 * The QRestrictedLine widget is a variant of @ref QLineEdit which
34 * accepts only a restricted set of characters as input.
35 * All other characters will be discarded and the signal @ref #invalidChar()
36 * will be emitted for each of them.
37 *
38 * Valid characters can be passed as a QString to the constructor
39 * or set afterwards via @ref #setValidChars().
40 * The default key bindings of @ref QLineEdit are still in effect.
41 *
42 * @short A line editor for restricted character sets.
43 * @author Michael Wiedmann <mw@miwie.in-berlin.de>
44 * @version 0.0.1
45 */
46class QRestrictedLine : public QLineEdit
47{
48 Q_OBJECT
49 Q_PROPERTY( QString validChars READ validChars WRITE setValidChars )
50
51public:
52
53 /**
54 * Constructor: This contructor takes three - optional - arguments.
55 * The first two parameters are simply passed on to @ref QLineEdit.
56 * @param parent pointer to the parent widget
57 * @param name pointer to the name of this widget
58 * @param valid pointer to set of valid characters
59 */
60 QRestrictedLine( QWidget *parent=0, const char *name=0,
61 const QString& valid = QString::null);
62
63 /**
64 * Destructs the restricted line editor.
65 */
66 ~QRestrictedLine();
67
68 /**
69 * All characters in the string valid are treated as
70 * acceptable characters.
71 */
72 void setValidChars(const QString& valid);
73 /**
74 * @return the string of acceptable characters.
75 */
76 QString validChars() const;
77
78signals:
79
80 /**
81 * Emitted when an invalid character was typed.
82 */
83 voidinvalidChar(int);
84
85protected:
86 /**
87 * @reimplemented
88 */
89 voidkeyPressEvent( QKeyEvent *e );
90
91private:
92 /// QString of valid characters for this line
93 QStringqsValidChars;
94};
95
96#endif // QRESTRICTEDLINE_H