-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 @@ -2,3 +2,3 @@ Package: qashmoney Priority: optional -Version: 0.74 +Version: 0.75 Architecture: arm 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 @@ -78,12 +78,9 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p - excludetransfers = new QCheckBox ( this ); - excludetransfers->setText ( "Include Transfers In Limit View" ); - limittransactionsbox = new QHBox ( this ); limittransactionsbox->setSpacing ( 2 ); - limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox ); + limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); limittransactions = new QComboBox ( limittransactionsbox ); + QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); limittransactions->insertItem ( "14 days" ); limittransactions->insertItem ( "30 days" ); - limittransactions->insertItem ( "60 days" ); limittransactions->insertItem ( "90 days" ); @@ -92,2 +89,6 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p limittransactions->insertItem ( "All" ); + limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); + + excludetransfers = new QCheckBox ( this ); + excludetransfers->setText ( "Include Transfers In Limit View" ); @@ -108,4 +109,4 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p layout->addWidget ( showclearedtransactions ); - layout->addWidget ( excludetransfers ); layout->addWidget ( limittransactionsbox ); + layout->addWidget ( excludetransfers ); layout->insertSpacing ( 3, 5 ); 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 @@ -62,3 +62,3 @@ void Preferences::addPreferences () - // 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 + // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 90 days, 3 = 180 days, 4 = 365 days 5 = all rows = 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 @@ -145,2 +145,4 @@ void QashMoney::changeTabDisplay () + setTransactionDisplayDate (); + // display transactions @@ -150,3 +152,3 @@ void QashMoney::changeTabDisplay () if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); + transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); @@ -256,4 +258,6 @@ void QashMoney::displayDatePreferencesDialog () displaytext.prepend ( transactiondisplay->limitbox->text() ); + + setTransactionDisplayDate(); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); + transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); @@ -292,4 +296,6 @@ void QashMoney::displayTransactionPreferencesDialog () displaytext.prepend ( transactiondisplay->limitbox->text() ); + + setTransactionDisplayDate(); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); + transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); @@ -354,3 +360,31 @@ void QashMoney::toggleOneTouchViewing ( bool state ) - +void QashMoney::setTransactionDisplayDate () + { + // determine how many days of transactions to show + int limittype = preferences->getPreference ( 7 ); + if ( limittype != 5 ) // set today's date if we are not showing all transactions + { + QDate today = QDate::currentDate (); + switch ( limittype ) // if we are not showing all transactions + { + case 0: // viewing two weeks + newdate = today.addDays ( -14 ); + break; + case 1: // viewing one month + newdate = today.addDays ( -30 ); + break; + case 2: // three months + newdate = today.addDays ( -90 ); + break; + case 3: // six months + newdate = today.addDays ( -180 ); + break; + case 4: // one year + newdate = today.addDays ( -365 ); + break; + } + } + else + newdate = QDate ( 1, 1, 1000 ); + } 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 @@ -7,2 +7,3 @@ #include <qtabwidget.h> +#include <qdatetime.h> @@ -48,2 +49,3 @@ class QashMoney : public QWidget void toggleOneTouchViewing ( bool ); + void setTransactionDisplayDate (); @@ -56,2 +58,3 @@ class QashMoney : public QWidget int tabheight; + QDate newdate; diff --git a/noncore/apps/qashmoney/qmaccounts.db b/noncore/apps/qashmoney/qmaccounts.db Binary files differindex 449bcab..76db78b 100755 --- a/noncore/apps/qashmoney/qmaccounts.db +++ b/noncore/apps/qashmoney/qmaccounts.db diff --git a/noncore/apps/qashmoney/qmbudgets.db b/noncore/apps/qashmoney/qmbudgets.db Binary files differindex d798f0c..ef75719 100755 --- a/noncore/apps/qashmoney/qmbudgets.db +++ b/noncore/apps/qashmoney/qmbudgets.db diff --git a/noncore/apps/qashmoney/qmmemory.db b/noncore/apps/qashmoney/qmmemory.db Binary files differindex 5c23122..c6b7920 100755 --- a/noncore/apps/qashmoney/qmmemory.db +++ b/noncore/apps/qashmoney/qmmemory.db diff --git a/noncore/apps/qashmoney/qmpreferences.db b/noncore/apps/qashmoney/qmpreferences.db Binary files differindex a4e96f5..91596cb 100755 --- a/noncore/apps/qashmoney/qmpreferences.db +++ b/noncore/apps/qashmoney/qmpreferences.db diff --git a/noncore/apps/qashmoney/qmtransactions.db b/noncore/apps/qashmoney/qmtransactions.db Binary files differindex 9e4acc9..a5eb4f3 100755 --- a/noncore/apps/qashmoney/qmtransactions.db +++ b/noncore/apps/qashmoney/qmtransactions.db diff --git a/noncore/apps/qashmoney/qmtransfers.db b/noncore/apps/qashmoney/qmtransfers.db Binary files differindex c31df1a..3ca9f78 100755 --- a/noncore/apps/qashmoney/qmtransfers.db +++ b/noncore/apps/qashmoney/qmtransfers.db 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 @@ -10,2 +10,3 @@ #include <stdlib.h> +#include <iostream.h> @@ -156,5 +157,6 @@ int Transaction::getYear ( int id ) -void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit ) +void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) { int showcleared = preferences->getPreference ( 3 ); + int year = ( displaydate.year() ) - 1; @@ -168,5 +170,5 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr 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 ); + 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 and accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit ); + 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 ); } @@ -175,3 +177,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) - 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 ); + 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 @@ -184,10 +186,4 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr { - // construct the date - //QString daystring = results [ counter ]; - //int day = results [ counter ].toInt (); - //QString monthstring = results [ counter + 1 ]; - //int month = results [ counter + 1 ].toInt (); - //QString yearstring = results [ counter + 2 ]; - //int year = results [ counter + 2 ].toInt (); - QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); + QDate displaydate ( 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 ] ) ); 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 @@ -5,2 +5,3 @@ #include <qlistview.h> +#include <qdatetime.h> #include <sqlite.h> @@ -45,3 +46,3 @@ class Transaction - void displayTransactions ( QListView *, int, bool, const char * ); + void displayTransactions ( QListView *, int, bool, const char *, QDate ); QString getPayee ( 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 @@ -129,4 +129,5 @@ void TransactionDisplay::addTransaction () displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); @@ -367,4 +368,5 @@ void TransactionDisplay::updateAndDisplay ( int id ) displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); @@ -411,4 +413,5 @@ void TransactionDisplay::deleteTransaction () displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); @@ -442,4 +445,5 @@ void TransactionDisplay::deleteTransaction () displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); @@ -494,4 +498,5 @@ void TransactionDisplay::toggleTransaction () displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); @@ -553,3 +558,6 @@ void TransactionDisplay::limitDisplay ( const QString &text ) displaytext.prepend ( text ); - transaction->displayTransactions ( listview, accountid, children, displaytext ); + setTransactionDisplayDate (); + if ( transaction->getNumberOfTransactions() > 0 ) + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); + if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) @@ -586 +594,30 @@ void TransactionDisplay::showTransactionNotes () +void TransactionDisplay::setTransactionDisplayDate () + { + // determine how many days of transactions to show + int limittype = preferences->getPreference ( 7 ); + if ( limittype != 5 ) // set today's date if we are not showing all transactions + { + QDate today = QDate::currentDate (); + switch ( limittype ) // if we are not showing all transactions + { + case 0: // viewing two weeks + displaydate = today.addDays ( -14 ); + break; + case 1: // viewing one month + displaydate = today.addDays ( -30 ); + break; + case 2: // three months + displaydate = today.addDays ( -90 ); + break; + case 3: // six months + displaydate = today.addDays ( -180 ); + break; + case 4: // one year + displaydate = today.addDays ( -365 ); + break; + } + } + else + displaydate = QDate ( 1, 1, 1000 ); + } 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 @@ -9,2 +9,3 @@ #include <qlineedit.h> +#include <qdatetime.h> @@ -50,2 +51,3 @@ class TransactionDisplay : public QWidget void showCalendar (); + void setTransactionDisplayDate (); @@ -53,2 +55,3 @@ class TransactionDisplay : public QWidget int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; + QDate displaydate; bool children; |