summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transactiondisplay.cpp
authorallenforsythe <allenforsythe>2003-05-16 20:08:38 (UTC)
committer allenforsythe <allenforsythe>2003-05-16 20:08:38 (UTC)
commite6ff2dbd2d128c3cf873e23f4df8006759b47079 (patch) (unidiff)
treebb3c996b76c8937d871f642f0e32032848d32396 /noncore/apps/qashmoney/transactiondisplay.cpp
parent87051a7ba4834aed152bc09aad7f4935c9729ccb (diff)
downloadopie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.zip
opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.gz
opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.bz2
Working on time frame for displaying cleared transactions. Not yet working.
Diffstat (limited to 'noncore/apps/qashmoney/transactiondisplay.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp49
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
@@ -127,8 +127,9 @@ void TransactionDisplay::addTransaction ()
127 listview->clear(); 127 listview->clear();
128 QString displaytext = "%"; 128 QString displaytext = "%";
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
133 // redisplay transfers 134 // redisplay transfers
134 if ( transfer->getNumberOfTransfers() > 0 ) 135 if ( transfer->getNumberOfTransfers() > 0 )
@@ -365,8 +366,9 @@ void TransactionDisplay::updateAndDisplay ( int id )
365 listview->clear(); 366 listview->clear();
366 QString displaytext = "%"; 367 QString displaytext = "%";
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
371 // redisplay transfers 373 // redisplay transfers
372 if ( transfer->getNumberOfTransfers() > 0 ) 374 if ( transfer->getNumberOfTransfers() > 0 )
@@ -409,8 +411,9 @@ void TransactionDisplay::deleteTransaction ()
409 listview->clear(); 411 listview->clear();
410 QString displaytext = "%"; 412 QString displaytext = "%";
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
415 if ( transfer->getNumberOfTransfers() > 0 ) 418 if ( transfer->getNumberOfTransfers() > 0 )
416 transfer->displayTransfers ( listview, accountid, children ); 419 transfer->displayTransfers ( listview, accountid, children );
@@ -440,8 +443,9 @@ void TransactionDisplay::deleteTransaction ()
440 listview->clear(); 443 listview->clear();
441 QString displaytext = "%"; 444 QString displaytext = "%";
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
446 if ( transfer->getNumberOfTransfers() > 0 ) 450 if ( transfer->getNumberOfTransfers() > 0 )
447 transfer->displayTransfers ( listview, accountid, children ); 451 transfer->displayTransfers ( listview, accountid, children );
@@ -492,8 +496,9 @@ void TransactionDisplay::toggleTransaction ()
492 listview->clear(); 496 listview->clear();
493 QString displaytext = "%"; 497 QString displaytext = "%";
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
498 if ( transfer->getNumberOfTransfers() != 0 ) 503 if ( transfer->getNumberOfTransfers() != 0 )
499 transfer->displayTransfers ( listview, accountid, children ); 504 transfer->displayTransfers ( listview, accountid, children );
@@ -551,7 +556,10 @@ void TransactionDisplay::limitDisplay ( const QString &text )
551 listview->clear (); 556 listview->clear ();
552 QString displaytext = "%"; 557 QString displaytext = "%";
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 )
556 transfer->displayTransfers ( listview, accountid, children ); 564 transfer->displayTransfers ( listview, accountid, children );
557 } 565 }
@@ -584,3 +592,32 @@ void TransactionDisplay::showTransactionNotes ()
584 } 592 }
585 } 593 }
586 594
595void 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 }