-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 07d5ae1..c94b989 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp | |||
@@ -111,164 +111,164 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in | |||
111 | 111 | ||
112 | // Description | 112 | // Description |
113 | label = new QLabel( tr( "Description:" ), container ); | 113 | label = new QLabel( tr( "Description:" ), container ); |
114 | QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); | 114 | QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); |
115 | layout->addWidget( label, 2, 0 ); | 115 | layout->addWidget( label, 2, 0 ); |
116 | descEdit = new QLineEdit( container ); | 116 | descEdit = new QLineEdit( container ); |
117 | QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) ); | 117 | QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) ); |
118 | layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); | 118 | layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); |
119 | 119 | ||
120 | // Category | 120 | // Category |
121 | label = new QLabel( tr( "Category:" ), container ); | 121 | label = new QLabel( tr( "Category:" ), container ); |
122 | QWhatsThis::add( label, tr( "Select transaction category here." ) ); | 122 | QWhatsThis::add( label, tr( "Select transaction category here." ) ); |
123 | layout->addWidget( label, 3, 0 ); | 123 | layout->addWidget( label, 3, 0 ); |
124 | catList = new QComboBox( container ); | 124 | catList = new QComboBox( container ); |
125 | QWhatsThis::add( catList, tr( "Select transaction category here." ) ); | 125 | QWhatsThis::add( catList, tr( "Select transaction category here." ) ); |
126 | layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); | 126 | layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); |
127 | 127 | ||
128 | // Type | 128 | // Type |
129 | label = new QLabel( tr( "Type:" ), container ); | 129 | label = new QLabel( tr( "Type:" ), container ); |
130 | QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); | 130 | QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); |
131 | layout->addWidget( label, 4, 0 ); | 131 | layout->addWidget( label, 4, 0 ); |
132 | typeList = new QComboBox( container ); | 132 | typeList = new QComboBox( container ); |
133 | QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); | 133 | QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); |
134 | layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); | 134 | layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); |
135 | 135 | ||
136 | // Amount | 136 | // Amount |
137 | label = new QLabel( tr( "Amount:" ), container ); | 137 | label = new QLabel( tr( "Amount:" ), container ); |
138 | QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); | 138 | QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); |
139 | layout->addWidget( label, 5, 0 ); | 139 | layout->addWidget( label, 5, 0 ); |
140 | amtEdit = new QLineEdit( container ); | 140 | amtEdit = new QLineEdit( container ); |
141 | QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); | 141 | QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); |
142 | layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); | 142 | layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); |
143 | 143 | ||
144 | // Fee | 144 | // Fee |
145 | label = new QLabel( tr( "Fee:" ), container ); | 145 | label = new QLabel( tr( "Fee:" ), container ); |
146 | QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); | 146 | QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); |
147 | layout->addWidget( label, 6, 0 ); | 147 | layout->addWidget( label, 6, 0 ); |
148 | feeEdit = new QLineEdit( container ); | 148 | feeEdit = new QLineEdit( container ); |
149 | QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); | 149 | QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); |
150 | layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); | 150 | layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); |
151 | 151 | ||
152 | // Notes | 152 | // Notes |
153 | label = new QLabel( tr( "Notes:" ), container ); | 153 | label = new QLabel( tr( "Notes:" ), container ); |
154 | QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); | 154 | QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); |
155 | layout->addWidget( label, 7, 0 ); | 155 | layout->addWidget( label, 7, 0 ); |
156 | noteEdit = new QMultiLineEdit( container ); | 156 | noteEdit = new QMultiLineEdit( container ); |
157 | QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); | 157 | QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); |
158 | layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); | 158 | layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); |
159 | 159 | ||
160 | // Populate current values if provided | 160 | // Populate current values if provided |
161 | if ( info ) | 161 | if ( info ) |
162 | { | 162 | { |
163 | if ( info->withdrawal() ) | 163 | if ( info->withdrawal() ) |
164 | { | 164 | { |
165 | withBtn->setChecked( TRUE ); | 165 | withBtn->setChecked( TRUE ); |
166 | slotWithdrawalClicked(); | 166 | slotWithdrawalClicked(); |
167 | } | 167 | } |
168 | else | 168 | else |
169 | { | 169 | { |
170 | depBtn->setChecked( TRUE ); | 170 | depBtn->setChecked( TRUE ); |
171 | slotDepositClicked(); | 171 | slotDepositClicked(); |
172 | } | 172 | } |
173 | QDate dt = info->date(); | 173 | QDate dt = info->date(); |
174 | slotDateChanged( dt.year(), dt.month(), dt.day() ); | 174 | slotDateChanged( dt.year(), dt.month(), dt.day() ); |
175 | datePicker->setDate( dt ); | 175 | datePicker->setDate( dt ); |
176 | numEdit->setText( info->number() ); | 176 | numEdit->setText( info->number() ); |
177 | descEdit->setText( info->desc() ); | 177 | descEdit->setText( info->desc() ); |
178 | QString temptext = info->category(); | 178 | QString temptext = info->category(); |
179 | int i = catList->count(); | 179 | int i = catList->count(); |
180 | while ( i > 0 ) | 180 | while ( i > 0 ) |
181 | { | 181 | { |
182 | i--; | 182 | i--; |
183 | catList->setCurrentItem( i ); | 183 | catList->setCurrentItem( i ); |
184 | if ( catList->currentText() == temptext ) | 184 | if ( catList->currentText() == temptext ) |
185 | { | 185 | { |
186 | break; | 186 | break; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | temptext = info->type(); | 189 | temptext = info->type(); |
190 | i = typeList->count(); | 190 | i = typeList->count(); |
191 | while ( i > 0 ) | 191 | while ( i > 0 ) |
192 | { | 192 | { |
193 | i--; | 193 | i--; |
194 | typeList->setCurrentItem( i ); | 194 | typeList->setCurrentItem( i ); |
195 | if ( typeList->currentText() == temptext ) | 195 | if ( typeList->currentText() == temptext ) |
196 | { | 196 | { |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); | 200 | amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); |
201 | feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); | 201 | feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); |
202 | noteEdit->setText( info->notes() ); | 202 | noteEdit->setText( info->notes() ); |
203 | } | 203 | } |
204 | else | 204 | else |
205 | { | 205 | { |
206 | withBtn->setChecked( TRUE ); | 206 | withBtn->setChecked( TRUE ); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | Transaction::~Transaction() | 210 | Transaction::~Transaction() |
211 | { | 211 | { |
212 | } | 212 | } |
213 | 213 | ||
214 | void Transaction::accept() | 214 | void Transaction::accept() |
215 | { | 215 | { |
216 | tran->setDesc( descEdit->text() ); | 216 | tran->setDesc( descEdit->text() ); |
217 | tran->setDate( datePicker->selectedDate() ); | 217 | tran->setDate( datePicker->selectedDate() ); |
218 | tran->setWithdrawal( withBtn->isChecked() ); | 218 | tran->setWithdrawal( withBtn->isChecked() ); |
219 | tran->setType( typeList->currentText() ); | 219 | tran->setType( typeList->currentText() ); |
220 | tran->setCategory( catList->currentText() ); | 220 | tran->setCategory( catList->currentText() ); |
221 | bool ok; | 221 | bool ok; |
222 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); | 222 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); |
223 | tran->setFee( feeEdit->text().toFloat( &ok ) ); | 223 | tran->setFee( feeEdit->text().toFloat( &ok ) ); |
224 | tran->setNumber( numEdit->text() ); | 224 | tran->setNumber( numEdit->text() ); |
225 | tran->setNotes( noteEdit->text() ); | 225 | tran->setNotes( noteEdit->text() ); |
226 | 226 | ||
227 | QDialog::accept(); | 227 | QDialog::accept(); |
228 | } | 228 | } |
229 | 229 | ||
230 | void Transaction::slotWithdrawalClicked() | 230 | void Transaction::slotWithdrawalClicked() |
231 | { | 231 | { |
232 | catList->clear(); | 232 | catList->clear(); |
233 | catList->insertItem( tr( "Automobile" ) ); | 233 | catList->insertItem( tr( "Automobile" ) ); |
234 | catList->insertItem( tr( "Bills" ) ); | 234 | catList->insertItem( tr( "Bills" ) ); |
235 | catList->insertItem( tr( "CDs" ) ); | 235 | catList->insertItem( tr( "CDs" ) ); |
236 | catList->insertItem( tr( "Clothing" ) ); | 236 | catList->insertItem( tr( "Clothing" ) ); |
237 | catList->insertItem( tr( "Computer" ) ); | 237 | catList->insertItem( tr( "Computer" ) ); |
238 | catList->insertItem( tr( "DVDs" ) ); | 238 | catList->insertItem( tr( "DVDs" ) ); |
239 | catList->insertItem( tr( "Eletronics" ) ); | 239 | catList->insertItem( tr( "Electronics" ) ); |
240 | catList->insertItem( tr( "Entertainment" ) ); | 240 | catList->insertItem( tr( "Entertainment" ) ); |
241 | catList->insertItem( tr( "Food" ) ); | 241 | catList->insertItem( tr( "Food" ) ); |
242 | catList->insertItem( tr( "Gasoline" ) ); | 242 | catList->insertItem( tr( "Gasoline" ) ); |
243 | catList->insertItem( tr( "Misc" ) ); | 243 | catList->insertItem( tr( "Misc" ) ); |
244 | catList->insertItem( tr( "Movies" ) ); | 244 | catList->insertItem( tr( "Movies" ) ); |
245 | catList->insertItem( tr( "Rent" ) ); | 245 | catList->insertItem( tr( "Rent" ) ); |
246 | catList->insertItem( tr( "Travel" ) ); | 246 | catList->insertItem( tr( "Travel" ) ); |
247 | catList->setCurrentItem( 0 ); | 247 | catList->setCurrentItem( 0 ); |
248 | typeList->clear(); | 248 | typeList->clear(); |
249 | typeList->insertItem( tr( "Debit Charge" ) ); | 249 | typeList->insertItem( tr( "Debit Charge" ) ); |
250 | typeList->insertItem( tr( "Written Check" ) ); | 250 | typeList->insertItem( tr( "Written Check" ) ); |
251 | typeList->insertItem( tr( "Transfer" ) ); | 251 | typeList->insertItem( tr( "Transfer" ) ); |
252 | typeList->insertItem( tr( "Credit Card" ) ); | 252 | typeList->insertItem( tr( "Credit Card" ) ); |
253 | } | 253 | } |
254 | 254 | ||
255 | void Transaction::slotDepositClicked() | 255 | void Transaction::slotDepositClicked() |
256 | { | 256 | { |
257 | catList->clear(); | 257 | catList->clear(); |
258 | catList->insertItem( tr( "Work" ) ); | 258 | catList->insertItem( tr( "Work" ) ); |
259 | catList->insertItem( tr( "Family Member" ) ); | 259 | catList->insertItem( tr( "Family Member" ) ); |
260 | catList->insertItem( tr( "Misc. Credit" ) ); | 260 | catList->insertItem( tr( "Misc. Credit" ) ); |
261 | catList->setCurrentItem( 0 ); | 261 | catList->setCurrentItem( 0 ); |
262 | typeList->clear(); | 262 | typeList->clear(); |
263 | typeList->insertItem( tr( "Written Check" ) ); | 263 | typeList->insertItem( tr( "Written Check" ) ); |
264 | typeList->insertItem( tr( "Automatic Payment" ) ); | 264 | typeList->insertItem( tr( "Automatic Payment" ) ); |
265 | typeList->insertItem( tr( "Transfer" ) ); | 265 | typeList->insertItem( tr( "Transfer" ) ); |
266 | typeList->insertItem( tr( "Cash" ) ); | 266 | typeList->insertItem( tr( "Cash" ) ); |
267 | } | 267 | } |
268 | 268 | ||
269 | void Transaction::slotDateChanged( int y, int m, int d ) | 269 | void Transaction::slotDateChanged( int y, int m, int d ) |
270 | { | 270 | { |
271 | QDate date; | 271 | QDate date; |
272 | date.setYMD( y, m, d ); | 272 | date.setYMD( y, m, d ); |
273 | dateBtn->setText( TimeString::shortDate( date ) ); | 273 | dateBtn->setText( TimeString::shortDate( date ) ); |
274 | } | 274 | } |