author | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
commit | 951d1d4125a80dc814f95d2956853bf53ca52e9a (patch) (side-by-side diff) | |
tree | 46c7a70b80a7eebb54cd59c46204c28335f3821c /noncore/apps/checkbook/traninfo.cpp | |
parent | f0a15a9866f9eddfe10596e63a1e6300b92b9e3f (diff) | |
download | opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.zip opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.gz opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.bz2 |
merge noncore/apps/* except
- advancedfm (ljp, please...)
- odict (tille, please...)
Diffstat (limited to 'noncore/apps/checkbook/traninfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index 65c190c..d880bb4 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp @@ -36,3 +36,3 @@ TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdra const QString &type, const QString &category, float amount, - float fee, const QString &number, const QString ¬es ) + float fee, const QString &number, const QString ¬es, int next ) { @@ -48,2 +48,3 @@ TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdra n = notes; + _next=next; } @@ -113,3 +114,3 @@ TranInfo::TranInfo( Config config, int entry ) - // Transaction number + // Transaction number cn = config.readEntry( "CheckNumber", "" ); @@ -118,2 +119,5 @@ TranInfo::TranInfo( Config config, int entry ) n = config.readEntry( "Comments", "" ); + + // next + _next = config.readNumEntry("Next", -1); } @@ -121,20 +125,22 @@ TranInfo::TranInfo( Config config, int entry ) +// --- datestr ---------------------------------------------------------------- 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 ) ); + int y=td.year(); + y= y>=2000 && y<=2099 ? y-2000 : y; + tempstr.sprintf( "%02d/%02d/%02d", y ,td.month(), td.day() ); + return( tempstr ); +} - return( tempstr ); +// --- getIdStr --------------------------------------------------------------- +const QString &TranInfo::getIdStr() +{ + tempstr.sprintf("%04d", i); + return( tempstr ); } -void TranInfo::write( Config *config, int entry ) +// --- write ------------------------------------------------------------------ +void TranInfo::write( Config *config ) { - config->setGroup( QString::number( entry ) ); + config->setGroup( QString::number( id() ) ); @@ -171,7 +177,8 @@ void TranInfo::write( Config *config, int entry ) - config->writeEntry( "CheckNumber", cn ); - + config->writeEntry( "CheckNumber", cn ); config->writeEntry( "Comments", n ); + config->writeEntry( "Next", _next ); } + int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) @@ -190 +197,16 @@ int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 } + +// --- toString --------------------------------------------------------------- +QString TranInfo::toString() +{ + QString ret; + ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f", + id(), + (const char *)datestr(), + (const char *)number(), + (const char *)desc(), + (withdrawal() ? -1 : 1) * amount(), + fee() + ); + return(ret); +} |