summaryrefslogtreecommitdiff
authorallenforsythe <allenforsythe>2003-05-16 10:01:09 (UTC)
committer allenforsythe <allenforsythe>2003-05-16 10:01:09 (UTC)
commitc6de8acfd02b24dead5a1ff815c3f167a578a48b (patch) (unidiff)
tree6d5749b781a70741eb51e84d36974e30c3ffc1a6
parent822414b8ac44ddc8c79aaffa630b45a13015d51a (diff)
downloadopie-c6de8acfd02b24dead5a1ff815c3f167a578a48b.zip
opie-c6de8acfd02b24dead5a1ff815c3f167a578a48b.tar.gz
opie-c6de8acfd02b24dead5a1ff815c3f167a578a48b.tar.bz2
Fixed edit transfer and edit account/view account bugs
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp12
-rwxr-xr-xnoncore/apps/qashmoney/qmaccounts.dbbin4096 -> 4096 bytes
-rwxr-xr-xnoncore/apps/qashmoney/qmmemory.dbbin4096 -> 4096 bytes
-rwxr-xr-xnoncore/apps/qashmoney/qmtransactions.dbbin4096 -> 4096 bytes
-rwxr-xr-xnoncore/apps/qashmoney/qmtransfers.dbbin3072 -> 3072 bytes
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp2
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
@@ -368,65 +368,77 @@ void AccountDisplay::editAccount ()
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
420void AccountDisplay::setAccountExpanded ( QListViewItem *item ) 432void 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
426void AccountDisplay::setAccountCollapsed ( QListViewItem *item ) 438void 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
@@ -216,97 +216,97 @@ void TransactionDisplay::editTransfer ()
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
270void TransactionDisplay::editTransaction () 270void 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 {