Diffstat (limited to 'noncore/apps/checkbook/traninfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index 5a770b0..460466c 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp @@ -25,16 +25,18 @@ Boston, MA 02111-1307, USA. */ #include "traninfo.h" #include <qpe/config.h> +QString tempstr; + TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, const QString &type, const QString &category, float amount, float fee, const QString &number, const QString ¬es ) { i = id; d = desc; td = date; w = withdrawal; @@ -112,25 +114,42 @@ TranInfo::TranInfo( Config config, int entry ) // Transaction number cn = config.readEntry( "CheckNumber", "" ); // Notes n = config.readEntry( "Comments", "" ); } } +const QString &TranInfo::datestr() +{ + tempstr = QString::number( td.year() ); + tempstr.append( '/' ); + int tempfield = td.month(); + if ( tempfield < 10 ) tempstr.append( '0' ); + tempstr.append( QString::number( tempfield ) ); + tempstr.append( '/' ); + tempfield = td.day(); + if ( tempfield < 10 ) tempstr.append( '0' ); + tempstr.append( QString::number( tempfield ) ); + + return( tempstr ); +} + void TranInfo::write( Config *config, int entry ) { config->setGroup( QString::number( entry ) ); config->writeEntry( "Description", d ); - QString tempstr = QString::number( td.month() ) + "/" + - QString::number( td.day() ) + "/" + - QString::number( td.year() ); + tempstr = QString::number( td.month() ); + tempstr.append( '/' ); + tempstr.append( QString::number( td.day() ) ); + tempstr.append( '/' ); + tempstr.append( QString::number( td.year() ) ); config->writeEntry( "Date", tempstr ); w ? tempstr = "true" : tempstr = "false"; config->writeEntry( "Payment", tempstr ); if ( t == "Debit Charge" || t == "Written Check" ) tempstr = "0"; |