summaryrefslogtreecommitdiff
authoralwin <alwin>2004-02-23 00:11:55 (UTC)
committer alwin <alwin>2004-02-23 00:11:55 (UTC)
commitfdf3a6d59f3725bebb923a774d04fb51fb1b0d68 (patch) (side-by-side diff)
treefffc5daec8afe5c339c3fe15988a30b7fe6aca21
parentc1cf5f3efde5a50656a196795fe297ca58ac4334 (diff)
downloadopie-fdf3a6d59f3725bebb923a774d04fb51fb1b0d68.zip
opie-fdf3a6d59f3725bebb923a774d04fb51fb1b0d68.tar.gz
opie-fdf3a6d59f3725bebb923a774d04fb51fb1b0d68.tar.bz2
remove depes to libstdc++
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,104 +1,103 @@
#include "account.h"
#include "transaction.h"
#include "transfer.h"
#include "preferences.h"
#include <qpixmap.h>
#include <stdlib.h>
-#include <iostream.h>
extern Preferences *preferences;
Account::Account ()
{
adb = sqlite_open ( "qmaccounts.db", 0, NULL );
}
Account::~Account ()
{
sqlite_close ( adb );
}
void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit,
int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency )
{
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 );
}
void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid )
{
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 );
}
void Account::deleteAccount ( int accountid )
{
sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid );
}
void Account::setAccountExpanded ( int expanded, int accountid )
{
sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid );
}
int Account::getAccountExpanded ( int id )
{
char **results;
sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id );
if ( strlen ( results [1] ) == 0 )
return 0;
else
return atoi ( results [ 1 ] );
}
int Account::getNumberOfAccounts ()
{
char **results;
sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL );
return atoi ( results [ 1 ] );
}
int Account::getNumberOfChildAccounts ( int id )
{
char **results;
sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id );
return atoi ( results [ 1 ] );
}
void Account::updateAccountBalance ( int accountid )
{
// Here, we'll get a balance for the transactions in an account
sqlite *tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
int rows, columns;
char **results;
sqlite_get_table_printf ( tdb, "select sum (amount) from transactions where accountid= %i;", &results, &rows, &columns, NULL, accountid );
float transactionsbalance = strtod ( results [ 1 ], 0 );
sqlite_close ( tdb );
// next, we'll get a balance for all the transfers from the account
sqlite *trdb = sqlite_open ( "qmtransfers.db", 0, NULL );
rows = 0;
columns = 0;
char **results2;
sqlite_get_table_printf ( trdb, "select sum (amount) from transfers where fromaccount = %i;", &results2, &rows, &columns, NULL, accountid );
float fromtransfersbalance = ( strtod ( results2 [ 1 ], 0 ) * -1 );
// finally, we'll get a balance for all the transfers into the account
rows = 0;
columns= 0;
char **results3;
sqlite_get_table_printf ( trdb, "select sum (amount) from transfers where toaccount = %i;", &results3, &rows, &columns, NULL, accountid );
float totransfersbalance = strtod ( results3 [ 1 ], 0 );
sqlite_close ( trdb );
// calculate and update new balance
sqlite_exec_printf ( adb, "update accounts2 set balance = %.2f where accountid = %i;", 0, 0, 0,
( transactionsbalance + fromtransfersbalance + totransfersbalance + getStatementBalance ( accountid ) ), accountid );
}
void Account::changeParentAccountBalance ( int parentid )
{
// select all child balances that share the parent of the current child account
char **results;
int rows;
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,100 +1,99 @@
#include "budget.h"
#include "transaction.h"
#include <stdlib.h>
-#include <iostream.h>
extern Transaction *transaction;
Budget::Budget ()
{
bdb = sqlite_open ( "qmbudgets.db", 0, NULL );
}
Budget::~Budget ()
{
sqlite_close ( bdb );
}
int Budget::addBudget ( QString name, int type, QString description, QString currency, int startday, int startmonth, int startyear, int endday, int endmonth, int endyear, int defaultview )
{
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 );
char **results;
sqlite_get_table ( bdb, "select last_insert_rowid() from budgets;", &results, NULL, NULL, NULL );
QString tablename = "table";
tablename.append ( results [ 1 ] );
sqlite_exec_printf ( bdb, "create table '%q' ( name, lineitemamount, type, lineitemid integer primary key );", 0, 0, 0, ( const char* ) tablename );
return atoi ( results [ 1 ] );
}
void Budget::updateBudget ( QString name, QString description, QString currency, int budgetid )
{
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 );
}
void Budget::deleteBudget ( int budgetid )
{
if ( getNumberOfBudgets() != 0 )
{
QString tablename = "table";
tablename.append ( QString::number ( budgetid ) );
sqlite_exec_printf ( bdb, "delete from budgets where budgetid = %i;", 0, 0, 0, budgetid );
sqlite_exec_printf ( bdb, "drop table '%q';", 0, 0, 0, ( const char* ) tablename );
}
}
int Budget::getNumberOfBudgets ()
{
char **results;
sqlite_get_table ( bdb, "select count() from budgets;", &results, NULL, NULL, NULL );
return atoi ( results [ 1 ] );
}
int Budget::getNumberOfLineItems ( int budgetid )
{
QString tablename = "table";
tablename.append ( QString::number ( budgetid ) );
char **results;
sqlite_get_table_printf ( bdb, "select count() from '%q';", &results, NULL, NULL, NULL, ( const char * ) tablename );
return atoi ( results [ 1 ] );
}
QStringList* Budget::getBudgetNames ()
{
QStringList *names = new QStringList ();
char **results;
int rows, counter;
sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL );
names->append ( "None" );
for ( counter = 0; counter < rows; counter++ )
names->append ( results [ counter+1 ] );
return names;
}
QString Budget::getBudgetName ( int budgetid )
{
char **results;
sqlite_get_table_printf ( bdb, "select name from budgets where budgetid= %i;", &results, NULL, NULL, NULL, budgetid );
return ( QString ) results [ 1 ];
}
QString Budget::getBudgetDescription ( int budgetid )
{
char **results;
sqlite_get_table_printf ( bdb, "select description from budgets where budgetid= %i;", &results, NULL, NULL, NULL, budgetid );
return ( QString ) results [ 1 ];
}
QString Budget::getCurrency ( int budgetid )
{
char **results;
sqlite_get_table_printf ( bdb, "select currency from budgets where budgetid= %i;", &results, NULL, NULL, NULL, budgetid );
return ( QString ) results [ 1 ];
}
QStringList* Budget::getBudgetIDs ()
{
QStringList *ids = new QStringList ();
char **results;
int rows, counter;
sqlite_get_table ( bdb, "select budgetid from budgets;", &results, &rows, NULL, NULL );
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,102 +1,101 @@
#include "qashmoney.h"
#include "preferencedialogs.h"
#include "memorydialog.h"
#include <qheader.h>
-#include <iostream.h>
Budget *budget = new Budget ();
Preferences *preferences = new Preferences ();
Account *account = new Account ();
Transaction *transaction = new Transaction ();
Transfer *transfer = new Transfer ();
Memory *memory = new Memory ();
QashMoney::QashMoney () : QWidget ()
{
preferences->addPreferences ();
preferences->initializeColumnPreferences ();
preferences->initializeSortingPreferences ();
// set the text in the upper part of the frame
setCaption ( tr ( "QashMoney" ) );
// Create new menubar for our mainwindow
// and add menu items
mainmenu = new QMenuBar ( this );
mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
preferencesmenu = new QPopupMenu ( this );
utilitiesmenu = new QPopupMenu ( this );
mainmenu->insertItem ( "Preferences", preferencesmenu );
mainmenu->insertItem ( "Utilities", utilitiesmenu );
preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) );
preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) );
preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) );
utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) );
// create the main tabwidget for displaying accounts and transactions
maintabs = new QTabWidget ( this );
tab = new QWidget ( this );
tab_2 = new QWidget ( this );
tab_3 = new QWidget ( this );
maintabs->addTab ( tab, "Accounts" );
maintabs->addTab ( tab_2, "Transactions" );
maintabs->addTab ( tab_3, "Budgets" );
tabheight = tab->height();
maintabs->setTabEnabled ( tab_2, FALSE );
// create a new account display object
accountdisplay = new AccountDisplay ( maintabs );
accountdisplay->setTabs ( tab_2, maintabs );
connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) );
// set the connection to disable the one touch account viewing if we are transfering money
connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) );
// create a new transactiondisplay object
transactiondisplay = new TransactionDisplay ( maintabs );
transactiondisplay->hide();
// create new budgetdisplay object
budgetdisplay = new BudgetDisplay ( maintabs );
budgetdisplay->hide();
tabslayout = new QVBoxLayout ( maintabs, 4, 2 );
tabslayout->addSpacing ( tabheight );
tabslayout->addWidget ( accountdisplay );
tabslayout->addWidget ( transactiondisplay );
tabslayout->addWidget ( budgetdisplay );
// connect a change in the maintabs with changing the tab display
connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) );
// create layout that will contain the menubar and the maintabs
layout = new QVBoxLayout ( this, 2, 2 );
layout->setMenuBar ( mainmenu );
layout->addWidget ( maintabs );
}
QashMoney::~QashMoney ()
{
delete budget;
delete preferences;
delete account;
delete transaction;
delete transfer;
delete memory;
}
void QashMoney::changeTabDisplay ()
{
// if the user pressed the transactions tab, hide the account display
// object and create a new transaction display
if ( maintabs->currentPageIndex() == 1 )
{
// initialize variables
bool children = FALSE;
// hide the account display and define accountid
int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt();
//remove all the columns from the transactiondisplay
int columns = transactiondisplay->listview->columns();
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 @@
TEMPLATE = app
CONFIG = qt warn_on release
HEADERS = qashmoney.h \
accountdisplay.h \
account.h \
transaction.h \
transactiondisplay.h \
newtransaction.h \
transfer.h \
transferdialog.h \
preferences.h \
preferencedialogs.h \
memory.h \
memorydialog.h \
newaccount.h \
calculator.h \
datepicker.h \
budget.h \
budgetdisplay.h \
currency.h
SOURCES = qashmoney.cpp \
accountdisplay.cpp \
account.cpp \
transaction.cpp \
transactiondisplay.cpp \
newtransaction.cpp \
transfer.cpp \
transferdialog.cpp \
preferences.cpp \
preferencedialogs.cpp \
memory.cpp \
memorydialog.cpp \
newaccount.cpp \
calculator.cpp \
datepicker.cpp \
main.cpp \
budget.cpp \
budgetdisplay.cpp \
currency.cpp
INCLUDEPATH = $(OPIEDIR)/include
DEPENDPATH = $(OPIEDIR)/include
DESTDIR = $(OPIEDIR)/bin
unix:LIBS += -lm
-LIBS += -lqpe -lqte -lstdc++ -lsqlite
+LIBS += -lqpe -lqte -lsqlite
include ( $(OPIEDIR)/include.pro )
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,107 +1,106 @@
// RESERVEDONE COLUMN NAME REPRESENTS THE LINEITEMID AND SHOULD BE CHANGED IN
// FUTURE VERSIONS OF QASHMONEY
// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION
#include "transaction.h"
#include "account.h"
#include "transactiondisplay.h"
#include <stdlib.h>
-#include <iostream.h>
extern Account *account;
extern Preferences *preferences;
Transaction::Transaction ()
{
tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
}
Transaction::~Transaction ()
{
sqlite_close ( tdb );
}
void 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 )
{
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, "
"0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description );
}
void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid )
{
sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f,"
"cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year,
amount, cleared, budgetid, lineitemid, transactionid );
}
void Transaction::deleteTransaction ( int transid )
{
sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid );
}
void Transaction::deleteAllTransactions ( int accountid )
{
sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid );
}
int Transaction::getAccountID ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return atol ( results [ 1 ] );
}
int Transaction::getNumberOfTransactions ()
{
char **results;
sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL );
return atoi ( results [ 1 ] );
}
int Transaction::getNumberOfTransactions ( int accountid )
{
char **results;
sqlite_get_table_printf ( tdb, "select count() from transactions where accountid = %i;", &results, NULL, NULL, NULL, accountid );
return atol ( results [ 1 ] );
}
QString Transaction::getPayee ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select payee from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return results [ 1 ];
}
QString Transaction::getTransactionDescription ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select reservedtwo from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return results [ 1 ];
}
QString Transaction::getNumber ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select number from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return results [ 1 ];
}
QString Transaction::getAmount ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select amount from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return results [ 1 ];
}
QString Transaction::getAbsoluteAmount ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select abs ( amount ) from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return results [ 1 ];
}
int Transaction::getCleared ( int id )
{
char **results;
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,111 +1,110 @@
#include "transactiondisplay.h"
#include "newtransaction.h"
#include "account.h"
#include "budget.h"
#include "memory.h"
#include "transfer.h"
#include "preferences.h"
#include "calculator.h"
#include "datepicker.h"
#include <qdatetime.h>
#include <qmessagebox.h>
#include <qheader.h>
#include <qmultilineedit.h>
-#include <iostream.h>
#include <qdatetime.h>
extern Transaction *transaction;
extern Budget *budget;
extern Account *account;
extern Preferences *preferences;
extern Memory *memory;
extern Transfer *transfer;
TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent )
{
// set transactiondisplay variables;
accountid = 0;
children = TRUE;
firstline = new QHBox ( this );
firstline->setSpacing ( 2 );
newtransaction = new QPushButton ( firstline );
newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) );
edittransaction = new QPushButton ( firstline );
edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) );
deletetransaction = new QPushButton ( firstline );
deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) );
toggletransaction = new QPushButton ( firstline );
toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") );
connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) );
viewtransactionnotes = new QPushButton ( firstline );
viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") );
connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) );
secondline = new QHBox ( this );
secondline->setSpacing ( 5 );
name = new QLabel ( secondline );
balance = new QLabel ( secondline );
QLabel *limit = new QLabel ( "Limit", secondline );
limitbox = new QLineEdit ( secondline );
limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) );
connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) );
listview = new QListView ( this );
listview->setAllColumnsShowFocus ( TRUE );
listview->setShowSortIndicator ( TRUE );
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, 2 );
layout->addWidget ( firstline );
layout->addWidget ( secondline );
layout->addWidget ( listview );
}
void TransactionDisplay::addTransaction ()
{
// create local variables
int cleared = -1;
// create new transaction window
NewTransaction *newtransaction = new NewTransaction ( this );
int width = this->size().width();
newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) );
newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) );
// enter today's date in the date box as defaul
QDate today = QDate::currentDate ();
int defaultday = today.day();
int defaultmonth = today.month();
int defaultyear = today.year();
newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
// add memory items to the transactionname combobox
memory->displayMemoryItems ( newtransaction->transactionname );
newtransaction->transactionname->insertItem ( "", 0 );
if ( newtransaction->exec () == QDialog::Accepted )
{
if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction
cleared = 1;
else
cleared = 0;
float amount = newtransaction->transactionamount->text().toFloat();
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,101 +1,100 @@
#include "transfer.h"
#include "account.h"
#include "transactiondisplay.h"
#include <stdlib.h>
-#include <iostream.h>
extern Account *account;
extern Preferences *preferences;
Transfer::Transfer ()
{
db = sqlite_open ( "qmtransfers.db", 0, 0 );
}
Transfer::~Transfer ()
{
sqlite_close ( db );
}
void Transfer::addTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared )
{
int nextrowid = -1;
char **results;
sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 );
if ( atoi ( results [ 1 ] ) != 0 )
{
char **results;
sqlite_get_table ( db, "select min ( rowid ) from transfers;", &results, 0, 0, 0 );
nextrowid = ( atoi ( results [ 1 ] ) ) - 1;
}
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 );
}
void Transfer::updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid )
{
sqlite_exec_printf ( db, "update transfers set fromaccount = %i, fromparent = %i, toaccount = %i, toparent = %i, day = %i, month = %i, year = %i,"
"amount = %.2f, cleared = %i where transferid = %i;", 0, 0, 0, fromaccount, fromparent, toaccount, toparent, day, month, year, amount, cleared, transferid );
}
void Transfer::deleteTransfer ( int transferid )
{
sqlite_exec_printf ( db, "delete from transfers where transferid = %i;", 0, 0, 0, transferid );
}
void Transfer::deleteAllTransfers ( int accountid )
{
sqlite_exec_printf ( db, "delete from transfers where fromaccount = %i;", 0, 0, 0, accountid );
sqlite_exec_printf ( db, "delete from transfers where toaccount = %i;", 0, 0, 0, accountid );
}
int Transfer::getNumberOfTransfers ()
{
char **results;
sqlite_get_table ( db, "select count() from transfers;", &results, 0, 0, 0 );
return atoi ( results [ 1 ] );
}
int Transfer::getNumberOfTransfers ( int accountid )
{
char **results;
sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid );
int transfers = atoi ( results [ 1 ] );
sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid );
transfers = transfers + atoi ( results [ 1 ] );
return transfers;
}
void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate )
{
int showcleared = preferences->getPreference ( 3 );
// select the from transfers to display
char **results;
int rows, columns;
if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE )
{
if ( showcleared == 0 )
sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where cleared = 0 and toparent = %i;", &results, &rows, &columns, 0, accountid );
else
sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where toparent = %i;", &results, &rows, &columns, 0, accountid );
}
else
{
if ( showcleared == 0 )
sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where cleared = 0 and toaccount = %i;", &results, &rows, &columns, 0, accountid );
else
sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where toaccount = %i;", &results, &rows, &columns, 0, accountid );
}
// iterate through the list and display the from items
int counter = 7;
int position = 0;
while ( counter < ( ( rows + 1 ) * columns ) )
{
// construct the date
QString daystring = results [ counter ];
int day = daystring.toInt ();
QString monthstring = results [ counter + 1 ];
int month = monthstring.toInt ();
QString yearstring = results [ counter + 2 ];
int year = yearstring.toInt ();