-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 12 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qmaccounts.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmmemory.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransactions.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransfers.db | bin | 3072 -> 3072 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 2 |
6 files changed, 13 insertions, 1 deletions
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index 46ab1db..b2c0838 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp | |||
@@ -320,113 +320,125 @@ void AccountDisplay::enableAccounts () | |||
320 | { | 320 | { |
321 | // iterate through accountdisplay listview and enable all accounts | 321 | // iterate through accountdisplay listview and enable all accounts |
322 | QListViewItemIterator it ( listview ); | 322 | QListViewItemIterator it ( listview ); |
323 | for ( ; it.current(); ++it ) | 323 | for ( ; it.current(); ++it ) |
324 | it.current()->setSelectable ( TRUE ); | 324 | it.current()->setSelectable ( TRUE ); |
325 | } | 325 | } |
326 | 326 | ||
327 | void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | 327 | void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) |
328 | { | 328 | { |
329 | switch ( column ) | 329 | switch ( column ) |
330 | { | 330 | { |
331 | case 0: | 331 | case 0: |
332 | if ( listview->columns() == 3 ) | 332 | if ( listview->columns() == 3 ) |
333 | preferences->changeColumnPreference ( 1, newsize ); | 333 | preferences->changeColumnPreference ( 1, newsize ); |
334 | else | 334 | else |
335 | preferences->changeColumnPreference ( 10, newsize ); | 335 | preferences->changeColumnPreference ( 10, newsize ); |
336 | break; | 336 | break; |
337 | case 1: | 337 | case 1: |
338 | if ( listview->columns() == 3 ) | 338 | if ( listview->columns() == 3 ) |
339 | preferences->changeColumnPreference ( 2, newsize ); | 339 | preferences->changeColumnPreference ( 2, newsize ); |
340 | else | 340 | else |
341 | preferences->changeColumnPreference ( 11, newsize ); | 341 | preferences->changeColumnPreference ( 11, newsize ); |
342 | break; | 342 | break; |
343 | case 2: | 343 | case 2: |
344 | preferences->changeColumnPreference ( 12, newsize ); | 344 | preferences->changeColumnPreference ( 12, newsize ); |
345 | break; | 345 | break; |
346 | } | 346 | } |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | int AccountDisplay::getIDColumn () | 350 | int AccountDisplay::getIDColumn () |
351 | { | 351 | { |
352 | int counter; | 352 | int counter; |
353 | int columns = listview->columns(); | 353 | int columns = listview->columns(); |
354 | for ( counter = 0; counter <= columns; counter++ ) | 354 | for ( counter = 0; counter <= columns; counter++ ) |
355 | if ( listview->header()->label ( counter ).length() == 0 ) | 355 | if ( listview->header()->label ( counter ).length() == 0 ) |
356 | return counter; | 356 | return counter; |
357 | } | 357 | } |
358 | 358 | ||
359 | void AccountDisplay::editAccount () | 359 | void AccountDisplay::editAccount () |
360 | { | 360 | { |
361 | if ( listview->selectedItem() == 0 ) | 361 | if ( listview->selectedItem() == 0 ) |
362 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto edit."); | 362 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto edit."); |
363 | else | 363 | else |
364 | { | 364 | { |
365 | // set the accountid | 365 | // set the accountid |
366 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt(); | 366 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt(); |
367 | 367 | ||
368 | //construct new dialog box | 368 | //construct new dialog box |
369 | QDialog *editaccountwindow = new QDialog ( this, 0, TRUE ); | 369 | QDialog *editaccountwindow = new QDialog ( this, 0, TRUE ); |
370 | editaccountwindow->setCaption ( "Edit Account" ); | 370 | editaccountwindow->setCaption ( "Edit Account" ); |
371 | 371 | ||
372 | // construct the items which will go in the dialog bix | 372 | // construct the items which will go in the dialog bix |
373 | QLabel *namelabel = new QLabel ( "Account Name", editaccountwindow ); | 373 | QLabel *namelabel = new QLabel ( "Account Name", editaccountwindow ); |
374 | QLineEdit *accountname = new QLineEdit ( editaccountwindow ); | 374 | QLineEdit *accountname = new QLineEdit ( editaccountwindow ); |
375 | QLabel *descriptionlabel = new QLabel ( "Account Description", editaccountwindow ); | 375 | QLabel *descriptionlabel = new QLabel ( "Account Description", editaccountwindow ); |
376 | QLineEdit *accountdescription = new QLineEdit ( editaccountwindow ); | 376 | QLineEdit *accountdescription = new QLineEdit ( editaccountwindow ); |
377 | Currency *currencybox = new Currency ( editaccountwindow ); | 377 | Currency *currencybox = new Currency ( editaccountwindow ); |
378 | 378 | ||
379 | QVBoxLayout *layout = new QVBoxLayout ( editaccountwindow, 5, 2 ); | 379 | QVBoxLayout *layout = new QVBoxLayout ( editaccountwindow, 5, 2 ); |
380 | layout->addWidget ( namelabel ); | 380 | layout->addWidget ( namelabel ); |
381 | layout->addWidget ( accountname ); | 381 | layout->addWidget ( accountname ); |
382 | layout->addWidget ( descriptionlabel ); | 382 | layout->addWidget ( descriptionlabel ); |
383 | layout->addWidget ( accountdescription ); | 383 | layout->addWidget ( accountdescription ); |
384 | layout->addWidget ( currencybox ); | 384 | layout->addWidget ( currencybox ); |
385 | 385 | ||
386 | //set the account name | 386 | //set the account name |
387 | accountname->setText ( listview->selectedItem()->text ( 0 ) ); | 387 | accountname->setText ( listview->selectedItem()->text ( 0 ) ); |
388 | 388 | ||
389 | //set the account description | 389 | //set the account description |
390 | accountdescription->setText ( account->getAccountDescription ( accountid ) ); | 390 | accountdescription->setText ( account->getAccountDescription ( accountid ) ); |
391 | 391 | ||
392 | if ( preferences->getPreference ( 4 ) == 1 ) | 392 | if ( preferences->getPreference ( 4 ) == 1 ) |
393 | { | 393 | { |
394 | // get currency code for this account then iterate through the currency box | 394 | // get currency code for this account then iterate through the currency box |
395 | // to find the one we want | 395 | // to find the one we want |
396 | int count = currencybox->currencybox->count(); | 396 | int count = currencybox->currencybox->count(); |
397 | QString code = account->getCurrencyCode ( accountid ); | 397 | QString code = account->getCurrencyCode ( accountid ); |
398 | for ( int counter = 0; count - 1; counter++ ) | 398 | for ( int counter = 0; count - 1; counter++ ) |
399 | { | 399 | { |
400 | if ( QString::compare ( currencybox->currencybox->text ( counter ), code ) == 0 ) | 400 | if ( QString::compare ( currencybox->currencybox->text ( counter ), code ) == 0 ) |
401 | { | 401 | { |
402 | currencybox->currencybox->setCurrentItem ( counter ); | 402 | currencybox->currencybox->setCurrentItem ( counter ); |
403 | break; | 403 | break; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | } | 406 | } |
407 | else | 407 | else |
408 | currencybox->setEnabled ( FALSE ); | 408 | currencybox->setEnabled ( FALSE ); |
409 | 409 | ||
410 | //execute the dialog box | 410 | //execute the dialog box |
411 | int response = editaccountwindow->exec(); | 411 | int response = editaccountwindow->exec(); |
412 | if ( response == 1 ) | 412 | if ( response == 1 ) |
413 | { | 413 | { |
414 | account->updateAccount ( accountname->text(), accountdescription->text(), currencybox->currencybox->currentText(), accountid ); | 414 | account->updateAccount ( accountname->text(), accountdescription->text(), currencybox->currencybox->currentText(), accountid ); |
415 | account->displayAccounts ( listview ); | 415 | account->displayAccounts ( listview ); |
416 | |||
417 | // Try and select the same account that was just edited | ||
418 | QListViewItemIterator it ( listview ); | ||
419 | for ( ; it.current(); ++it ) | ||
420 | { | ||
421 | if ( it.current()->text ( 0 ) == accountname->text() ) | ||
422 | { | ||
423 | listview->setSelected ( it.current(), TRUE ); | ||
424 | return; | ||
425 | } | ||
426 | } | ||
427 | maintabs->setTabEnabled ( tab2, FALSE ); | ||
416 | } | 428 | } |
417 | } | 429 | } |
418 | } | 430 | } |
419 | 431 | ||
420 | void AccountDisplay::setAccountExpanded ( QListViewItem *item ) | 432 | void AccountDisplay::setAccountExpanded ( QListViewItem *item ) |
421 | { | 433 | { |
422 | int accountid = item->text ( getIDColumn() ).toInt(); | 434 | int accountid = item->text ( getIDColumn() ).toInt(); |
423 | account->setAccountExpanded ( 1, accountid ); | 435 | account->setAccountExpanded ( 1, accountid ); |
424 | } | 436 | } |
425 | 437 | ||
426 | void AccountDisplay::setAccountCollapsed ( QListViewItem *item ) | 438 | void AccountDisplay::setAccountCollapsed ( QListViewItem *item ) |
427 | { | 439 | { |
428 | int accountid = item->text ( getIDColumn() ).toInt(); | 440 | int accountid = item->text ( getIDColumn() ).toInt(); |
429 | account->setAccountExpanded ( 0, accountid ); | 441 | account->setAccountExpanded ( 0, accountid ); |
430 | } | 442 | } |
431 | 443 | ||
432 | 444 | ||
diff --git a/noncore/apps/qashmoney/qmaccounts.db b/noncore/apps/qashmoney/qmaccounts.db index 1c6f024..449bcab 100755 --- a/noncore/apps/qashmoney/qmaccounts.db +++ b/noncore/apps/qashmoney/qmaccounts.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmmemory.db b/noncore/apps/qashmoney/qmmemory.db index be33cd4..5c23122 100755 --- a/noncore/apps/qashmoney/qmmemory.db +++ b/noncore/apps/qashmoney/qmmemory.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransactions.db b/noncore/apps/qashmoney/qmtransactions.db index 1b05561..9e4acc9 100755 --- a/noncore/apps/qashmoney/qmtransactions.db +++ b/noncore/apps/qashmoney/qmtransactions.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransfers.db b/noncore/apps/qashmoney/qmtransfers.db index 4c04b5f..c31df1a 100755 --- a/noncore/apps/qashmoney/qmtransfers.db +++ b/noncore/apps/qashmoney/qmtransfers.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 6e5c4f6..14f5641 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -168,193 +168,193 @@ void TransactionDisplay::showCalendar () | |||
168 | DatePicker *dp = new DatePicker ( newDate ); | 168 | DatePicker *dp = new DatePicker ( newDate ); |
169 | if ( dp->exec () == QDialog::Accepted ) | 169 | if ( dp->exec () == QDialog::Accepted ) |
170 | { | 170 | { |
171 | year = dp->getYear(); | 171 | year = dp->getYear(); |
172 | month = dp->getMonth(); | 172 | month = dp->getMonth(); |
173 | day = dp->getDay(); | 173 | day = dp->getDay(); |
174 | date->setText ( preferences->getDate ( year, month, day ) ); | 174 | date->setText ( preferences->getDate ( year, month, day ) ); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void TransactionDisplay::editTransfer () | 178 | void TransactionDisplay::editTransfer () |
179 | { | 179 | { |
180 | transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); | 180 | transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); |
181 | fromaccount = transfer->getFromAccountID ( transferid ); | 181 | fromaccount = transfer->getFromAccountID ( transferid ); |
182 | toaccount = transfer->getToAccountID ( transferid ); | 182 | toaccount = transfer->getToAccountID ( transferid ); |
183 | year = transfer->getYear ( transferid ); | 183 | year = transfer->getYear ( transferid ); |
184 | month = transfer->getMonth ( transferid ); | 184 | month = transfer->getMonth ( transferid ); |
185 | day = transfer->getDay ( transferid ); | 185 | day = transfer->getDay ( transferid ); |
186 | 186 | ||
187 | QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); | 187 | QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); |
188 | editransfer->setCaption ( "Transfer" ); | 188 | editransfer->setCaption ( "Transfer" ); |
189 | 189 | ||
190 | QStringList accountnames = account->getAccountNames(); | 190 | QStringList accountnames = account->getAccountNames(); |
191 | QStringList accountids = account->getAccountIDs(); | 191 | QStringList accountids = account->getAccountIDs(); |
192 | 192 | ||
193 | QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); | 193 | QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); |
194 | QFont f = this->font(); | 194 | QFont f = this->font(); |
195 | f.setWeight ( QFont::Bold ); | 195 | f.setWeight ( QFont::Bold ); |
196 | fromaccountlabel->setFont ( f ); | 196 | fromaccountlabel->setFont ( f ); |
197 | 197 | ||
198 | QComboBox *fromaccountbox = new QComboBox ( editransfer ); | 198 | QComboBox *fromaccountbox = new QComboBox ( editransfer ); |
199 | fromaccountbox->insertStringList ( accountnames ); | 199 | fromaccountbox->insertStringList ( accountnames ); |
200 | fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); | 200 | fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); |
201 | 201 | ||
202 | QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); | 202 | QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); |
203 | toaccountlabel->setFont ( f ); | 203 | toaccountlabel->setFont ( f ); |
204 | 204 | ||
205 | QComboBox *toaccountbox = new QComboBox ( editransfer ); | 205 | QComboBox *toaccountbox = new QComboBox ( editransfer ); |
206 | toaccountbox->insertStringList ( accountnames ); | 206 | toaccountbox->insertStringList ( accountnames ); |
207 | toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); | 207 | toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); |
208 | 208 | ||
209 | QLabel *datelabel = new QLabel ( "Date", editransfer ); | 209 | QLabel *datelabel = new QLabel ( "Date", editransfer ); |
210 | QHBox *datebox = new QHBox ( editransfer ); | 210 | QHBox *datebox = new QHBox ( editransfer ); |
211 | datebox->setSpacing ( 2 ); | 211 | datebox->setSpacing ( 2 ); |
212 | date = new QLineEdit ( datebox ); | 212 | date = new QLineEdit ( datebox ); |
213 | date->setAlignment ( Qt::AlignRight ); | 213 | date->setAlignment ( Qt::AlignRight ); |
214 | date->setDisabled ( TRUE ); | 214 | date->setDisabled ( TRUE ); |
215 | date->setText ( preferences->getDate ( year, month, day ) ); | 215 | date->setText ( preferences->getDate ( year, month, day ) ); |
216 | QPushButton *datebutton = new QPushButton ( datebox ); | 216 | QPushButton *datebutton = new QPushButton ( datebox ); |
217 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 217 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
218 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 218 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); |
219 | 219 | ||
220 | QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); | 220 | QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); |
221 | 221 | ||
222 | QHBox *amountbox = new QHBox ( editransfer ); | 222 | QHBox *amountbox = new QHBox ( editransfer ); |
223 | amountbox->setSpacing ( 2 ); | 223 | amountbox->setSpacing ( 2 ); |
224 | amount = new QLineEdit ( amountbox ); | 224 | amount = new QLineEdit ( amountbox ); |
225 | amount->setAlignment ( Qt::AlignRight ); | 225 | amount->setAlignment ( Qt::AlignRight ); |
226 | amount->setText ( transfer->getAmount ( transferid ) ); | 226 | amount->setText ( transfer->getAmount ( transferid ) ); |
227 | QPushButton *calculatorbutton = new QPushButton( amountbox ); | 227 | QPushButton *calculatorbutton = new QPushButton( amountbox ); |
228 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 228 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
229 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 229 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
230 | 230 | ||
231 | QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); | 231 | QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); |
232 | 232 | ||
233 | QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); | 233 | QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); |
234 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); | 234 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); |
235 | layout->addWidget ( fromaccountbox, Qt::AlignLeft ); | 235 | layout->addWidget ( fromaccountbox, Qt::AlignLeft ); |
236 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); | 236 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); |
237 | layout->addWidget ( toaccountbox, Qt::AlignLeft ); | 237 | layout->addWidget ( toaccountbox, Qt::AlignLeft ); |
238 | layout->addSpacing ( 5 ); | 238 | layout->addSpacing ( 5 ); |
239 | layout->addWidget ( datelabel, Qt::AlignLeft ); | 239 | layout->addWidget ( datelabel, Qt::AlignLeft ); |
240 | layout->addWidget ( datebox, Qt::AlignLeft ); | 240 | layout->addWidget ( datebox, Qt::AlignLeft ); |
241 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); | 241 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); |
242 | layout->addWidget ( amountbox, Qt::AlignLeft ); | 242 | layout->addWidget ( amountbox, Qt::AlignLeft ); |
243 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); | 243 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); |
244 | 244 | ||
245 | if ( editransfer->exec() == QDialog::Accepted ) | 245 | if ( editransfer->exec() == QDialog::Accepted ) |
246 | { | 246 | { |
247 | //get fromaccount | 247 | //get fromaccount |
248 | fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); | 248 | fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); |
249 | 249 | ||
250 | //get to account | 250 | //get to account |
251 | toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); | 251 | toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); |
252 | 252 | ||
253 | //set cleared flag | 253 | //set cleared flag |
254 | int cleared = 0; | 254 | int cleared = 0; |
255 | if ( clearedcheckbox->isChecked() == TRUE ) | 255 | if ( clearedcheckbox->isChecked() == TRUE ) |
256 | cleared = 1; | 256 | cleared = 1; |
257 | 257 | ||
258 | //update transfer | 258 | //update transfer |
259 | transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), | 259 | transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), |
260 | day, month, year, amount->text().toFloat(), cleared, transferid ); | 260 | day, month, year, amount->text().toFloat(), cleared, transferid ); |
261 | 261 | ||
262 | account->updateAccountBalance ( fromaccount ); | 262 | account->updateAccountBalance ( fromaccount ); |
263 | if ( account->getParentAccountID ( fromaccount ) != -1 ) | 263 | if ( account->getParentAccountID ( fromaccount ) != -1 ) |
264 | account->changeParentAccountBalance ( fromaccount ); | 264 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) ); |
265 | 265 | ||
266 | updateAndDisplay ( toaccount ); | 266 | updateAndDisplay ( toaccount ); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | void TransactionDisplay::editTransaction () | 270 | void TransactionDisplay::editTransaction () |
271 | { | 271 | { |
272 | int cleared; | 272 | int cleared; |
273 | 273 | ||
274 | // set the transaction id and budgetid | 274 | // set the transaction id and budgetid |
275 | int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt(); | 275 | int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt(); |
276 | int budgetid = transaction->getBudgetID ( transactionid ); | 276 | int budgetid = transaction->getBudgetID ( transactionid ); |
277 | int lineitemid = transaction->getLineItemID ( transactionid ); | 277 | int lineitemid = transaction->getLineItemID ( transactionid ); |
278 | 278 | ||
279 | // create edit transaction window | 279 | // create edit transaction window |
280 | NewTransaction *newtransaction = new NewTransaction ( this ); | 280 | NewTransaction *newtransaction = new NewTransaction ( this ); |
281 | int width = this->width(); | 281 | int width = this->width(); |
282 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 282 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
283 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); | 283 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); |
284 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 284 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
285 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 285 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
286 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 286 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
287 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); | 287 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); |
288 | 288 | ||
289 | // enter the date in the date box | 289 | // enter the date in the date box |
290 | newtransaction->year = transaction->getYear ( transactionid ); | 290 | newtransaction->year = transaction->getYear ( transactionid ); |
291 | newtransaction->month = transaction->getMonth ( transactionid ); | 291 | newtransaction->month = transaction->getMonth ( transactionid ); |
292 | newtransaction->day = transaction->getDay ( transactionid ); | 292 | newtransaction->day = transaction->getDay ( transactionid ); |
293 | newtransaction->transactiondate->setText ( preferences->getDate ( newtransaction->year, newtransaction->month, newtransaction->day ) ); | 293 | newtransaction->transactiondate->setText ( preferences->getDate ( newtransaction->year, newtransaction->month, newtransaction->day ) ); |
294 | 294 | ||
295 | // set the description | 295 | // set the description |
296 | newtransaction->setDescription ( transaction->getTransactionDescription ( transactionid ) ); | 296 | newtransaction->setDescription ( transaction->getTransactionDescription ( transactionid ) ); |
297 | 297 | ||
298 | // add memory items to the transactionname combobox | 298 | // add memory items to the transactionname combobox |
299 | memory->displayMemoryItems ( newtransaction->transactionname ); | 299 | memory->displayMemoryItems ( newtransaction->transactionname ); |
300 | 300 | ||
301 | // add correct transaction name | 301 | // add correct transaction name |
302 | newtransaction->transactionname->setEditText ( transaction->getPayee ( transactionid ) ); | 302 | newtransaction->transactionname->setEditText ( transaction->getPayee ( transactionid ) ); |
303 | 303 | ||
304 | // add transaction number | 304 | // add transaction number |
305 | newtransaction->transactionnumber->setText ( transaction->getNumber ( transactionid ) ); | 305 | newtransaction->transactionnumber->setText ( transaction->getNumber ( transactionid ) ); |
306 | 306 | ||
307 | // add transaction amount | 307 | // add transaction amount |
308 | newtransaction->transactionamount->setText ( transaction->getAbsoluteAmount ( transactionid ) ); | 308 | newtransaction->transactionamount->setText ( transaction->getAbsoluteAmount ( transactionid ) ); |
309 | 309 | ||
310 | // check for and set the correct budget | 310 | // check for and set the correct budget |
311 | if ( budgetid >= 1 ) // only do it if this transaction has a budget and line item | 311 | if ( budgetid >= 1 ) // only do it if this transaction has a budget and line item |
312 | { | 312 | { |
313 | newtransaction->budgetbox->setCurrentItem ( newtransaction->getBudgetIndex ( budgetid ) + 1 ); | 313 | newtransaction->budgetbox->setCurrentItem ( newtransaction->getBudgetIndex ( budgetid ) + 1 ); |
314 | if ( lineitemid >= 1 ) | 314 | if ( lineitemid >= 1 ) |
315 | { | 315 | { |
316 | newtransaction->setLineItems (); | 316 | newtransaction->setLineItems (); |
317 | newtransaction->lineitembox->setCurrentItem ( newtransaction->getLineItemIndex ( lineitemid ) ); | 317 | newtransaction->lineitembox->setCurrentItem ( newtransaction->getLineItemIndex ( lineitemid ) ); |
318 | } | 318 | } |
319 | else | 319 | else |
320 | { | 320 | { |
321 | newtransaction->lineitemlabel->setEnabled ( FALSE ); | 321 | newtransaction->lineitemlabel->setEnabled ( FALSE ); |
322 | newtransaction->lineitembox->setEnabled ( FALSE ); | 322 | newtransaction->lineitembox->setEnabled ( FALSE ); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | else | 325 | else |
326 | { | 326 | { |
327 | newtransaction->lineitemlabel->setEnabled ( FALSE ); | 327 | newtransaction->lineitemlabel->setEnabled ( FALSE ); |
328 | newtransaction->lineitembox->setEnabled ( FALSE ); | 328 | newtransaction->lineitembox->setEnabled ( FALSE ); |
329 | } | 329 | } |
330 | 330 | ||
331 | // check cleared checkbox if necessary | 331 | // check cleared checkbox if necessary |
332 | if ( transaction->getCleared ( transactionid ) == 1 ) | 332 | if ( transaction->getCleared ( transactionid ) == 1 ) |
333 | newtransaction->clearedcheckbox->setChecked ( TRUE ); | 333 | newtransaction->clearedcheckbox->setChecked ( TRUE ); |
334 | 334 | ||
335 | // check deposit box if necessary | 335 | // check deposit box if necessary |
336 | if ( transaction->getAmount ( transactionid ).toFloat() > 0 ) | 336 | if ( transaction->getAmount ( transactionid ).toFloat() > 0 ) |
337 | newtransaction->depositbox->setChecked ( TRUE ); | 337 | newtransaction->depositbox->setChecked ( TRUE ); |
338 | 338 | ||
339 | if ( newtransaction->exec () == QDialog::Accepted ) | 339 | if ( newtransaction->exec () == QDialog::Accepted ) |
340 | { | 340 | { |
341 | if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) | 341 | if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) |
342 | cleared = 1; | 342 | cleared = 1; |
343 | else | 343 | else |
344 | cleared = 0; | 344 | cleared = 0; |
345 | 345 | ||
346 | float amount = newtransaction->transactionamount->text().toFloat(); | 346 | float amount = newtransaction->transactionamount->text().toFloat(); |
347 | if ( newtransaction->depositbox->isChecked() == FALSE ) | 347 | if ( newtransaction->depositbox->isChecked() == FALSE ) |
348 | amount = amount * -1; | 348 | amount = amount * -1; |
349 | 349 | ||
350 | // add the transaction name to the memory items | 350 | // add the transaction name to the memory items |
351 | memory->addMemoryItem ( newtransaction->transactionname->currentText() ); | 351 | memory->addMemoryItem ( newtransaction->transactionname->currentText() ); |
352 | 352 | ||
353 | // update the transaction | 353 | // update the transaction |
354 | transaction->updateTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), newtransaction->transactionnumber->text().toInt(), | 354 | transaction->updateTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), newtransaction->transactionnumber->text().toInt(), |
355 | newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), | 355 | newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), |
356 | amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem(), transactionid ); | 356 | amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem(), transactionid ); |
357 | 357 | ||
358 | updateAndDisplay ( transaction->getAccountID ( transactionid ) ); | 358 | updateAndDisplay ( transaction->getAccountID ( transactionid ) ); |
359 | } | 359 | } |
360 | } | 360 | } |