author | allenforsythe <allenforsythe> | 2003-05-16 20:08:38 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-16 20:08:38 (UTC) |
commit | e6ff2dbd2d128c3cf873e23f4df8006759b47079 (patch) (unidiff) | |
tree | bb3c996b76c8937d871f642f0e32032848d32396 /noncore/apps/qashmoney | |
parent | 87051a7ba4834aed152bc09aad7f4935c9729ccb (diff) | |
download | opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.zip opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.gz opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.bz2 |
Working on time frame for displaying cleared transactions. Not yet working.
-rwxr-xr-x | noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 13 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 42 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qmaccounts.db | bin | 4096 -> 6144 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmbudgets.db | bin | 3072 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmmemory.db | bin | 4096 -> 10240 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmpreferences.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransactions.db | bin | 4096 -> 24576 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransfers.db | bin | 3072 -> 3072 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 49 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.h | 3 |
15 files changed, 106 insertions, 31 deletions
diff --git a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control index ffd11db..b00e3b1 100755 --- a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control +++ b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | |||
@@ -1,5 +1,5 @@ | |||
1 | Package: qashmoney | 1 | Package: qashmoney |
2 | Priority: optional | 2 | Priority: optional |
3 | Version: 0.74 | 3 | Version: 0.75 |
4 | Architecture: arm | 4 | Architecture: arm |
5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com | 5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com |
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index 00d52c6..d7c66d3 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp | |||
@@ -77,18 +77,19 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p | |||
77 | showclearedtransactions->setText ( "Show Cleared Transactions" ); | 77 | showclearedtransactions->setText ( "Show Cleared Transactions" ); |
78 | 78 | ||
79 | excludetransfers = new QCheckBox ( this ); | ||
80 | excludetransfers->setText ( "Include Transfers In Limit View" ); | ||
81 | |||
82 | limittransactionsbox = new QHBox ( this ); | 79 | limittransactionsbox = new QHBox ( this ); |
83 | limittransactionsbox->setSpacing ( 2 ); | 80 | limittransactionsbox->setSpacing ( 2 ); |
84 | limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox ); | 81 | limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); |
85 | limittransactions = new QComboBox ( limittransactionsbox ); | 82 | limittransactions = new QComboBox ( limittransactionsbox ); |
83 | QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); | ||
86 | limittransactions->insertItem ( "14 days" ); | 84 | limittransactions->insertItem ( "14 days" ); |
87 | limittransactions->insertItem ( "30 days" ); | 85 | limittransactions->insertItem ( "30 days" ); |
88 | limittransactions->insertItem ( "60 days" ); | ||
89 | limittransactions->insertItem ( "90 days" ); | 86 | limittransactions->insertItem ( "90 days" ); |
90 | limittransactions->insertItem ( "180 days" ); | 87 | limittransactions->insertItem ( "180 days" ); |
91 | limittransactions->insertItem ( "365 days" ); | 88 | limittransactions->insertItem ( "365 days" ); |
92 | limittransactions->insertItem ( "All" ); | 89 | limittransactions->insertItem ( "All" ); |
90 | limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); | ||
91 | |||
92 | excludetransfers = new QCheckBox ( this ); | ||
93 | excludetransfers->setText ( "Include Transfers In Limit View" ); | ||
93 | 94 | ||
94 | if ( preferences->getPreference ( 3 ) == 1 ) | 95 | if ( preferences->getPreference ( 3 ) == 1 ) |
@@ -107,6 +108,6 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p | |||
107 | layout = new QVBoxLayout ( this, 2, 2 ); | 108 | layout = new QVBoxLayout ( this, 2, 2 ); |
108 | layout->addWidget ( showclearedtransactions ); | 109 | layout->addWidget ( showclearedtransactions ); |
109 | layout->addWidget ( excludetransfers ); | ||
110 | layout->addWidget ( limittransactionsbox ); | 110 | layout->addWidget ( limittransactionsbox ); |
111 | layout->addWidget ( excludetransfers ); | ||
111 | layout->insertSpacing ( 3, 5 ); | 112 | layout->insertSpacing ( 3, 5 ); |
112 | layout->addWidget ( defaults ); | 113 | layout->addWidget ( defaults ); |
diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp index 819d5cf..9bf64dd 100755 --- a/noncore/apps/qashmoney/preferences.cpp +++ b/noncore/apps/qashmoney/preferences.cpp | |||
@@ -61,5 +61,5 @@ void Preferences::addPreferences () | |||
61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); | 61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); |
62 | 62 | ||
63 | // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 60 days, 3 = 90 days, 4 = 180 days, 5 = 365 days, 6 = all | 63 | // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 90 days, 3 = 180 days, 4 = 365 days 5 = all |
64 | rows = 0; | 64 | rows = 0; |
65 | sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); | 65 | sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); |
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 | |||
@@ -144,4 +144,6 @@ void QashMoney::changeTabDisplay () | |||
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(); |
@@ -149,5 +151,5 @@ void QashMoney::changeTabDisplay () | |||
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 |
@@ -255,6 +257,8 @@ void QashMoney::displayDatePreferencesDialog () | |||
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 ) |
@@ -291,6 +295,8 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
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 ) |
@@ -353,4 +359,32 @@ void QashMoney::toggleOneTouchViewing ( bool state ) | |||
353 | } | 359 | } |
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 | ||
diff --git a/noncore/apps/qashmoney/qashmoney.h b/noncore/apps/qashmoney/qashmoney.h index cf0bd42..ec2c7ec 100755 --- a/noncore/apps/qashmoney/qashmoney.h +++ b/noncore/apps/qashmoney/qashmoney.h | |||
@@ -6,4 +6,5 @@ | |||
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qtabwidget.h> | 7 | #include <qtabwidget.h> |
8 | #include <qdatetime.h> | ||
8 | 9 | ||
9 | #include "accountdisplay.h" | 10 | #include "accountdisplay.h" |
@@ -47,4 +48,5 @@ class QashMoney : public QWidget | |||
47 | void disableOneTouchViewing (); | 48 | void disableOneTouchViewing (); |
48 | void toggleOneTouchViewing ( bool ); | 49 | void toggleOneTouchViewing ( bool ); |
50 | void setTransactionDisplayDate (); | ||
49 | 51 | ||
50 | private: | 52 | private: |
@@ -55,4 +57,5 @@ class QashMoney : public QWidget | |||
55 | BudgetDisplay *budgetdisplay; | 57 | BudgetDisplay *budgetdisplay; |
56 | int tabheight; | 58 | int tabheight; |
59 | QDate newdate; | ||
57 | 60 | ||
58 | }; | 61 | }; |
diff --git a/noncore/apps/qashmoney/qmaccounts.db b/noncore/apps/qashmoney/qmaccounts.db index 449bcab..76db78b 100755 --- a/noncore/apps/qashmoney/qmaccounts.db +++ b/noncore/apps/qashmoney/qmaccounts.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmbudgets.db b/noncore/apps/qashmoney/qmbudgets.db index d798f0c..ef75719 100755 --- a/noncore/apps/qashmoney/qmbudgets.db +++ b/noncore/apps/qashmoney/qmbudgets.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmmemory.db b/noncore/apps/qashmoney/qmmemory.db index 5c23122..c6b7920 100755 --- a/noncore/apps/qashmoney/qmmemory.db +++ b/noncore/apps/qashmoney/qmmemory.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmpreferences.db b/noncore/apps/qashmoney/qmpreferences.db index a4e96f5..91596cb 100755 --- a/noncore/apps/qashmoney/qmpreferences.db +++ b/noncore/apps/qashmoney/qmpreferences.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransactions.db b/noncore/apps/qashmoney/qmtransactions.db index 9e4acc9..a5eb4f3 100755 --- a/noncore/apps/qashmoney/qmtransactions.db +++ b/noncore/apps/qashmoney/qmtransactions.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransfers.db b/noncore/apps/qashmoney/qmtransfers.db index c31df1a..3ca9f78 100755 --- a/noncore/apps/qashmoney/qmtransfers.db +++ b/noncore/apps/qashmoney/qmtransfers.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp index af7d18f..5ecc7ed 100755 --- a/noncore/apps/qashmoney/transaction.cpp +++ b/noncore/apps/qashmoney/transaction.cpp | |||
@@ -9,4 +9,5 @@ | |||
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <iostream.h> | ||
11 | 12 | ||
12 | extern Account *account; | 13 | extern Account *account; |
@@ -155,7 +156,8 @@ int Transaction::getYear ( int id ) | |||
155 | } | 156 | } |
156 | 157 | ||
157 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit ) | 158 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) |
158 | { | 159 | { |
159 | int showcleared = preferences->getPreference ( 3 ); | 160 | int showcleared = preferences->getPreference ( 3 ); |
161 | int year = ( displaydate.year() ) - 1; | ||
160 | 162 | ||
161 | // select the transactions to display | 163 | // select the transactions to display |
@@ -167,12 +169,12 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr | |||
167 | { | 169 | { |
168 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 170 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) |
169 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); | 171 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and year >= %i parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit ); |
170 | else | 172 | else |
171 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); | 173 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 year >= %i accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit ); |
172 | } | 174 | } |
173 | else | 175 | else |
174 | { | 176 | { |
175 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 177 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) |
176 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); | 178 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where year >= %i and parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit ); |
177 | else | 179 | else |
178 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); | 180 | sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); |
@@ -183,12 +185,6 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr | |||
183 | while ( counter < ( ( rows + 1 ) * columns ) ) | 185 | while ( counter < ( ( rows + 1 ) * columns ) ) |
184 | { | 186 | { |
185 | // construct the date | 187 | QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
186 | //QString daystring = results [ counter ]; | 188 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
187 | //int day = results [ counter ].toInt (); | ||
188 | //QString monthstring = results [ counter + 1 ]; | ||
189 | //int month = results [ counter + 1 ].toInt (); | ||
190 | //QString yearstring = results [ counter + 2 ]; | ||
191 | //int year = results [ counter + 2 ].toInt (); | ||
192 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | ||
193 | 189 | ||
194 | // construct transaction name, amount, id | 190 | // construct transaction name, amount, id |
diff --git a/noncore/apps/qashmoney/transaction.h b/noncore/apps/qashmoney/transaction.h index 5db011c..7297bb1 100755 --- a/noncore/apps/qashmoney/transaction.h +++ b/noncore/apps/qashmoney/transaction.h | |||
@@ -4,4 +4,5 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qdatetime.h> | ||
6 | #include <sqlite.h> | 7 | #include <sqlite.h> |
7 | 8 | ||
@@ -44,5 +45,5 @@ class Transaction | |||
44 | public slots: | 45 | public slots: |
45 | 46 | ||
46 | void displayTransactions ( QListView *, int, bool, const char * ); | 47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); |
47 | QString getPayee ( int ); | 48 | QString getPayee ( int ); |
48 | QString getTransactionDescription ( int ); | 49 | QString getTransactionDescription ( int ); |
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 | |||
@@ -128,6 +128,7 @@ void TransactionDisplay::addTransaction () | |||
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 |
@@ -366,6 +367,7 @@ void TransactionDisplay::updateAndDisplay ( int id ) | |||
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 |
@@ -410,6 +412,7 @@ void TransactionDisplay::deleteTransaction () | |||
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 ) |
@@ -441,6 +444,7 @@ void TransactionDisplay::deleteTransaction () | |||
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 ) |
@@ -493,6 +497,7 @@ void TransactionDisplay::toggleTransaction () | |||
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 ) |
@@ -552,5 +557,8 @@ void TransactionDisplay::limitDisplay ( const QString &text ) | |||
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 ); |
@@ -585,2 +593,31 @@ void TransactionDisplay::showTransactionNotes () | |||
585 | } | 593 | } |
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 | } | ||
diff --git a/noncore/apps/qashmoney/transactiondisplay.h b/noncore/apps/qashmoney/transactiondisplay.h index 79f20ba..1746f6c 100755 --- a/noncore/apps/qashmoney/transactiondisplay.h +++ b/noncore/apps/qashmoney/transactiondisplay.h | |||
@@ -8,4 +8,5 @@ | |||
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qdatetime.h> | ||
10 | 11 | ||
11 | class TransactionDisplay : public QWidget | 12 | class TransactionDisplay : public QWidget |
@@ -49,7 +50,9 @@ class TransactionDisplay : public QWidget | |||
49 | void showCalculator (); | 50 | void showCalculator (); |
50 | void showCalendar (); | 51 | void showCalendar (); |
52 | void setTransactionDisplayDate (); | ||
51 | 53 | ||
52 | private: | 54 | private: |
53 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; | 55 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; |
56 | QDate displaydate; | ||
54 | bool children; | 57 | bool children; |
55 | QBoxLayout *layout; | 58 | QBoxLayout *layout; |