author | drw <drw> | 2002-11-02 01:29:30 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-02 01:29:30 (UTC) |
commit | bf9388acdebf6e55345dff3bd1cd652b45a2202a (patch) (unidiff) | |
tree | 737ca55c9a30a1dde3aa289fd99cac7e4c30a3f7 | |
parent | 6e9225388baa9dfac4ed09f22189cfa98a610d39 (diff) | |
download | opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.zip opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.gz opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.bz2 |
Code updates/fixes
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/checkbook/checkbook.h | 5 | ||||
-rw-r--r-- | noncore/apps/checkbook/checkbook.pro | 42 | ||||
-rw-r--r-- | noncore/apps/checkbook/graph.cpp | 112 | ||||
-rw-r--r-- | noncore/apps/checkbook/graph.h | 63 | ||||
-rw-r--r-- | noncore/apps/checkbook/graphinfo.cpp | 84 | ||||
-rw-r--r-- | noncore/apps/checkbook/graphinfo.h | 82 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.h | 1 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 4 |
11 files changed, 430 insertions, 58 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 4b81c6d..20b42b5 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -27,8 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "checkbook.h" | 29 | #include "checkbook.h" |
30 | #include "transaction.h" | 30 | #include "transaction.h" |
31 | #include "graph.h" | ||
32 | #include "graphinfo.h" | ||
31 | 33 | ||
32 | #include <opie/otabwidget.h> | 34 | #include <opie/otabwidget.h> |
33 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
34 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
@@ -49,16 +51,21 @@ | |||
49 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) | 51 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) |
50 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 52 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
51 | { | 53 | { |
52 | name = n; | 54 | name = n; |
53 | filename = fd + name + ".qcb"; | 55 | filename = fd; |
56 | filename.append( name ); | ||
57 | filename.append( ".qcb" ); | ||
54 | filedir = fd; | 58 | filedir = fd; |
55 | currencySymbol = symbol; | 59 | currencySymbol = symbol; |
56 | currBalance = 0.0; | 60 | currBalance = 0.0; |
57 | 61 | ||
58 | if ( name != "" ) | 62 | if ( name != "" ) |
59 | { | 63 | { |
60 | setCaption( name + " - " + tr( "Checkbook" ) ); | 64 | QString tempstr = name; |
65 | tempstr.append( " - " ); | ||
66 | tempstr.append( tr( "Checkbook" ) ); | ||
67 | setCaption( tempstr ); | ||
61 | } | 68 | } |
62 | else | 69 | else |
63 | { | 70 | { |
64 | setCaption( tr( "New checkbook" ) ); | 71 | setCaption( tr( "New checkbook" ) ); |
@@ -241,15 +248,16 @@ QWidget *Checkbook::initCharts() | |||
241 | graphList->insertItem( tr( "..." ) ); | 248 | graphList->insertItem( tr( "..." ) ); |
242 | layout->addWidget( graphList, 0, 1 ); | 249 | layout->addWidget( graphList, 0, 1 ); |
243 | */ | 250 | */ |
244 | 251 | ||
245 | QWidget *graphWidget = new QWidget( control ); | 252 | GraphInfo* info = new GraphInfo( GraphInfo::BarChart, 0x0, tr( "Graph Title" ), |
246 | QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) ); | 253 | tr( "X-Axis" ), tr( "Y-Axis" ) ); |
254 | graphWidget = new Graph( control, info ); | ||
255 | QWhatsThis::add( graphWidget, tr( "Charting is not implemented yet." ) ); | ||
247 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); | 256 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); |
248 | graphWidget->setBackgroundMode( QWidget::PaletteBase ); | ||
249 | 257 | ||
250 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); | 258 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); |
251 | QWhatsThis::add( btn, tr( "Click here to draw the graph." ) ); | 259 | QWhatsThis::add( btn, tr( "Click here to draw the chart." ) ); |
252 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); | 260 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); |
253 | layout->addWidget( btn, 1, 1 ); | 261 | layout->addWidget( btn, 1, 1 ); |
254 | 262 | ||
255 | return control; | 263 | return control; |
@@ -275,10 +283,10 @@ void Checkbook::loadCheckbook() | |||
275 | break; | 283 | break; |
276 | } | 284 | } |
277 | } | 285 | } |
278 | bankEdit->setText( config.readEntry( "Bank", "" ) ); | 286 | bankEdit->setText( config.readEntry( "Bank", "" ) ); |
279 | acctNumEdit->setText( config.readEntry( "Number", "" ) ); | 287 | acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); |
280 | pinNumEdit->setText( config.readEntry( "PINNumber", "" ) ); | 288 | pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); |
281 | balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); | 289 | balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); |
282 | notesEdit->setText( config.readEntry( "Notes", "" ) ); | 290 | notesEdit->setText( config.readEntry( "Notes", "" ) ); |
283 | 291 | ||
284 | bool ok; | 292 | bool ok; |
@@ -308,13 +316,9 @@ void Checkbook::loadCheckbook() | |||
308 | // Add to transaction list | 316 | // Add to transaction list |
309 | transactions.append( tran ); | 317 | transactions.append( tran ); |
310 | 318 | ||
311 | // Add to transaction table | 319 | // Add to transaction table |
312 | QDate date = tran->date(); | 320 | ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(), |
313 | QString datestr = QString::number( date.month() ) + "/" + | ||
314 | QString::number( date.day() ) + "/" + | ||
315 | QString::number( date.year() ); | ||
316 | ( void ) new QListViewItem( tranTable, QString::number( i ), datestr, | ||
317 | trandesc, stramount ); | 321 | trandesc, stramount ); |
318 | } | 322 | } |
319 | else | 323 | else |
320 | { | 324 | { |
@@ -356,10 +360,10 @@ void Checkbook::accept() | |||
356 | // Save info | 360 | // Save info |
357 | config->setGroup( "Account" ); | 361 | config->setGroup( "Account" ); |
358 | config->writeEntry( "Type", typeList->currentText() ); | 362 | config->writeEntry( "Type", typeList->currentText() ); |
359 | config->writeEntry( "Bank", bankEdit->text() ); | 363 | config->writeEntry( "Bank", bankEdit->text() ); |
360 | config->writeEntry( "Number", acctNumEdit->text() ); | 364 | config->writeEntryCrypt( "Number", acctNumEdit->text() ); |
361 | config->writeEntry( "PINNumber", pinNumEdit->text() ); | 365 | config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); |
362 | config->writeEntry( "Balance", balanceEdit->text() ); | 366 | config->writeEntry( "Balance", balanceEdit->text() ); |
363 | config->writeEntry( "Notes", notesEdit->text() ); | 367 | config->writeEntry( "Notes", notesEdit->text() ); |
364 | 368 | ||
365 | // Save transactions | 369 | // Save transactions |
@@ -378,10 +382,15 @@ void Checkbook::accept() | |||
378 | 382 | ||
379 | void Checkbook::slotNameChanged( const QString &newname ) | 383 | void Checkbook::slotNameChanged( const QString &newname ) |
380 | { | 384 | { |
381 | name = newname; | 385 | name = newname; |
382 | filename = filedir + newname + ".qcb"; | 386 | filename = filedir; |
383 | setCaption( name + " - " + tr( "Checkbook" ) ); | 387 | filename.append( newname ); |
388 | filename.append( ".qcb" ); | ||
389 | QString tempstr = name; | ||
390 | tempstr.append( " - " ); | ||
391 | tempstr.append( tr( "Checkbook" ) ); | ||
392 | setCaption( tempstr ); | ||
384 | } | 393 | } |
385 | 394 | ||
386 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | 395 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) |
387 | { | 396 | { |
@@ -413,15 +422,10 @@ void Checkbook::slotNewTran() | |||
413 | // Add to transaction list | 422 | // Add to transaction list |
414 | transactions.append( traninfo ); | 423 | transactions.append( traninfo ); |
415 | 424 | ||
416 | // Add to transaction table | 425 | // Add to transaction table |
417 | 426 | ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), | |
418 | QDate date = traninfo->date(); | 427 | traninfo->datestr(), traninfo->desc(), stramount ); |
419 | QString datestr = QString::number( date.month() ) + "/" + | ||
420 | QString::number( date.day() ) + "/" + | ||
421 | QString::number( date.year() ); | ||
422 | ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), datestr, | ||
423 | traninfo->desc(), stramount ); | ||
424 | 428 | ||
425 | adjustBalance( amount ); | 429 | adjustBalance( amount ); |
426 | } | 430 | } |
427 | else | 431 | else |
@@ -453,13 +457,9 @@ void Checkbook::slotEditTran() | |||
453 | currencySymbol ); | 457 | currencySymbol ); |
454 | currtran->showMaximized(); | 458 | currtran->showMaximized(); |
455 | if ( currtran->exec() == QDialog::Accepted ) | 459 | if ( currtran->exec() == QDialog::Accepted ) |
456 | { | 460 | { |
457 | QDate date = traninfo->date(); | 461 | curritem->setText( 1, traninfo->datestr() ); |
458 | QString datestr = QString::number( date.month() ) + "/" + | ||
459 | QString::number( date.day() ) + "/" + | ||
460 | QString::number( date.year() ); | ||
461 | curritem->setText( 1, datestr ); | ||
462 | 462 | ||
463 | curritem->setText( 2, traninfo->desc() ); | 463 | curritem->setText( 2, traninfo->desc() ); |
464 | 464 | ||
465 | float amount = traninfo->amount(); | 465 | float amount = traninfo->amount(); |
@@ -488,9 +488,8 @@ void Checkbook::slotDeleteTran() | |||
488 | } | 488 | } |
489 | 489 | ||
490 | bool ok; | 490 | bool ok; |
491 | int tranid = curritem->text( 0 ).toInt( &ok ); | 491 | int tranid = curritem->text( 0 ).toInt( &ok ); |
492 | //TranInfo *traninfo = transactions.at( tranid - 1 ); | ||
493 | TranInfo *traninfo = findTranByID( tranid ); | 492 | TranInfo *traninfo = findTranByID( tranid ); |
494 | 493 | ||
495 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) | 494 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) |
496 | { | 495 | { |
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h index a86c0f9..01f1115 100644 --- a/noncore/apps/checkbook/checkbook.h +++ b/noncore/apps/checkbook/checkbook.h | |||
@@ -34,8 +34,9 @@ | |||
34 | #include <qdialog.h> | 34 | #include <qdialog.h> |
35 | 35 | ||
36 | class OTabWidget; | 36 | class OTabWidget; |
37 | 37 | ||
38 | class Graph; | ||
38 | class QComboBox; | 39 | class QComboBox; |
39 | class QLabel; | 40 | class QLabel; |
40 | class QLineEdit; | 41 | class QLineEdit; |
41 | class QListView; | 42 | class QListView; |
@@ -82,11 +83,11 @@ class Checkbook : public QDialog | |||
82 | QLabel *balanceLabel; | 83 | QLabel *balanceLabel; |
83 | float currBalance; | 84 | float currBalance; |
84 | 85 | ||
85 | // Charts tab | 86 | // Charts tab |
86 | QWidget *initCharts(); | 87 | QWidget *initCharts(); |
87 | //QComboBox *graphList; | 88 | //QComboBox *graphList; |
88 | QWidget *graphWidget; | 89 | Graph *graphWidget; |
89 | 90 | ||
90 | protected slots: | 91 | protected slots: |
91 | void accept(); | 92 | void accept(); |
92 | 93 | ||
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro index 07cc012..bd69939 100644 --- a/noncore/apps/checkbook/checkbook.pro +++ b/noncore/apps/checkbook/checkbook.pro | |||
@@ -1,32 +1,36 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = mainwindow.h \ | 3 | HEADERS = mainwindow.h \ |
4 | traninfo.h \ | 4 | traninfo.h \ |
5 | checkbook.h \ | 5 | graphinfo.h \ |
6 | transaction.h | 6 | checkbook.h \ |
7 | SOURCES = main.cpp \ | 7 | transaction.h \ |
8 | mainwindow.cpp \ | 8 | graph.h |
9 | traninfo.cpp \ | 9 | SOURCES = main.cpp \ |
10 | checkbook.cpp \ | 10 | mainwindow.cpp \ |
11 | transaction.cpp | 11 | traninfo.cpp \ |
12 | graphinfo.cpp \ | ||
13 | checkbook.cpp \ | ||
14 | transaction.cpp \ | ||
15 | graph.cpp | ||
12 | INCLUDEPATH += $(OPIEDIR)/include | 16 | INCLUDEPATH += $(OPIEDIR)/include |
13 | DEPENDPATH += $(OPIEDIR)/include | 17 | DEPENDPATH += $(OPIEDIR)/include |
14 | LIBS += -lqpe -lopie | 18 | LIBS += -lqpe -lopie |
15 | TARGET = checkbook | 19 | TARGET = checkbook |
16 | DESTDIR = $(OPIEDIR)/bin | 20 | DESTDIR = $(OPIEDIR)/bin |
17 | 21 | ||
18 | TRANSLATIONS = ../../../i18n/de/checkbook.ts \ | 22 | TRANSLATIONS = ../../../i18n/de/checkbook.ts \ |
19 | ../../../i18n/en/checkbook.ts \ | 23 | ../../../i18n/en/checkbook.ts \ |
20 | ../../../i18n/es/checkbook.ts \ | 24 | ../../../i18n/es/checkbook.ts \ |
21 | ../../../i18n/fr/checkbook.ts \ | 25 | ../../../i18n/fr/checkbook.ts \ |
22 | ../../../i18n/hu/checkbook.ts \ | 26 | ../../../i18n/hu/checkbook.ts \ |
23 | ../../../i18n/ja/checkbook.ts \ | 27 | ../../../i18n/ja/checkbook.ts \ |
24 | ../../../i18n/ko/checkbook.ts \ | 28 | ../../../i18n/ko/checkbook.ts \ |
25 | ../../../i18n/no/checkbook.ts \ | 29 | ../../../i18n/no/checkbook.ts \ |
26 | ../../../i18n/pl/checkbook.ts \ | 30 | ../../../i18n/pl/checkbook.ts \ |
27 | ../../../i18n/pt/checkbook.ts \ | 31 | ../../../i18n/pt/checkbook.ts \ |
28 | ../../../i18n/pt_BR/checkbook.ts \ | 32 | ../../../i18n/pt_BR/checkbook.ts \ |
29 | ../../../i18n/sl/checkbook.ts \ | 33 | ../../../i18n/sl/checkbook.ts \ |
30 | ../../../i18n/zh_CN/checkbook.ts \ | 34 | ../../../i18n/zh_CN/checkbook.ts \ |
31 | ../../../i18n/zh_TW/checkbook.ts \ | 35 | ../../../i18n/zh_TW/checkbook.ts \ |
32 | ../../../i18n/it/checkbook.ts | 36 | ../../../i18n/it/checkbook.ts |
diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp new file mode 100644 index 0000000..bae92da --- a/dev/null +++ b/noncore/apps/checkbook/graph.cpp | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "graph.h" | ||
30 | #include "graphinfo.h" | ||
31 | |||
32 | #include <qpainter.h> | ||
33 | |||
34 | Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) | ||
35 | : QWidget( parent, name, flags ) | ||
36 | { | ||
37 | setBackgroundMode( QWidget::PaletteBase ); | ||
38 | |||
39 | data = d; | ||
40 | |||
41 | graph.setOptimization( QPixmap::BestOptim ); | ||
42 | } | ||
43 | |||
44 | void Graph::setGraphInfo( GraphInfo *d ) | ||
45 | { | ||
46 | data = d; | ||
47 | } | ||
48 | |||
49 | void Graph::drawGraph( bool regen ) | ||
50 | { | ||
51 | if ( regen ) | ||
52 | { | ||
53 | initGraph(); | ||
54 | } | ||
55 | QPainter p( this ); | ||
56 | p.drawPixmap( 0, 0, graph ); | ||
57 | } | ||
58 | |||
59 | void Graph::paintEvent( QPaintEvent * ) | ||
60 | { | ||
61 | drawGraph( FALSE ); | ||
62 | } | ||
63 | |||
64 | void Graph::resizeEvent( QResizeEvent * ) | ||
65 | { | ||
66 | drawGraph( TRUE ); | ||
67 | } | ||
68 | |||
69 | void Graph::initGraph() | ||
70 | { | ||
71 | graph.resize( width(), height() ); | ||
72 | graph.fill( QColor( 255, 255, 255 ) ); | ||
73 | |||
74 | if ( !data ) | ||
75 | { | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | // Any common stuff here (titles, ???) | ||
80 | |||
81 | switch ( data->graphType() ) | ||
82 | { | ||
83 | case GraphInfo::BarChart : | ||
84 | { | ||
85 | drawBarChart(); | ||
86 | } | ||
87 | break; | ||
88 | case GraphInfo::LineChart : | ||
89 | { | ||
90 | drawLineChart(); | ||
91 | } | ||
92 | break; | ||
93 | case GraphInfo::PieChart : | ||
94 | { | ||
95 | drawPieChart(); | ||
96 | } | ||
97 | }; | ||
98 | } | ||
99 | |||
100 | void Graph::drawBarChart() | ||
101 | { | ||
102 | //Find max value in GraphInfo->dataPoints() - make function in GraphInfo!!! | ||
103 | } | ||
104 | |||
105 | void Graph::drawLineChart() | ||
106 | { | ||
107 | } | ||
108 | |||
109 | void Graph::drawPieChart() | ||
110 | { | ||
111 | } | ||
112 | |||
diff --git a/noncore/apps/checkbook/graph.h b/noncore/apps/checkbook/graph.h new file mode 100644 index 0000000..7379be7 --- a/dev/null +++ b/noncore/apps/checkbook/graph.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef GRAPH_H | ||
30 | #define GRAPH_H | ||
31 | |||
32 | #include <qpixmap.h> | ||
33 | #include <qwidget.h> | ||
34 | |||
35 | class GraphInfo; | ||
36 | |||
37 | class Graph : public QWidget | ||
38 | { | ||
39 | Q_OBJECT | ||
40 | |||
41 | public: | ||
42 | Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 ); | ||
43 | |||
44 | void setGraphInfo( GraphInfo * ); | ||
45 | |||
46 | void drawGraph( bool = FALSE ); | ||
47 | |||
48 | protected: | ||
49 | void paintEvent( QPaintEvent * ); | ||
50 | void resizeEvent( QResizeEvent * ); | ||
51 | |||
52 | private: | ||
53 | GraphInfo *data; | ||
54 | |||
55 | QPixmap graph; | ||
56 | |||
57 | void initGraph(); | ||
58 | void drawBarChart(); | ||
59 | void drawLineChart(); | ||
60 | void drawPieChart(); | ||
61 | }; | ||
62 | |||
63 | #endif | ||
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp new file mode 100644 index 0000000..7b06bdb --- a/dev/null +++ b/noncore/apps/checkbook/graphinfo.cpp | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "graphinfo.h" | ||
30 | |||
31 | GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title, | ||
32 | const QString &xtitle, const QString &ytitle ) | ||
33 | { | ||
34 | t = type; | ||
35 | d = data; | ||
36 | gt = title; | ||
37 | xt = xtitle; | ||
38 | yt = ytitle; | ||
39 | } | ||
40 | |||
41 | GraphInfo::GraphType GraphInfo::graphType() | ||
42 | { | ||
43 | return t; | ||
44 | } | ||
45 | |||
46 | void GraphInfo::setGraphType( GraphType type ) | ||
47 | { | ||
48 | t = type; | ||
49 | } | ||
50 | |||
51 | DataPointList *GraphInfo::dataPoints() | ||
52 | { | ||
53 | return d; | ||
54 | } | ||
55 | |||
56 | void GraphInfo::setDataPoints( DataPointList *data ) | ||
57 | { | ||
58 | d = data; | ||
59 | } | ||
60 | |||
61 | float GraphInfo::maxValue() | ||
62 | { | ||
63 | float max; | ||
64 | |||
65 | } | ||
66 | |||
67 | float GraphInfo::minValue() | ||
68 | { | ||
69 | } | ||
70 | |||
71 | void GraphInfo::setGraphTitle( const QString &title ) | ||
72 | { | ||
73 | gt = title; | ||
74 | } | ||
75 | |||
76 | void GraphInfo::setXAxisTitle( const QString &xtitle ) | ||
77 | { | ||
78 | xt = xtitle; | ||
79 | } | ||
80 | |||
81 | void GraphInfo::setYAxisTitle( const QString &ytitle ) | ||
82 | { | ||
83 | yt = ytitle; | ||
84 | } | ||
diff --git a/noncore/apps/checkbook/graphinfo.h b/noncore/apps/checkbook/graphinfo.h new file mode 100644 index 0000000..4ad1dc9 --- a/dev/null +++ b/noncore/apps/checkbook/graphinfo.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef GRAPHINFO_H | ||
30 | #define GRAPHINFO_H | ||
31 | |||
32 | #include <qlist.h> | ||
33 | #include <qstringlist.h> | ||
34 | |||
35 | class DataPointInfo | ||
36 | { | ||
37 | public: | ||
38 | DataPointInfo() | ||
39 | : l( 0x0 ), v( 0.0 ) {} | ||
40 | DataPointInfo( const QString &label, float value ) | ||
41 | : l( label ), v( value ) {} | ||
42 | |||
43 | const QString &label() { return l; } | ||
44 | float value() { return v; } | ||
45 | |||
46 | private: | ||
47 | QString l; | ||
48 | float v; | ||
49 | }; | ||
50 | |||
51 | typedef QList<DataPointInfo> DataPointList; | ||
52 | |||
53 | class GraphInfo | ||
54 | { | ||
55 | public: | ||
56 | enum GraphType { BarChart, LineChart, PieChart }; | ||
57 | |||
58 | GraphInfo( GraphType = BarChart, DataPointList * = 0x0, | ||
59 | const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 ); | ||
60 | |||
61 | GraphInfo::GraphType graphType(); | ||
62 | void setGraphType( GraphType ); | ||
63 | |||
64 | DataPointList *dataPoints(); | ||
65 | void setDataPoints( DataPointList * ); | ||
66 | |||
67 | float maxValue(); | ||
68 | float minValue(); | ||
69 | |||
70 | void setGraphTitle( const QString & ); | ||
71 | void setXAxisTitle( const QString & ); | ||
72 | void setYAxisTitle( const QString & ); | ||
73 | |||
74 | private: | ||
75 | GraphType t; | ||
76 | DataPointList *d; | ||
77 | QString gt; | ||
78 | QString xt; | ||
79 | QString yt; | ||
80 | }; | ||
81 | |||
82 | #endif | ||
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index ead17b4..2eb8396 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -136,9 +136,12 @@ void MainWindow::slotEdit() | |||
136 | { | 136 | { |
137 | cbList->changeItem( newname, cbList->currentItem() ); | 137 | cbList->changeItem( newname, cbList->currentItem() ); |
138 | cbList->sort(); | 138 | cbList->sort(); |
139 | 139 | ||
140 | QFile f( cbDir + currname + ".qcb" ); | 140 | QString tempstr = cbDir; |
141 | tempstr.append( currname ); | ||
142 | tempstr.append( ".qcb" ); | ||
143 | QFile f( tempstr ); | ||
141 | if ( f.exists() ) | 144 | if ( f.exists() ) |
142 | { | 145 | { |
143 | f.remove(); | 146 | f.remove(); |
144 | } | 147 | } |
@@ -150,10 +153,12 @@ void MainWindow::slotEdit() | |||
150 | void MainWindow::slotDelete() | 153 | void MainWindow::slotDelete() |
151 | { | 154 | { |
152 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) | 155 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) |
153 | { | 156 | { |
154 | QString name = cbDir + cbList->currentText() + ".qcb"; | 157 | QString tempstr = cbDir; |
155 | QFile f( name ); | 158 | tempstr.append( cbList->currentText() ); |
159 | tempstr.append( ".qcb" ); | ||
160 | QFile f( tempstr ); | ||
156 | if ( f.exists() ) | 161 | if ( f.exists() ) |
157 | { | 162 | { |
158 | f.remove(); | 163 | f.remove(); |
159 | } | 164 | } |
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index 5a770b0..460466c 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp | |||
@@ -29,8 +29,10 @@ | |||
29 | #include "traninfo.h" | 29 | #include "traninfo.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | 32 | ||
33 | QString tempstr; | ||
34 | |||
33 | TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, | 35 | TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, |
34 | const QString &type, const QString &category, float amount, | 36 | const QString &type, const QString &category, float amount, |
35 | float fee, const QString &number, const QString ¬es ) | 37 | float fee, const QString &number, const QString ¬es ) |
36 | { | 38 | { |
@@ -116,17 +118,34 @@ TranInfo::TranInfo( Config config, int entry ) | |||
116 | n = config.readEntry( "Comments", "" ); | 118 | n = config.readEntry( "Comments", "" ); |
117 | } | 119 | } |
118 | } | 120 | } |
119 | 121 | ||
122 | const QString &TranInfo::datestr() | ||
123 | { | ||
124 | tempstr = QString::number( td.year() ); | ||
125 | tempstr.append( '/' ); | ||
126 | int tempfield = td.month(); | ||
127 | if ( tempfield < 10 ) tempstr.append( '0' ); | ||
128 | tempstr.append( QString::number( tempfield ) ); | ||
129 | tempstr.append( '/' ); | ||
130 | tempfield = td.day(); | ||
131 | if ( tempfield < 10 ) tempstr.append( '0' ); | ||
132 | tempstr.append( QString::number( tempfield ) ); | ||
133 | |||
134 | return( tempstr ); | ||
135 | } | ||
136 | |||
120 | void TranInfo::write( Config *config, int entry ) | 137 | void TranInfo::write( Config *config, int entry ) |
121 | { | 138 | { |
122 | config->setGroup( QString::number( entry ) ); | 139 | config->setGroup( QString::number( entry ) ); |
123 | 140 | ||
124 | config->writeEntry( "Description", d ); | 141 | config->writeEntry( "Description", d ); |
125 | 142 | ||
126 | QString tempstr = QString::number( td.month() ) + "/" + | 143 | tempstr = QString::number( td.month() ); |
127 | QString::number( td.day() ) + "/" + | 144 | tempstr.append( '/' ); |
128 | QString::number( td.year() ); | 145 | tempstr.append( QString::number( td.day() ) ); |
146 | tempstr.append( '/' ); | ||
147 | tempstr.append( QString::number( td.year() ) ); | ||
129 | config->writeEntry( "Date", tempstr ); | 148 | config->writeEntry( "Date", tempstr ); |
130 | 149 | ||
131 | w ? tempstr = "true" | 150 | w ? tempstr = "true" |
132 | : tempstr = "false"; | 151 | : tempstr = "false"; |
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h index 1743ff7..e944c29 100644 --- a/noncore/apps/checkbook/traninfo.h +++ b/noncore/apps/checkbook/traninfo.h | |||
@@ -46,8 +46,9 @@ class TranInfo | |||
46 | 46 | ||
47 | int id() const { return i; } | 47 | int id() const { return i; } |
48 | const QString &desc() const { return d; } | 48 | const QString &desc() const { return d; } |
49 | const QDate &date() const { return td; } | 49 | const QDate &date() const { return td; } |
50 | const QString &datestr(); | ||
50 | bool withdrawal()const { return w; } | 51 | bool withdrawal()const { return w; } |
51 | const QString &type() const { return t; } | 52 | const QString &type() const { return t; } |
52 | const QString &category()const { return c; } | 53 | const QString &category()const { return c; } |
53 | float amount() const { return a; } | 54 | float amount() const { return a; } |
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 82baec9..a921491 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp | |||
@@ -48,9 +48,11 @@ | |||
48 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, | 48 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, |
49 | char symbol ) | 49 | char symbol ) |
50 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 50 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
51 | { | 51 | { |
52 | setCaption( tr( "Transaction for " ) + acctname ); | 52 | QString tempstr = tr( "Transaction for " ); |
53 | tempstr.append( acctname ); | ||
54 | setCaption( tempstr ); | ||
53 | 55 | ||
54 | tran = info; | 56 | tran = info; |
55 | currencySymbol = symbol; | 57 | currencySymbol = symbol; |
56 | 58 | ||