author | drw <drw> | 2002-11-02 01:29:30 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-02 01:29:30 (UTC) |
commit | bf9388acdebf6e55345dff3bd1cd652b45a2202a (patch) (side-by-side diff) | |
tree | 737ca55c9a30a1dde3aa289fd99cac7e4c30a3f7 /noncore/apps/checkbook/checkbook.cpp | |
parent | 6e9225388baa9dfac4ed09f22189cfa98a610d39 (diff) | |
download | opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.zip opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.gz opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.bz2 |
Code updates/fixes
Diffstat (limited to 'noncore/apps/checkbook/checkbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 59 |
1 files changed, 29 insertions, 30 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 @@ -25,12 +25,14 @@ Boston, MA 02111-1307, USA. */ #include "checkbook.h" #include "transaction.h" +#include "graph.h" +#include "graphinfo.h" #include <opie/otabwidget.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> @@ -47,20 +49,25 @@ #include <qwidget.h> Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { name = n; - filename = fd + name + ".qcb"; + filename = fd; + filename.append( name ); + filename.append( ".qcb" ); filedir = fd; currencySymbol = symbol; currBalance = 0.0; if ( name != "" ) { - setCaption( name + " - " + tr( "Checkbook" ) ); + QString tempstr = name; + tempstr.append( " - " ); + tempstr.append( tr( "Checkbook" ) ); + setCaption( tempstr ); } else { setCaption( tr( "New checkbook" ) ); } @@ -239,19 +246,20 @@ QWidget *Checkbook::initCharts() graphList->insertItem( tr( "By category" ) ); graphList->insertItem( tr( "..." ) ); graphList->insertItem( tr( "..." ) ); layout->addWidget( graphList, 0, 1 ); */ - QWidget *graphWidget = new QWidget( control ); - QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) ); + GraphInfo* info = new GraphInfo( GraphInfo::BarChart, 0x0, tr( "Graph Title" ), + tr( "X-Axis" ), tr( "Y-Axis" ) ); + graphWidget = new Graph( control, info ); + QWhatsThis::add( graphWidget, tr( "Charting is not implemented yet." ) ); layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); - graphWidget->setBackgroundMode( QWidget::PaletteBase ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); - QWhatsThis::add( btn, tr( "Click here to draw the graph." ) ); + QWhatsThis::add( btn, tr( "Click here to draw the chart." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); layout->addWidget( btn, 1, 1 ); return control; } @@ -273,14 +281,14 @@ void Checkbook::loadCheckbook() if ( typeList->currentText() == temptext ) { break; } } bankEdit->setText( config.readEntry( "Bank", "" ) ); - acctNumEdit->setText( config.readEntry( "Number", "" ) ); - pinNumEdit->setText( config.readEntry( "PINNumber", "" ) ); + acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); + pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); notesEdit->setText( config.readEntry( "Notes", "" ) ); bool ok; currBalance = balanceEdit->text().toFloat( &ok ); startBalance = currBalance; @@ -306,17 +314,13 @@ void Checkbook::loadCheckbook() stramount.sprintf( "%c%.2f", currencySymbol, amount ); // Add to transaction list transactions.append( tran ); // Add to transaction table - QDate date = tran->date(); - QString datestr = QString::number( date.month() ) + "/" + - QString::number( date.day() ) + "/" + - QString::number( date.year() ); - ( void ) new QListViewItem( tranTable, QString::number( i ), datestr, + ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(), trandesc, stramount ); } else { delete tran; } @@ -354,14 +358,14 @@ void Checkbook::accept() Config *config = new Config(filename, Config::File); // Save info config->setGroup( "Account" ); config->writeEntry( "Type", typeList->currentText() ); config->writeEntry( "Bank", bankEdit->text() ); - config->writeEntry( "Number", acctNumEdit->text() ); - config->writeEntry( "PINNumber", pinNumEdit->text() ); + config->writeEntryCrypt( "Number", acctNumEdit->text() ); + config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); config->writeEntry( "Balance", balanceEdit->text() ); config->writeEntry( "Notes", notesEdit->text() ); // Save transactions TranInfo *tran = transactions.first(); int i = 1; @@ -376,14 +380,19 @@ void Checkbook::accept() QDialog::accept(); } void Checkbook::slotNameChanged( const QString &newname ) { name = newname; - filename = filedir + newname + ".qcb"; - setCaption( name + " - " + tr( "Checkbook" ) ); + filename = filedir; + filename.append( newname ); + filename.append( ".qcb" ); + QString tempstr = name; + tempstr.append( " - " ); + tempstr.append( tr( "Checkbook" ) ); + setCaption( tempstr ); } void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) { currBalance -= startBalance; bool ok; @@ -411,19 +420,14 @@ void Checkbook::slotNewTran() stramount.sprintf( "%c%.2f", currencySymbol, amount ); // Add to transaction list transactions.append( traninfo ); // Add to transaction table - - QDate date = traninfo->date(); - QString datestr = QString::number( date.month() ) + "/" + - QString::number( date.day() ) + "/" + - QString::number( date.year() ); - ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), datestr, - traninfo->desc(), stramount ); + ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), + traninfo->datestr(), traninfo->desc(), stramount ); adjustBalance( amount ); } else { highTranNum--; @@ -451,17 +455,13 @@ void Checkbook::slotEditTran() Transaction *currtran = new Transaction( this, name, traninfo, currencySymbol ); currtran->showMaximized(); if ( currtran->exec() == QDialog::Accepted ) { - QDate date = traninfo->date(); - QString datestr = QString::number( date.month() ) + "/" + - QString::number( date.day() ) + "/" + - QString::number( date.year() ); - curritem->setText( 1, datestr ); + curritem->setText( 1, traninfo->datestr() ); curritem->setText( 2, traninfo->desc() ); float amount = traninfo->amount(); if ( traninfo->withdrawal() ) { @@ -486,13 +486,12 @@ void Checkbook::slotDeleteTran() { return; } bool ok; int tranid = curritem->text( 0 ).toInt( &ok ); - //TranInfo *traninfo = transactions.at( tranid - 1 ); TranInfo *traninfo = findTranByID( tranid ); if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) { float amount = traninfo->amount(); if ( traninfo->withdrawal() ) |