author | zecke <zecke> | 2004-10-26 21:28:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-26 21:28:59 (UTC) |
commit | ae5855babec6e46802be89ee408d26a2cbbb1981 (patch) (side-by-side diff) | |
tree | 6aab434ceb2831741b997b93f053e1843c3d59ec | |
parent | c95aeb8fd283fe9d2f220209e696726120857257 (diff) | |
download | opie-ae5855babec6e46802be89ee408d26a2cbbb1981.zip opie-ae5855babec6e46802be89ee408d26a2cbbb1981.tar.gz opie-ae5855babec6e46802be89ee408d26a2cbbb1981.tar.bz2 |
-Remove usage of latin1() as a possible fix to #1471
-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 @@ -333,16 +333,18 @@ void Checkbook::loadCheckbook() // Load transactions float amount; QString stramount; + QString symbol = _pCfg->getCurrencySymbol(); for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) { amount = tran->amount(); if ( tran->withdrawal() ) { 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 ); } // set sort order @@ -369,13 +371,16 @@ void Checkbook::loadCheckbook() 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); } } @@ -481,18 +486,20 @@ void Checkbook::slotNewTran() Transaction *currtran = new Transaction( this, true, info->name(), traninfo, _pCfg ); + QString symbol = _pCfg->getCurrencySymbol(); if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) { // Add to transaction list info->addTransaction( traninfo ); // Add to transaction table 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(), stramount ); resort(); @@ -540,9 +547,10 @@ void Checkbook::slotEditTran() { amount *= -1; } QString stramount; - stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); + stramount.sprintf( "%.2f", amount ); + stramount.prepend( _pCfg->getCurrencySymbol() ); curritem->setText( COL_AMOUNT, stramount ); resort(); adjustBalance(); 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 @@ -192,9 +192,10 @@ void MainWindow::addCheckbook( CBInfo *cb ) lvi->setText( posName, cb->name() ); if ( _cfg.getShowBalances() ) { 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 ); } } @@ -303,9 +304,10 @@ void MainWindow::openBook(QListViewItem *curritem) // Update balance if changed if ( _cfg.getShowBalances() && cb->balance() != currbalance ) { 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 ); } // write config, if needed |