summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/account.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/budget.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.pro2
-rwxr-xr-xnoncore/apps/qashmoney/transaction.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/transfer.cpp1
7 files changed, 1 insertions, 7 deletions
diff --git a/noncore/apps/qashmoney/account.cpp b/noncore/apps/qashmoney/account.cpp
index 28f9ba2..181be23 100755
--- a/noncore/apps/qashmoney/account.cpp
+++ b/noncore/apps/qashmoney/account.cpp
@@ -1,72 +1,71 @@
1#include "account.h" 1#include "account.h"
2#include "transaction.h" 2#include "transaction.h"
3#include "transfer.h" 3#include "transfer.h"
4#include "preferences.h" 4#include "preferences.h"
5 5
6#include <qpixmap.h> 6#include <qpixmap.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <iostream.h>
9 8
10extern Preferences *preferences; 9extern Preferences *preferences;
11 10
12Account::Account () 11Account::Account ()
13 { 12 {
14 adb = sqlite_open ( "qmaccounts.db", 0, NULL ); 13 adb = sqlite_open ( "qmaccounts.db", 0, NULL );
15 } 14 }
16 15
17Account::~Account () 16Account::~Account ()
18 { 17 {
19 sqlite_close ( adb ); 18 sqlite_close ( adb );
20 } 19 }
21 20
22void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit, 21void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit,
23 int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) 22 int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency )
24 { 23 {
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, 24 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 ); 25 (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency );
27 } 26 }
28 27
29void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid ) 28void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid )
30 { 29 {
31 sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid ); 30 sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid );
32 } 31 }
33 32
34void Account::deleteAccount ( int accountid ) 33void Account::deleteAccount ( int accountid )
35 { 34 {
36 sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid ); 35 sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid );
37 } 36 }
38 37
39void Account::setAccountExpanded ( int expanded, int accountid ) 38void Account::setAccountExpanded ( int expanded, int accountid )
40 { 39 {
41 sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid ); 40 sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid );
42 } 41 }
43 42
44int Account::getAccountExpanded ( int id ) 43int Account::getAccountExpanded ( int id )
45 { 44 {
46 char **results; 45 char **results;
47 sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id ); 46 sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id );
48 if ( strlen ( results [1] ) == 0 ) 47 if ( strlen ( results [1] ) == 0 )
49 return 0; 48 return 0;
50 else 49 else
51 return atoi ( results [ 1 ] ); 50 return atoi ( results [ 1 ] );
52 } 51 }
53 52
54int Account::getNumberOfAccounts () 53int Account::getNumberOfAccounts ()
55 { 54 {
56 char **results; 55 char **results;
57 sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL ); 56 sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL );
58 return atoi ( results [ 1 ] ); 57 return atoi ( results [ 1 ] );
59 } 58 }
60 59
61int Account::getNumberOfChildAccounts ( int id ) 60int Account::getNumberOfChildAccounts ( int id )
62 { 61 {
63 char **results; 62 char **results;
64 sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id ); 63 sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id );
65 return atoi ( results [ 1 ] ); 64 return atoi ( results [ 1 ] );
66 } 65 }
67 66
68void Account::updateAccountBalance ( int accountid ) 67void Account::updateAccountBalance ( int accountid )
69 { 68 {
70 // Here, we'll get a balance for the transactions in an account 69 // Here, we'll get a balance for the transactions in an account
71 sqlite *tdb = sqlite_open ( "qmtransactions.db", 0, NULL ); 70 sqlite *tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
72 int rows, columns; 71 int rows, columns;
diff --git a/noncore/apps/qashmoney/budget.cpp b/noncore/apps/qashmoney/budget.cpp
index 9f74078..2cec329 100755
--- a/noncore/apps/qashmoney/budget.cpp
+++ b/noncore/apps/qashmoney/budget.cpp
@@ -1,68 +1,67 @@
1#include "budget.h" 1#include "budget.h"
2#include "transaction.h" 2#include "transaction.h"
3#include <stdlib.h> 3#include <stdlib.h>
4#include <iostream.h>
5 4
6extern Transaction *transaction; 5extern Transaction *transaction;
7 6
8Budget::Budget () 7Budget::Budget ()
9 { 8 {
10 bdb = sqlite_open ( "qmbudgets.db", 0, NULL ); 9 bdb = sqlite_open ( "qmbudgets.db", 0, NULL );
11 } 10 }
12 11
13Budget::~Budget () 12Budget::~Budget ()
14 { 13 {
15 sqlite_close ( bdb ); 14 sqlite_close ( bdb );
16 } 15 }
17 16
18int Budget::addBudget ( QString name, int type, QString description, QString currency, int startday, int startmonth, int startyear, int endday, int endmonth, int endyear, int defaultview ) 17int Budget::addBudget ( QString name, int type, QString description, QString currency, int startday, int startmonth, int startyear, int endday, int endmonth, int endyear, int defaultview )
19 { 18 {
20 sqlite_exec_printf ( bdb, "insert into budgets values ( '%q', %i, '%q', '%q', %i, %i, %i, %i, %i, %i, %i, NULL );", 0, 0, 0, ( const char * ) name, type, ( const char * ) description, ( const char * ) currency, startday, startmonth, startyear, endday, endmonth, endyear, defaultview ); 19 sqlite_exec_printf ( bdb, "insert into budgets values ( '%q', %i, '%q', '%q', %i, %i, %i, %i, %i, %i, %i, NULL );", 0, 0, 0, ( const char * ) name, type, ( const char * ) description, ( const char * ) currency, startday, startmonth, startyear, endday, endmonth, endyear, defaultview );
21 char **results; 20 char **results;
22 sqlite_get_table ( bdb, "select last_insert_rowid() from budgets;", &results, NULL, NULL, NULL ); 21 sqlite_get_table ( bdb, "select last_insert_rowid() from budgets;", &results, NULL, NULL, NULL );
23 QString tablename = "table"; 22 QString tablename = "table";
24 tablename.append ( results [ 1 ] ); 23 tablename.append ( results [ 1 ] );
25 sqlite_exec_printf ( bdb, "create table '%q' ( name, lineitemamount, type, lineitemid integer primary key );", 0, 0, 0, ( const char* ) tablename ); 24 sqlite_exec_printf ( bdb, "create table '%q' ( name, lineitemamount, type, lineitemid integer primary key );", 0, 0, 0, ( const char* ) tablename );
26 return atoi ( results [ 1 ] ); 25 return atoi ( results [ 1 ] );
27 } 26 }
28 27
29void Budget::updateBudget ( QString name, QString description, QString currency, int budgetid ) 28void Budget::updateBudget ( QString name, QString description, QString currency, int budgetid )
30 { 29 {
31 sqlite_exec_printf ( bdb, "update budgets set name = '%q', description = '%q', currency = '%q' where budgetid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currency, budgetid ); 30 sqlite_exec_printf ( bdb, "update budgets set name = '%q', description = '%q', currency = '%q' where budgetid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currency, budgetid );
32 } 31 }
33 32
34void Budget::deleteBudget ( int budgetid ) 33void Budget::deleteBudget ( int budgetid )
35 { 34 {
36 if ( getNumberOfBudgets() != 0 ) 35 if ( getNumberOfBudgets() != 0 )
37 { 36 {
38 QString tablename = "table"; 37 QString tablename = "table";
39 tablename.append ( QString::number ( budgetid ) ); 38 tablename.append ( QString::number ( budgetid ) );
40 sqlite_exec_printf ( bdb, "delete from budgets where budgetid = %i;", 0, 0, 0, budgetid ); 39 sqlite_exec_printf ( bdb, "delete from budgets where budgetid = %i;", 0, 0, 0, budgetid );
41 sqlite_exec_printf ( bdb, "drop table '%q';", 0, 0, 0, ( const char* ) tablename ); 40 sqlite_exec_printf ( bdb, "drop table '%q';", 0, 0, 0, ( const char* ) tablename );
42 } 41 }
43 } 42 }
44 43
45int Budget::getNumberOfBudgets () 44int Budget::getNumberOfBudgets ()
46 { 45 {
47 char **results; 46 char **results;
48 sqlite_get_table ( bdb, "select count() from budgets;", &results, NULL, NULL, NULL ); 47 sqlite_get_table ( bdb, "select count() from budgets;", &results, NULL, NULL, NULL );
49 return atoi ( results [ 1 ] ); 48 return atoi ( results [ 1 ] );
50 } 49 }
51 50
52int Budget::getNumberOfLineItems ( int budgetid ) 51int Budget::getNumberOfLineItems ( int budgetid )
53 { 52 {
54 QString tablename = "table"; 53 QString tablename = "table";
55 tablename.append ( QString::number ( budgetid ) ); 54 tablename.append ( QString::number ( budgetid ) );
56 char **results; 55 char **results;
57 sqlite_get_table_printf ( bdb, "select count() from '%q';", &results, NULL, NULL, NULL, ( const char * ) tablename ); 56 sqlite_get_table_printf ( bdb, "select count() from '%q';", &results, NULL, NULL, NULL, ( const char * ) tablename );
58 return atoi ( results [ 1 ] ); 57 return atoi ( results [ 1 ] );
59 } 58 }
60 59
61QStringList* Budget::getBudgetNames () 60QStringList* Budget::getBudgetNames ()
62 { 61 {
63 QStringList *names = new QStringList (); 62 QStringList *names = new QStringList ();
64 char **results; 63 char **results;
65 int rows, counter; 64 int rows, counter;
66 sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL ); 65 sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL );
67 names->append ( "None" ); 66 names->append ( "None" );
68 for ( counter = 0; counter < rows; counter++ ) 67 for ( counter = 0; counter < rows; counter++ )
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp
index e985f0b..d4cbc14 100755
--- a/noncore/apps/qashmoney/qashmoney.cpp
+++ b/noncore/apps/qashmoney/qashmoney.cpp
@@ -1,70 +1,69 @@
1#include "qashmoney.h" 1#include "qashmoney.h"
2#include "preferencedialogs.h" 2#include "preferencedialogs.h"
3#include "memorydialog.h" 3#include "memorydialog.h"
4 4
5#include <qheader.h> 5#include <qheader.h>
6#include <iostream.h>
7 6
8Budget *budget = new Budget (); 7Budget *budget = new Budget ();
9Preferences *preferences = new Preferences (); 8Preferences *preferences = new Preferences ();
10Account *account = new Account (); 9Account *account = new Account ();
11Transaction *transaction = new Transaction (); 10Transaction *transaction = new Transaction ();
12Transfer *transfer = new Transfer (); 11Transfer *transfer = new Transfer ();
13Memory *memory = new Memory (); 12Memory *memory = new Memory ();
14 13
15QashMoney::QashMoney () : QWidget () 14QashMoney::QashMoney () : QWidget ()
16 { 15 {
17 preferences->addPreferences (); 16 preferences->addPreferences ();
18 preferences->initializeColumnPreferences (); 17 preferences->initializeColumnPreferences ();
19 preferences->initializeSortingPreferences (); 18 preferences->initializeSortingPreferences ();
20 19
21 // set the text in the upper part of the frame 20 // set the text in the upper part of the frame
22 setCaption ( tr ( "QashMoney" ) ); 21 setCaption ( tr ( "QashMoney" ) );
23 22
24 // Create new menubar for our mainwindow 23 // Create new menubar for our mainwindow
25 // and add menu items 24 // and add menu items
26 mainmenu = new QMenuBar ( this ); 25 mainmenu = new QMenuBar ( this );
27 mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); 26 mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
28 preferencesmenu = new QPopupMenu ( this ); 27 preferencesmenu = new QPopupMenu ( this );
29 utilitiesmenu = new QPopupMenu ( this ); 28 utilitiesmenu = new QPopupMenu ( this );
30 mainmenu->insertItem ( "Preferences", preferencesmenu ); 29 mainmenu->insertItem ( "Preferences", preferencesmenu );
31 mainmenu->insertItem ( "Utilities", utilitiesmenu ); 30 mainmenu->insertItem ( "Utilities", utilitiesmenu );
32 preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) ); 31 preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) );
33 preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) ); 32 preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) );
34 preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) ); 33 preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) );
35 utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) ); 34 utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) );
36 35
37 // create the main tabwidget for displaying accounts and transactions 36 // create the main tabwidget for displaying accounts and transactions
38 maintabs = new QTabWidget ( this ); 37 maintabs = new QTabWidget ( this );
39 tab = new QWidget ( this ); 38 tab = new QWidget ( this );
40 tab_2 = new QWidget ( this ); 39 tab_2 = new QWidget ( this );
41 tab_3 = new QWidget ( this ); 40 tab_3 = new QWidget ( this );
42 maintabs->addTab ( tab, "Accounts" ); 41 maintabs->addTab ( tab, "Accounts" );
43 maintabs->addTab ( tab_2, "Transactions" ); 42 maintabs->addTab ( tab_2, "Transactions" );
44 maintabs->addTab ( tab_3, "Budgets" ); 43 maintabs->addTab ( tab_3, "Budgets" );
45 tabheight = tab->height(); 44 tabheight = tab->height();
46 maintabs->setTabEnabled ( tab_2, FALSE ); 45 maintabs->setTabEnabled ( tab_2, FALSE );
47 46
48 // create a new account display object 47 // create a new account display object
49 accountdisplay = new AccountDisplay ( maintabs ); 48 accountdisplay = new AccountDisplay ( maintabs );
50 accountdisplay->setTabs ( tab_2, maintabs ); 49 accountdisplay->setTabs ( tab_2, maintabs );
51 connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) ); 50 connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) );
52 51
53 // set the connection to disable the one touch account viewing if we are transfering money 52 // set the connection to disable the one touch account viewing if we are transfering money
54 connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) ); 53 connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) );
55 54
56 // create a new transactiondisplay object 55 // create a new transactiondisplay object
57 transactiondisplay = new TransactionDisplay ( maintabs ); 56 transactiondisplay = new TransactionDisplay ( maintabs );
58 transactiondisplay->hide(); 57 transactiondisplay->hide();
59 58
60 // create new budgetdisplay object 59 // create new budgetdisplay object
61 budgetdisplay = new BudgetDisplay ( maintabs ); 60 budgetdisplay = new BudgetDisplay ( maintabs );
62 budgetdisplay->hide(); 61 budgetdisplay->hide();
63 62
64 tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); 63 tabslayout = new QVBoxLayout ( maintabs, 4, 2 );
65 tabslayout->addSpacing ( tabheight ); 64 tabslayout->addSpacing ( tabheight );
66 tabslayout->addWidget ( accountdisplay ); 65 tabslayout->addWidget ( accountdisplay );
67 tabslayout->addWidget ( transactiondisplay ); 66 tabslayout->addWidget ( transactiondisplay );
68 tabslayout->addWidget ( budgetdisplay ); 67 tabslayout->addWidget ( budgetdisplay );
69 68
70 // connect a change in the maintabs with changing the tab display 69 // connect a change in the maintabs with changing the tab display
diff --git a/noncore/apps/qashmoney/qashmoney.pro b/noncore/apps/qashmoney/qashmoney.pro
index 8b4646a..ec29faa 100755
--- a/noncore/apps/qashmoney/qashmoney.pro
+++ b/noncore/apps/qashmoney/qashmoney.pro
@@ -1,49 +1,49 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3 HEADERS =qashmoney.h \ 3 HEADERS =qashmoney.h \
4 accountdisplay.h \ 4 accountdisplay.h \
5 account.h \ 5 account.h \
6 transaction.h \ 6 transaction.h \
7 transactiondisplay.h \ 7 transactiondisplay.h \
8 newtransaction.h \ 8 newtransaction.h \
9 transfer.h \ 9 transfer.h \
10 transferdialog.h \ 10 transferdialog.h \
11 preferences.h \ 11 preferences.h \
12 preferencedialogs.h \ 12 preferencedialogs.h \
13 memory.h \ 13 memory.h \
14 memorydialog.h \ 14 memorydialog.h \
15 newaccount.h \ 15 newaccount.h \
16 calculator.h \ 16 calculator.h \
17 datepicker.h \ 17 datepicker.h \
18 budget.h \ 18 budget.h \
19 budgetdisplay.h \ 19 budgetdisplay.h \
20 currency.h 20 currency.h
21 SOURCES =qashmoney.cpp \ 21 SOURCES =qashmoney.cpp \
22 accountdisplay.cpp \ 22 accountdisplay.cpp \
23 account.cpp \ 23 account.cpp \
24 transaction.cpp \ 24 transaction.cpp \
25 transactiondisplay.cpp \ 25 transactiondisplay.cpp \
26 newtransaction.cpp \ 26 newtransaction.cpp \
27 transfer.cpp \ 27 transfer.cpp \
28 transferdialog.cpp \ 28 transferdialog.cpp \
29 preferences.cpp \ 29 preferences.cpp \
30 preferencedialogs.cpp \ 30 preferencedialogs.cpp \
31 memory.cpp \ 31 memory.cpp \
32 memorydialog.cpp \ 32 memorydialog.cpp \
33 newaccount.cpp \ 33 newaccount.cpp \
34 calculator.cpp \ 34 calculator.cpp \
35 datepicker.cpp \ 35 datepicker.cpp \
36 main.cpp \ 36 main.cpp \
37 budget.cpp \ 37 budget.cpp \
38 budgetdisplay.cpp \ 38 budgetdisplay.cpp \
39 currency.cpp 39 currency.cpp
40INCLUDEPATH = $(OPIEDIR)/include 40INCLUDEPATH = $(OPIEDIR)/include
41DEPENDPATH = $(OPIEDIR)/include 41DEPENDPATH = $(OPIEDIR)/include
42 42
43DESTDIR = $(OPIEDIR)/bin 43DESTDIR = $(OPIEDIR)/bin
44 44
45unix:LIBS += -lm 45unix:LIBS += -lm
46LIBS += -lqpe -lqte -lstdc++ -lsqlite 46LIBS += -lqpe -lqte -lsqlite
47 47
48include ( $(OPIEDIR)/include.pro ) 48include ( $(OPIEDIR)/include.pro )
49 49
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp
index dcf46b1..d008a4f 100755
--- a/noncore/apps/qashmoney/transaction.cpp
+++ b/noncore/apps/qashmoney/transaction.cpp
@@ -1,75 +1,74 @@
1// RESERVEDONE COLUMN NAME REPRESENTS THE LINEITEMID AND SHOULD BE CHANGED IN 1// RESERVEDONE COLUMN NAME REPRESENTS THE LINEITEMID AND SHOULD BE CHANGED IN
2// FUTURE VERSIONS OF QASHMONEY 2// FUTURE VERSIONS OF QASHMONEY
3 3
4// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION 4// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION
5 5
6#include "transaction.h" 6#include "transaction.h"
7#include "account.h" 7#include "account.h"
8#include "transactiondisplay.h" 8#include "transactiondisplay.h"
9 9
10#include <stdlib.h> 10#include <stdlib.h>
11#include <iostream.h>
12 11
13extern Account *account; 12extern Account *account;
14extern Preferences *preferences; 13extern Preferences *preferences;
15 14
16Transaction::Transaction () 15Transaction::Transaction ()
17 { 16 {
18 tdb = sqlite_open ( "qmtransactions.db", 0, NULL ); 17 tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
19 } 18 }
20 19
21Transaction::~Transaction () 20Transaction::~Transaction ()
22 { 21 {
23 sqlite_close ( tdb ); 22 sqlite_close ( tdb );
24 } 23 }
25 24
26void Transaction::addTransaction ( QString description, QString payee, int accountid, int parentid, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid ) 25void Transaction::addTransaction ( QString description, QString payee, int accountid, int parentid, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid )
27 { 26 {
28 sqlite_exec_printf ( tdb, "insert into transactions values ( '%q', %i, %i, %i, %i, %i, %i, %.2f, %i, %i, 0, 0, 0, 0, 0, 0, %i, '%q', 0, " 27 sqlite_exec_printf ( tdb, "insert into transactions values ( '%q', %i, %i, %i, %i, %i, %i, %.2f, %i, %i, 0, 0, 0, 0, 0, 0, %i, '%q', 0, "
29 "0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description ); 28 "0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description );
30 } 29 }
31 30
32void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid ) 31void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid )
33 { 32 {
34 sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f," 33 sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f,"
35 "cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year, 34 "cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year,
36 amount, cleared, budgetid, lineitemid, transactionid ); 35 amount, cleared, budgetid, lineitemid, transactionid );
37 } 36 }
38 37
39void Transaction::deleteTransaction ( int transid ) 38void Transaction::deleteTransaction ( int transid )
40 { 39 {
41 sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid ); 40 sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid );
42 } 41 }
43 42
44void Transaction::deleteAllTransactions ( int accountid ) 43void Transaction::deleteAllTransactions ( int accountid )
45 { 44 {
46 sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid ); 45 sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid );
47 } 46 }
48 47
49int Transaction::getAccountID ( int id ) 48int Transaction::getAccountID ( int id )
50 { 49 {
51 char **results; 50 char **results;
52 sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); 51 sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
53 return atol ( results [ 1 ] ); 52 return atol ( results [ 1 ] );
54 } 53 }
55 54
56int Transaction::getNumberOfTransactions () 55int Transaction::getNumberOfTransactions ()
57 { 56 {
58 char **results; 57 char **results;
59 sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL ); 58 sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL );
60 return atoi ( results [ 1 ] ); 59 return atoi ( results [ 1 ] );
61 } 60 }
62 61
63int Transaction::getNumberOfTransactions ( int accountid ) 62int Transaction::getNumberOfTransactions ( int accountid )
64 { 63 {
65 char **results; 64 char **results;
66 sqlite_get_table_printf ( tdb, "select count() from transactions where accountid = %i;", &results, NULL, NULL, NULL, accountid ); 65 sqlite_get_table_printf ( tdb, "select count() from transactions where accountid = %i;", &results, NULL, NULL, NULL, accountid );
67 return atol ( results [ 1 ] ); 66 return atol ( results [ 1 ] );
68 } 67 }
69 68
70QString Transaction::getPayee ( int id ) 69QString Transaction::getPayee ( int id )
71 { 70 {
72 char **results; 71 char **results;
73 sqlite_get_table_printf ( tdb, "select payee from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); 72 sqlite_get_table_printf ( tdb, "select payee from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
74 return results [ 1 ]; 73 return results [ 1 ];
75 } 74 }
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp
index 1839cd2..78b8a00 100755
--- a/noncore/apps/qashmoney/transactiondisplay.cpp
+++ b/noncore/apps/qashmoney/transactiondisplay.cpp
@@ -1,79 +1,78 @@
1#include "transactiondisplay.h" 1#include "transactiondisplay.h"
2#include "newtransaction.h" 2#include "newtransaction.h"
3#include "account.h" 3#include "account.h"
4#include "budget.h" 4#include "budget.h"
5#include "memory.h" 5#include "memory.h"
6#include "transfer.h" 6#include "transfer.h"
7#include "preferences.h" 7#include "preferences.h"
8#include "calculator.h" 8#include "calculator.h"
9#include "datepicker.h" 9#include "datepicker.h"
10 10
11#include <qdatetime.h> 11#include <qdatetime.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qheader.h> 13#include <qheader.h>
14#include <qmultilineedit.h> 14#include <qmultilineedit.h>
15#include <iostream.h>
16#include <qdatetime.h> 15#include <qdatetime.h>
17 16
18extern Transaction *transaction; 17extern Transaction *transaction;
19extern Budget *budget; 18extern Budget *budget;
20extern Account *account; 19extern Account *account;
21extern Preferences *preferences; 20extern Preferences *preferences;
22extern Memory *memory; 21extern Memory *memory;
23extern Transfer *transfer; 22extern Transfer *transfer;
24 23
25TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) 24TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent )
26 { 25 {
27 // set transactiondisplay variables; 26 // set transactiondisplay variables;
28 accountid = 0; 27 accountid = 0;
29 children = TRUE; 28 children = TRUE;
30 29
31 firstline = new QHBox ( this ); 30 firstline = new QHBox ( this );
32 firstline->setSpacing ( 2 ); 31 firstline->setSpacing ( 2 );
33 32
34 newtransaction = new QPushButton ( firstline ); 33 newtransaction = new QPushButton ( firstline );
35 newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); 34 newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
36 connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); 35 connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) );
37 36
38 edittransaction = new QPushButton ( firstline ); 37 edittransaction = new QPushButton ( firstline );
39 edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); 38 edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
40 connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); 39 connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) );
41 40
42 deletetransaction = new QPushButton ( firstline ); 41 deletetransaction = new QPushButton ( firstline );
43 deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); 42 deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
44 connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); 43 connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) );
45 44
46 toggletransaction = new QPushButton ( firstline ); 45 toggletransaction = new QPushButton ( firstline );
47 toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); 46 toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") );
48 connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); 47 connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) );
49 48
50 viewtransactionnotes = new QPushButton ( firstline ); 49 viewtransactionnotes = new QPushButton ( firstline );
51 viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); 50 viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") );
52 connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); 51 connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) );
53 52
54 secondline = new QHBox ( this ); 53 secondline = new QHBox ( this );
55 secondline->setSpacing ( 5 ); 54 secondline->setSpacing ( 5 );
56 55
57 name = new QLabel ( secondline ); 56 name = new QLabel ( secondline );
58 balance = new QLabel ( secondline ); 57 balance = new QLabel ( secondline );
59 58
60 QLabel *limit = new QLabel ( "Limit", secondline ); 59 QLabel *limit = new QLabel ( "Limit", secondline );
61 limitbox = new QLineEdit ( secondline ); 60 limitbox = new QLineEdit ( secondline );
62 limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); 61 limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) );
63 connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); 62 connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) );
64 63
65 listview = new QListView ( this ); 64 listview = new QListView ( this );
66 listview->setAllColumnsShowFocus ( TRUE ); 65 listview->setAllColumnsShowFocus ( TRUE );
67 listview->setShowSortIndicator ( TRUE ); 66 listview->setShowSortIndicator ( TRUE );
68 listview->header()->setTracking ( FALSE ); 67 listview->header()->setTracking ( FALSE );
69 connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); 68 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 ) ) ); 69 connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
71 70
72 layout = new QVBoxLayout ( this, 2, 2 ); 71 layout = new QVBoxLayout ( this, 2, 2 );
73 layout->addWidget ( firstline ); 72 layout->addWidget ( firstline );
74 layout->addWidget ( secondline ); 73 layout->addWidget ( secondline );
75 layout->addWidget ( listview ); 74 layout->addWidget ( listview );
76 } 75 }
77 76
78void TransactionDisplay::addTransaction () 77void TransactionDisplay::addTransaction ()
79 { 78 {
diff --git a/noncore/apps/qashmoney/transfer.cpp b/noncore/apps/qashmoney/transfer.cpp
index c4bbaf9..ae1b748 100755
--- a/noncore/apps/qashmoney/transfer.cpp
+++ b/noncore/apps/qashmoney/transfer.cpp
@@ -1,69 +1,68 @@
1#include "transfer.h" 1#include "transfer.h"
2#include "account.h" 2#include "account.h"
3#include "transactiondisplay.h" 3#include "transactiondisplay.h"
4#include <stdlib.h> 4#include <stdlib.h>
5#include <iostream.h>
6 5
7extern Account *account; 6extern Account *account;
8extern Preferences *preferences; 7extern Preferences *preferences;
9 8
10Transfer::Transfer () 9Transfer::Transfer ()
11 { 10 {
12 db = sqlite_open ( "qmtransfers.db", 0, 0 ); 11 db = sqlite_open ( "qmtransfers.db", 0, 0 );
13 } 12 }
14 13
15Transfer::~Transfer () 14Transfer::~Transfer ()
16 { 15 {
17 sqlite_close ( db ); 16 sqlite_close ( db );
18 } 17 }
19 18
20void Transfer::addTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared ) 19void Transfer::addTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared )
21 { 20 {
22 int nextrowid = -1; 21 int nextrowid = -1;
23 char **results; 22 char **results;
24 sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 ); 23 sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 );
25 if ( atoi ( results [ 1 ] ) != 0 ) 24 if ( atoi ( results [ 1 ] ) != 0 )
26 { 25 {
27 char **results; 26 char **results;
28 sqlite_get_table ( db, "select min ( rowid ) from transfers;", &results, 0, 0, 0 ); 27 sqlite_get_table ( db, "select min ( rowid ) from transfers;", &results, 0, 0, 0 );
29 nextrowid = ( atoi ( results [ 1 ] ) ) - 1; 28 nextrowid = ( atoi ( results [ 1 ] ) ) - 1;
30 } 29 }
31 sqlite_exec_printf ( db, "insert into transfers values ( %i, %i, %i, %i, %i, %i, %i, 0, 0, %.2f, %i, 0, 0, 0, 0, 0, %i );", 0, 0, 0, fromaccount, fromparent, toaccount, toparent, day, month, year, amount, cleared, nextrowid ); 30 sqlite_exec_printf ( db, "insert into transfers values ( %i, %i, %i, %i, %i, %i, %i, 0, 0, %.2f, %i, 0, 0, 0, 0, 0, %i );", 0, 0, 0, fromaccount, fromparent, toaccount, toparent, day, month, year, amount, cleared, nextrowid );
32 } 31 }
33 32
34void Transfer::updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid ) 33void Transfer::updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid )
35 { 34 {
36 sqlite_exec_printf ( db, "update transfers set fromaccount = %i, fromparent = %i, toaccount = %i, toparent = %i, day = %i, month = %i, year = %i," 35 sqlite_exec_printf ( db, "update transfers set fromaccount = %i, fromparent = %i, toaccount = %i, toparent = %i, day = %i, month = %i, year = %i,"
37 "amount = %.2f, cleared = %i where transferid = %i;", 0, 0, 0, fromaccount, fromparent, toaccount, toparent, day, month, year, amount, cleared, transferid ); 36 "amount = %.2f, cleared = %i where transferid = %i;", 0, 0, 0, fromaccount, fromparent, toaccount, toparent, day, month, year, amount, cleared, transferid );
38 } 37 }
39 38
40void Transfer::deleteTransfer ( int transferid ) 39void Transfer::deleteTransfer ( int transferid )
41 { 40 {
42 sqlite_exec_printf ( db, "delete from transfers where transferid = %i;", 0, 0, 0, transferid ); 41 sqlite_exec_printf ( db, "delete from transfers where transferid = %i;", 0, 0, 0, transferid );
43 } 42 }
44 43
45void Transfer::deleteAllTransfers ( int accountid ) 44void Transfer::deleteAllTransfers ( int accountid )
46 { 45 {
47 sqlite_exec_printf ( db, "delete from transfers where fromaccount = %i;", 0, 0, 0, accountid ); 46 sqlite_exec_printf ( db, "delete from transfers where fromaccount = %i;", 0, 0, 0, accountid );
48 sqlite_exec_printf ( db, "delete from transfers where toaccount = %i;", 0, 0, 0, accountid ); 47 sqlite_exec_printf ( db, "delete from transfers where toaccount = %i;", 0, 0, 0, accountid );
49 } 48 }
50 49
51int Transfer::getNumberOfTransfers () 50int Transfer::getNumberOfTransfers ()
52 { 51 {
53 char **results; 52 char **results;
54 sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 ); 53 sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 );
55 return atoi ( results [ 1 ] ); 54 return atoi ( results [ 1 ] );
56 } 55 }
57 56
58int Transfer::getNumberOfTransfers ( int accountid ) 57int Transfer::getNumberOfTransfers ( int accountid )
59 { 58 {
60 char **results; 59 char **results;
61 sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid ); 60 sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid );
62 int transfers = atoi ( results [ 1 ] ); 61 int transfers = atoi ( results [ 1 ] );
63 sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid ); 62 sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid );
64 transfers = transfers + atoi ( results [ 1 ] ); 63 transfers = transfers + atoi ( results [ 1 ] );
65 return transfers; 64 return transfers;
66 } 65 }
67 66
68void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ) 67void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate )
69 { 68 {