-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 6 |
2 files changed, 17 insertions, 7 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 706d970..44d3764 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -335,4 +335,5 @@ void Checkbook::loadCheckbook() float amount; QString stramount; + QString symbol = _pCfg->getCurrencySymbol(); for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) { @@ -342,5 +343,6 @@ void Checkbook::loadCheckbook() amount *= -1; } - stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); + stramount.sprintf( "%.2f", amount ); + stramount.prepend( symbol ); ( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->datestr(false), tran->number(), tran->datestr(true), tran->desc(), stramount ); } @@ -371,9 +373,12 @@ void Checkbook::adjustBalance() // update running balance in register QString sRunning; + QString symbol = _pCfg->getCurrencySymbol(); float bal=info->startingBalance(); + for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) { TranInfo *tran=item->getTranInfo(); bal=bal + (tran->withdrawal() ? -1 : 1)*tran->amount() - tran->fee(); - sRunning.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), bal ); + sRunning.sprintf( "%.2f", bal ); + sRunning.prepend(symbol); item->setText( COL_BAL, sRunning); } @@ -483,4 +488,5 @@ void Checkbook::slotNewTran() traninfo, _pCfg ); + QString symbol = _pCfg->getCurrencySymbol(); if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) { @@ -491,6 +497,7 @@ void Checkbook::slotNewTran() float amount; QString stramount; - amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); - stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); + amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); + stramount.sprintf( "%.2f", amount ); + stramount.prepend(symbol); ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false), traninfo->number(), traninfo->datestr(true), traninfo->desc(), @@ -542,5 +549,6 @@ void Checkbook::slotEditTran() } QString stramount; - stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); + stramount.sprintf( "%.2f", amount ); + stramount.prepend( _pCfg->getCurrencySymbol() ); curritem->setText( COL_AMOUNT, stramount ); resort(); diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index ce15e3e..c7ffa7c 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -194,5 +194,6 @@ void MainWindow::addCheckbook( CBInfo *cb ) { QString balance; - balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); + balance.sprintf( "%.2f", cb->balance() ); + balance.prepend( _cfg.getCurrencySymbol() ); lvi->setText( posName + 1, balance ); } @@ -305,5 +306,6 @@ void MainWindow::openBook(QListViewItem *curritem) { QString tempstr; - tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); + tempstr.sprintf( "%.2f", cb->balance() ); + tempstr.prepend( _cfg.getCurrencySymbol() ); curritem->setText( posName + 1, tempstr ); } |