summaryrefslogtreecommitdiff
path: root/noncore/apps
authorcniehaus <cniehaus>2002-09-15 14:23:06 (UTC)
committer cniehaus <cniehaus>2002-09-15 14:23:06 (UTC)
commita7dc3fe0c963ef8f5f19c04c2806daeb91ba23c8 (patch) (unidiff)
tree4f6040e942db66db4130f8faecb9ba74527c35d5 /noncore/apps
parentbefc227723d5d6ac6eb2e8c142624a24a79ff72f (diff)
downloadopie-a7dc3fe0c963ef8f5f19c04c2806daeb91ba23c8.zip
opie-a7dc3fe0c963ef8f5f19c04c2806daeb91ba23c8.tar.gz
opie-a7dc3fe0c963ef8f5f19c04c2806daeb91ba23c8.tar.bz2
hehe
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/calcdlg.ui243
-rw-r--r--noncore/apps/checkbook/checkbook.pro50
-rw-r--r--noncore/apps/checkbook/config.cpp560
-rw-r--r--noncore/apps/checkbook/config.h99
-rw-r--r--noncore/apps/checkbook/qcheckbook.cpp147
-rw-r--r--noncore/apps/checkbook/qcheckdetails.cpp119
-rw-r--r--noncore/apps/checkbook/qcheckdetails.h27
-rw-r--r--noncore/apps/checkbook/qcheckdetailsbase.ui62
-rw-r--r--noncore/apps/checkbook/qcheckentry.cpp256
-rw-r--r--noncore/apps/checkbook/qcheckentry.h31
-rw-r--r--noncore/apps/checkbook/qchecknamebase.ui136
-rw-r--r--noncore/apps/checkbook/qcheckview.h33
12 files changed, 243 insertions, 1520 deletions
diff --git a/noncore/apps/checkbook/calcdlg.ui b/noncore/apps/checkbook/calcdlg.ui
new file mode 100644
index 0000000..7637ca8
--- a/dev/null
+++ b/noncore/apps/checkbook/calcdlg.ui
@@ -0,0 +1,243 @@
1<!DOCTYPE UI><UI>
2<class>CalcDlg</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>CalcDlg</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>222</width>
15 <height>274</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Network Time</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <widget>
29 <class>QTabWidget</class>
30 <property stdset="1">
31 <name>name</name>
32 <cstring>TabWidgetMain</cstring>
33 </property>
34 <property stdset="1">
35 <name>geometry</name>
36 <rect>
37 <x>10</x>
38 <y>0</y>
39 <width>200</width>
40 <height>260</height>
41 </rect>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <widget>
50 <class>QWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tabMain</cstring>
54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Molweight</string>
58 </attribute>
59 <widget>
60 <class>QFrame</class>
61 <property stdset="1">
62 <name>name</name>
63 <cstring>FrameSystemTime</cstring>
64 </property>
65 <property stdset="1">
66 <name>geometry</name>
67 <rect>
68 <x>2</x>
69 <y>2</y>
70 <width>180</width>
71 <height>220</height>
72 </rect>
73 </property>
74 <property stdset="1">
75 <name>frameShape</name>
76 <enum>StyledPanel</enum>
77 </property>
78 <property stdset="1">
79 <name>frameShadow</name>
80 <enum>Raised</enum>
81 </property>
82 <widget>
83 <class>QLabel</class>
84 <property stdset="1">
85 <name>name</name>
86 <cstring>TextLabel1_4</cstring>
87 </property>
88 <property stdset="1">
89 <name>geometry</name>
90 <rect>
91 <x>1</x>
92 <y>1</y>
93 <width>298</width>
94 <height>16</height>
95 </rect>
96 </property>
97 <property stdset="1">
98 <name>text</name>
99 <string>Formula:</string>
100 </property>
101 </widget>
102 <widget>
103 <class>QLabel</class>
104 <property stdset="1">
105 <name>name</name>
106 <cstring>TextLabel2_4</cstring>
107 </property>
108 <property stdset="1">
109 <name>geometry</name>
110 <rect>
111 <x>1</x>
112 <y>86</y>
113 <width>298</width>
114 <height>16</height>
115 </rect>
116 </property>
117 <property stdset="1">
118 <name>text</name>
119 <string>Result:</string>
120 </property>
121 </widget>
122 <widget>
123 <class>QLayoutWidget</class>
124 <property stdset="1">
125 <name>name</name>
126 <cstring>Layout7</cstring>
127 </property>
128 <property stdset="1">
129 <name>geometry</name>
130 <rect>
131 <x>0</x>
132 <y>50</y>
133 <width>175</width>
134 <height>30</height>
135 </rect>
136 </property>
137 <hbox>
138 <property stdset="1">
139 <name>margin</name>
140 <number>0</number>
141 </property>
142 <property stdset="1">
143 <name>spacing</name>
144 <number>6</number>
145 </property>
146 <widget>
147 <class>QPushButton</class>
148 <property stdset="1">
149 <name>name</name>
150 <cstring>calculate</cstring>
151 </property>
152 <property stdset="1">
153 <name>text</name>
154 <string>Calculate</string>
155 </property>
156 </widget>
157 <widget>
158 <class>QPushButton</class>
159 <property stdset="1">
160 <name>name</name>
161 <cstring>clear_fields</cstring>
162 </property>
163 <property stdset="1">
164 <name>text</name>
165 <string>Clear</string>
166 </property>
167 </widget>
168 </hbox>
169 </widget>
170 <widget>
171 <class>QLineEdit</class>
172 <property stdset="1">
173 <name>name</name>
174 <cstring>formula</cstring>
175 </property>
176 <property stdset="1">
177 <name>geometry</name>
178 <rect>
179 <x>0</x>
180 <y>20</y>
181 <width>170</width>
182 <height>22</height>
183 </rect>
184 </property>
185 </widget>
186 <widget>
187 <class>QMultiLineEdit</class>
188 <property stdset="1">
189 <name>name</name>
190 <cstring>anal_display</cstring>
191 </property>
192 <property stdset="1">
193 <name>geometry</name>
194 <rect>
195 <x>0</x>
196 <y>130</y>
197 <width>170</width>
198 <height>80</height>
199 </rect>
200 </property>
201 </widget>
202 <widget>
203 <class>QLineEdit</class>
204 <property stdset="1">
205 <name>name</name>
206 <cstring>LineEdit2</cstring>
207 </property>
208 <property stdset="1">
209 <name>geometry</name>
210 <rect>
211 <x>0</x>
212 <y>100</y>
213 <width>170</width>
214 <height>22</height>
215 </rect>
216 </property>
217 </widget>
218 </widget>
219 </widget>
220 <widget>
221 <class>QWidget</class>
222 <property stdset="1">
223 <name>name</name>
224 <cstring>tabNtp</cstring>
225 </property>
226 <attribute>
227 <name>title</name>
228 <string>Nernst</string>
229 </attribute>
230 <grid>
231 <property stdset="1">
232 <name>margin</name>
233 <number>1</number>
234 </property>
235 <property stdset="1">
236 <name>spacing</name>
237 <number>2</number>
238 </property>
239 </grid>
240 </widget>
241 </widget>
242</widget>
243</UI>
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro
deleted file mode 100644
index e9e2167..0000000
--- a/noncore/apps/checkbook/checkbook.pro
+++ b/dev/null
@@ -1,50 +0,0 @@
1 TEMPLATE= app
2 CONFIG = qt warn_on release
3 HEADERS = config.h \
4 qcheckbook.h \
5 qcheckdetails.h \
6 qcheckentry.h \
7 qcheckgraph.h \
8 qcheckmainmenu.h \
9 qcheckname.h \
10 qcheckview.h \
11 qrestrictedcombo.h \
12 qrestrictedline.h
13 SOURCES = config.cpp \
14 main.cpp \
15 qcheckbook.cpp \
16 qcheckdetails.cpp \
17 qcheckentry.cpp \
18 qcheckgraph.cpp \
19 qcheckmainmenu.cpp \
20 qcheckname.cpp \
21 qcheckview.cpp \
22 qrestrictedcombo.cpp \
23 qrestrictedline.cpp
24 INTERFACES= qcheckdetailsbase.ui \
25 qcheckentrybase.ui \
26 qcheckgraphbase.ui \
27 qcheckmmbase.ui \
28 qchecknamebase.ui \
29 qcheckviewbase.ui
30INCLUDEPATH += $(OPIEDIR)/include
31DEPENDPATH += $(OPIEDIR)/include
32 LIBS += -lqpe
33 TARGET = checkbook
34 DESTDIR = $(OPIEDIR)/bin
35
36TRANSLATIONS = ../../../i18n/de/checkbook.ts \
37 ../../../i18n/en/checkbook.ts \
38 ../../../i18n/es/checkbook.ts \
39 ../../../i18n/fr/checkbook.ts \
40 ../../../i18n/hu/checkbook.ts \
41 ../../../i18n/ja/checkbook.ts \
42 ../../../i18n/ko/checkbook.ts \
43 ../../../i18n/no/checkbook.ts \
44 ../../../i18n/pl/checkbook.ts \
45 ../../../i18n/pt/checkbook.ts \
46 ../../../i18n/pt_BR/checkbook.ts \
47 ../../../i18n/sl/checkbook.ts \
48 ../../../i18n/zh_CN/checkbook.ts \
49 ../../../i18n/zh_TW/checkbook.ts \
50 ../../../i18n/it/checkbook.ts
diff --git a/noncore/apps/checkbook/config.cpp b/noncore/apps/checkbook/config.cpp
deleted file mode 100644
index e6c6dcc..0000000
--- a/noncore/apps/checkbook/config.cpp
+++ b/dev/null
@@ -1,560 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qdir.h>
22#include <qfile.h>
23#include <qfileinfo.h>
24#include <qmessagebox.h>
25#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
26#include <qtextcodec.h>
27#endif
28#include <qtextstream.h>
29
30#include <sys/stat.h>
31#include <sys/types.h>
32#include <fcntl.h>
33#include <stdlib.h>
34#include <unistd.h>
35
36#include "config.h"
37
38
39/*!
40 \internal
41*/
42QString Config::configFilename(const QString& name, Domain d)
43{
44 switch (d) {
45 case File:
46 return name;
47 case User: {
48 QDir dir = (QString(getenv("HOME")) + "/Settings");
49 if ( !dir.exists() )
50 mkdir(dir.path().local8Bit(),0700);
51 return dir.path() + "/" + name + ".conf";
52 }
53 }
54 return name;
55}
56
57/*!
58 \class Config config.h
59 \brief The Config class provides for saving application cofniguration state.
60
61 You should keep a Config in existence only while you do not want others
62 to be able to change the state. There is no locking currently, but there
63 may be in the future.
64*/
65
66/*!
67 \enum Config::ConfigGroup
68 \internal
69*/
70
71/*!
72 \enum Config::Domain
73
74 \value File
75 \value User
76
77 See Config for details.
78*/
79
80/*!
81 Constructs a config that will load or create a configuration with the
82 given \a name in the given \a domain.
83
84 You must call setGroup() before doing much else with the Config.
85
86 In the default Domain, \e User,
87 the configuration is user-specific. \a name should not contain "/" in
88 this case, and in general should be the name of the C++ class that is
89 primarily responsible for maintaining the configuration.
90
91 In the File Domain, \a name is an absolute filename.
92*/
93Config::Config( const QString &name, Domain domain )
94 : filename( configFilename(name,domain) )
95{
96 git = groups.end();
97 read();
98
99 lang = getenv("LANG");
100 int i = lang.find(".");
101 if ( i > 0 )
102 lang = lang.left( i );
103 i = lang.find( "_" );
104 if ( i > 0 )
105 glang = lang.left(i);
106}
107
108/*!
109 Writes any changes to disk and destroys the in-memory object.
110*/
111Config::~Config()
112{
113 if ( changed )
114 write();
115}
116
117/*!
118 Returns whether the current group has an entry called \a key.
119*/
120bool Config::hasKey( const QString &key ) const
121{
122 if ( groups.end() == git )
123 return FALSE;
124 ConfigGroup::ConstIterator it = ( *git ).find( key );
125 return it != ( *git ).end();
126}
127
128/*!
129 Sets the current group for subsequent reading and writing of
130 entries to \a gname. Grouping allows the application to partition the namespace.
131
132 This function must be called prior to any reading or writing
133 of entries.
134
135 The \a gname must not be empty.
136*/
137void Config::setGroup( const QString &gname )
138{
139 QMap< QString, ConfigGroup>::Iterator it = groups.find( gname );
140 if ( it == groups.end() ) {
141 git = groups.insert( gname, ConfigGroup() );
142 changed = TRUE;
143 return;
144 }
145 git = it;
146}
147
148/*!
149 Writes a (\a key, \a value) entry to the current group.
150
151 \sa readEntry()
152*/
153void Config::writeEntry( const QString &key, const char* value )
154{
155 writeEntry(key,QString(value));
156}
157
158/*!
159 Writes a (\a key, \a value) entry to the current group.
160
161 \sa readEntry()
162*/
163void Config::writeEntry( const QString &key, const QString &value )
164{
165 if ( git == groups.end() ) {
166 qWarning( "no group set" );
167 return;
168 }
169 if ( (*git)[key] != value ) {
170 ( *git ).insert( key, value );
171 changed = TRUE;
172 }
173}
174
175/*
176 Note that the degree of protection offered by the encryption here is
177 only sufficient to avoid the most casual observation of the configuration
178 files. People with access to the files can write down the contents and
179 decrypt it using this source code.
180
181 Conceivably, and at some burden to the user, this encryption could
182 be improved.
183*/
184static QString encipher(const QString& plain)
185{
186 // mainly, we make it long
187 QString cipher;
188 int mix=28730492;
189 for (int i=0; i<(int)plain.length(); i++) {
190 int u = plain[i].unicode();
191 int c = u ^ mix;
192 QString x = QString::number(c,36);
193 cipher.append(QChar('a'+x.length()));
194 cipher.append(x);
195 mix *= u;
196 }
197 return cipher;
198}
199
200static QString decipher(const QString& cipher)
201{
202 QString plain;
203 int mix=28730492;
204 for (int i=0; i<(int)cipher.length();) {
205 int l = cipher[i].unicode()-'a';
206 QString x = cipher.mid(i+1,l); i+=l+1;
207 int u = x.toInt(0,36) ^ mix;
208 plain.append(QChar(u));
209 mix *= u;
210 }
211 return plain;
212}
213
214/*!
215 Writes an encrypted (\a key, \a value) entry to the current group.
216
217 Note that the degree of protection offered by the encryption is
218 only sufficient to avoid the most casual observation of the configuration
219 files.
220
221 \sa readEntry()
222*/
223void Config::writeEntryCrypt( const QString &key, const QString &value )
224{
225 if ( git == groups.end() ) {
226 qWarning( "no group set" );
227 return;
228 }
229 QString evalue = encipher(value);
230 if ( (*git)[key] != evalue ) {
231 ( *git ).insert( key, evalue );
232 changed = TRUE;
233 }
234}
235
236/*!
237 Writes a (\a key, \a num) entry to the current group.
238
239 \sa readNumEntry()
240*/
241void Config::writeEntry( const QString &key, int num )
242{
243 QString s;
244 s.setNum( num );
245 writeEntry( key, s );
246}
247
248#ifdef Q_HAS_BOOL_TYPE
249/*!
250 Writes a (\a key, \a b) entry to the current group. This is equivalent
251 to writing a 0 or 1 as an integer entry.
252
253 \sa readBoolEntry()
254*/
255void Config::writeEntry( const QString &key, bool b )
256{
257 QString s;
258 s.setNum( ( int )b );
259 writeEntry( key, s );
260}
261#endif
262
263/*!
264 Writes a (\a key, \a lst) entry to the current group. The list
265 is separated by \a sep, so the strings must not contain that character.
266
267 \sa readListEntry()
268*/
269void Config::writeEntry( const QString &key, const QStringList &lst, const QChar &sep )
270{
271 QString s;
272 QStringList::ConstIterator it = lst.begin();
273 for ( ; it != lst.end(); ++it )
274 s += *it + sep;
275 writeEntry( key, s );
276}
277
278/*!
279 Removes the \a key entry from the current group. Does nothing if
280 there is no such entry.
281*/
282
283void Config::removeEntry( const QString &key )
284{
285 if ( git == groups.end() ) {
286 qWarning( "no group set" );
287 return;
288 }
289 ( *git ).remove( key );
290 changed = TRUE;
291}
292
293/*!
294 \fn bool Config::operator == ( const Config & other ) const
295
296 Tests for equality with \a other. Config objects are equal if they refer to the same filename.
297*/
298
299/*!
300 \fn bool Config::operator != ( const Config & other ) const
301
302 Tests for inequality with \a other. Config objects are equal if they refer to the same filename.
303*/
304
305/*!
306 \fn QString Config::readEntry( const QString &key, const QString &deflt ) const
307
308 Reads a string entry stored with \a key, defaulting to \a deflt if there is no entry.
309*/
310
311/*!
312 \internal
313 For compatibility, non-const version.
314*/
315QString Config::readEntry( const QString &key, const QString &deflt )
316{
317 QString res = readEntryDirect( key+"["+lang+"]" );
318 if ( !res.isNull() )
319 return res;
320 if ( !glang.isEmpty() ) {
321 res = readEntryDirect( key+"["+glang+"]" );
322 if ( !res.isNull() )
323 return res;
324 }
325 return readEntryDirect( key, deflt );
326}
327
328/*!
329 \fn QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const
330
331 Reads an encrypted string entry stored with \a key, defaulting to \a deflt if there is no entry.
332*/
333
334/*!
335 \internal
336 For compatibility, non-const version.
337*/
338QString Config::readEntryCrypt( const QString &key, const QString &deflt )
339{
340 QString res = readEntryDirect( key+"["+lang+"]" );
341 if ( res.isNull() && glang.isEmpty() )
342 res = readEntryDirect( key+"["+glang+"]" );
343 if ( res.isNull() )
344 res = readEntryDirect( key, QString::null );
345 if ( res.isNull() )
346 return deflt;
347 return decipher(res);
348}
349
350/*!
351 \fn QString Config::readEntryDirect( const QString &key, const QString &deflt ) const
352 \internal
353*/
354
355/*!
356 \internal
357 For compatibility, non-const version.
358*/
359QString Config::readEntryDirect( const QString &key, const QString &deflt )
360{
361 if ( git == groups.end() ) {
362 //qWarning( "no group set" );
363 return deflt;
364 }
365 ConfigGroup::ConstIterator it = ( *git ).find( key );
366 if ( it != ( *git ).end() )
367 return *it;
368 else
369 return deflt;
370}
371
372/*!
373 \fn int Config::readNumEntry( const QString &key, int deflt ) const
374 Reads a numeric entry stored with \a key, defaulting to \a deflt if there is no entry.
375*/
376
377/*!
378 \internal
379 For compatibility, non-const version.
380*/
381int Config::readNumEntry( const QString &key, int deflt )
382{
383 QString s = readEntry( key );
384 if ( s.isEmpty() )
385 return deflt;
386 else
387 return s.toInt();
388}
389
390/*!
391 \fn bool Config::readBoolEntry( const QString &key, bool deflt ) const
392 Reads a bool entry stored with \a key, defaulting to \a deflt if there is no entry.
393*/
394
395/*!
396 \internal
397 For compatibility, non-const version.
398*/
399bool Config::readBoolEntry( const QString &key, bool deflt )
400{
401 QString s = readEntry( key );
402 if ( s.isEmpty() )
403 return deflt;
404 else
405 return (bool)s.toInt();
406}
407
408/*!
409 \fn QStringList Config::readListEntry( const QString &key, const QChar &sep ) const
410 Reads a string list entry stored with \a key, and with \a sep as the separator.
411*/
412
413/*!
414 \internal
415 For compatibility, non-const version.
416*/
417
418/*!
419 Removes all entries from the current group.
420*/
421void Config::clearGroup()
422{
423 if ( git == groups.end() ) {
424 qWarning( "no group set" );
425 return;
426 }
427 if ( !(*git).isEmpty() ) {
428 ( *git ).clear();
429 changed = TRUE;
430 }
431}
432
433void Config::removeGroup()
434{
435 if ( git == groups.end() ) {
436 qWarning( "no group set" );
437 return;
438 }
439
440 groups.remove(git);
441 changed = TRUE;
442}
443
444/*!
445 \internal
446*/
447void Config::write( const QString &fn )
448{
449 QString strNewFile;
450 if ( !fn.isEmpty() )
451 filename = fn;
452 strNewFile = filename + ".new";
453
454 QFile f( strNewFile );
455 if ( !f.open( IO_WriteOnly|IO_Raw ) ) {
456 qWarning( "could not open for writing `%s'", strNewFile.latin1() );
457 git = groups.end();
458 return;
459 }
460
461 QString str;
462 QCString cstr;
463 QMap< QString, ConfigGroup >::Iterator g_it = groups.begin();
464
465 for ( ; g_it != groups.end(); ++g_it ) {
466 str += "[" + g_it.key() + "]\n";
467 ConfigGroup::Iterator e_it = ( *g_it ).begin();
468 for ( ; e_it != ( *g_it ).end(); ++e_it )
469 str += e_it.key() + " = " + *e_it + "\n";
470 }
471 cstr = str.utf8();
472
473 int total_length;
474 total_length = f.writeBlock( cstr.data(), cstr.length() );
475 if ( total_length != int(cstr.length()) ) {
476 QMessageBox::critical( 0, QObject::tr("Out of Space"),
477 QObject::tr("There was a problem creating\nConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") );
478 f.close();
479 QFile::remove( strNewFile );
480 return;
481 }
482
483 f.close();
484 // now rename the file...
485 if ( rename( strNewFile, filename ) < 0 ) {
486 qWarning( "problem renaming the file %s to %s", strNewFile.latin1(),
487 filename.latin1() );
488 QFile::remove( strNewFile );
489 }
490}
491
492/*!
493 Returns whether the Config is in a valid state.
494*/
495bool Config::isValid() const
496{
497 return groups.end() != git;
498}
499
500/*!
501 \internal
502*/
503void Config::read()
504{
505 changed = FALSE;
506
507 if ( !QFileInfo( filename ).exists() ) {
508 git = groups.end();
509 return;
510 }
511
512 QFile f( filename );
513 if ( !f.open( IO_ReadOnly ) ) {
514 git = groups.end();
515 return;
516 }
517
518 QTextStream s( &f );
519#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
520 // The below should work, but doesn't in Qt 2.3.0
521 s.setCodec( QTextCodec::codecForMib( 106 ) );
522#else
523 s.setEncoding( QTextStream::UnicodeUTF8 );
524#endif
525
526 QStringList list = QStringList::split('\n', s.read() );
527 f.close();
528
529 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
530 if ( !parse( *it ) ) {
531 git = groups.end();
532 return;
533 }
534 }
535}
536
537/*!
538 \internal
539*/
540bool Config::parse( const QString &l )
541{
542 QString line = l.stripWhiteSpace();
543 if ( line[ 0 ] == QChar( '[' ) ) {
544 QString gname = line;
545 gname = gname.remove( 0, 1 );
546 if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) )
547 gname = gname.remove( gname.length() - 1, 1 );
548 git = groups.insert( gname, ConfigGroup() );
549 } else if ( !line.isEmpty() ) {
550 if ( git == groups.end() )
551 return FALSE;
552 int eq = line.find( '=' );
553 if ( eq == -1 )
554 return FALSE;
555 QString key = line.left(eq).stripWhiteSpace();
556 QString value = line.mid(eq+1).stripWhiteSpace();
557 ( *git ).insert( key, value );
558 }
559 return TRUE;
560}
diff --git a/noncore/apps/checkbook/config.h b/noncore/apps/checkbook/config.h
deleted file mode 100644
index b3a8561..0000000
--- a/noncore/apps/checkbook/config.h
+++ b/dev/null
@@ -1,99 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef CONFIG_H
22#define CONFIG_H
23
24// ##### could use QSettings with Qt 3.0
25
26#include <qmap.h>
27#include <qstringlist.h>
28
29class ConfigPrivate;
30class Config
31{
32public:
33 typedef QMap< QString, QString > ConfigGroup;
34
35 enum Domain { File, User };
36 Config( const QString &name, Domain domain=User );
37 ~Config();
38
39 bool operator == ( const Config & other ) const { return (filename == other.filename); }
40 bool operator != ( const Config & other ) const { return (filename != other.filename); }
41
42 bool isValid() const;
43 bool hasKey( const QString &key ) const;
44
45 void setGroup( const QString &gname );
46 void writeEntry( const QString &key, const char* value );
47 void writeEntry( const QString &key, const QString &value );
48 void writeEntryCrypt( const QString &key, const QString &value );
49 void writeEntry( const QString &key, int num );
50#ifdef Q_HAS_BOOL_TYPE
51 void writeEntry( const QString &key, bool b );
52#endif
53 void writeEntry( const QString &key, const QStringList &lst, const QChar &sep );
54 void removeEntry( const QString &key );
55
56 QString readEntry( const QString &key, const QString &deflt = QString::null ) const;
57 QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const;
58 QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const;
59 int readNumEntry( const QString &key, int deflt = -1 ) const;
60 bool readBoolEntry( const QString &key, bool deflt = FALSE ) const;
61
62 // For compatibility, non-const versions.
63 QString readEntry( const QString &key, const QString &deflt );
64 QString readEntryCrypt( const QString &key, const QString &deflt );
65 QString readEntryDirect( const QString &key, const QString &deflt );
66 int readNumEntry( const QString &key, int deflt );
67 bool readBoolEntry( const QString &key, bool deflt );
68
69 void clearGroup();
70 void removeGroup();
71
72 void write( const QString &fn = QString::null );
73
74protected:
75 void read();
76 bool parse( const QString &line );
77
78 QMap< QString, ConfigGroup > groups;
79 QMap< QString, ConfigGroup >::Iterator git;
80 QString filename;
81 QString lang;
82 QString glang;
83 bool changed;
84 ConfigPrivate *d;
85 static QString configFilename(const QString& name, Domain);
86};
87
88inline QString Config::readEntry( const QString &key, const QString &deflt ) const
89{ return ((Config*)this)->readEntry(key,deflt); }
90inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const
91{ return ((Config*)this)->readEntryCrypt(key,deflt); }
92inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const
93{ return ((Config*)this)->readEntryDirect(key,deflt); }
94inline int Config::readNumEntry( const QString &key, int deflt ) const
95{ return ((Config*)this)->readNumEntry(key,deflt); }
96inline bool Config::readBoolEntry( const QString &key, bool deflt ) const
97{ return ((Config*)this)->readBoolEntry(key,deflt); }
98
99#endif
diff --git a/noncore/apps/checkbook/qcheckbook.cpp b/noncore/apps/checkbook/qcheckbook.cpp
deleted file mode 100644
index bb7a5ac..0000000
--- a/noncore/apps/checkbook/qcheckbook.cpp
+++ b/dev/null
@@ -1,147 +0,0 @@
1#include "qcheckbook.h"
2
3#include <qmenubar.h>
4#include <qstatusbar.h>
5#include <qpopupmenu.h>
6#include <qapplication.h>
7#include <qfile.h>
8#include <qdir.h>
9
10QCheckBook::QCheckBook()
11 : QMainWindow(),
12 m_view(),
13 m_view2(),
14 m_view3()
15{
16 initCheck = false;
17 initMM = false;
18 setCaption("Checking");
19 statusBar()->hide();
20 menuBar()->hide();
21
22 bar = new QToolBar(this);
23 bar->setHorizontalStretchable( TRUE );
24
25 addToolBar(bar);
26
27 Config config("qcheckbook");
28 config.setGroup("Global");
29 QString lastCheck = config.readEntry("LastCheckBook", QString(""));
30
31 QString checkdirname = QDir::homeDirPath();
32 checkdirname.append("/.checkbooks/");
33 checkdirname.append(lastCheck);
34 QFile f(checkdirname);
35
36
37 if (lastCheck.isEmpty() == false && lastCheck != "" && f.exists() == true)
38 {
39 newCheck(lastCheck);
40 } else {
41 initMainMenus();
42 }
43
44 setToolBarsMovable( FALSE );
45}
46
47void QCheckBook::newCheck(const QString &filename)
48{
49 if (filename.isEmpty() == false)
50 {
51 initCheck = true;
52 if (m_view != 0)
53 {
54 m_view=0;
55 delete m_view;
56 }
57 m_view = new QCheckView(this, filename);
58 m_view->hide();
59 connect(m_view, SIGNAL(reload(const QString &)), this, SLOT(newCheck(const QString &)));
60 if (initMM == true)
61 {
62 delete nb1;
63 }
64 bar->clear();
65 mbar = new QMenuBar(bar);
66 mbar->setMargin(0);
67
68 QPixmap newIcon = Resource::loadPixmap( "new" );
69 nb2 = new QToolButton( newIcon, "New", QString::null, m_view, SLOT(newClicked()), bar, "new item" );
70 QPixmap pixmap = Resource::loadPixmap( "pixmap" );
71 m_filename = filename;
72 nb3 = new QToolButton( pixmap, "Graph", QString::null, this, SLOT(newGraph()), bar, "new graph" );
73
74 QPixmap closeIcon = Resource::loadPixmap( "close" );
75 nb4 = new QToolButton( closeIcon, "Close", QString::null, this, SLOT(initMainMenus()), bar, "close graph" );
76
77 popup = new QPopupMenu(m_view);
78 popup->insertItem("&New Entry", m_view, SLOT(newClicked()));
79 popup->insertItem("&Graph Checkbook", this, SLOT(newGraph()));
80 popup->insertItem("&Close Checkbook", this, SLOT(initMainMenus()));
81 popup->insertItem("&Exit", this, SLOT(close()));
82 mbar->insertItem("&File", popup);
83
84 setCentralWidget(m_view);
85 m_view->show();
86
87 Config config("qcheckbook");
88 config.setGroup("Global");
89 config.writeEntry("LastCheckBook", filename);
90 initMM = false;
91 }
92}
93
94void QCheckBook::close()
95{
96 QApplication::exit();
97}
98
99void QCheckBook::newGraph()
100{
101 if (m_filename.isEmpty() == false)
102 {
103 m_view2 = new QCheckGraph(m_filename);
104 m_view2->showMaximized();
105 }
106}
107
108void QCheckBook::initMainMenus()
109{
110 Config config("qcheckbook");
111 config.setGroup("Global");
112 config.writeEntry("LastCheckBook", QString(""));
113 initMM = true;
114 m_filename = "";
115 if (m_view3 != 0)
116 {
117 delete m_view3;
118 }
119 m_view3 = new QCheckMainMenu(this);
120 m_view3->hide();
121
122 if (initCheck == true)
123 {
124 delete nb2;
125 delete nb3;
126 delete nb4;
127 }
128
129 bar->clear();
130
131 mbar = new QMenuBar(bar);
132 mbar->setMargin(0);
133
134 QPixmap newIcon = Resource::loadPixmap( "new" );
135 nb1 = new QToolButton( newIcon, "New", QString::null, m_view3, SLOT(newClicked()), bar, "new book" );
136
137 popup = new QPopupMenu();
138 popup->insertItem("&New", m_view3, SLOT(newClicked()));
139 popup->insertItem("&Exit", this, SLOT(close()));
140 mbar->insertItem("&File", popup);
141
142 setCentralWidget(m_view3);
143 m_view3->show();
144
145 connect(m_view3, SIGNAL(itemSelected(const QString &)), this, SLOT(newCheck(const QString &)));
146 initCheck = false;
147}
diff --git a/noncore/apps/checkbook/qcheckdetails.cpp b/noncore/apps/checkbook/qcheckdetails.cpp
deleted file mode 100644
index 19a5e82..0000000
--- a/noncore/apps/checkbook/qcheckdetails.cpp
+++ b/dev/null
@@ -1,119 +0,0 @@
1#include "qcheckdetails.h"
2
3QCheckDetails::QCheckDetails(int row, int col, const QStringList item)
4 : QMainWindow(),
5 m_view()
6{
7 m_view = new QCheckDetailsBase(this);
8 setCentralWidget(m_view);
9
10 m_row = row;
11 m_col = col;
12
13 QToolBar *bar = new QToolBar(this);
14 bar->setHorizontalStretchable( TRUE );
15
16 QPixmap newIcon = Resource::loadPixmap( "edit" );
17 QPixmap trashIcon = Resource::loadPixmap( "trash" );
18 QToolButton *nb1 = new QToolButton( newIcon, "Edit", QString::null, this, SLOT(editCheck()), bar, "edit transaction" );
19 QToolButton *nb2 = new QToolButton( trashIcon, "Delete", QString::null, this, SLOT(deleteCheck()), bar, "delete transaction" );
20 addToolBar(bar);
21
22 QString text = "";
23 if (item[0] == "true")
24 {
25 text.append("<b>Payment</b> to <b>");
26 text.append(item[1]);
27 }
28 if (item[0] == "false")
29 {
30 text.append("<b>Deposit</b> from <b>");
31 text.append(item[1]);
32 }
33 text.append("</b> on <b>");
34 text.append(item[7]);
35 text.append("</b> for <b>");
36 text.append(QString("$" + item[5]));
37
38 text.append("</b>, to make your balance <b>$");
39 text.append(item[9]);
40 text.append("</b>.");
41
42 text.append("<br><br>");
43 text.append("<b>Category: </b>");
44 text.append(item[2]);
45 text.append("<br>");
46 text.append("<b>Type: </b>");
47
48 QString type = "No Type";
49 if (item[0] == "true")
50 {
51 if(item[3] == "0")
52 {
53 type = "Debit Charge";
54 }
55 if(item[3] == "1")
56 {
57 type = "Written Check";
58 }
59 if(item[3] == "2")
60 {
61 type = "Transfer";
62 }
63 if(item[3] == "3")
64 {
65 type = "Credit Card";
66 }
67 }
68
69 if (item[0] == "false")
70 {
71 if(item[3] == "0")
72 {
73 type = "Written Check";
74 }
75 if(item[3] == "1")
76 {
77 type = "Automatic Payment";
78 }
79 if(item[3] == "2")
80 {
81 type = "Transfer";
82 }
83 if(item[3] == "3")
84 {
85 type = "Cash";
86 }
87 }
88
89 text.append(type);
90 text.append("<br>");
91 if (item[4] != "0")
92 {
93 text.append("<b>Check Number: </b>");
94 text.append(item[4]);
95 text.append("<br>");
96 }
97 if (item[6] != ".00")
98 {
99 text.append("<b>Extra Fee: </b>");
100 text.append(QString("$" + item[6]));
101 m_view->checkDetails->setText(text);
102 }
103 if (item[8] != "")
104 {
105 text.append("<br><b>Additional Comments: </b>");
106 text.append(item[8]);
107 }
108 m_view->checkDetails->setText(text);
109}
110
111void QCheckDetails::editCheck()
112{
113 emit editClicked(m_row, m_col);
114}
115
116void QCheckDetails::deleteCheck()
117{
118 emit deleteClicked(m_row, m_col);
119}
diff --git a/noncore/apps/checkbook/qcheckdetails.h b/noncore/apps/checkbook/qcheckdetails.h
deleted file mode 100644
index fe5fe1a..0000000
--- a/noncore/apps/checkbook/qcheckdetails.h
+++ b/dev/null
@@ -1,27 +0,0 @@
1#include "qcheckdetailsbase.h"
2#include <qstring.h>
3#include <qtextview.h>
4#include <qtoolbar.h>
5#include <qpe/resource.h>
6#include <qpixmap.h>
7#include <qdialog.h>
8#include <qmainwindow.h>
9#include <qtoolbutton.h>
10#include <qwidget.h>
11
12class QCheckDetails : public QMainWindow
13{
14 Q_OBJECT
15 public:
16 QCheckDetails(int row, int col, const QStringList item);
17 signals:
18 void editClicked(int, int);
19 void deleteClicked(int, int);
20 public slots:
21 void editCheck();
22 void deleteCheck();
23 private:
24 int m_row;
25 int m_col;
26 QCheckDetailsBase *m_view;
27};
diff --git a/noncore/apps/checkbook/qcheckdetailsbase.ui b/noncore/apps/checkbook/qcheckdetailsbase.ui
deleted file mode 100644
index d94ba5e..0000000
--- a/noncore/apps/checkbook/qcheckdetailsbase.ui
+++ b/dev/null
@@ -1,62 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckDetailsBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckDetailsBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>240</width>
15 <height>265</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Transaction Details</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>4</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>QTextView</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>checkDetails</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/qcheckentry.cpp b/noncore/apps/checkbook/qcheckentry.cpp
deleted file mode 100644
index 2e8da1c..0000000
--- a/noncore/apps/checkbook/qcheckentry.cpp
+++ b/dev/null
@@ -1,256 +0,0 @@
1#include "qcheckentry.h"
2
3QCheckEntry::QCheckEntry()
4 : QCheckEntryBase()
5{
6 connect(transAmount, SIGNAL(textChanged(const QString &)), this, SLOT(amountChanged(const QString &)));
7 connect(transFee, SIGNAL(textChanged(const QString &)), this, SLOT(transFeeChanged(const QString &)));
8 connect(payment, SIGNAL(clicked()), this, SLOT(paymentClicked()));
9 connect(deposit, SIGNAL(clicked()), this, SLOT(depositClicked()));
10
11 QString todaysdate = QString::number(QDate::currentDate().month());
12 todaysdate.append("/");
13 todaysdate.append(QString::number(QDate::currentDate().day()));
14 todaysdate.append("/");
15 todaysdate.append(QString::number(QDate::currentDate().year()));
16 dateEdit->setText(todaysdate);
17
18 descriptionCombo->setFocus();
19
20 dateEdit->setValidChars("0123456789./-");
21 dateEdit->setMaxLength(10);
22
23 descriptionCombo->lineEdit()->setMaxLength(30);
24
25 checkNumber->setValidChars("0123456789-");
26 checkNumber->setMaxLength(10);
27
28 transAmount->setValidChars("0123456789.");
29
30 transFee->setMaxLength(5);
31 transFee->setValidChars("0123456789.");
32 setTabOrder(transType,checkNumber);
33 setTabOrder(checkNumber,transAmount);
34 setTabOrder(transAmount,transFee);
35 setTabOrder(transFee,dateEdit);
36 setTabOrder(dateEdit, additionalNotes );
37}
38
39void QCheckEntry::paymentClicked()
40{
41 cmbCategory->clear();
42 cmbCategory->insertItem( tr( "Automobile" ) );
43 cmbCategory->insertItem( tr( "Bills" ) );
44 cmbCategory->insertItem( tr( "CDs" ) );
45 cmbCategory->insertItem( tr( "Clothing" ) );
46 cmbCategory->insertItem( tr( "Computer" ) );
47 cmbCategory->insertItem( tr( "DVDs" ) );
48 cmbCategory->insertItem( tr( "Eletronics" ) );
49 cmbCategory->insertItem( tr( "Entertainment" ) );
50 cmbCategory->insertItem( tr( "Food" ) );
51 cmbCategory->insertItem( tr( "Gasoline" ) );
52 cmbCategory->insertItem( tr( "Misc" ) );
53 cmbCategory->insertItem( tr( "Movies" ) );
54 cmbCategory->insertItem( tr( "Rent" ) );
55 cmbCategory->insertItem( tr( "Travel" ) );
56 cmbCategory->setCurrentItem( 0 );
57 transType->clear();
58 transType->insertItem( tr( "Debit Charge" ) );
59 transType->insertItem( tr( "Written Check" ) );
60 transType->insertItem( tr( "Transfer" ) );
61 transType->insertItem( tr( "Credit Card" ) );
62}
63
64void QCheckEntry::depositClicked()
65{
66 cmbCategory->clear();
67 cmbCategory->insertItem( tr( "Work" ) );
68 cmbCategory->insertItem( tr( "Family Member" ) );
69 cmbCategory->insertItem( tr( "Misc. Credit" ) );
70 cmbCategory->setCurrentItem( 0 );
71 transType->clear();
72 transType->insertItem( tr( "Written Check" ) );
73 transType->insertItem( tr( "Automatic Payment" ) );
74 transType->insertItem( tr( "Transfer" ) );
75 transType->insertItem( tr( "Cash" ) );
76}
77
78QStringList QCheckEntry::popupEntry(const QStringList &originaldata)
79{
80 QCheckEntry qce;
81
82 // This is how the list looks:
83 // 0: true or false, true == payment, false == deposit
84 // 1: description of the transaction
85 // 2: category name
86 // 3: transaction type (stores the integer value of the index of the combobox)
87 // 4: check number of the transaction (if any)
88 // 5: transaction amount
89 // 6: transaction fee (e.g. service charge, or ATM charge).
90 // 7: date of the transaction
91 // 8: additional notes
92 // 9: recently used descriptions
93 if (originaldata.count() > 1)
94 {
95 if (originaldata[0] == "true")
96 {
97 qce.payment->setChecked(true);
98 qce.paymentClicked();
99 } else {
100 if (originaldata[0] == "false")
101 {
102 qce.deposit->setChecked(true);
103 qce.depositClicked();
104 }
105 }
106 qce.descriptionCombo->lineEdit()->setText(originaldata[1]);
107 qce.cmbCategory->lineEdit()->setText(originaldata[2]);
108 qce.transType->setCurrentItem(originaldata[3].toInt());
109 qce.checkNumber->setText(originaldata[4]);
110 qce.transAmount->setText(originaldata[5]);
111 qce.transFee->setText(originaldata[6]);
112 qce.dateEdit->setText(originaldata[7]);
113 qce.additionalNotes->setText(originaldata[8]);
114 QStringList recentlist;
115 if (!originaldata[9].isEmpty())
116 {
117 recentlist = QStringList::split(',', originaldata[9], false);
118 }
119 if (!recentlist.isEmpty())
120 {
121 qce.descriptionCombo->insertStringList(recentlist);
122 }
123 } else {
124 QStringList recentlist;
125 if (!originaldata[0].isEmpty())
126 {
127 recentlist = QStringList::split(',', originaldata[0], false);
128 }
129 if (!recentlist.isEmpty())
130 {
131 qce.descriptionCombo->insertStringList(recentlist);
132 }
133 }
134
135 qce.setWFlags(Qt::WType_Modal);
136 qce.showMaximized();
137
138 qce.descriptionCombo->lineEdit()->clear();
139
140 if (qce.exec() == QDialog::Accepted)
141 {
142 // Validate that the user has inputed a valid dollar amount
143 if (qce.transFee->text().contains('.') == 0)
144 {
145 QString text = qce.transFee->text();
146 text.append(".00");
147 qce.transFee->setText(text);
148 } else {
149 QString tmp = qce.transFee->text();
150 if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1)
151 {
152 tmp.append("00");
153 qce.transFee->setText(tmp);
154 } else {
155 if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2)
156 {
157 tmp.append("0");
158 qce.transFee->setText(tmp);
159 }
160 }
161 }
162 if (qce.transAmount->text().contains('.') == 0)
163 {
164 QString text = qce.transAmount->text();
165 text.append(".00");
166 qce.transAmount->setText(text);
167 } else {
168 QString tmp = qce.transAmount->text();
169 if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1)
170 {
171 tmp.append("00");
172 qce.transAmount->setText(tmp);
173 } else {
174 if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2)
175 {
176 tmp.append("0");
177 qce.transAmount->setText(tmp);
178 }
179 }
180 }
181
182 QString recent;
183 if (qce.descriptionCombo->count() != 0)
184 {
185 QStringList recentlist = QStringList::split(',', originaldata[9], false);
186 if (recentlist.count() >= 10)
187 {
188 recentlist.remove(recentlist.last());
189 }
190 recentlist.prepend(qce.descriptionCombo->lineEdit()->text());
191 recent = recentlist.join(",");
192 } else {
193 recent = qce.descriptionCombo->lineEdit()->text();
194 }
195
196 QString checkNumberString = qce.checkNumber->text();
197 if (checkNumberString.isEmpty() == true)
198 {
199 checkNumberString = "0";
200 }
201
202 QString paymentChecked = "true";
203 if (qce.payment->isChecked() == false)
204 {
205 paymentChecked = "false";
206 }
207 QStringList returnvalue;
208 returnvalue << paymentChecked << qce.descriptionCombo->lineEdit()->text() << qce.cmbCategory->lineEdit()->text() << QString::number(qce.transType->currentItem()) << checkNumberString << qce.transAmount->text() << qce.transFee->text() << qce.dateEdit->text() << qce.additionalNotes->text() << recent;
209 return returnvalue;
210 } else {
211 QStringList blank;
212 return blank;
213 }
214}
215
216void QCheckEntry::transFeeChanged(const QString &input)
217{
218 QString tmpinput = input;
219 if (tmpinput.contains('.') > 1)
220 {
221 int first = tmpinput.find('.');
222 tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1);
223 }
224 if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1)
225 {
226 tmpinput = tmpinput.remove((tmpinput.length() - 1), 1);
227 }
228 transFee->setText(tmpinput);
229}
230
231void QCheckEntry::amountChanged(const QString &input)
232{
233 QString tmpinput = input;
234 if (tmpinput.contains('.') > 1)
235 {
236 int first = tmpinput.find('.');
237 tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1);
238 }
239 if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1)
240 {
241 tmpinput = tmpinput.remove((tmpinput.length() - 1), 1);
242 }
243 transAmount->setText(tmpinput);
244}
245
246void QCheckEntry::accept()
247{
248 // Does the description combo not have any text in it? Do something if it doesn't!
249 if (descriptionCombo->lineEdit()->text().isEmpty() == true)
250 {
251 QMessageBox::critical(this, "Field Missing.", "<qt>You didn't enter a description for this transaction. Please fill out the \"Transaction Description\" field and try again.</qt>");
252 descriptionCombo->setFocus();
253 return;
254 }
255 QDialog::accept();
256}
diff --git a/noncore/apps/checkbook/qcheckentry.h b/noncore/apps/checkbook/qcheckentry.h
deleted file mode 100644
index f361bbf..0000000
--- a/noncore/apps/checkbook/qcheckentry.h
+++ b/dev/null
@@ -1,31 +0,0 @@
1#include <qstring.h>
2#include <qcombobox.h>
3#include "qrestrictedline.h"
4#include <qcombobox.h>
5#include <qstringlist.h>
6#include <qlabel.h>
7#include <qmultilineedit.h>
8#include "qcheckentrybase.h"
9#include <qdialog.h>
10#include <qregexp.h>
11#include <qmessagebox.h>
12#include <qwidget.h>
13#include <qevent.h>
14#include <qdatetime.h>
15#include <qradiobutton.h>
16#include "config.h"
17
18class QCheckEntry : public QCheckEntryBase
19{
20 Q_OBJECT
21 public:
22 QCheckEntry();
23 static QStringList popupEntry(const QStringList &originaldata);
24 private slots:
25 void amountChanged(const QString &);
26 void transFeeChanged(const QString &);
27 void paymentClicked();
28 void depositClicked();
29 protected slots:
30 virtual void accept();
31};
diff --git a/noncore/apps/checkbook/qchecknamebase.ui b/noncore/apps/checkbook/qchecknamebase.ui
deleted file mode 100644
index b9bda19..0000000
--- a/noncore/apps/checkbook/qchecknamebase.ui
+++ b/dev/null
@@ -1,136 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>QCheckNameBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QCheckNameBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>228</width>
15 <height>108</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Check Book Name</string>
21 </property>
22 <widget>
23 <class>QLabel</class>
24 <property stdset="1">
25 <name>name</name>
26 <cstring>TextLabel3</cstring>
27 </property>
28 <property stdset="1">
29 <name>geometry</name>
30 <rect>
31 <x>10</x>
32 <y>5</y>
33 <width>70</width>
34 <height>16</height>
35 </rect>
36 </property>
37 <property stdset="1">
38 <name>font</name>
39 <font>
40 <family>BDF-helvetica</family>
41 <pointsize>19</pointsize>
42 <bold>1</bold>
43 </font>
44 </property>
45 <property stdset="1">
46 <name>text</name>
47 <string>Name...</string>
48 </property>
49 </widget>
50 <widget>
51 <class>QLabel</class>
52 <property stdset="1">
53 <name>name</name>
54 <cstring>TextLabel4</cstring>
55 </property>
56 <property stdset="1">
57 <name>geometry</name>
58 <rect>
59 <x>10</x>
60 <y>25</y>
61 <width>210</width>
62 <height>25</height>
63 </rect>
64 </property>
65 <property stdset="1">
66 <name>text</name>
67 <string>Please name your check book (limit: 15 characters):</string>
68 </property>
69 <property stdset="1">
70 <name>alignment</name>
71 <set>WordBreak|AlignVCenter|AlignLeft</set>
72 </property>
73 <property>
74 <name>wordwrap</name>
75 </property>
76 </widget>
77 <widget>
78 <class>QPushButton</class>
79 <property stdset="1">
80 <name>name</name>
81 <cstring>cmdDone</cstring>
82 </property>
83 <property stdset="1">
84 <name>geometry</name>
85 <rect>
86 <x>75</x>
87 <y>80</y>
88 <width>75</width>
89 <height>25</height>
90 </rect>
91 </property>
92 <property stdset="1">
93 <name>text</name>
94 <string>&amp;Done</string>
95 </property>
96 </widget>
97 <widget>
98 <class>QRestrictedLine</class>
99 <property stdset="1">
100 <name>name</name>
101 <cstring>leText</cstring>
102 </property>
103 <property stdset="1">
104 <name>geometry</name>
105 <rect>
106 <x>5</x>
107 <y>51</y>
108 <width>216</width>
109 <height>25</height>
110 </rect>
111 </property>
112 </widget>
113</widget>
114<customwidgets>
115 <customwidget>
116 <class>QRestrictedLine</class>
117 <header location="local">qrestrictedline.h</header>
118 <sizehint>
119 <width>-1</width>
120 <height>-1</height>
121 </sizehint>
122 <container>0</container>
123 <sizepolicy>
124 <hordata>5</hordata>
125 <verdata>5</verdata>
126 </sizepolicy>
127 <pixmap>image0</pixmap>
128 </customwidget>
129</customwidgets>
130<images>
131 <image>
132 <name>image0</name>
133 <data format="XPM.GZ" length="649">789c6dd23b0ec2300c00d03da7b0e22d42e9476c88232031222186c80c3074813220c4dd214dddd84dac0e759fe2386e1a07a7e3015c639e6318ef04740b0f70d7d730bccf97fdc7d8be87f8406737c62210606869dbb531f531a57f4a299d03a7e06c11cca1055508412c2889acc2ef425423b34840a645f28244936860d2c265d7923bae8b2f05cb35a91739002d2b5727d535cbe954a43ad1e22f700755caf7407cf4799fe286c47dbe3bf303014167a2</data>
134 </image>
135</images>
136</UI>
diff --git a/noncore/apps/checkbook/qcheckview.h b/noncore/apps/checkbook/qcheckview.h
deleted file mode 100644
index 840dc8b..0000000
--- a/noncore/apps/checkbook/qcheckview.h
+++ b/dev/null
@@ -1,33 +0,0 @@
1#include "qcheckviewbase.h"
2#include "qrestrictedline.h"
3#include "qcheckentry.h"
4#include "qcheckdetails.h"
5
6#include <qstring.h>
7#include "config.h"
8#include <qtable.h>
9#include <qpoint.h>
10#include <qlayout.h>
11
12class QCheckView : public QCheckViewBase
13{
14 Q_OBJECT
15 public:
16 QCheckView(QWidget *, QString filename);
17 void load(const QString filename);
18 private:
19 Config *config;
20 QString calculator(QString largervalue, QString smallervalue, bool subtract);
21 int lastSortCol;
22 bool ascend;
23 QCheckDetails *qcd;
24 QString m_filename;
25 private slots:
26 // void entryActivated(int);
27 void newClicked();
28 void tableClicked(int, int, int, const QPoint &mousePos);
29 void editClicked(int, int);
30 void deleteClicked(int, int);
31 signals:
32 void reload(const QString &filename);
33};