summaryrefslogtreecommitdiff
path: root/noncore
authorallenforsythe <allenforsythe>2003-05-28 11:49:47 (UTC)
committer allenforsythe <allenforsythe>2003-05-28 11:49:47 (UTC)
commit52047fd3d3f30509d65834747c3a0c5c6760dc01 (patch) (side-by-side diff)
tree136945c2ffff2434ba1e3c8959b5335f5016e8f8 /noncore
parent7c85b3e98921afa74c7c6a90da4dfd54631c89c5 (diff)
downloadopie-52047fd3d3f30509d65834747c3a0c5c6760dc01.zip
opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.gz
opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.bz2
*** empty log message ***
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/CHANGES8
-rwxr-xr-xnoncore/apps/qashmoney/README35
-rwxr-xr-xnoncore/apps/qashmoney/account.cpp9
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp19
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.h1
-rwxr-xr-xnoncore/apps/qashmoney/budget.cpp3
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp12
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.h1
-rwxr-xr-xnoncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control5
-rwxr-xr-xnoncore/apps/qashmoney/preferences.cpp50
-rwxr-xr-xnoncore/apps/qashmoney/preferences.h3
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp23
-rwxr-xr-xnoncore/apps/qashmoney/transaction.cpp122
-rwxr-xr-xnoncore/apps/qashmoney/transaction.h3
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.h1
-rwxr-xr-xnoncore/apps/qashmoney/transfer.cpp61
-rwxr-xr-xnoncore/apps/qashmoney/transfer.h3
-rwxr-xr-xnoncore/apps/qashmoney/transferdialog.cpp2
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
@@ -4,2 +4,10 @@ CHANGES
+0.76 - 5/21/03
+
+ Updated postinst file so app will install on new Sharp ROM 3.1
+ Improved algorithm for selecting cleared transaction
+ Fixed budget display bug
+
+----------------------------------------------------------------------------------
+
11/1/02 - Initial release of 0.2 version. Considered stable beta version.
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
@@ -4,9 +4,6 @@ README
-Welcome to the latest version of QashMoney! This app is designed to make your
-budgeting fast, inuitive and easy.
-
This file lists all the important files in the qashmoney CVS directory and how
to make the IPK file that goes on the Zaurus. When you checkout the
-qashmoney module from CVS, it will create a directory on your hard drive called
-qashmoney. These instructions assume you are in the directory.
+qashmoney-source module from CVS, it will create a directory on your hard drive called
+qashmoney-source. These instructions assume you are in this directory.
@@ -25,10 +22,7 @@ http://www.sqlite.org
-to download this progam. The SQLite library has already been compiled for the
-IPK and is in the 'install' directory. So there is no need to compile SQLite
-for ARM but you can if you want. There are instructions for that on the
-website.
+to download this progam.
After that, set the correct environment variables for the package you
-are developing.Two scripts in the qashmoney are used for that purpose: x86.sh
-andarm.shIf you are buidling for x86 type:
+are developing. Two scripts in the qashmoney-source directory are used for that purpose: x86.sh
+and arm.sh. If you are building for x86 type:
@@ -65,20 +59,3 @@ here as you would on the Zaurus.
-If you compile the binary file for the Zaurus, another script in this directory
-will come in handy. To automagically make the IPK file, type:
-
-su
-./make_ipk
-
-You need to be the root user to set the ownership of the binary and other
-files correctly. The IPK file will appear in the qashmoney directory. Now put
-this file onto the Zaurus and install!
-
-Two other scripts in the directory may be of use. The make_x86 script cleans
-the directory and makes the x86 qashmoney binary automatically. The make_arm
-scripts makes the ARM binary. So you should really only have to type three
-commands the make the IPK file:
-
-./make_arm
-su
-./make_ipk
+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.
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
@@ -24,5 +24,4 @@ void Account::addAccount ( QString name, int parentid, float balance, int type,
{
- 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,
+ 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,
(const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency );
- cout << "Results = " << r << endl;
}
@@ -227,2 +226,8 @@ void Account::displayAccounts ( QListView *listview )
}
+
+ // Now reset the column sorting to user preference
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 1, &column, &direction );
+ listview->setSorting ( column, direction );
}
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
@@ -3,2 +3,3 @@
#include <qheader.h>
+#include <iostream.h>
@@ -47,6 +48,7 @@ AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent )
connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) );
-
+
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
-
+ connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
+
layout = new QVBoxLayout ( this, 2, 5 );
@@ -270,10 +272,8 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item )
cleared = 1;
-
+ cout << "Year from transferdialog = " << td->getYear() << endl;
// add the transfer with a new date if its been edited or use the default date
if ( td->getDateEdited () == TRUE )
- transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid,
- account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared );
+ transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared );
else
- transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid,
- account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared );
+ transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared );
@@ -349,2 +349,7 @@ void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize )
+void AccountDisplay::saveSortingPreference ( int column )
+ {
+ preferences->changeSortingPreference ( 1, column );
+ }
+
int AccountDisplay::getIDColumn ()
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
@@ -44,2 +44,3 @@ class AccountDisplay : public QWidget
void setAccountCollapsed ( QListViewItem *item );
+ void saveSortingPreference ( int column );
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
@@ -3,2 +3,3 @@
#include <stdlib.h>
+#include <iostream.h>
@@ -64,3 +65,3 @@ QStringList* Budget::getBudgetNames ()
int rows, counter;
- sqlite_get_table ( bdb, "select name from budgets order by name asc;", &results, &rows, NULL, NULL );
+ sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL );
names->append ( "None" );
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
@@ -84,2 +84,9 @@ BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
+ connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
+
+ // pull the column sorting preference from the preferences table, and configure the listview accordingly
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 3, &column, &direction );
+ listview->setSorting ( column, direction );
@@ -120,2 +127,7 @@ void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
+void BudgetDisplay::saveSortingPreference ( int column )
+ {
+ preferences->changeSortingPreference ( 3, column );
+ }
+
int BudgetDisplay::getIDColumn ()
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
@@ -71,2 +71,3 @@ class BudgetDisplay : public QWidget
void constructLineItemWindow ();
+ void saveSortingPreference ( int column );
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,6 +1,7 @@
Package: qashmoney
+Files: bin/qashmoney pics/qashmony/* pics/qashmony/flags/* apps/Applications/qashmoney.desktop
Priority: optional
-Version: 0.75
+Version: 0.76
Architecture: arm
-Maintainer: Allen Forsythe qashmoneyman@attbi.com
+Maintainer: Allen Forsythe allen@qashmoney.org
Section: Applications
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
@@ -152,2 +152,27 @@ void Preferences::initializeColumnPreferences ()
+void Preferences::initializeSortingPreferences ()
+ {
+ int rows = 0;
+ int columns = 0;
+ char **results;
+
+ if ( sqlite_get_table ( db, "select count() from sorting;", 0, 0, 0, 0 ) != 0 )
+ sqlite_exec ( db, "create table sorting ( listbox, column, direction, id integer primary key );", 0, 0, 0 );
+
+ // initialize account listbox sorting. Set direction = 1 here so ascending sort is default.
+ sqlite_get_table ( db, "select column, direction from sorting where id = 1;", &results, &rows, &columns, 0 );
+ if ( rows == 0 )
+ sqlite_exec ( db, "insert into sorting values ( 'accounts', 0, 1, NULL );", 0, 0, 0 );
+
+ // initialize transaction listbox sorting
+ sqlite_get_table ( db, "select column, direction from sorting where id = 2;", &results, &rows, &columns, 0);
+ if ( rows == 0 )
+ sqlite_exec ( db, "insert into sorting values ( 'transactions', 0, 1, NULL );", 0, 0, 0 );
+
+ // initialize budgets listbox sorting
+ sqlite_get_table ( db, "select column, direction from sorting where id = 3;", & results, &rows, &columns, 0 );
+ if ( rows == 0 )
+ sqlite_exec ( db, "insert into sorting values ( 'budgets', 0, 1, NULL );", 0, 0, 0 );
+ }
+
void Preferences::changeColumnPreference ( int id, int width )
@@ -164,2 +189,27 @@ int Preferences::getColumnPreference ( int id )
+void Preferences::changeSortingPreference ( int id, int column )
+ {
+ int pColumn = 0; // column setting coming from the prefs object
+ int pDirection = 0; // direction setting coming from the prefs object
+
+ // because there appears to be no way to query the QT header object directly for it's current sort settings, we have
+ // to maintain track of them ourselves. So start by pulling the current saved setting for this view.
+ getSortingPreference ( id, &pColumn, &pDirection );
+
+ // if the current saved column == the new column, then the user wants to toggle the sort order.
+ // otherwise we behave like QT does by default, which is to select the new column and default to an ascending sort.
+ if ( column == pColumn )
+ sqlite_exec_printf ( db, "update sorting set direction = %i where id = %i;", 0, 0, 0, !pDirection, id );
+ else
+ sqlite_exec_printf ( db, "update sorting set column = %i, direction = 1 where id = %i;", 0, 0, 0, column, id );
+ }
+
+void Preferences::getSortingPreference ( int id, int *column, int *direction )
+ {
+ char **results;
+ sqlite_get_table_printf ( db, "select column, direction from sorting where id = %i;", &results, NULL, NULL, NULL, id );
+ *column = atoi ( results [ 2 ] );
+ *direction = atoi ( results [ 3 ] );
+ }
+
int Preferences::getPreference ( int id )
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
@@ -14,2 +14,3 @@ class Preferences
void initializeColumnPreferences ();
+ void initializeSortingPreferences ();
@@ -18,2 +19,3 @@ class Preferences
int getColumnPreference ( int id );
+ void getSortingPreference ( int id, int *column, int *direction );
@@ -26,2 +28,3 @@ class Preferences
void changeColumnPreference ( int id, int width );
+ void changeSortingPreference ( int id, int column );
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
@@ -16,4 +16,5 @@ QashMoney::QashMoney () : QWidget ()
{
- preferences->addPreferences();
+ preferences->addPreferences ();
preferences->initializeColumnPreferences ();
+ preferences->initializeSortingPreferences ();
@@ -155,3 +156,3 @@ void QashMoney::changeTabDisplay ()
// display transfers
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
@@ -180,2 +181,8 @@ void QashMoney::changeTabDisplay ()
}
+
+ // pull the column sorting preference from the preferences table, and configure the listview accordingly
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 2, &column, &direction );
+ transactiondisplay->listview->setSorting ( column, direction );
@@ -199,2 +206,8 @@ void QashMoney::changeTabDisplay ()
+ // set sorting preference on account display columns
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 1, &column, &direction );
+ accountdisplay->listview->setSorting ( column, direction );
+
// display the accounts
@@ -264,3 +277,3 @@ void QashMoney::displayDatePreferencesDialog ()
if ( transfer->getNumberOfTransfers() != 0 )
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
}
@@ -302,3 +315,3 @@ void QashMoney::displayTransactionPreferencesDialog ()
if ( transfer->getNumberOfTransfers() != 0 )
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
}
@@ -387,3 +400,3 @@ void QashMoney::setTransactionDisplayDate ()
else
- newdate = QDate ( 1, 1, 1000 );
+ newdate = QDate ( 1900, 1, 1 );
}
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
@@ -157,26 +157,102 @@ int Transaction::getYear ( int id )
-void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate )
+char ** Transaction::selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id )
{
+ // initialize variables
+ char **results;
int showcleared = preferences->getPreference ( 3 );
- int year = ( displaydate.year() ) - 1;
+ QDate today = QDate::currentDate();
+ int fromyear = fromdate.year();
+ int toyear = today.year();
+ int frommonth = fromdate.month();
+ int tomonth = today.month();
+ int fromday = fromdate.day();
- // select the transactions to display
- // two different statements are used based on
- // whether we are showing cleared transactions
- char **results;
- int rows, columns;
- if ( showcleared == 0 )
+ // construct the first part of the string
+ QString query = "select day, month, year, payee, amount, transid, accountid from transactions where";
+
+ if ( frommonth == tomonth && fromyear == toyear ) // our dates cross neither a month nor a year
{
- if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
- 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 );
- else
- 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 );
+ query.append ( " year = " );
+ query.append ( QString::number ( toyear ) );
+ query.append ( " and month = " );
+ query.append ( QString::number ( tomonth ) );
+ query.append ( " and day >= " );
+ query.append ( QString::number ( fromday ) );
+ query.append ( " and" );
}
- else
+ else if ( frommonth != tomonth && fromyear == toyear ) // our dates cross a month within the same year
{
- if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
- 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 );
- else
- 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 );
+ query.append ( " year = " );
+ query.append ( QString::number ( toyear ) );
+ query.append ( " and ( ( month <= " );
+ query.append ( QString::number ( tomonth ) );
+ query.append ( " and month > " );
+ query.append ( QString::number ( frommonth ) );
+ query.append ( " ) or ( month = " );
+ query.append ( QString::number ( frommonth ) );
+ query.append ( " and day >= " );
+ query.append ( QString::number ( fromday ) );
+ query.append ( " ) ) and " );
}
+ else if ( fromyear != toyear && fromyear != 1900 ) // here we are showing transactions from an entire year
+ {
+ // divide this taks into two parts - get the transactions from the prior and then the current year
+ // current year part
+ int tmpfrommonth = 1; // set temporary from months and days to Jan. 1
+ int tmpfromday = 1;
+ query.append ( " ( year >= " );
+ query.append ( QString::number ( fromyear ) );
+ query.append ( " and ( month <= " );
+ query.append ( QString::number ( tomonth ) );
+ query.append ( " and month > " );
+ query.append ( QString::number ( tmpfrommonth ) );
+ query.append ( " ) or ( month = " );
+ query.append ( QString::number ( tmpfrommonth ) );
+ query.append ( " and day >= " );
+ query.append ( QString::number ( tmpfromday ) );
+ query.append ( " ) ) or" );
+
+ // prior year part
+ int tmptomonth = 12;
+ query.append ( " ( year = " );
+ query.append ( QString::number ( fromyear ) );
+ query.append ( " and ( ( month <= " );
+ query.append ( QString::number ( tmptomonth ) );
+ query.append ( " and month > " );
+ query.append ( QString::number ( frommonth ) );
+ query.append ( " ) or ( month = " );
+ query.append ( QString::number ( frommonth ) );
+ query.append ( " and day >= " );
+ query.append ( QString::number ( fromday ) );
+ query.append ( " ) ) ) and " );
+ }
+
+ if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
+ query.append ( " parentid = %i and payee like '%q';" );
+ else
+ query.append ( " accountid = %i and payee like '%q';" );
+
+ sqlite_get_table_printf ( tdb, query, &results, &rows, &columns, NULL, id, limit );
+ return results;
+ }
+
+char ** Transaction::selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id )
+ {
+ char **results;
+ if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
+ 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 );
+ else
+ 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 );
+ return results;
+ }
+
+void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate )
+ {
+ int showcleared = preferences->getPreference ( 3 );
+
+ char **results;
+ if ( showcleared == 0 )
+ results = selectNonClearedTransactions ( displaydate, children, limit, id );
+ else
+ results = selectAllTransactions ( displaydate, children, limit, id );
@@ -186,3 +262,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
{
- QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );
+ //QDate testdate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );
QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );
@@ -197,3 +273,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
- // fill in values
+ // fill in values
if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account
@@ -201,3 +277,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 )
- ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid);
+ ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid );
else
@@ -205,4 +281,4 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
}
- else
- {
+ else
+ {
if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 )
@@ -211,3 +287,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid, accountname );
- }
+ }
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
@@ -47,2 +47,4 @@ class Transaction
void displayTransactions ( QListView *, int, bool, const char *, QDate );
+ char ** selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id );
+ char ** selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id );
QString getPayee ( int );
@@ -64,2 +66,3 @@ class Transaction
sqlite *tdb;
+ int rows, columns;
};
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
@@ -69,2 +69,3 @@ TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent )
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
+ connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
@@ -135,3 +136,3 @@ void TransactionDisplay::addTransaction ()
if ( transfer->getNumberOfTransfers() > 0 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
@@ -374,3 +375,3 @@ void TransactionDisplay::updateAndDisplay ( int id )
if ( transfer->getNumberOfTransfers() > 0 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
@@ -418,3 +419,3 @@ void TransactionDisplay::deleteTransaction ()
if ( transfer->getNumberOfTransfers() > 0 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
@@ -450,3 +451,3 @@ void TransactionDisplay::deleteTransaction ()
if ( transfer->getNumberOfTransfers() > 0 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
@@ -503,3 +504,3 @@ void TransactionDisplay::toggleTransaction ()
if ( transfer->getNumberOfTransfers() != 0 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
}
@@ -553,2 +554,7 @@ void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize )
+void TransactionDisplay::saveSortingPreference ( int column )
+ {
+ preferences->changeSortingPreference ( 2, column );
+ }
+
void TransactionDisplay::limitDisplay ( const QString &text )
@@ -563,3 +569,3 @@ void TransactionDisplay::limitDisplay ( const QString &text )
if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 )
- transfer->displayTransfers ( listview, accountid, children );
+ transfer->displayTransfers ( listview, accountid, children, displaydate );
}
@@ -621,3 +627,3 @@ void TransactionDisplay::setTransactionDisplayDate ()
else
- displaydate = QDate ( 1, 1, 1000 );
+ displaydate = QDate ( 1900, 1, 1 );
}
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
@@ -52,2 +52,3 @@ class TransactionDisplay : public QWidget
void setTransactionDisplayDate ();
+ void saveSortingPreference ( int column );
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
@@ -67,3 +67,3 @@ int Transfer::getNumberOfTransfers ( int accountid )
-void Transfer::displayTransfers ( QListView *listview, int accountid, bool children )
+void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate )
{
@@ -102,2 +102,3 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child
QString date = preferences->getDate ( year, month, day );
+ QDate testdate ( year, month, day );
@@ -114,18 +115,20 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child
- // display this transfer
- if ( account->getParentAccountID ( accountid ) == -1 )
+ if ( testdate >= displaydate || showcleared == 0 )
{
- if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
- ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount );
+ // display this transfer
+ if ( account->getParentAccountID ( accountid ) == -1 )
+ {
+ if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
+ ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount );
+ else
+ QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount );
+ }
else
- QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount );
+ {
+ if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
+ ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id );
+ else
+ QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id );
+ }
}
- else
- {
- if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
- ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id );
- else
- QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id );
- }
-
counter = counter + 7;
@@ -165,2 +168,3 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child
QString date = preferences->getDate ( year, month, day );
+ QDate testdate ( year, month, day );
@@ -178,16 +182,19 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child
- // display this transfer
- if ( account->getParentAccountID ( accountid ) == -1 )
- {
- if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
- ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount );
- else
- QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount );
- }
- else
- {
- if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
- ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id );
+ if ( testdate >= displaydate || showcleared == 0 )
+ {
+ // display this transfer
+ if ( account->getParentAccountID ( accountid ) == -1 )
+ {
+ if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
+ ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount );
+ else
+ QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount );
+ }
else
- QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id );
+ {
+ if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 )
+ ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id );
+ else
+ QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id );
+ }
}
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
@@ -6,2 +6,3 @@
#include <sqlite.h>
+#include <qdatetime.h>
@@ -31,3 +32,3 @@ class Transfer
- void displayTransfers ( QListView *listview, int accountid, bool children );
+ void displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate );
int getCleared ( int id );
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
@@ -99,3 +99,3 @@ int TransferDialog::getYear ()
{
- return day;
+ return year;
}