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 /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 | |||
@@ -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 | { |