summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/qashmoney.cpp
Unidiff
Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp42
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
@@ -140,18 +140,20 @@ void QashMoney::changeTabDisplay ()
140 transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); 140 transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 );
141 141
142 // set the accountid and children variables 142 // set the accountid and children variables
143 transactiondisplay->setChildren ( children ); 143 transactiondisplay->setChildren ( children );
144 transactiondisplay->setAccountID ( accountid ); 144 transactiondisplay->setAccountID ( accountid );
145 145
146 setTransactionDisplayDate ();
147
146 // display transactions 148 // display transactions
147 transactiondisplay->listview->clear(); 149 transactiondisplay->listview->clear();
148 QString displaytext = "%"; 150 QString displaytext = "%";
149 displaytext.prepend ( transactiondisplay->limitbox->text() ); 151 displaytext.prepend ( transactiondisplay->limitbox->text() );
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
153 // display transfers 155 // display transfers
154 transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); 156 transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
155 157
156 // open a new preferences object and resize the transaction display columns 158 // open a new preferences object and resize the transaction display columns
157 // each column will have a different size based on whether we are looking at a child 159 // each column will have a different size based on whether we are looking at a child
@@ -251,14 +253,16 @@ void QashMoney::displayDatePreferencesDialog ()
251 253
252 // redisplay transactions if they are visible incorporating 254 // redisplay transactions if they are visible incorporating
253 // any changes to the date format 255 // any changes to the date format
254 transactiondisplay->listview->clear(); 256 transactiondisplay->listview->clear();
255 QString displaytext = "%"; 257 QString displaytext = "%";
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
260 if ( transfer->getNumberOfTransfers() != 0 ) 264 if ( transfer->getNumberOfTransfers() != 0 )
261 transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); 265 transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
262 } 266 }
263 else if ( accountdisplay->isVisible() ) 267 else if ( accountdisplay->isVisible() )
264 { 268 {
@@ -287,14 +291,16 @@ void QashMoney::displayTransactionPreferencesDialog ()
287 children = FALSE; 291 children = FALSE;
288 292
289 // redisplay transactions incorporating any transaction preference changes 293 // redisplay transactions incorporating any transaction preference changes
290 transactiondisplay->listview->clear(); 294 transactiondisplay->listview->clear();
291 QString displaytext = "%"; 295 QString displaytext = "%";
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
296 if ( transfer->getNumberOfTransfers() != 0 ) 302 if ( transfer->getNumberOfTransfers() != 0 )
297 transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); 303 transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
298 } 304 }
299 else 305 else
300 { 306 {
@@ -349,8 +355,36 @@ void QashMoney::toggleOneTouchViewing ( bool state )
349 if ( state == TRUE ) 355 if ( state == TRUE )
350 disableOneTouchViewing(); 356 disableOneTouchViewing();
351 else 357 else
352 enableOneTouchViewing(); 358 enableOneTouchViewing();
353 } 359 }
354 360
355 361void 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