summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transactiondisplay.cpp
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (side-by-side diff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/qashmoney/transactiondisplay.cpp
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/apps/qashmoney/transactiondisplay.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp
index 474f11e..0b94d62 100755
--- a/noncore/apps/qashmoney/transactiondisplay.cpp
+++ b/noncore/apps/qashmoney/transactiondisplay.cpp
@@ -1,114 +1,114 @@
#include "transactiondisplay.h"
#include "newtransaction.h"
#include "account.h"
#include "budget.h"
#include "memory.h"
#include "transfer.h"
#include "calculator.h"
#include "datepicker.h"
#include <qmessagebox.h>
#include <qheader.h>
#include <qmultilineedit.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 () ) );
+ 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 () ) );
+ 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 () ) );
+ 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 () ) );
+ 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 () ) );
+ 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 & ) ) );
+ 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 ) ) );
+ 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();
if ( newtransaction->depositbox->isChecked() == FALSE )
amount = amount * -1;
// add the transaction name to the memory items
memory->addMemoryItem ( newtransaction->transactionname->currentText() );
// add the transaction
@@ -168,97 +168,97 @@ void TransactionDisplay::showCalendar ()
{
year = dp->getYear();
month = dp->getMonth();
day = dp->getDay();
date->setText ( preferences->getDate ( year, month, day ) );
}
}
void TransactionDisplay::editTransfer ()
{
transferid = listview->currentItem()->text ( getIDColumn() ).toInt();
fromaccount = transfer->getFromAccountID ( transferid );
toaccount = transfer->getToAccountID ( transferid );
year = transfer->getYear ( transferid );
month = transfer->getMonth ( transferid );
day = transfer->getDay ( transferid );
QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE );
editransfer->setCaption ( "Transfer" );
QStringList accountnames = account->getAccountNames();
QStringList accountids = account->getAccountIDs();
QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer );
QFont f = this->font();
f.setWeight ( QFont::Bold );
fromaccountlabel->setFont ( f );
QComboBox *fromaccountbox = new QComboBox ( editransfer );
fromaccountbox->insertStringList ( accountnames );
fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) );
QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer );
toaccountlabel->setFont ( f );
QComboBox *toaccountbox = new QComboBox ( editransfer );
toaccountbox->insertStringList ( accountnames );
toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) );
QLabel *datelabel = new QLabel ( "Date", editransfer );
QHBox *datebox = new QHBox ( editransfer );
datebox->setSpacing ( 2 );
date = new QLineEdit ( datebox );
date->setAlignment ( Qt::AlignRight );
date->setDisabled ( TRUE );
date->setText ( preferences->getDate ( year, month, day ) );
QPushButton *datebutton = new QPushButton ( datebox );
datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
- connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) );
+ connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
QLabel *amounttlabel = new QLabel ( "Amount", editransfer );
QHBox *amountbox = new QHBox ( editransfer );
amountbox->setSpacing ( 2 );
amount = new QLineEdit ( amountbox );
amount->setAlignment ( Qt::AlignRight );
amount->setText ( transfer->getAmount ( transferid ) );
QPushButton *calculatorbutton = new QPushButton( amountbox );
calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer );
QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 );
layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
layout->addWidget ( fromaccountbox, Qt::AlignLeft );
layout->addWidget ( toaccountlabel, Qt::AlignLeft );
layout->addWidget ( toaccountbox, Qt::AlignLeft );
layout->addSpacing ( 5 );
layout->addWidget ( datelabel, Qt::AlignLeft );
layout->addWidget ( datebox, Qt::AlignLeft );
layout->addWidget ( amounttlabel, Qt::AlignLeft );
layout->addWidget ( amountbox, Qt::AlignLeft );
layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
if ( editransfer->exec() == QDialog::Accepted )
{
//get fromaccount
fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt();
//get to account
toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt();
//set cleared flag
int cleared = 0;
if ( clearedcheckbox->isChecked() == TRUE )
cleared = 1;
//update transfer
transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ),
day, month, year, amount->text().toFloat(), cleared, transferid );
account->updateAccountBalance ( fromaccount );
if ( account->getParentAccountID ( fromaccount ) != -1 )
account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) );
updateAndDisplay ( toaccount );