-rw-r--r-- | noncore/apps/checkbook/cbinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.h | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/noncore/apps/checkbook/cbinfo.cpp b/noncore/apps/checkbook/cbinfo.cpp index 36dde04..6e3afa7 100644 --- a/noncore/apps/checkbook/cbinfo.cpp +++ b/noncore/apps/checkbook/cbinfo.cpp | |||
@@ -165,33 +165,33 @@ void CBInfo::removeTransaction( TranInfo *tran ) | |||
165 | void CBInfo::loadTransactions() | 165 | void CBInfo::loadTransactions() |
166 | { | 166 | { |
167 | TranInfo *tran; | 167 | TranInfo *tran; |
168 | QString trandesc = ""; | 168 | QString trandesc = ""; |
169 | 169 | ||
170 | tl = new TranInfoList(); | 170 | tl = new TranInfoList(); |
171 | 171 | ||
172 | Config config( fn, Config::File ); | 172 | Config config( fn, Config::File ); |
173 | int i=_first; | 173 | int i=_first; |
174 | bool bOld=false; | 174 | bool bOld=false; |
175 | if( i==-1 ) { | 175 | if( i==-1 ) { |
176 | i=1; | 176 | i=1; |
177 | bOld=true; | 177 | bOld=true; |
178 | } | 178 | } |
179 | while( i>=0 ) { | 179 | while( i>=0 ) { |
180 | _last=i; | 180 | _last=i; |
181 | tran=new TranInfo(config, i); | 181 | tran=new TranInfo(&config, i); |
182 | trandesc = tran->desc(); | 182 | trandesc = tran->desc(); |
183 | if( trandesc==QString::null ) { | 183 | if( trandesc==QString::null ) { |
184 | delete tran; | 184 | delete tran; |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | tl->append(tran); | 187 | tl->append(tran); |
188 | i= bOld ? i+1 : tran->getNext(); | 188 | i= bOld ? i+1 : tran->getNext(); |
189 | } | 189 | } |
190 | 190 | ||
191 | calcBalance(); | 191 | calcBalance(); |
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | // --- calcBalance ------------------------------------------------------------ | 195 | // --- calcBalance ------------------------------------------------------------ |
196 | void CBInfo::calcBalance() | 196 | void CBInfo::calcBalance() |
197 | { | 197 | { |
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index 4833af9..7bd2004 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp | |||
@@ -37,103 +37,103 @@ TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdra | |||
37 | const QString &type, const QString &category, float amount, | 37 | const QString &type, const QString &category, float amount, |
38 | float fee, const QString &number, const QString ¬es, int next ) | 38 | float fee, const QString &number, const QString ¬es, int next ) |
39 | { | 39 | { |
40 | i = id; | 40 | i = id; |
41 | d = desc; | 41 | d = desc; |
42 | td = date; | 42 | td = date; |
43 | w = withdrawal; | 43 | w = withdrawal; |
44 | t = type; | 44 | t = type; |
45 | c = category; | 45 | c = category; |
46 | a = amount; | 46 | a = amount; |
47 | f = fee; | 47 | f = fee; |
48 | cn = number; | 48 | cn = number; |
49 | n = notes; | 49 | n = notes; |
50 | _next=next; | 50 | _next=next; |
51 | } | 51 | } |
52 | 52 | ||
53 | TranInfo::TranInfo( Config config, int entry ) | 53 | TranInfo::TranInfo( Config *config, int entry ) |
54 | { | 54 | { |
55 | config.setGroup( QString::number( entry ) ); | 55 | config->setGroup( QString::number( entry ) ); |
56 | QString desc = config.readEntry( "Description", "Not Found" ); | 56 | QString desc = config->readEntry( "Description", "Not Found" ); |
57 | if ( desc != "Not Found" ) | 57 | if ( desc != "Not Found" ) |
58 | { | 58 | { |
59 | // ID | 59 | // ID |
60 | i = entry; | 60 | i = entry; |
61 | 61 | ||
62 | // Description | 62 | // Description |
63 | d = desc; | 63 | d = desc; |
64 | 64 | ||
65 | // Transaction date | 65 | // Transaction date |
66 | int yr, mn, dy; | 66 | int yr, mn, dy; |
67 | QString datestr = config.readEntry( "Date", "" ); | 67 | QString datestr = config->readEntry( "Date", "" ); |
68 | int begin, end; | 68 | int begin, end; |
69 | begin = datestr.find( '/' ); | 69 | begin = datestr.find( '/' ); |
70 | mn = datestr.left( begin ).toInt(); | 70 | mn = datestr.left( begin ).toInt(); |
71 | end = datestr.find( '/', ++begin ); | 71 | end = datestr.find( '/', ++begin ); |
72 | dy = datestr.mid( begin, end - begin ).toInt(); | 72 | dy = datestr.mid( begin, end - begin ).toInt(); |
73 | yr = datestr.right( datestr.length() - end - 1).toInt(); | 73 | yr = datestr.right( datestr.length() - end - 1).toInt(); |
74 | td.setYMD( yr, mn, dy ); | 74 | td.setYMD( yr, mn, dy ); |
75 | 75 | ||
76 | // Deposit/withdrawal indicator ( withdrawal == TRUE ) | 76 | // Deposit/withdrawal indicator ( withdrawal == TRUE ) |
77 | w = ( config.readEntry( "Payment", "false" ) == "true" ); | 77 | w = ( config->readEntry( "Payment", "false" ) == "true" ); |
78 | 78 | ||
79 | // Type | 79 | // Type |
80 | QString type = config.readEntry( "Type", "0" ); | 80 | QString type = config->readEntry( "Type", "0" ); |
81 | if ( w ) | 81 | if ( w ) |
82 | { // Withdrawal types | 82 | { // Withdrawal types |
83 | if( type == "0" ) | 83 | if( type == "0" ) |
84 | t = "Debit Charge"; | 84 | t = "Debit Charge"; |
85 | else if( type == "1" ) | 85 | else if( type == "1" ) |
86 | t = "Written Check"; | 86 | t = "Written Check"; |
87 | else if( type == "2" ) | 87 | else if( type == "2" ) |
88 | t = "Transfer"; | 88 | t = "Transfer"; |
89 | else if( type == "3" ) | 89 | else if( type == "3" ) |
90 | t = "Credit Card"; | 90 | t = "Credit Card"; |
91 | } | 91 | } |
92 | else | 92 | else |
93 | { | 93 | { |
94 | if( type == "0" ) | 94 | if( type == "0" ) |
95 | t = "Written Check"; | 95 | t = "Written Check"; |
96 | else if( type == "1" ) | 96 | else if( type == "1" ) |
97 | t = "Automatic Payment"; | 97 | t = "Automatic Payment"; |
98 | else if( type == "2" ) | 98 | else if( type == "2" ) |
99 | t = "Transfer"; | 99 | t = "Transfer"; |
100 | else if( type == "3" ) | 100 | else if( type == "3" ) |
101 | t = "Cash"; | 101 | t = "Cash"; |
102 | } | 102 | } |
103 | 103 | ||
104 | // Category | 104 | // Category |
105 | c = config.readEntry( "Category", "" ); | 105 | c = config->readEntry( "Category", "" ); |
106 | 106 | ||
107 | // Transaction amount | 107 | // Transaction amount |
108 | QString stramount = config.readEntry( "Amount", "0.00" ); | 108 | QString stramount = config->readEntry( "Amount", "0.00" ); |
109 | bool ok; | 109 | bool ok; |
110 | a = stramount.toFloat( &ok ); | 110 | a = stramount.toFloat( &ok ); |
111 | 111 | ||
112 | // Transaction fee | 112 | // Transaction fee |
113 | stramount = config.readEntry( "TransactionFee", "0.00" ); | 113 | stramount = config->readEntry( "TransactionFee", "0.00" ); |
114 | f = stramount.toFloat( &ok ); | 114 | f = stramount.toFloat( &ok ); |
115 | 115 | ||
116 | // Transaction number | 116 | // Transaction number |
117 | cn = config.readEntry( "CheckNumber", "" ); | 117 | cn = config->readEntry( "CheckNumber", "" ); |
118 | 118 | ||
119 | // Notes | 119 | // Notes |
120 | n = config.readEntry( "Comments", "" ); | 120 | n = config->readEntry( "Comments", "" ); |
121 | 121 | ||
122 | // next | 122 | // next |
123 | _next = config.readNumEntry("Next", -1); | 123 | _next = config->readNumEntry("Next", -1); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | // --- datestr ---------------------------------------------------------------- | 127 | // --- datestr ---------------------------------------------------------------- |
128 | const QString &TranInfo::datestr(bool bDisplayDate) | 128 | const QString &TranInfo::datestr(bool bDisplayDate) |
129 | { | 129 | { |
130 | if( bDisplayDate ) { | 130 | if( bDisplayDate ) { |
131 | tempstr=TimeString::numberDateString( td ); | 131 | tempstr=TimeString::numberDateString( td ); |
132 | } else { | 132 | } else { |
133 | tempstr.sprintf( "%04d-%02d-%02d", td.year() ,td.month(), td.day() ); | 133 | tempstr.sprintf( "%04d-%02d-%02d", td.year() ,td.month(), td.day() ); |
134 | } | 134 | } |
135 | return(tempstr); | 135 | return(tempstr); |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | // --- getIdStr --------------------------------------------------------------- | 139 | // --- getIdStr --------------------------------------------------------------- |
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h index cbe0238..2ecb60d 100644 --- a/noncore/apps/checkbook/traninfo.h +++ b/noncore/apps/checkbook/traninfo.h | |||
@@ -28,33 +28,33 @@ | |||
28 | 28 | ||
29 | #ifndef TRANINFO_H | 29 | #ifndef TRANINFO_H |
30 | #define TRANINFO_H | 30 | #define TRANINFO_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qlist.h> | 33 | #include <qlist.h> |
34 | 34 | ||
35 | class Config; | 35 | class Config; |
36 | 36 | ||
37 | class TranInfo | 37 | class TranInfo |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), | 40 | TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), |
41 | bool = TRUE, const QString & = 0x0, const QString & = 0x0, | 41 | bool = TRUE, const QString & = 0x0, const QString & = 0x0, |
42 | float = 0.0, float = 0.0, | 42 | float = 0.0, float = 0.0, |
43 | const QString & = 0x0, const QString & = 0x0, int =-1 ); | 43 | const QString & = 0x0, const QString & = 0x0, int =-1 ); |
44 | TranInfo( Config, int ); | 44 | TranInfo( Config *, int ); |
45 | 45 | ||
46 | // getters | 46 | // getters |
47 | int id() const { return i; } | 47 | int id() const { return i; } |
48 | const QString &getIdStr(); | 48 | const QString &getIdStr(); |
49 | 49 | ||
50 | const QString &desc() const { return d; } | 50 | const QString &desc() const { return d; } |
51 | const QDate &date() const { return td; } | 51 | const QDate &date() const { return td; } |
52 | const QString &datestr(bool = false); | 52 | const QString &datestr(bool = false); |
53 | bool withdrawal()const { return w; } | 53 | bool withdrawal()const { return w; } |
54 | const QString &type() const { return t; } | 54 | const QString &type() const { return t; } |
55 | const QString &category()const { return c; } | 55 | const QString &category()const { return c; } |
56 | float amount() const { return a; } | 56 | float amount() const { return a; } |
57 | float fee() const { return f; } | 57 | float fee() const { return f; } |
58 | const QString &number()const { return cn; } | 58 | const QString &number()const { return cn; } |
59 | const QString ¬es() const { return n; } | 59 | const QString ¬es() const { return n; } |
60 | int getNext() { return(_next); } | 60 | int getNext() { return(_next); } |