Diffstat (limited to 'noncore/apps/qashmoney/transactiondisplay.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index ae6223d..1839cd2 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -64,12 +64,13 @@ TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) | |||
64 | 64 | ||
65 | listview = new QListView ( this ); | 65 | listview = new QListView ( this ); |
66 | listview->setAllColumnsShowFocus ( TRUE ); | 66 | listview->setAllColumnsShowFocus ( TRUE ); |
67 | listview->setShowSortIndicator ( TRUE ); | 67 | listview->setShowSortIndicator ( TRUE ); |
68 | listview->header()->setTracking ( FALSE ); | 68 | listview->header()->setTracking ( FALSE ); |
69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
70 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
70 | 71 | ||
71 | layout = new QVBoxLayout ( this, 2, 2 ); | 72 | layout = new QVBoxLayout ( this, 2, 2 ); |
72 | layout->addWidget ( firstline ); | 73 | layout->addWidget ( firstline ); |
73 | layout->addWidget ( secondline ); | 74 | layout->addWidget ( secondline ); |
74 | layout->addWidget ( listview ); | 75 | layout->addWidget ( listview ); |
75 | } | 76 | } |
@@ -130,13 +131,13 @@ void TransactionDisplay::addTransaction () | |||
130 | setTransactionDisplayDate (); | 131 | setTransactionDisplayDate (); |
131 | if ( transaction->getNumberOfTransactions() > 0 ) | 132 | if ( transaction->getNumberOfTransactions() > 0 ) |
132 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 133 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
133 | 134 | ||
134 | // redisplay transfers | 135 | // redisplay transfers |
135 | if ( transfer->getNumberOfTransfers() > 0 ) | 136 | if ( transfer->getNumberOfTransfers() > 0 ) |
136 | transfer->displayTransfers ( listview, accountid, children ); | 137 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
137 | 138 | ||
138 | // add the transaction amount to the account it's associated with | 139 | // add the transaction amount to the account it's associated with |
139 | // and update its parent account balance if necessary | 140 | // and update its parent account balance if necessary |
140 | account->updateAccountBalance ( accountid ); | 141 | account->updateAccountBalance ( accountid ); |
141 | if ( account->getParentAccountID ( accountid ) != -1 ) | 142 | if ( account->getParentAccountID ( accountid ) != -1 ) |
142 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 143 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
@@ -369,13 +370,13 @@ void TransactionDisplay::updateAndDisplay ( int id ) | |||
369 | setTransactionDisplayDate (); | 370 | setTransactionDisplayDate (); |
370 | if ( transaction->getNumberOfTransactions() > 0 ) | 371 | if ( transaction->getNumberOfTransactions() > 0 ) |
371 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 372 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
372 | 373 | ||
373 | // redisplay transfers | 374 | // redisplay transfers |
374 | if ( transfer->getNumberOfTransfers() > 0 ) | 375 | if ( transfer->getNumberOfTransfers() > 0 ) |
375 | transfer->displayTransfers ( listview, accountid, children ); | 376 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
376 | 377 | ||
377 | // add the transaction amount to the account it's associated with | 378 | // add the transaction amount to the account it's associated with |
378 | // and update its parent account balance if necessary | 379 | // and update its parent account balance if necessary |
379 | account->updateAccountBalance ( id ); | 380 | account->updateAccountBalance ( id ); |
380 | if ( account->getParentAccountID ( id ) != -1 ) | 381 | if ( account->getParentAccountID ( id ) != -1 ) |
381 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); | 382 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); |
@@ -413,13 +414,13 @@ void TransactionDisplay::deleteTransaction () | |||
413 | displaytext.prepend ( limitbox->text() ); | 414 | displaytext.prepend ( limitbox->text() ); |
414 | setTransactionDisplayDate (); | 415 | setTransactionDisplayDate (); |
415 | if ( transaction->getNumberOfTransactions() > 0 ) | 416 | if ( transaction->getNumberOfTransactions() > 0 ) |
416 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 417 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
417 | 418 | ||
418 | if ( transfer->getNumberOfTransfers() > 0 ) | 419 | if ( transfer->getNumberOfTransfers() > 0 ) |
419 | transfer->displayTransfers ( listview, accountid, children ); | 420 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
420 | 421 | ||
421 | // if we are viewing different child accounts through the parent account | 422 | // if we are viewing different child accounts through the parent account |
422 | // ie if there are five columns and the parentid is -1 | 423 | // ie if there are five columns and the parentid is -1 |
423 | // update the accountid ( which is the parent ) and update the child account | 424 | // update the accountid ( which is the parent ) and update the child account |
424 | // balance. Get its accountid from the transactionid | 425 | // balance. Get its accountid from the transactionid |
425 | account->updateAccountBalance ( accountid ); // will update either a parent or child | 426 | account->updateAccountBalance ( accountid ); // will update either a parent or child |
@@ -445,13 +446,13 @@ void TransactionDisplay::deleteTransaction () | |||
445 | displaytext.prepend ( limitbox->text() ); | 446 | displaytext.prepend ( limitbox->text() ); |
446 | setTransactionDisplayDate (); | 447 | setTransactionDisplayDate (); |
447 | if ( transaction->getNumberOfTransactions() > 0 ) | 448 | if ( transaction->getNumberOfTransactions() > 0 ) |
448 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 449 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
449 | 450 | ||
450 | if ( transfer->getNumberOfTransfers() > 0 ) | 451 | if ( transfer->getNumberOfTransfers() > 0 ) |
451 | transfer->displayTransfers ( listview, accountid, children ); | 452 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
452 | 453 | ||
453 | // for the from account | 454 | // for the from account |
454 | account->updateAccountBalance ( fromaccountid ); | 455 | account->updateAccountBalance ( fromaccountid ); |
455 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) | 456 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) |
456 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); | 457 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); |
457 | 458 | ||
@@ -498,13 +499,13 @@ void TransactionDisplay::toggleTransaction () | |||
498 | displaytext.prepend ( limitbox->text() ); | 499 | displaytext.prepend ( limitbox->text() ); |
499 | setTransactionDisplayDate (); | 500 | setTransactionDisplayDate (); |
500 | if ( transaction->getNumberOfTransactions() > 0 ) | 501 | if ( transaction->getNumberOfTransactions() > 0 ) |
501 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 502 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
502 | 503 | ||
503 | if ( transfer->getNumberOfTransfers() != 0 ) | 504 | if ( transfer->getNumberOfTransfers() != 0 ) |
504 | transfer->displayTransfers ( listview, accountid, children ); | 505 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
505 | } | 506 | } |
506 | 507 | ||
507 | void TransactionDisplay::redisplayAccountBalance () | 508 | void TransactionDisplay::redisplayAccountBalance () |
508 | { | 509 | { |
509 | QString accountbalance = account->getAccountBalance ( accountid ); | 510 | QString accountbalance = account->getAccountBalance ( accountid ); |
510 | balance->setText ( accountbalance ); | 511 | balance->setText ( accountbalance ); |
@@ -548,23 +549,28 @@ void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
548 | else if ( listview->columns() == 5 && column != 4 ) | 549 | else if ( listview->columns() == 5 && column != 4 ) |
549 | preferences->changeColumnPreference ( column + 6, newsize ); | 550 | preferences->changeColumnPreference ( column + 6, newsize ); |
550 | else | 551 | else |
551 | preferences->changeColumnPreference ( 9, newsize ); | 552 | preferences->changeColumnPreference ( 9, newsize ); |
552 | } | 553 | } |
553 | 554 | ||
555 | void TransactionDisplay::saveSortingPreference ( int column ) | ||
556 | { | ||
557 | preferences->changeSortingPreference ( 2, column ); | ||
558 | } | ||
559 | |||
554 | void TransactionDisplay::limitDisplay ( const QString &text ) | 560 | void TransactionDisplay::limitDisplay ( const QString &text ) |
555 | { | 561 | { |
556 | listview->clear (); | 562 | listview->clear (); |
557 | QString displaytext = "%"; | 563 | QString displaytext = "%"; |
558 | displaytext.prepend ( text ); | 564 | displaytext.prepend ( text ); |
559 | setTransactionDisplayDate (); | 565 | setTransactionDisplayDate (); |
560 | if ( transaction->getNumberOfTransactions() > 0 ) | 566 | if ( transaction->getNumberOfTransactions() > 0 ) |
561 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 567 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
562 | 568 | ||
563 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) | 569 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) |
564 | transfer->displayTransfers ( listview, accountid, children ); | 570 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
565 | } | 571 | } |
566 | 572 | ||
567 | int TransactionDisplay::getIDColumn () | 573 | int TransactionDisplay::getIDColumn () |
568 | { | 574 | { |
569 | int counter; | 575 | int counter; |
570 | int columns = listview->columns(); | 576 | int columns = listview->columns(); |
@@ -616,8 +622,8 @@ void TransactionDisplay::setTransactionDisplayDate () | |||
616 | case 4: // one year | 622 | case 4: // one year |
617 | displaydate = today.addDays ( -365 ); | 623 | displaydate = today.addDays ( -365 ); |
618 | break; | 624 | break; |
619 | } | 625 | } |
620 | } | 626 | } |
621 | else | 627 | else |
622 | displaydate = QDate ( 1, 1, 1000 ); | 628 | displaydate = QDate ( 1900, 1, 1 ); |
623 | } | 629 | } |