Diffstat (limited to 'noncore/apps/qashmoney/transactiondisplay.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 14f5641..ae6223d 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -129,4 +129,5 @@ void TransactionDisplay::addTransaction () | |||
129 | displaytext.prepend ( limitbox->text() ); | 129 | displaytext.prepend ( limitbox->text() ); |
130 | setTransactionDisplayDate (); | ||
130 | if ( transaction->getNumberOfTransactions() > 0 ) | 131 | if ( transaction->getNumberOfTransactions() > 0 ) |
131 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 132 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
132 | 133 | ||
@@ -367,4 +368,5 @@ void TransactionDisplay::updateAndDisplay ( int id ) | |||
367 | displaytext.prepend ( limitbox->text() ); | 368 | displaytext.prepend ( limitbox->text() ); |
369 | setTransactionDisplayDate (); | ||
368 | if ( transaction->getNumberOfTransactions() > 0 ) | 370 | if ( transaction->getNumberOfTransactions() > 0 ) |
369 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 371 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
370 | 372 | ||
@@ -411,4 +413,5 @@ void TransactionDisplay::deleteTransaction () | |||
411 | displaytext.prepend ( limitbox->text() ); | 413 | displaytext.prepend ( limitbox->text() ); |
414 | setTransactionDisplayDate (); | ||
412 | if ( transaction->getNumberOfTransactions() > 0 ) | 415 | if ( transaction->getNumberOfTransactions() > 0 ) |
413 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 416 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
414 | 417 | ||
@@ -442,4 +445,5 @@ void TransactionDisplay::deleteTransaction () | |||
442 | displaytext.prepend ( limitbox->text() ); | 445 | displaytext.prepend ( limitbox->text() ); |
446 | setTransactionDisplayDate (); | ||
443 | if ( transaction->getNumberOfTransactions() > 0 ) | 447 | if ( transaction->getNumberOfTransactions() > 0 ) |
444 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 448 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
445 | 449 | ||
@@ -494,4 +498,5 @@ void TransactionDisplay::toggleTransaction () | |||
494 | displaytext.prepend ( limitbox->text() ); | 498 | displaytext.prepend ( limitbox->text() ); |
499 | setTransactionDisplayDate (); | ||
495 | if ( transaction->getNumberOfTransactions() > 0 ) | 500 | if ( transaction->getNumberOfTransactions() > 0 ) |
496 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 501 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
497 | 502 | ||
@@ -553,3 +558,6 @@ void TransactionDisplay::limitDisplay ( const QString &text ) | |||
553 | displaytext.prepend ( text ); | 558 | displaytext.prepend ( text ); |
554 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 559 | setTransactionDisplayDate (); |
560 | if ( transaction->getNumberOfTransactions() > 0 ) | ||
561 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | ||
562 | |||
555 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) | 563 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) |
@@ -586 +594,30 @@ void TransactionDisplay::showTransactionNotes () | |||
586 | 594 | ||
595 | void TransactionDisplay::setTransactionDisplayDate () | ||
596 | { | ||
597 | // determine how many days of transactions to show | ||
598 | int limittype = preferences->getPreference ( 7 ); | ||
599 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | ||
600 | { | ||
601 | QDate today = QDate::currentDate (); | ||
602 | switch ( limittype ) // if we are not showing all transactions | ||
603 | { | ||
604 | case 0: // viewing two weeks | ||
605 | displaydate = today.addDays ( -14 ); | ||
606 | break; | ||
607 | case 1: // viewing one month | ||
608 | displaydate = today.addDays ( -30 ); | ||
609 | break; | ||
610 | case 2: // three months | ||
611 | displaydate = today.addDays ( -90 ); | ||
612 | break; | ||
613 | case 3: // six months | ||
614 | displaydate = today.addDays ( -180 ); | ||
615 | break; | ||
616 | case 4: // one year | ||
617 | displaydate = today.addDays ( -365 ); | ||
618 | break; | ||
619 | } | ||
620 | } | ||
621 | else | ||
622 | displaydate = QDate ( 1, 1, 1000 ); | ||
623 | } | ||