author | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
commit | 52047fd3d3f30509d65834747c3a0c5c6760dc01 (patch) (unidiff) | |
tree | 136945c2ffff2434ba1e3c8959b5335f5016e8f8 | |
parent | 7c85b3e98921afa74c7c6a90da4dfd54631c89c5 (diff) | |
download | opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.zip opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.gz opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.bz2 |
*** empty log message ***
-rwxr-xr-x | noncore/apps/qashmoney/CHANGES | 8 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/README | 35 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/account.cpp | 9 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 19 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budget.cpp | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.cpp | 12 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | 5 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 50 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 23 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.cpp | 122 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transfer.cpp | 61 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transfer.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transferdialog.cpp | 2 |
19 files changed, 276 insertions, 105 deletions
diff --git a/noncore/apps/qashmoney/CHANGES b/noncore/apps/qashmoney/CHANGES index f17035b..a3ac224 100755 --- a/noncore/apps/qashmoney/CHANGES +++ b/noncore/apps/qashmoney/CHANGES | |||
@@ -3,4 +3,12 @@ QashMoney - Budget Software for the Sharp Zaurus | |||
3 | CHANGES | 3 | CHANGES |
4 | 4 | ||
5 | 0.76 - 5/21/03 | ||
6 | |||
7 | Updated postinst file so app will install on new Sharp ROM 3.1 | ||
8 | Improved algorithm for selecting cleared transaction | ||
9 | Fixed budget display bug | ||
10 | |||
11 | ---------------------------------------------------------------------------------- | ||
12 | |||
5 | 11/1/02 - Initial release of 0.2 version. Considered stable beta version. | 13 | 11/1/02 - Initial release of 0.2 version. Considered stable beta version. |
6 | 11/16/02 - Release of version 0.3. This is a stable version adding function to | 14 | 11/16/02 - Release of version 0.3. This is a stable version adding function to |
diff --git a/noncore/apps/qashmoney/README b/noncore/apps/qashmoney/README index 1888ce6..ef004f7 100755 --- a/noncore/apps/qashmoney/README +++ b/noncore/apps/qashmoney/README | |||
@@ -3,11 +3,8 @@ QashMoney - Budget Software for the Sharp Zaurus | |||
3 | README | 3 | README |
4 | 4 | ||
5 | Welcome to the latest version of QashMoney! This app is designed to make your | ||
6 | budgeting fast, inuitive and easy. | ||
7 | |||
8 | This file lists all the important files in the qashmoney CVS directory and how | 5 | This file lists all the important files in the qashmoney CVS directory and how |
9 | to make the IPK file that goes on the Zaurus. When you checkout the | 6 | to make the IPK file that goes on the Zaurus. When you checkout the |
10 | qashmoney module from CVS, it will create a directory on your hard drive called | 7 | qashmoney-source module from CVS, it will create a directory on your hard drive called |
11 | qashmoney. These instructions assume you are in the directory. | 8 | qashmoney-source. These instructions assume you are in this directory. |
12 | 9 | ||
13 | The first thing you need to do is have all the necessary cross-compile software | 10 | The first thing you need to do is have all the necessary cross-compile software |
@@ -24,12 +21,9 @@ QashMoney. Go to: | |||
24 | http://www.sqlite.org | 21 | http://www.sqlite.org |
25 | 22 | ||
26 | to download this progam. The SQLite library has already been compiled for the | 23 | to download this progam. |
27 | IPK and is in the 'install' directory. So there is no need to compile SQLite | ||
28 | for ARM but you can if you want. There are instructions for that on the | ||
29 | website. | ||
30 | 24 | ||
31 | After that, set the correct environment variables for the package you | 25 | After that, set the correct environment variables for the package you |
32 | are developing.Two scripts in the qashmoney are used for that purpose: x86.sh | 26 | are developing. Two scripts in the qashmoney-source directory are used for that purpose: x86.sh |
33 | andarm.shIf you are buidling for x86 type: | 27 | and arm.sh. If you are building for x86 type: |
34 | 28 | ||
35 | source x86.sh | 29 | source x86.sh |
@@ -64,22 +58,5 @@ and QashMoney should appear in the frambuffer. You can use and test qashmoney | |||
64 | here as you would on the Zaurus. | 58 | here as you would on the Zaurus. |
65 | 59 | ||
66 | If you compile the binary file for the Zaurus, another script in this directory | 60 | If you want to compile the app and make the IPK file, check out the qashmoney-build module and see the README file in that module. |
67 | will come in handy. To automagically make the IPK file, type: | ||
68 | |||
69 | su | ||
70 | ./make_ipk | ||
71 | |||
72 | You need to be the root user to set the ownership of the binary and other | ||
73 | files correctly. The IPK file will appear in the qashmoney directory. Now put | ||
74 | this file onto the Zaurus and install! | ||
75 | |||
76 | Two other scripts in the directory may be of use. The make_x86 script cleans | ||
77 | the directory and makes the x86 qashmoney binary automatically. The make_arm | ||
78 | scripts makes the ARM binary. So you should really only have to type three | ||
79 | commands the make the IPK file: | ||
80 | |||
81 | ./make_arm | ||
82 | su | ||
83 | ./make_ipk | ||
84 | 61 | ||
85 | I hope the program can be useful. If you have any questions or comments, please | 62 | I hope the program can be useful. If you have any questions or comments, please |
diff --git a/noncore/apps/qashmoney/account.cpp b/noncore/apps/qashmoney/account.cpp index fc2f8c1..28f9ba2 100755 --- a/noncore/apps/qashmoney/account.cpp +++ b/noncore/apps/qashmoney/account.cpp | |||
@@ -23,7 +23,6 @@ void Account::addAccount ( QString name, int parentid, float balance, int type, | |||
23 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) | 23 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) |
24 | { | 24 | { |
25 | int r = sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, | 25 | sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, |
26 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); | 26 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); |
27 | cout << "Results = " << r << endl; | ||
28 | } | 27 | } |
29 | 28 | ||
@@ -226,4 +225,10 @@ void Account::displayAccounts ( QListView *listview ) | |||
226 | listview->setColumnWidthMode ( 3, QListView::Manual ); | 225 | listview->setColumnWidthMode ( 3, QListView::Manual ); |
227 | } | 226 | } |
227 | |||
228 | // Now reset the column sorting to user preference | ||
229 | int column = 0; | ||
230 | int direction = 0; | ||
231 | preferences->getSortingPreference ( 1, &column, &direction ); | ||
232 | listview->setSorting ( column, direction ); | ||
228 | } | 233 | } |
229 | 234 | ||
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index b2c0838..64f4ea8 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp | |||
@@ -2,4 +2,5 @@ | |||
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <iostream.h> | ||
4 | 5 | ||
5 | #include "accountdisplay.h" | 6 | #include "accountdisplay.h" |
@@ -46,8 +47,9 @@ AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) | |||
46 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); | 47 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); |
47 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); | 48 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); |
48 | 49 | ||
49 | listview->header()->setTracking ( FALSE ); | 50 | listview->header()->setTracking ( FALSE ); |
50 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 51 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
51 | 52 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | |
53 | |||
52 | layout = new QVBoxLayout ( this, 2, 5 ); | 54 | layout = new QVBoxLayout ( this, 2, 5 ); |
53 | layout->addWidget ( firstline ); | 55 | layout->addWidget ( firstline ); |
@@ -269,12 +271,10 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item ) | |||
269 | if ( td->clearedcheckbox->isChecked() == TRUE ) | 271 | if ( td->clearedcheckbox->isChecked() == TRUE ) |
270 | cleared = 1; | 272 | cleared = 1; |
271 | 273 | cout << "Year from transferdialog = " << td->getYear() << endl; | |
272 | // add the transfer with a new date if its been edited or use the default date | 274 | // add the transfer with a new date if its been edited or use the default date |
273 | if ( td->getDateEdited () == TRUE ) | 275 | if ( td->getDateEdited () == TRUE ) |
274 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, | 276 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); |
275 | account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); | ||
276 | else | 277 | else |
277 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, | 278 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); |
278 | account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); | ||
279 | 279 | ||
280 | // update account balances of both accounts and parents if necessary | 280 | // update account balances of both accounts and parents if necessary |
@@ -348,4 +348,9 @@ void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
348 | } | 348 | } |
349 | 349 | ||
350 | void AccountDisplay::saveSortingPreference ( int column ) | ||
351 | { | ||
352 | preferences->changeSortingPreference ( 1, column ); | ||
353 | } | ||
354 | |||
350 | int AccountDisplay::getIDColumn () | 355 | int AccountDisplay::getIDColumn () |
351 | { | 356 | { |
diff --git a/noncore/apps/qashmoney/accountdisplay.h b/noncore/apps/qashmoney/accountdisplay.h index 37bcb34..6d67b9b 100755 --- a/noncore/apps/qashmoney/accountdisplay.h +++ b/noncore/apps/qashmoney/accountdisplay.h | |||
@@ -43,4 +43,5 @@ class AccountDisplay : public QWidget | |||
43 | void setAccountExpanded ( QListViewItem *item ); | 43 | void setAccountExpanded ( QListViewItem *item ); |
44 | void setAccountCollapsed ( QListViewItem *item ); | 44 | void setAccountCollapsed ( QListViewItem *item ); |
45 | void saveSortingPreference ( int column ); | ||
45 | 46 | ||
46 | private: | 47 | private: |
diff --git a/noncore/apps/qashmoney/budget.cpp b/noncore/apps/qashmoney/budget.cpp index 42f7eca..9f74078 100755 --- a/noncore/apps/qashmoney/budget.cpp +++ b/noncore/apps/qashmoney/budget.cpp | |||
@@ -2,4 +2,5 @@ | |||
2 | #include "transaction.h" | 2 | #include "transaction.h" |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <iostream.h> | ||
4 | 5 | ||
5 | extern Transaction *transaction; | 6 | extern Transaction *transaction; |
@@ -63,5 +64,5 @@ QStringList* Budget::getBudgetNames () | |||
63 | char **results; | 64 | char **results; |
64 | int rows, counter; | 65 | int rows, counter; |
65 | sqlite_get_table ( bdb, "select name from budgets order by name asc;", &results, &rows, NULL, NULL ); | 66 | sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL ); |
66 | names->append ( "None" ); | 67 | names->append ( "None" ); |
67 | for ( counter = 0; counter < rows; counter++ ) | 68 | for ( counter = 0; counter < rows; counter++ ) |
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp index 09f62b2..afc6a2d 100755 --- a/noncore/apps/qashmoney/budgetdisplay.cpp +++ b/noncore/apps/qashmoney/budgetdisplay.cpp | |||
@@ -83,4 +83,11 @@ BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) | |||
83 | listview->header()->setTracking ( FALSE ); | 83 | listview->header()->setTracking ( FALSE ); |
84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
85 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
86 | |||
87 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
88 | int column = 0; | ||
89 | int direction = 0; | ||
90 | preferences->getSortingPreference ( 3, &column, &direction ); | ||
91 | listview->setSorting ( column, direction ); | ||
85 | 92 | ||
86 | displayBudgetNames(); | 93 | displayBudgetNames(); |
@@ -119,4 +126,9 @@ void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
119 | } | 126 | } |
120 | 127 | ||
128 | void BudgetDisplay::saveSortingPreference ( int column ) | ||
129 | { | ||
130 | preferences->changeSortingPreference ( 3, column ); | ||
131 | } | ||
132 | |||
121 | int BudgetDisplay::getIDColumn () | 133 | int BudgetDisplay::getIDColumn () |
122 | { | 134 | { |
diff --git a/noncore/apps/qashmoney/budgetdisplay.h b/noncore/apps/qashmoney/budgetdisplay.h index 25e952a..3976ce1 100755 --- a/noncore/apps/qashmoney/budgetdisplay.h +++ b/noncore/apps/qashmoney/budgetdisplay.h | |||
@@ -70,4 +70,5 @@ class BudgetDisplay : public QWidget | |||
70 | void constructBudgetWindow (); | 70 | void constructBudgetWindow (); |
71 | void constructLineItemWindow (); | 71 | void constructLineItemWindow (); |
72 | void saveSortingPreference ( int column ); | ||
72 | 73 | ||
73 | private: | 74 | private: |
diff --git a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control index b00e3b1..ec65c0e 100755 --- a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control +++ b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | |||
@@ -1,7 +1,8 @@ | |||
1 | Package: qashmoney | 1 | Package: qashmoney |
2 | Files: bin/qashmoney pics/qashmony/* pics/qashmony/flags/* apps/Applications/qashmoney.desktop | ||
2 | Priority: optional | 3 | Priority: optional |
3 | Version: 0.75 | 4 | Version: 0.76 |
4 | Architecture: arm | 5 | Architecture: arm |
5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com | 6 | Maintainer: Allen Forsythe allen@qashmoney.org |
6 | Section: Applications | 7 | Section: Applications |
7 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. | 8 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. |
diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp index 9bf64dd..880807a 100755 --- a/noncore/apps/qashmoney/preferences.cpp +++ b/noncore/apps/qashmoney/preferences.cpp | |||
@@ -151,4 +151,29 @@ void Preferences::initializeColumnPreferences () | |||
151 | } | 151 | } |
152 | 152 | ||
153 | void Preferences::initializeSortingPreferences () | ||
154 | { | ||
155 | int rows = 0; | ||
156 | int columns = 0; | ||
157 | char **results; | ||
158 | |||
159 | if ( sqlite_get_table ( db, "select count() from sorting;", 0, 0, 0, 0 ) != 0 ) | ||
160 | sqlite_exec ( db, "create table sorting ( listbox, column, direction, id integer primary key );", 0, 0, 0 ); | ||
161 | |||
162 | // initialize account listbox sorting. Set direction = 1 here so ascending sort is default. | ||
163 | sqlite_get_table ( db, "select column, direction from sorting where id = 1;", &results, &rows, &columns, 0 ); | ||
164 | if ( rows == 0 ) | ||
165 | sqlite_exec ( db, "insert into sorting values ( 'accounts', 0, 1, NULL );", 0, 0, 0 ); | ||
166 | |||
167 | // initialize transaction listbox sorting | ||
168 | sqlite_get_table ( db, "select column, direction from sorting where id = 2;", &results, &rows, &columns, 0); | ||
169 | if ( rows == 0 ) | ||
170 | sqlite_exec ( db, "insert into sorting values ( 'transactions', 0, 1, NULL );", 0, 0, 0 ); | ||
171 | |||
172 | // initialize budgets listbox sorting | ||
173 | sqlite_get_table ( db, "select column, direction from sorting where id = 3;", & results, &rows, &columns, 0 ); | ||
174 | if ( rows == 0 ) | ||
175 | sqlite_exec ( db, "insert into sorting values ( 'budgets', 0, 1, NULL );", 0, 0, 0 ); | ||
176 | } | ||
177 | |||
153 | void Preferences::changeColumnPreference ( int id, int width ) | 178 | void Preferences::changeColumnPreference ( int id, int width ) |
154 | { | 179 | { |
@@ -163,4 +188,29 @@ int Preferences::getColumnPreference ( int id ) | |||
163 | } | 188 | } |
164 | 189 | ||
190 | void Preferences::changeSortingPreference ( int id, int column ) | ||
191 | { | ||
192 | int pColumn = 0; // column setting coming from the prefs object | ||
193 | int pDirection = 0; // direction setting coming from the prefs object | ||
194 | |||
195 | // because there appears to be no way to query the QT header object directly for it's current sort settings, we have | ||
196 | // to maintain track of them ourselves. So start by pulling the current saved setting for this view. | ||
197 | getSortingPreference ( id, &pColumn, &pDirection ); | ||
198 | |||
199 | // if the current saved column == the new column, then the user wants to toggle the sort order. | ||
200 | // otherwise we behave like QT does by default, which is to select the new column and default to an ascending sort. | ||
201 | if ( column == pColumn ) | ||
202 | sqlite_exec_printf ( db, "update sorting set direction = %i where id = %i;", 0, 0, 0, !pDirection, id ); | ||
203 | else | ||
204 | sqlite_exec_printf ( db, "update sorting set column = %i, direction = 1 where id = %i;", 0, 0, 0, column, id ); | ||
205 | } | ||
206 | |||
207 | void Preferences::getSortingPreference ( int id, int *column, int *direction ) | ||
208 | { | ||
209 | char **results; | ||
210 | sqlite_get_table_printf ( db, "select column, direction from sorting where id = %i;", &results, NULL, NULL, NULL, id ); | ||
211 | *column = atoi ( results [ 2 ] ); | ||
212 | *direction = atoi ( results [ 3 ] ); | ||
213 | } | ||
214 | |||
165 | int Preferences::getPreference ( int id ) | 215 | int Preferences::getPreference ( int id ) |
166 | { | 216 | { |
diff --git a/noncore/apps/qashmoney/preferences.h b/noncore/apps/qashmoney/preferences.h index 4a3e058..10ec6e9 100755 --- a/noncore/apps/qashmoney/preferences.h +++ b/noncore/apps/qashmoney/preferences.h | |||
@@ -13,8 +13,10 @@ class Preferences | |||
13 | void addPreferences (); | 13 | void addPreferences (); |
14 | void initializeColumnPreferences (); | 14 | void initializeColumnPreferences (); |
15 | void initializeSortingPreferences (); | ||
15 | 16 | ||
16 | // Returns a preference value for the given preferences ID | 17 | // Returns a preference value for the given preferences ID |
17 | int getPreference ( int ); | 18 | int getPreference ( int ); |
18 | int getColumnPreference ( int id ); | 19 | int getColumnPreference ( int id ); |
20 | void getSortingPreference ( int id, int *column, int *direction ); | ||
19 | 21 | ||
20 | // Convenience for getting date separator with one function | 22 | // Convenience for getting date separator with one function |
@@ -25,4 +27,5 @@ class Preferences | |||
25 | void changePreference ( int , int ); | 27 | void changePreference ( int , int ); |
26 | void changeColumnPreference ( int id, int width ); | 28 | void changeColumnPreference ( int id, int width ); |
29 | void changeSortingPreference ( int id, int column ); | ||
27 | 30 | ||
28 | // The primary database that stores all our data | 31 | // The primary database that stores all our data |
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 83eea01..20e8d32 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -15,6 +15,7 @@ Memory *memory = new Memory (); | |||
15 | QashMoney::QashMoney () : QWidget () | 15 | QashMoney::QashMoney () : QWidget () |
16 | { | 16 | { |
17 | preferences->addPreferences(); | 17 | preferences->addPreferences (); |
18 | preferences->initializeColumnPreferences (); | 18 | preferences->initializeColumnPreferences (); |
19 | preferences->initializeSortingPreferences (); | ||
19 | 20 | ||
20 | // set the text in the upper part of the frame | 21 | // set the text in the upper part of the frame |
@@ -154,5 +155,5 @@ void QashMoney::changeTabDisplay () | |||
154 | 155 | ||
155 | // display transfers | 156 | // display transfers |
156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 157 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
157 | 158 | ||
158 | // open a new preferences object and resize the transaction display columns | 159 | // open a new preferences object and resize the transaction display columns |
@@ -179,4 +180,10 @@ void QashMoney::changeTabDisplay () | |||
179 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); | 180 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); |
180 | } | 181 | } |
182 | |||
183 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
184 | int column = 0; | ||
185 | int direction = 0; | ||
186 | preferences->getSortingPreference ( 2, &column, &direction ); | ||
187 | transactiondisplay->listview->setSorting ( column, direction ); | ||
181 | 188 | ||
182 | // show the window | 189 | // show the window |
@@ -198,4 +205,10 @@ void QashMoney::changeTabDisplay () | |||
198 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); | 205 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); |
199 | 206 | ||
207 | // set sorting preference on account display columns | ||
208 | int column = 0; | ||
209 | int direction = 0; | ||
210 | preferences->getSortingPreference ( 1, &column, &direction ); | ||
211 | accountdisplay->listview->setSorting ( column, direction ); | ||
212 | |||
200 | // display the accounts | 213 | // display the accounts |
201 | if ( account->getNumberOfAccounts() != 0 ) | 214 | if ( account->getNumberOfAccounts() != 0 ) |
@@ -263,5 +276,5 @@ void QashMoney::displayDatePreferencesDialog () | |||
263 | 276 | ||
264 | if ( transfer->getNumberOfTransfers() != 0 ) | 277 | if ( transfer->getNumberOfTransfers() != 0 ) |
265 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 278 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
266 | } | 279 | } |
267 | else if ( accountdisplay->isVisible() ) | 280 | else if ( accountdisplay->isVisible() ) |
@@ -301,5 +314,5 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
301 | 314 | ||
302 | if ( transfer->getNumberOfTransfers() != 0 ) | 315 | if ( transfer->getNumberOfTransfers() != 0 ) |
303 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 316 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
304 | } | 317 | } |
305 | else | 318 | else |
@@ -386,5 +399,5 @@ void QashMoney::setTransactionDisplayDate () | |||
386 | } | 399 | } |
387 | else | 400 | else |
388 | newdate = QDate ( 1, 1, 1000 ); | 401 | newdate = QDate ( 1900, 1, 1 ); |
389 | } | 402 | } |
390 | 403 | ||
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp index 5ecc7ed..a3bd9e7 100755 --- a/noncore/apps/qashmoney/transaction.cpp +++ b/noncore/apps/qashmoney/transaction.cpp | |||
@@ -156,28 +156,104 @@ int Transaction::getYear ( int id ) | |||
156 | } | 156 | } |
157 | 157 | ||
158 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) | 158 | char ** Transaction::selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id ) |
159 | { | 159 | { |
160 | // initialize variables | ||
161 | char **results; | ||
160 | int showcleared = preferences->getPreference ( 3 ); | 162 | int showcleared = preferences->getPreference ( 3 ); |
161 | int year = ( displaydate.year() ) - 1; | 163 | QDate today = QDate::currentDate(); |
164 | int fromyear = fromdate.year(); | ||
165 | int toyear = today.year(); | ||
166 | int frommonth = fromdate.month(); | ||
167 | int tomonth = today.month(); | ||
168 | int fromday = fromdate.day(); | ||
162 | 169 | ||
163 | // select the transactions to display | 170 | // construct the first part of the string |
164 | // two different statements are used based on | 171 | QString query = "select day, month, year, payee, amount, transid, accountid from transactions where"; |
165 | // whether we are showing cleared transactions | 172 | |
166 | char **results; | 173 | if ( frommonth == tomonth && fromyear == toyear ) // our dates cross neither a month nor a year |
167 | int rows, columns; | ||
168 | if ( showcleared == 0 ) | ||
169 | { | 174 | { |
170 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 175 | query.append ( " year = " ); |
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 ); | 176 | query.append ( QString::number ( toyear ) ); |
172 | else | 177 | query.append ( " and month = " ); |
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 ); | 178 | query.append ( QString::number ( tomonth ) ); |
179 | query.append ( " and day >= " ); | ||
180 | query.append ( QString::number ( fromday ) ); | ||
181 | query.append ( " and" ); | ||
174 | } | 182 | } |
175 | else | 183 | else if ( frommonth != tomonth && fromyear == toyear ) // our dates cross a month within the same year |
176 | { | 184 | { |
177 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 185 | query.append ( " year = " ); |
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 ); | 186 | query.append ( QString::number ( toyear ) ); |
179 | else | 187 | query.append ( " and ( ( month <= " ); |
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 ); | 188 | query.append ( QString::number ( tomonth ) ); |
189 | query.append ( " and month > " ); | ||
190 | query.append ( QString::number ( frommonth ) ); | ||
191 | query.append ( " ) or ( month = " ); | ||
192 | query.append ( QString::number ( frommonth ) ); | ||
193 | query.append ( " and day >= " ); | ||
194 | query.append ( QString::number ( fromday ) ); | ||
195 | query.append ( " ) ) and " ); | ||
181 | } | 196 | } |
197 | else if ( fromyear != toyear && fromyear != 1900 ) // here we are showing transactions from an entire year | ||
198 | { | ||
199 | // divide this taks into two parts - get the transactions from the prior and then the current year | ||
200 | // current year part | ||
201 | int tmpfrommonth = 1; // set temporary from months and days to Jan. 1 | ||
202 | int tmpfromday = 1; | ||
203 | query.append ( " ( year >= " ); | ||
204 | query.append ( QString::number ( fromyear ) ); | ||
205 | query.append ( " and ( month <= " ); | ||
206 | query.append ( QString::number ( tomonth ) ); | ||
207 | query.append ( " and month > " ); | ||
208 | query.append ( QString::number ( tmpfrommonth ) ); | ||
209 | query.append ( " ) or ( month = " ); | ||
210 | query.append ( QString::number ( tmpfrommonth ) ); | ||
211 | query.append ( " and day >= " ); | ||
212 | query.append ( QString::number ( tmpfromday ) ); | ||
213 | query.append ( " ) ) or" ); | ||
214 | |||
215 | // prior year part | ||
216 | int tmptomonth = 12; | ||
217 | query.append ( " ( year = " ); | ||
218 | query.append ( QString::number ( fromyear ) ); | ||
219 | query.append ( " and ( ( month <= " ); | ||
220 | query.append ( QString::number ( tmptomonth ) ); | ||
221 | query.append ( " and month > " ); | ||
222 | query.append ( QString::number ( frommonth ) ); | ||
223 | query.append ( " ) or ( month = " ); | ||
224 | query.append ( QString::number ( frommonth ) ); | ||
225 | query.append ( " and day >= " ); | ||
226 | query.append ( QString::number ( fromday ) ); | ||
227 | query.append ( " ) ) ) and " ); | ||
228 | } | ||
229 | |||
230 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | ||
231 | query.append ( " parentid = %i and payee like '%q';" ); | ||
232 | else | ||
233 | query.append ( " accountid = %i and payee like '%q';" ); | ||
234 | |||
235 | sqlite_get_table_printf ( tdb, query, &results, &rows, &columns, NULL, id, limit ); | ||
236 | return results; | ||
237 | } | ||
238 | |||
239 | char ** Transaction::selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id ) | ||
240 | { | ||
241 | char **results; | ||
242 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | ||
243 | 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 ); | ||
244 | else | ||
245 | 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 ); | ||
246 | return results; | ||
247 | } | ||
248 | |||
249 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) | ||
250 | { | ||
251 | int showcleared = preferences->getPreference ( 3 ); | ||
252 | |||
253 | char **results; | ||
254 | if ( showcleared == 0 ) | ||
255 | results = selectNonClearedTransactions ( displaydate, children, limit, id ); | ||
256 | else | ||
257 | results = selectAllTransactions ( displaydate, children, limit, id ); | ||
182 | 258 | ||
183 | // iterate through the result list and display each item | 259 | // iterate through the result list and display each item |
@@ -185,5 +261,5 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr | |||
185 | while ( counter < ( ( rows + 1 ) * columns ) ) | 261 | while ( counter < ( ( rows + 1 ) * columns ) ) |
186 | { | 262 | { |
187 | QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | 263 | //QDate testdate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
188 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | 264 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
189 | 265 | ||
@@ -196,19 +272,19 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr | |||
196 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); | 272 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); |
197 | 273 | ||
198 | // fill in values | 274 | // fill in values |
199 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account | 275 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account |
200 | { | 276 | { |
201 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) | 277 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) |
202 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid); | 278 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid ); |
203 | else | 279 | else |
204 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid ); | 280 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid ); |
205 | } | 281 | } |
206 | else | 282 | else |
207 | { | 283 | { |
208 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) | 284 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) |
209 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid, accountname ); | 285 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid, accountname ); |
210 | else | 286 | else |
211 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid, accountname ); | 287 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid, accountname ); |
212 | } | 288 | } |
213 | 289 | ||
214 | // advance counter | 290 | // advance counter |
diff --git a/noncore/apps/qashmoney/transaction.h b/noncore/apps/qashmoney/transaction.h index 7297bb1..5871555 100755 --- a/noncore/apps/qashmoney/transaction.h +++ b/noncore/apps/qashmoney/transaction.h | |||
@@ -46,4 +46,6 @@ class Transaction | |||
46 | 46 | ||
47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); | 47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); |
48 | char ** selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id ); | ||
49 | char ** selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id ); | ||
48 | QString getPayee ( int ); | 50 | QString getPayee ( int ); |
49 | QString getTransactionDescription ( int ); | 51 | QString getTransactionDescription ( int ); |
@@ -63,4 +65,5 @@ class Transaction | |||
63 | 65 | ||
64 | sqlite *tdb; | 66 | sqlite *tdb; |
67 | int rows, columns; | ||
65 | }; | 68 | }; |
66 | 69 | ||
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index ae6223d..1839cd2 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -68,4 +68,5 @@ TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) | |||
68 | listview->header()->setTracking ( FALSE ); | 68 | listview->header()->setTracking ( FALSE ); |
69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
70 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
70 | 71 | ||
71 | layout = new QVBoxLayout ( this, 2, 2 ); | 72 | layout = new QVBoxLayout ( this, 2, 2 ); |
@@ -134,5 +135,5 @@ void TransactionDisplay::addTransaction () | |||
134 | // redisplay transfers | 135 | // redisplay transfers |
135 | if ( transfer->getNumberOfTransfers() > 0 ) | 136 | if ( transfer->getNumberOfTransfers() > 0 ) |
136 | transfer->displayTransfers ( listview, accountid, children ); | 137 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
137 | 138 | ||
138 | // add the transaction amount to the account it's associated with | 139 | // add the transaction amount to the account it's associated with |
@@ -373,5 +374,5 @@ void TransactionDisplay::updateAndDisplay ( int id ) | |||
373 | // redisplay transfers | 374 | // redisplay transfers |
374 | if ( transfer->getNumberOfTransfers() > 0 ) | 375 | if ( transfer->getNumberOfTransfers() > 0 ) |
375 | transfer->displayTransfers ( listview, accountid, children ); | 376 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
376 | 377 | ||
377 | // add the transaction amount to the account it's associated with | 378 | // add the transaction amount to the account it's associated with |
@@ -417,5 +418,5 @@ void TransactionDisplay::deleteTransaction () | |||
417 | 418 | ||
418 | if ( transfer->getNumberOfTransfers() > 0 ) | 419 | if ( transfer->getNumberOfTransfers() > 0 ) |
419 | transfer->displayTransfers ( listview, accountid, children ); | 420 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
420 | 421 | ||
421 | // if we are viewing different child accounts through the parent account | 422 | // if we are viewing different child accounts through the parent account |
@@ -449,5 +450,5 @@ void TransactionDisplay::deleteTransaction () | |||
449 | 450 | ||
450 | if ( transfer->getNumberOfTransfers() > 0 ) | 451 | if ( transfer->getNumberOfTransfers() > 0 ) |
451 | transfer->displayTransfers ( listview, accountid, children ); | 452 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
452 | 453 | ||
453 | // for the from account | 454 | // for the from account |
@@ -502,5 +503,5 @@ void TransactionDisplay::toggleTransaction () | |||
502 | 503 | ||
503 | if ( transfer->getNumberOfTransfers() != 0 ) | 504 | if ( transfer->getNumberOfTransfers() != 0 ) |
504 | transfer->displayTransfers ( listview, accountid, children ); | 505 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
505 | } | 506 | } |
506 | 507 | ||
@@ -552,4 +553,9 @@ void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
552 | } | 553 | } |
553 | 554 | ||
555 | void TransactionDisplay::saveSortingPreference ( int column ) | ||
556 | { | ||
557 | preferences->changeSortingPreference ( 2, column ); | ||
558 | } | ||
559 | |||
554 | void TransactionDisplay::limitDisplay ( const QString &text ) | 560 | void TransactionDisplay::limitDisplay ( const QString &text ) |
555 | { | 561 | { |
@@ -562,5 +568,5 @@ void TransactionDisplay::limitDisplay ( const QString &text ) | |||
562 | 568 | ||
563 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) | 569 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) |
564 | transfer->displayTransfers ( listview, accountid, children ); | 570 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
565 | } | 571 | } |
566 | 572 | ||
@@ -620,4 +626,4 @@ void TransactionDisplay::setTransactionDisplayDate () | |||
620 | } | 626 | } |
621 | else | 627 | else |
622 | displaydate = QDate ( 1, 1, 1000 ); | 628 | displaydate = QDate ( 1900, 1, 1 ); |
623 | } | 629 | } |
diff --git a/noncore/apps/qashmoney/transactiondisplay.h b/noncore/apps/qashmoney/transactiondisplay.h index 1746f6c..594776a 100755 --- a/noncore/apps/qashmoney/transactiondisplay.h +++ b/noncore/apps/qashmoney/transactiondisplay.h | |||
@@ -51,4 +51,5 @@ class TransactionDisplay : public QWidget | |||
51 | void showCalendar (); | 51 | void showCalendar (); |
52 | void setTransactionDisplayDate (); | 52 | void setTransactionDisplayDate (); |
53 | void saveSortingPreference ( int column ); | ||
53 | 54 | ||
54 | private: | 55 | private: |
diff --git a/noncore/apps/qashmoney/transfer.cpp b/noncore/apps/qashmoney/transfer.cpp index 77cbb4e..568d584 100755 --- a/noncore/apps/qashmoney/transfer.cpp +++ b/noncore/apps/qashmoney/transfer.cpp | |||
@@ -66,5 +66,5 @@ int Transfer::getNumberOfTransfers ( int accountid ) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | void Transfer::displayTransfers ( QListView *listview, int accountid, bool children ) | 68 | void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ) |
69 | { | 69 | { |
70 | int showcleared = preferences->getPreference ( 3 ); | 70 | int showcleared = preferences->getPreference ( 3 ); |
@@ -101,4 +101,5 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child | |||
101 | int year = yearstring.toInt (); | 101 | int year = yearstring.toInt (); |
102 | QString date = preferences->getDate ( year, month, day ); | 102 | QString date = preferences->getDate ( year, month, day ); |
103 | QDate testdate ( year, month, day ); | ||
103 | 104 | ||
104 | //construct the amount and id strings | 105 | //construct the amount and id strings |
@@ -113,20 +114,22 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child | |||
113 | QString toaccount = account->getAccountName ( atol ( results [ counter + 6 ] ) ); | 114 | QString toaccount = account->getAccountName ( atol ( results [ counter + 6 ] ) ); |
114 | 115 | ||
115 | // display this transfer | 116 | if ( testdate >= displaydate || showcleared == 0 ) |
116 | if ( account->getParentAccountID ( accountid ) == -1 ) | ||
117 | { | 117 | { |
118 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | 118 | // display this transfer |
119 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); | 119 | if ( account->getParentAccountID ( accountid ) == -1 ) |
120 | { | ||
121 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
122 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); | ||
123 | else | ||
124 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); | ||
125 | } | ||
120 | else | 126 | else |
121 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); | 127 | { |
128 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
129 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
130 | else | ||
131 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
132 | } | ||
122 | } | 133 | } |
123 | else | ||
124 | { | ||
125 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
126 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
127 | else | ||
128 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
129 | } | ||
130 | |||
131 | counter = counter + 7; | 134 | counter = counter + 7; |
132 | } | 135 | } |
@@ -164,4 +167,5 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child | |||
164 | int year = yearstring.toInt (); | 167 | int year = yearstring.toInt (); |
165 | QString date = preferences->getDate ( year, month, day ); | 168 | QString date = preferences->getDate ( year, month, day ); |
169 | QDate testdate ( year, month, day ); | ||
166 | 170 | ||
167 | //construct the amount and id strings | 171 | //construct the amount and id strings |
@@ -177,18 +181,21 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child | |||
177 | QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); | 181 | QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); |
178 | 182 | ||
179 | // display this transfer | 183 | if ( testdate >= displaydate || showcleared == 0 ) |
180 | if ( account->getParentAccountID ( accountid ) == -1 ) | 184 | { |
181 | { | 185 | // display this transfer |
182 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | 186 | if ( account->getParentAccountID ( accountid ) == -1 ) |
183 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); | 187 | { |
184 | else | 188 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) |
185 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); | 189 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); |
186 | } | 190 | else |
187 | else | 191 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); |
188 | { | 192 | } |
189 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
190 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
191 | else | 193 | else |
192 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | 194 | { |
195 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
196 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
197 | else | ||
198 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
199 | } | ||
193 | } | 200 | } |
194 | 201 | ||
diff --git a/noncore/apps/qashmoney/transfer.h b/noncore/apps/qashmoney/transfer.h index 33dedf4..e910e7c 100755 --- a/noncore/apps/qashmoney/transfer.h +++ b/noncore/apps/qashmoney/transfer.h | |||
@@ -5,4 +5,5 @@ | |||
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <sqlite.h> | 6 | #include <sqlite.h> |
7 | #include <qdatetime.h> | ||
7 | 8 | ||
8 | #include "preferences.h" | 9 | #include "preferences.h" |
@@ -30,5 +31,5 @@ class Transfer | |||
30 | int getNumberOfTransfers ( int accountid ); | 31 | int getNumberOfTransfers ( int accountid ); |
31 | 32 | ||
32 | void displayTransfers ( QListView *listview, int accountid, bool children ); | 33 | void displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ); |
33 | int getCleared ( int id ); | 34 | int getCleared ( int id ); |
34 | void setCleared ( int id, int cleared ); | 35 | void setCleared ( int id, int cleared ); |
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp index 7bc3eb0..f85c740 100755 --- a/noncore/apps/qashmoney/transferdialog.cpp +++ b/noncore/apps/qashmoney/transferdialog.cpp | |||
@@ -98,5 +98,5 @@ int TransferDialog::getMonth () | |||
98 | int TransferDialog::getYear () | 98 | int TransferDialog::getYear () |
99 | { | 99 | { |
100 | return day; | 100 | return year; |
101 | } | 101 | } |
102 | 102 | ||