author | mickeyl <mickeyl> | 2003-10-30 13:18:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-30 13:18:08 (UTC) |
commit | 37414f207b147af4cf6778b323a0aa23127901bd (patch) (side-by-side diff) | |
tree | b08c10043ab689b0a40425d268cd72226799b0cf /noncore/apps/checkbook/traninfo.cpp | |
parent | d53637f46cf217fc760d7aac58b4596843a73803 (diff) | |
download | opie-37414f207b147af4cf6778b323a0aa23127901bd.zip opie-37414f207b147af4cf6778b323a0aa23127901bd.tar.gz opie-37414f207b147af4cf6778b323a0aa23127901bd.tar.bz2 |
apply patch to HEAD
Diffstat (limited to 'noncore/apps/checkbook/traninfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index d880bb4..506f567 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp @@ -20,24 +20,25 @@ : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "traninfo.h" #include <qpe/config.h> +#include <qpe/timestring.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, int next ) { i = id; d = desc; td = date; w = withdrawal; t = type; @@ -115,32 +116,35 @@ TranInfo::TranInfo( Config config, int entry ) // Transaction number cn = config.readEntry( "CheckNumber", "" ); // Notes n = config.readEntry( "Comments", "" ); // next _next = config.readNumEntry("Next", -1); } } // --- datestr ---------------------------------------------------------------- -const QString &TranInfo::datestr() +const QString &TranInfo::datestr(bool bDisplayDate) { - int y=td.year(); - y= y>=2000 && y<=2099 ? y-2000 : y; - tempstr.sprintf( "%02d/%02d/%02d", y ,td.month(), td.day() ); + if( bDisplayDate ) { + tempstr=TimeString::numberDateString( td ); + } else { + tempstr.sprintf( "%04d-%02d-%02d", td.year() ,td.month(), td.day() ); + } return( tempstr ); } + // --- getIdStr --------------------------------------------------------------- const QString &TranInfo::getIdStr() { tempstr.sprintf("%04d", i); return( tempstr ); } // --- write ------------------------------------------------------------------ void TranInfo::write( Config *config ) { config->setGroup( QString::number( id() ) ); @@ -201,12 +205,23 @@ 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); } + + +// --- findMostRecentByDesc --------------------------------------------------- +TranInfo *TranInfoList::findMostRecentByDesc( const QString &desc ) +{ + for(TranInfo *cur=last(); cur; cur=prev()) { + if( cur->desc()==desc ) + return( cur ); + } + return(NULL); +}
\ No newline at end of file |