summaryrefslogtreecommitdiff
path: root/noncore
authordrw <drw>2002-11-02 01:29:30 (UTC)
committer drw <drw>2002-11-02 01:29:30 (UTC)
commitbf9388acdebf6e55345dff3bd1cd652b45a2202a (patch) (unidiff)
tree737ca55c9a30a1dde3aa289fd99cac7e4c30a3f7 /noncore
parent6e9225388baa9dfac4ed09f22189cfa98a610d39 (diff)
downloadopie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.zip
opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.gz
opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.bz2
Code updates/fixes
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp59
-rw-r--r--noncore/apps/checkbook/checkbook.h5
-rw-r--r--noncore/apps/checkbook/checkbook.pro42
-rw-r--r--noncore/apps/checkbook/graph.cpp112
-rw-r--r--noncore/apps/checkbook/graph.h63
-rw-r--r--noncore/apps/checkbook/graphinfo.cpp84
-rw-r--r--noncore/apps/checkbook/graphinfo.h82
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp11
-rw-r--r--noncore/apps/checkbook/traninfo.cpp25
-rw-r--r--noncore/apps/checkbook/traninfo.h1
-rw-r--r--noncore/apps/checkbook/transaction.cpp4
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
@@ -28,6 +28,8 @@
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>
@@ -50,14 +52,19 @@ Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char
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 {
@@ -242,13 +249,14 @@ QWidget *Checkbook::initCharts()
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
@@ -276,8 +284,8 @@ void Checkbook::loadCheckbook()
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
@@ -309,11 +317,7 @@ void Checkbook::loadCheckbook()
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
@@ -357,8 +361,8 @@ void Checkbook::accept()
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
@@ -379,8 +383,13 @@ void Checkbook::accept()
379void Checkbook::slotNameChanged( const QString &newname ) 383void 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
386void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) 395void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
@@ -414,13 +423,8 @@ void Checkbook::slotNewTran()
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 }
@@ -454,11 +458,7 @@ void Checkbook::slotEditTran()
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
@@ -489,7 +489,6 @@ void Checkbook::slotDeleteTran()
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() ) )
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
@@ -35,6 +35,7 @@
35 35
36class OTabWidget; 36class OTabWidget;
37 37
38class Graph;
38class QComboBox; 39class QComboBox;
39class QLabel; 40class QLabel;
40class QLineEdit; 41class QLineEdit;
@@ -83,9 +84,9 @@ class Checkbook : public QDialog
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();
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,14 +1,18 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3HEADERS = mainwindow.h \ 3HEADERS = mainwindow.h \
4 traninfo.h \ 4 traninfo.h \
5 checkbook.h \ 5 graphinfo.h \
6 transaction.h 6 checkbook.h \
7SOURCES = main.cpp \ 7 transaction.h \
8 mainwindow.cpp \ 8 graph.h
9 traninfo.cpp \ 9SOURCES = 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
12INCLUDEPATH += $(OPIEDIR)/include 16INCLUDEPATH += $(OPIEDIR)/include
13DEPENDPATH += $(OPIEDIR)/include 17DEPENDPATH += $(OPIEDIR)/include
14LIBS += -lqpe -lopie 18LIBS += -lqpe -lopie
@@ -16,17 +20,17 @@ TARGET = checkbook
16DESTDIR = $(OPIEDIR)/bin 20DESTDIR = $(OPIEDIR)/bin
17 21
18TRANSLATIONS = ../../../i18n/de/checkbook.ts \ 22TRANSLATIONS = ../../../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
34Graph::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
44void Graph::setGraphInfo( GraphInfo *d )
45{
46 data = d;
47}
48
49void Graph::drawGraph( bool regen )
50{
51 if ( regen )
52 {
53 initGraph();
54 }
55 QPainter p( this );
56 p.drawPixmap( 0, 0, graph );
57}
58
59void Graph::paintEvent( QPaintEvent * )
60{
61 drawGraph( FALSE );
62}
63
64void Graph::resizeEvent( QResizeEvent * )
65{
66 drawGraph( TRUE );
67}
68
69void 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
100void Graph::drawBarChart()
101{
102 //Find max value in GraphInfo->dataPoints() - make function in GraphInfo!!!
103}
104
105void Graph::drawLineChart()
106{
107}
108
109void 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
35class GraphInfo;
36
37class 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
31GraphInfo::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
41GraphInfo::GraphType GraphInfo::graphType()
42{
43 return t;
44}
45
46void GraphInfo::setGraphType( GraphType type )
47{
48 t = type;
49}
50
51DataPointList *GraphInfo::dataPoints()
52{
53 return d;
54}
55
56void GraphInfo::setDataPoints( DataPointList *data )
57{
58 d = data;
59}
60
61float GraphInfo::maxValue()
62{
63 float max;
64
65}
66
67float GraphInfo::minValue()
68{
69}
70
71void GraphInfo::setGraphTitle( const QString &title )
72{
73 gt = title;
74}
75
76void GraphInfo::setXAxisTitle( const QString &xtitle )
77{
78 xt = xtitle;
79}
80
81void 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
35class 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
51typedef QList<DataPointInfo> DataPointList;
52
53class 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
@@ -137,7 +137,10 @@ void MainWindow::slotEdit()
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();
@@ -151,8 +154,10 @@ 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();
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
@@ -30,6 +30,8 @@
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32 32
33QString tempstr;
34
33TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, 35TranInfo::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 &notes ) 37 float fee, const QString &number, const QString &notes )
@@ -117,15 +119,32 @@ TranInfo::TranInfo( Config config, int entry )
117 } 119 }
118} 120}
119 121
122const 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
120void TranInfo::write( Config *config, int entry ) 137void 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"
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
@@ -47,6 +47,7 @@ class TranInfo
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; }
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
@@ -49,7 +49,9 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in
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;