Diffstat (limited to 'noncore/apps/checkbook/checkbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 223 |
1 files changed, 83 insertions, 140 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 5a6d607..7a6b7cc 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -24,13 +24,15 @@ | |||
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "checkbook.h" | 29 | #include "checkbook.h" |
30 | #include "cbinfo.h" | ||
30 | #include "transaction.h" | 31 | #include "transaction.h" |
32 | #include "traninfo.h" | ||
31 | #include "graph.h" | 33 | #include "graph.h" |
32 | #include "graphinfo.h" | 34 | #include "graphinfo.h" |
33 | #include "password.h" | 35 | #include "password.h" |
34 | 36 | ||
35 | #include <opie/otabwidget.h> | 37 | #include <opie/otabwidget.h> |
36 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
@@ -47,26 +49,21 @@ | |||
47 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
48 | #include <qmultilineedit.h> | 50 | #include <qmultilineedit.h> |
49 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
50 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
51 | #include <qwidget.h> | 53 | #include <qwidget.h> |
52 | 54 | ||
53 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, const QString &symbol ) | 55 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol ) |
54 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 56 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
55 | { | 57 | { |
56 | name = n; | 58 | info = i; |
57 | filename = fd; | ||
58 | filename.append( name ); | ||
59 | filename.append( ".qcb" ); | ||
60 | filedir = fd; | ||
61 | currencySymbol = symbol; | 59 | currencySymbol = symbol; |
62 | currBalance = 0.0; | ||
63 | 60 | ||
64 | if ( name != "" ) | 61 | if ( info->name() != "" ) |
65 | { | 62 | { |
66 | QString tempstr = name; | 63 | QString tempstr = info->name(); |
67 | tempstr.append( " - " ); | 64 | tempstr.append( " - " ); |
68 | tempstr.append( tr( "Checkbook" ) ); | 65 | tempstr.append( tr( "Checkbook" ) ); |
69 | setCaption( tempstr ); | 66 | setCaption( tempstr ); |
70 | } | 67 | } |
71 | else | 68 | else |
72 | { | 69 | { |
@@ -92,17 +89,12 @@ Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, cons | |||
92 | } | 89 | } |
93 | 90 | ||
94 | Checkbook::~Checkbook() | 91 | Checkbook::~Checkbook() |
95 | { | 92 | { |
96 | } | 93 | } |
97 | 94 | ||
98 | const QString &Checkbook::getName() | ||
99 | { | ||
100 | return( name ); | ||
101 | } | ||
102 | |||
103 | QWidget *Checkbook::initInfo() | 95 | QWidget *Checkbook::initInfo() |
104 | { | 96 | { |
105 | QWidget *control = new QWidget( mainWidget ); | 97 | QWidget *control = new QWidget( mainWidget ); |
106 | 98 | ||
107 | QVBoxLayout *vb = new QVBoxLayout( control ); | 99 | QVBoxLayout *vb = new QVBoxLayout( control ); |
108 | 100 | ||
@@ -270,161 +262,121 @@ QWidget *Checkbook::initCharts() | |||
270 | 262 | ||
271 | return control; | 263 | return control; |
272 | } | 264 | } |
273 | 265 | ||
274 | void Checkbook::loadCheckbook() | 266 | void Checkbook::loadCheckbook() |
275 | { | 267 | { |
276 | transactions.clear(); | 268 | if ( !info ) |
277 | 269 | { | |
278 | Config config( filename, Config::File ); | 270 | return; |
271 | } | ||
279 | 272 | ||
280 | // Load info | 273 | tranList = info->transactions(); |
281 | config.setGroup( "Account" ); | ||
282 | 274 | ||
283 | password = config.readEntryCrypt( "Password", "" ); | 275 | passwordCB->setChecked( !info->password().isNull() ); |
284 | passwordCB->setChecked( password != "" ); | 276 | nameEdit->setText( info->name() ); |
285 | nameEdit->setText( name ); | 277 | QString temptext = info->type(); |
286 | QString temptext = config.readEntry( "Type" ); | ||
287 | int i = typeList->count(); | 278 | int i = typeList->count(); |
288 | while ( i > 0 ) | 279 | while ( i > 0 ) |
289 | { | 280 | { |
290 | i--; | 281 | i--; |
291 | typeList->setCurrentItem( i ); | 282 | typeList->setCurrentItem( i ); |
292 | if ( typeList->currentText() == temptext ) | 283 | if ( typeList->currentText() == temptext ) |
293 | { | 284 | { |
294 | break; | 285 | break; |
295 | } | 286 | } |
296 | } | 287 | } |
297 | bankEdit->setText( config.readEntry( "Bank", "" ) ); | 288 | bankEdit->setText( info->bank() ); |
298 | acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); | 289 | acctNumEdit->setText( info->account() ); |
299 | pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); | 290 | pinNumEdit->setText( info->pin() ); |
300 | balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); | 291 | temptext.setNum( info->startingBalance(), 'f', 2 ); |
301 | notesEdit->setText( config.readEntry( "Notes", "" ) ); | 292 | balanceEdit->setText( temptext ); |
302 | 293 | notesEdit->setText( info->notes() ); | |
303 | bool ok; | ||
304 | currBalance = balanceEdit->text().toFloat( &ok ); | ||
305 | startBalance = currBalance; | ||
306 | 294 | ||
307 | // Load transactions | 295 | // Load transactions |
308 | TranInfo *tran; | ||
309 | QString trandesc = ""; | ||
310 | float amount; | 296 | float amount; |
311 | QString stramount; | 297 | QString stramount; |
312 | for ( int i = 1; trandesc != QString::null; i++ ) | 298 | |
313 | { | 299 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) |
314 | tran = new TranInfo( config, i ); | ||
315 | trandesc = tran->desc(); | ||
316 | if ( trandesc != QString::null ) | ||
317 | { | 300 | { |
318 | currBalance -= tran->fee(); | ||
319 | amount = tran->amount(); | 301 | amount = tran->amount(); |
320 | if ( tran->withdrawal() ) | 302 | if ( tran->withdrawal() ) |
321 | { | 303 | { |
322 | amount *= -1; | 304 | amount *= -1; |
323 | } | 305 | } |
324 | currBalance += amount; | ||
325 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | 306 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); |
326 | 307 | ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), tran->desc(), stramount ); | |
327 | // Add to transaction list | ||
328 | transactions.inSort( tran ); | ||
329 | |||
330 | // Add to transaction table | ||
331 | ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), trandesc, stramount ); | ||
332 | } | 308 | } |
333 | else | ||
334 | { | ||
335 | delete tran; | ||
336 | } | ||
337 | } | ||
338 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); | ||
339 | 309 | ||
340 | highTranNum = transactions.count(); | 310 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) ); |
311 | |||
312 | highTranNum = tranList->count(); | ||
341 | } | 313 | } |
342 | 314 | ||
343 | void Checkbook::adjustBalance( float amount ) | 315 | void Checkbook::adjustBalance() |
344 | { | 316 | { |
345 | currBalance += amount; | 317 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) ); |
346 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); | ||
347 | |||
348 | } | 318 | } |
349 | 319 | ||
350 | TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc ) | 320 | TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc ) |
351 | { | 321 | { |
352 | TranInfo *traninfo = transactions.first(); | 322 | TranInfo *traninfo = tranList->first(); |
353 | while ( traninfo ) | 323 | while ( traninfo ) |
354 | { | 324 | { |
355 | if ( traninfo->number() == checknum && traninfo->datestr() == date && | 325 | if ( traninfo->number() == checknum && traninfo->datestr() == date && |
356 | traninfo->desc() == desc ) | 326 | traninfo->desc() == desc ) |
357 | break; | 327 | break; |
358 | traninfo = transactions.next(); | 328 | traninfo = tranList->next(); |
359 | } | 329 | } |
360 | return( traninfo ); | 330 | return( traninfo ); |
361 | } | 331 | } |
362 | 332 | ||
363 | void Checkbook::accept() | 333 | void Checkbook::accept() |
364 | { | 334 | { |
365 | QFile f( filename ); | 335 | info->setName( nameEdit->text() ); |
366 | if ( f.exists() ) | 336 | info->setType( typeList->currentText() ); |
367 | { | 337 | info->setBank( bankEdit->text() ); |
368 | f.remove(); | 338 | info->setAccount( acctNumEdit->text() ); |
369 | } | 339 | info->setPin( pinNumEdit->text() ); |
370 | 340 | bool ok; | |
371 | Config *config = new Config(filename, Config::File); | 341 | info->setStartingBalance( balanceEdit->text().toFloat( &ok ) ); |
372 | 342 | info->setNotes( notesEdit->text() ); | |
373 | // Save info | ||
374 | config->setGroup( "Account" ); | ||
375 | config->writeEntryCrypt( "Password", password ); | ||
376 | config->writeEntry( "Type", typeList->currentText() ); | ||
377 | config->writeEntry( "Bank", bankEdit->text() ); | ||
378 | config->writeEntryCrypt( "Number", acctNumEdit->text() ); | ||
379 | config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); | ||
380 | config->writeEntry( "Balance", balanceEdit->text() ); | ||
381 | config->writeEntry( "Notes", notesEdit->text() ); | ||
382 | |||
383 | // Save transactions | ||
384 | int i = 1; | ||
385 | for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() ) | ||
386 | { | ||
387 | tran->write( config, i ); | ||
388 | i++; | ||
389 | } | ||
390 | config->write(); | ||
391 | 343 | ||
392 | QDialog::accept(); | 344 | QDialog::accept(); |
393 | } | 345 | } |
394 | 346 | ||
395 | void Checkbook::slotPasswordClicked() | 347 | void Checkbook::slotPasswordClicked() |
396 | { | 348 | { |
397 | if ( password == "" && passwordCB->isChecked() ) | 349 | if ( info->password().isNull() && passwordCB->isChecked() ) |
398 | { | 350 | { |
399 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 351 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
400 | if ( pw->exec() != QDialog::Accepted ) | 352 | if ( pw->exec() != QDialog::Accepted ) |
401 | { | 353 | { |
402 | passwordCB->setChecked( FALSE ); | 354 | passwordCB->setChecked( FALSE ); |
403 | delete pw; | 355 | delete pw; |
404 | return; | 356 | return; |
405 | } | 357 | } |
406 | password = pw->password; | 358 | info->setPassword( pw->password ); |
407 | delete pw; | 359 | delete pw; |
408 | 360 | ||
409 | pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) ); | 361 | pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) ); |
410 | if ( pw->exec() != QDialog::Accepted || pw->password != password ) | 362 | if ( pw->exec() != QDialog::Accepted || pw->password != info->password() ) |
411 | { | 363 | { |
412 | passwordCB->setChecked( FALSE ); | 364 | passwordCB->setChecked( FALSE ); |
413 | password = ""; | 365 | info->setPassword( QString::null ); |
414 | } | 366 | } |
415 | 367 | ||
416 | delete pw; | 368 | delete pw; |
417 | } | 369 | } |
418 | else if ( password != "" && !passwordCB->isChecked() ) | 370 | else if ( !info->password().isNull() && !passwordCB->isChecked() ) |
419 | { | 371 | { |
420 | Password *pw = new Password( this, tr( "Enter password" ), | 372 | Password *pw = new Password( this, tr( "Enter password" ), |
421 | tr( "Please enter your password to confirm removal of password protection:" ) ); | 373 | tr( "Please enter your password to confirm removal of password protection:" ) ); |
422 | if ( pw->exec() == QDialog::Accepted && pw->password == password ) | 374 | if ( pw->exec() == QDialog::Accepted && pw->password == info->password() ) |
423 | { | 375 | { |
424 | password = ""; | 376 | info->setPassword( QString::null ); |
425 | delete pw; | 377 | delete pw; |
426 | return; | 378 | return; |
427 | } | 379 | } |
428 | else | 380 | else |
429 | { | 381 | { |
430 | passwordCB->setChecked( TRUE ); | 382 | passwordCB->setChecked( TRUE ); |
@@ -433,57 +385,62 @@ void Checkbook::slotPasswordClicked() | |||
433 | delete pw; | 385 | delete pw; |
434 | } | 386 | } |
435 | } | 387 | } |
436 | 388 | ||
437 | void Checkbook::slotNameChanged( const QString &newname ) | 389 | void Checkbook::slotNameChanged( const QString &newname ) |
438 | { | 390 | { |
439 | name = newname; | 391 | info->setName( newname ); |
440 | filename = filedir; | 392 | |
441 | filename.append( newname ); | 393 | // TODO - need filedir |
442 | filename.append( ".qcb" ); | 394 | //QString namestr = filedir; |
443 | QString tempstr = name; | 395 | //namestr.append( newname ); |
444 | tempstr.append( " - " ); | 396 | //namestr.append( ".qcb" ); |
445 | tempstr.append( tr( "Checkbook" ) ); | 397 | //info->setFilename( namestr ); |
446 | setCaption( tempstr ); | 398 | |
399 | QString namestr = newname; | ||
400 | namestr.append( " - " ); | ||
401 | namestr.append( tr( "Checkbook" ) ); | ||
402 | setCaption( namestr ); | ||
447 | } | 403 | } |
448 | 404 | ||
449 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | 405 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) |
450 | { | 406 | { |
451 | currBalance -= startBalance; | ||
452 | bool ok; | 407 | bool ok; |
453 | startBalance = newbalance.toFloat( &ok ); | 408 | info->setStartingBalance( newbalance.toFloat( &ok ) ); |
454 | adjustBalance( startBalance ); | 409 | adjustBalance(); |
455 | } | 410 | } |
456 | 411 | ||
457 | void Checkbook::slotNewTran() | 412 | void Checkbook::slotNewTran() |
458 | { | 413 | { |
459 | highTranNum++; | 414 | highTranNum++; |
460 | TranInfo *traninfo = new TranInfo( highTranNum ); | 415 | TranInfo *traninfo = new TranInfo( highTranNum ); |
461 | 416 | ||
462 | Transaction *currtran = new Transaction( this, name, | 417 | Transaction *currtran = new Transaction( this, info->name(), |
463 | traninfo, | 418 | traninfo, |
464 | currencySymbol ); | 419 | currencySymbol ); |
465 | currtran->showMaximized(); | 420 | currtran->showMaximized(); |
466 | if ( currtran->exec() == QDialog::Accepted ) | 421 | if ( currtran->exec() == QDialog::Accepted ) |
467 | { | 422 | { |
468 | float amount = traninfo->amount(); | 423 | // Add to transaction list |
424 | info->addTransaction( traninfo ); | ||
425 | |||
426 | // Add to transaction table | ||
427 | float amount; | ||
428 | QString stramount; | ||
429 | |||
430 | amount = traninfo->amount(); | ||
469 | if ( traninfo->withdrawal() ) | 431 | if ( traninfo->withdrawal() ) |
470 | { | 432 | { |
471 | amount *= -1; | 433 | amount *= -1; |
472 | } | 434 | } |
473 | QString stramount; | ||
474 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | 435 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); |
475 | 436 | ||
476 | // Add to transaction list | ||
477 | transactions.inSort( traninfo ); | ||
478 | |||
479 | // Add to transaction table | ||
480 | ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(), | 437 | ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(), |
481 | stramount ); | 438 | stramount ); |
482 | 439 | ||
483 | adjustBalance( amount ); | 440 | adjustBalance(); |
484 | } | 441 | } |
485 | else | 442 | else |
486 | { | 443 | { |
487 | highTranNum--; | 444 | highTranNum--; |
488 | delete traninfo; | 445 | delete traninfo; |
489 | } | 446 | } |
@@ -494,45 +451,39 @@ void Checkbook::slotEditTran() | |||
494 | QListViewItem *curritem = tranTable->currentItem(); | 451 | QListViewItem *curritem = tranTable->currentItem(); |
495 | if ( !curritem ) | 452 | if ( !curritem ) |
496 | { | 453 | { |
497 | return; | 454 | return; |
498 | } | 455 | } |
499 | 456 | ||
500 | TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); | 457 | TranInfo *traninfo = info->findTransaction( curritem->text( 0 ), curritem->text( 1 ), |
501 | float origamt = traninfo->amount(); | 458 | curritem->text( 2 ) ); |
502 | if ( traninfo->withdrawal() ) | ||
503 | { | ||
504 | origamt *= -1; | ||
505 | } | ||
506 | 459 | ||
507 | Transaction *currtran = new Transaction( this, name, | 460 | Transaction *currtran = new Transaction( this, info->name(), |
508 | traninfo, | 461 | traninfo, |
509 | currencySymbol ); | 462 | currencySymbol ); |
510 | currtran->showMaximized(); | 463 | currtran->showMaximized(); |
511 | if ( currtran->exec() == QDialog::Accepted ) | 464 | if ( currtran->exec() == QDialog::Accepted ) |
512 | { | 465 | { |
466 | curritem->setText( 0, traninfo->number() ); | ||
513 | curritem->setText( 1, traninfo->datestr() ); | 467 | curritem->setText( 1, traninfo->datestr() ); |
514 | |||
515 | curritem->setText( 2, traninfo->desc() ); | 468 | curritem->setText( 2, traninfo->desc() ); |
516 | 469 | ||
517 | float amount = traninfo->amount(); | 470 | float amount = traninfo->amount(); |
518 | if ( traninfo->withdrawal() ) | 471 | if ( traninfo->withdrawal() ) |
519 | { | 472 | { |
520 | amount *= -1; | 473 | amount *= -1; |
521 | } | 474 | } |
522 | adjustBalance( origamt * -1 ); | ||
523 | adjustBalance( amount ); | ||
524 | QString stramount; | 475 | QString stramount; |
525 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | 476 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); |
526 | curritem->setText( 3, stramount ); | 477 | curritem->setText( 3, stramount ); |
527 | 478 | ||
528 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); | 479 | adjustBalance(); |
480 | } | ||
529 | 481 | ||
530 | delete currtran; | 482 | delete currtran; |
531 | } | 483 | } |
532 | } | ||
533 | 484 | ||
534 | void Checkbook::slotDeleteTran() | 485 | void Checkbook::slotDeleteTran() |
535 | { | 486 | { |
536 | QListViewItem *curritem = tranTable->currentItem(); | 487 | QListViewItem *curritem = tranTable->currentItem(); |
537 | if ( !curritem ) | 488 | if ( !curritem ) |
538 | { | 489 | { |
@@ -540,23 +491,15 @@ void Checkbook::slotDeleteTran() | |||
540 | } | 491 | } |
541 | 492 | ||
542 | TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); | 493 | TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); |
543 | 494 | ||
544 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) | 495 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) |
545 | { | 496 | { |
546 | float amount = traninfo->amount(); | 497 | info->removeTransaction( traninfo ); |
547 | if ( traninfo->withdrawal() ) | ||
548 | { | ||
549 | amount *= -1; | ||
550 | } | ||
551 | |||
552 | transactions.remove( traninfo ); | ||
553 | delete traninfo; | ||
554 | delete curritem; | 498 | delete curritem; |
555 | 499 | adjustBalance(); | |
556 | adjustBalance( amount * -1 ); | ||
557 | } | 500 | } |
558 | } | 501 | } |
559 | 502 | ||
560 | void Checkbook::slotDrawGraph() | 503 | void Checkbook::slotDrawGraph() |
561 | { | 504 | { |
562 | if ( graphInfo ) | 505 | if ( graphInfo ) |
@@ -579,19 +522,19 @@ void Checkbook::slotDrawGraph() | |||
579 | } | 522 | } |
580 | 523 | ||
581 | void Checkbook::drawBalanceChart() | 524 | void Checkbook::drawBalanceChart() |
582 | { | 525 | { |
583 | DataPointList *list = new DataPointList(); | 526 | DataPointList *list = new DataPointList(); |
584 | 527 | ||
585 | float balance = startBalance; | 528 | float balance = info->startingBalance(); |
586 | float amount; | 529 | float amount; |
587 | QString label; | 530 | QString label; |
588 | int i = 0; | 531 | int i = 0; |
589 | int count = transactions.count(); | 532 | int count = tranList->count(); |
590 | 533 | ||
591 | for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() ) | 534 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) |
592 | { | 535 | { |
593 | i++; | 536 | i++; |
594 | balance -= tran->fee(); | 537 | balance -= tran->fee(); |
595 | amount = tran->amount(); | 538 | amount = tran->amount(); |
596 | if ( tran->withdrawal() ) | 539 | if ( tran->withdrawal() ) |
597 | { | 540 | { |
@@ -613,21 +556,21 @@ void Checkbook::drawBalanceChart() | |||
613 | } | 556 | } |
614 | 557 | ||
615 | void Checkbook::drawCategoryChart( bool withdrawals ) | 558 | void Checkbook::drawCategoryChart( bool withdrawals ) |
616 | { | 559 | { |
617 | DataPointList *list = new DataPointList(); | 560 | DataPointList *list = new DataPointList(); |
618 | 561 | ||
619 | TranInfo *tran = transactions.first(); | 562 | TranInfo *tran = tranList->first(); |
620 | if ( tran && tran->withdrawal() == withdrawals ) | 563 | if ( tran && tran->withdrawal() == withdrawals ) |
621 | { | 564 | { |
622 | list->append( new DataPointInfo( tran->category(), tran->amount() ) ); | 565 | list->append( new DataPointInfo( tran->category(), tran->amount() ) ); |
623 | } | 566 | } |
624 | tran = transactions.next(); | 567 | tran = tranList->next(); |
625 | 568 | ||
626 | DataPointInfo *cat; | 569 | DataPointInfo *cat; |
627 | for ( ; tran; tran = transactions.next() ) | 570 | for ( ; tran; tran = tranList->next() ) |
628 | { | 571 | { |
629 | if ( tran->withdrawal() == withdrawals ) | 572 | if ( tran->withdrawal() == withdrawals ) |
630 | { | 573 | { |
631 | // Find category in list | 574 | // Find category in list |
632 | for ( cat = list->first(); cat; cat = list->next() ) | 575 | for ( cat = list->first(); cat; cat = list->next() ) |
633 | { | 576 | { |