Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 1ea358c..83eea01 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -145,2 +145,4 @@ void QashMoney::changeTabDisplay () | |||
145 | 145 | ||
146 | setTransactionDisplayDate (); | ||
147 | |||
146 | // display transactions | 148 | // display transactions |
@@ -150,3 +152,3 @@ void QashMoney::changeTabDisplay () | |||
150 | if ( transaction->getNumberOfTransactions() > 0 ) | 152 | if ( transaction->getNumberOfTransactions() > 0 ) |
151 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
152 | 154 | ||
@@ -256,4 +258,6 @@ void QashMoney::displayDatePreferencesDialog () | |||
256 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 258 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
259 | |||
260 | setTransactionDisplayDate(); | ||
257 | if ( transaction->getNumberOfTransactions() > 0 ) | 261 | if ( transaction->getNumberOfTransactions() > 0 ) |
258 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 262 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
259 | 263 | ||
@@ -292,4 +296,6 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
292 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 296 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
297 | |||
298 | setTransactionDisplayDate(); | ||
293 | if ( transaction->getNumberOfTransactions() > 0 ) | 299 | if ( transaction->getNumberOfTransactions() > 0 ) |
294 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 300 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
295 | 301 | ||
@@ -354,3 +360,31 @@ void QashMoney::toggleOneTouchViewing ( bool state ) | |||
354 | 360 | ||
355 | 361 | void QashMoney::setTransactionDisplayDate () | |
362 | { | ||
363 | // determine how many days of transactions to show | ||
364 | int limittype = preferences->getPreference ( 7 ); | ||
365 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | ||
366 | { | ||
367 | QDate today = QDate::currentDate (); | ||
368 | switch ( limittype ) // if we are not showing all transactions | ||
369 | { | ||
370 | case 0: // viewing two weeks | ||
371 | newdate = today.addDays ( -14 ); | ||
372 | break; | ||
373 | case 1: // viewing one month | ||
374 | newdate = today.addDays ( -30 ); | ||
375 | break; | ||
376 | case 2: // three months | ||
377 | newdate = today.addDays ( -90 ); | ||
378 | break; | ||
379 | case 3: // six months | ||
380 | newdate = today.addDays ( -180 ); | ||
381 | break; | ||
382 | case 4: // one year | ||
383 | newdate = today.addDays ( -365 ); | ||
384 | break; | ||
385 | } | ||
386 | } | ||
387 | else | ||
388 | newdate = QDate ( 1, 1, 1000 ); | ||
389 | } | ||
356 | 390 | ||