summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/checkbook.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/checkbook/checkbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 77c1f57..ab25516 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -302,25 +302,25 @@ void Checkbook::loadCheckbook()
if ( trandesc != QString::null )
{
currBalance -= tran->fee();
amount = tran->amount();
if ( tran->withdrawal() )
{
amount *= -1;
}
currBalance += amount;
stramount.sprintf( "%c%.2f", currencySymbol, amount );
// Add to transaction list
- transactions.append( tran );
+ transactions.inSort( tran );
// Add to transaction table
( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(),
trandesc, stramount );
}
else
{
delete tran;
}
}
balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
@@ -406,25 +406,25 @@ void Checkbook::slotNewTran()
currtran->showMaximized();
if ( currtran->exec() == QDialog::Accepted )
{
float amount = traninfo->amount();
if ( traninfo->withdrawal() )
{
amount *= -1;
}
QString stramount;
stramount.sprintf( "%c%.2f", currencySymbol, amount );
// Add to transaction list
- transactions.append( traninfo );
+ transactions.inSort( traninfo );
// Add to transaction table
( void ) new QListViewItem( tranTable, QString::number( highTranNum ),
traninfo->datestr(), traninfo->desc(), stramount );
adjustBalance( amount );
}
else
{
highTranNum--;
delete traninfo;
}
@@ -553,25 +553,25 @@ void Checkbook::drawBalanceChart()
}
list->append( new DataPointInfo( label, balance ) );
}
graphInfo = new GraphInfo( GraphInfo::BarChart, list );
}
void Checkbook::drawCategoryChart( bool withdrawals )
{
DataPointList *list = new DataPointList();
TranInfo *tran = transactions.first();
- if ( tran->withdrawal() == withdrawals )
+ if ( tran && tran->withdrawal() == withdrawals )
{
list->append( new DataPointInfo( tran->category(), tran->amount() ) );
}
tran = transactions.next();
DataPointInfo *cat;
for ( ; tran; tran = transactions.next() )
{
if ( tran->withdrawal() == withdrawals )
{
// Find category in list
for ( cat = list->first(); cat; cat = list->next() )