-rwxr-xr-x | noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 13 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 42 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qmaccounts.db | bin | 4096 -> 6144 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmbudgets.db | bin | 3072 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmmemory.db | bin | 4096 -> 10240 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmpreferences.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransactions.db | bin | 4096 -> 24576 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransfers.db | bin | 3072 -> 3072 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 49 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.h | 3 |
15 files changed, 106 insertions, 31 deletions
diff --git a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control index ffd11db..b00e3b1 100755 --- a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control +++ b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control @@ -1,7 +1,7 @@ Package: qashmoney Priority: optional -Version: 0.74 +Version: 0.75 Architecture: arm Maintainer: Allen Forsythe qashmoneyman@attbi.com Section: Applications Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. 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 @@ -73,26 +73,27 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p { setCaption( tr ( "Transaction" ) ); showclearedtransactions = new QCheckBox ( this ); showclearedtransactions->setText ( "Show Cleared Transactions" ); - 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" ); limittransactions->insertItem ( "180 days" ); limittransactions->insertItem ( "365 days" ); limittransactions->insertItem ( "All" ); + limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); + + excludetransfers = new QCheckBox ( this ); + excludetransfers->setText ( "Include Transfers In Limit View" ); if ( preferences->getPreference ( 3 ) == 1 ) showclearedtransactions->setChecked ( TRUE ); else showclearedtransactions->setChecked ( FALSE ); @@ -103,14 +104,14 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( showclearedtransactions ); - layout->addWidget ( excludetransfers ); layout->addWidget ( limittransactionsbox ); + layout->addWidget ( excludetransfers ); layout->insertSpacing ( 3, 5 ); layout->addWidget ( defaults ); connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); 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 @@ -57,13 +57,13 @@ void Preferences::addPreferences () // exclude transfers from limit view 0 = no 1 = yes rows = 0; sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); if ( rows == 0 ) sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); - // 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; sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); if ( rows == 0 ) sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 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 @@ -140,18 +140,20 @@ void QashMoney::changeTabDisplay () transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); // set the accountid and children variables transactiondisplay->setChildren ( children ); transactiondisplay->setAccountID ( accountid ); + setTransactionDisplayDate (); + // display transactions transactiondisplay->listview->clear(); QString displaytext = "%"; displaytext.prepend ( transactiondisplay->limitbox->text() ); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); + transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); // display transfers transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); // open a new preferences object and resize the transaction display columns // each column will have a different size based on whether we are looking at a child @@ -251,14 +253,16 @@ void QashMoney::displayDatePreferencesDialog () // redisplay transactions if they are visible incorporating // any changes to the date format transactiondisplay->listview->clear(); QString displaytext = "%"; 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 ); if ( transfer->getNumberOfTransfers() != 0 ) transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); } else if ( accountdisplay->isVisible() ) { @@ -287,14 +291,16 @@ void QashMoney::displayTransactionPreferencesDialog () children = FALSE; // redisplay transactions incorporating any transaction preference changes transactiondisplay->listview->clear(); QString displaytext = "%"; 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 ); if ( transfer->getNumberOfTransfers() != 0 ) transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); } else { @@ -349,8 +355,36 @@ void QashMoney::toggleOneTouchViewing ( bool state ) if ( state == TRUE ) disableOneTouchViewing(); else enableOneTouchViewing(); } - +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 @@ -2,12 +2,13 @@ #define QASHMONEY_H #include <qpe/qpemenubar.h> #include <qpopupmenu.h> #include <qlayout.h> #include <qtabwidget.h> +#include <qdatetime.h> #include "accountdisplay.h" #include "transactiondisplay.h" #include "budgetdisplay.h" #include "account.h" #include "preferences.h" @@ -43,19 +44,21 @@ class QashMoney : public QWidget private slots: void changeTabDisplay (); void showTransactions (); void enableOneTouchViewing (); void disableOneTouchViewing (); void toggleOneTouchViewing ( bool ); + void setTransactionDisplayDate (); private: QVBoxLayout *layout; QVBoxLayout *tabslayout; AccountDisplay *accountdisplay; TransactionDisplay *transactiondisplay; BudgetDisplay *budgetdisplay; int tabheight; + QDate newdate; }; #endif 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 @@ -5,12 +5,13 @@ #include "transaction.h" #include "account.h" #include "transactiondisplay.h" #include <stdlib.h> +#include <iostream.h> extern Account *account; extern Preferences *preferences; Transaction::Transaction () { @@ -151,48 +152,43 @@ int Transaction::getYear ( int id ) char **results; sqlite_get_table_printf ( tdb, "select year from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); QString yearstring = results [ 1 ]; return yearstring.toInt(); } -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; // 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 ) { 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 ); } else { 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 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 ); } // iterate through the result list and display each item int counter = 7; while ( counter < ( ( rows + 1 ) * columns ) ) { - // 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 ] ) ); // construct transaction name, amount, id QString payee = results [ counter + 3 ]; QString amount = results [ counter + 4 ]; QString transferid = results [ counter + 5 ]; 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 @@ -1,11 +1,12 @@ #ifndef TRANSACTION_H #define TRANSACTION_H #include <qstring.h> #include <qlistview.h> +#include <qdatetime.h> #include <sqlite.h> #include "preferences.h" class Transaction { @@ -40,13 +41,13 @@ class Transaction // These two functions clear budget ids is either a line item or an entire budget is deleted void clearBudgetIDs ( int, int ); void clearBudgetIDs ( int ); public slots: - void displayTransactions ( QListView *, int, bool, const char * ); + void displayTransactions ( QListView *, int, bool, const char *, QDate ); QString getPayee ( int ); QString getTransactionDescription ( int ); QString getNumber ( int ); QString getAmount ( int ); QString getAbsoluteAmount ( int ); int getCleared ( 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 @@ -124,14 +124,15 @@ void TransactionDisplay::addTransaction () newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); // redisplay transactions listview->clear(); QString displaytext = "%"; displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); // redisplay transfers if ( transfer->getNumberOfTransfers() > 0 ) transfer->displayTransfers ( listview, accountid, children ); // add the transaction amount to the account it's associated with @@ -362,14 +363,15 @@ void TransactionDisplay::editTransaction () void TransactionDisplay::updateAndDisplay ( int id ) { // redisplay transactions listview->clear(); QString displaytext = "%"; displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); // redisplay transfers if ( transfer->getNumberOfTransfers() > 0 ) transfer->displayTransfers ( listview, accountid, children ); // add the transaction amount to the account it's associated with @@ -406,14 +408,15 @@ void TransactionDisplay::deleteTransaction () transaction->deleteTransaction ( transactionid ); listview->clear(); QString displaytext = "%"; displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); if ( transfer->getNumberOfTransfers() > 0 ) transfer->displayTransfers ( listview, accountid, children ); // if we are viewing different child accounts through the parent account // ie if there are five columns and the parentid is -1 @@ -437,14 +440,15 @@ void TransactionDisplay::deleteTransaction () // delete the transfer and redisplay transactions transfer->deleteTransfer ( transactionid ); listview->clear(); QString displaytext = "%"; displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); if ( transfer->getNumberOfTransfers() > 0 ) transfer->displayTransfers ( listview, accountid, children ); // for the from account account->updateAccountBalance ( fromaccountid ); @@ -489,14 +493,15 @@ void TransactionDisplay::toggleTransaction () transfer->setCleared ( transactionid, 0 ); } listview->clear(); QString displaytext = "%"; displaytext.prepend ( limitbox->text() ); + setTransactionDisplayDate (); if ( transaction->getNumberOfTransactions() > 0 ) - transaction->displayTransactions ( listview, accountid, children, displaytext ); + transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); if ( transfer->getNumberOfTransfers() != 0 ) transfer->displayTransfers ( listview, accountid, children ); } void TransactionDisplay::redisplayAccountBalance () @@ -548,13 +553,16 @@ void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) void TransactionDisplay::limitDisplay ( const QString &text ) { listview->clear (); QString displaytext = "%"; 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 ) transfer->displayTransfers ( listview, accountid, children ); } int TransactionDisplay::getIDColumn () { @@ -581,6 +589,35 @@ void TransactionDisplay::showTransactionNotes () notes->setEnabled ( FALSE ); notes->setText ( transaction->getTransactionDescription ( transactionid ) ); description->show(); } } +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 @@ -4,12 +4,13 @@ #include <qlayout.h> #include <qhbox.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlabel.h> #include <qlineedit.h> +#include <qdatetime.h> class TransactionDisplay : public QWidget { Q_OBJECT public: @@ -45,15 +46,17 @@ class TransactionDisplay : public QWidget void checkListViewEdit (); void checkListViewToggle (); void saveColumnSize ( int column, int oldsize, int newsize ); void limitDisplay ( const QString & ); void showCalculator (); void showCalendar (); + void setTransactionDisplayDate (); private: int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; + QDate displaydate; bool children; QBoxLayout *layout; QHBox *firstline; QHBox *secondline; void redisplayAccountBalance (); void updateAndDisplay ( int accountid ); |