summaryrefslogtreecommitdiff
authorallenforsythe <allenforsythe>2003-05-16 10:01:09 (UTC)
committer allenforsythe <allenforsythe>2003-05-16 10:01:09 (UTC)
commitc6de8acfd02b24dead5a1ff815c3f167a578a48b (patch) (side-by-side diff)
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
@@ -352,81 +352,93 @@ int AccountDisplay::getIDColumn ()
int counter;
int columns = listview->columns();
for ( counter = 0; counter <= columns; counter++ )
if ( listview->header()->label ( counter ).length() == 0 )
return counter;
}
void AccountDisplay::editAccount ()
{
if ( listview->selectedItem() == 0 )
QMessageBox::warning ( this, "QashMoney", "Please select an account\nto edit.");
else
{
// set the accountid
int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt();
//construct new dialog box
QDialog *editaccountwindow = new QDialog ( this, 0, TRUE );
editaccountwindow->setCaption ( "Edit Account" );
// construct the items which will go in the dialog bix
QLabel *namelabel = new QLabel ( "Account Name", editaccountwindow );
QLineEdit *accountname = new QLineEdit ( editaccountwindow );
QLabel *descriptionlabel = new QLabel ( "Account Description", editaccountwindow );
QLineEdit *accountdescription = new QLineEdit ( editaccountwindow );
Currency *currencybox = new Currency ( editaccountwindow );
QVBoxLayout *layout = new QVBoxLayout ( editaccountwindow, 5, 2 );
layout->addWidget ( namelabel );
layout->addWidget ( accountname );
layout->addWidget ( descriptionlabel );
layout->addWidget ( accountdescription );
layout->addWidget ( currencybox );
//set the account name
accountname->setText ( listview->selectedItem()->text ( 0 ) );
//set the account description
accountdescription->setText ( account->getAccountDescription ( accountid ) );
if ( preferences->getPreference ( 4 ) == 1 )
{
// get currency code for this account then iterate through the currency box
// to find the one we want
int count = currencybox->currencybox->count();
QString code = account->getCurrencyCode ( accountid );
for ( int counter = 0; count - 1; counter++ )
{
if ( QString::compare ( currencybox->currencybox->text ( counter ), code ) == 0 )
{
currencybox->currencybox->setCurrentItem ( counter );
break;
}
}
}
else
currencybox->setEnabled ( FALSE );
//execute the dialog box
int response = editaccountwindow->exec();
if ( response == 1 )
{
account->updateAccount ( accountname->text(), accountdescription->text(), currencybox->currencybox->currentText(), accountid );
account->displayAccounts ( listview );
+
+ // Try and select the same account that was just edited
+ QListViewItemIterator it ( listview );
+ for ( ; it.current(); ++it )
+ {
+ if ( it.current()->text ( 0 ) == accountname->text() )
+ {
+ listview->setSelected ( it.current(), TRUE );
+ return;
+ }
+ }
+ maintabs->setTabEnabled ( tab2, FALSE );
}
}
}
void AccountDisplay::setAccountExpanded ( QListViewItem *item )
{
int accountid = item->text ( getIDColumn() ).toInt();
account->setAccountExpanded ( 1, accountid );
}
void AccountDisplay::setAccountCollapsed ( QListViewItem *item )
{
int accountid = item->text ( getIDColumn() ).toInt();
account->setAccountExpanded ( 0, accountid );
}
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
@@ -200,129 +200,129 @@ void TransactionDisplay::editTransfer ()
fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) );
QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer );
toaccountlabel->setFont ( f );
QComboBox *toaccountbox = new QComboBox ( editransfer );
toaccountbox->insertStringList ( accountnames );
toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) );
QLabel *datelabel = new QLabel ( "Date", editransfer );
QHBox *datebox = new QHBox ( editransfer );
datebox->setSpacing ( 2 );
date = new QLineEdit ( datebox );
date->setAlignment ( Qt::AlignRight );
date->setDisabled ( TRUE );
date->setText ( preferences->getDate ( year, month, day ) );
QPushButton *datebutton = new QPushButton ( datebox );
datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) );
QLabel *amounttlabel = new QLabel ( "Amount", editransfer );
QHBox *amountbox = new QHBox ( editransfer );
amountbox->setSpacing ( 2 );
amount = new QLineEdit ( amountbox );
amount->setAlignment ( Qt::AlignRight );
amount->setText ( transfer->getAmount ( transferid ) );
QPushButton *calculatorbutton = new QPushButton( amountbox );
calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer );
QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 );
layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
layout->addWidget ( fromaccountbox, Qt::AlignLeft );
layout->addWidget ( toaccountlabel, Qt::AlignLeft );
layout->addWidget ( toaccountbox, Qt::AlignLeft );
layout->addSpacing ( 5 );
layout->addWidget ( datelabel, Qt::AlignLeft );
layout->addWidget ( datebox, Qt::AlignLeft );
layout->addWidget ( amounttlabel, Qt::AlignLeft );
layout->addWidget ( amountbox, Qt::AlignLeft );
layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
if ( editransfer->exec() == QDialog::Accepted )
{
//get fromaccount
fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt();
//get to account
toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt();
//set cleared flag
int cleared = 0;
if ( clearedcheckbox->isChecked() == TRUE )
cleared = 1;
//update transfer
transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ),
day, month, year, amount->text().toFloat(), cleared, transferid );
account->updateAccountBalance ( fromaccount );
if ( account->getParentAccountID ( fromaccount ) != -1 )
- account->changeParentAccountBalance ( fromaccount );
+ account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) );
updateAndDisplay ( toaccount );
}
}
void TransactionDisplay::editTransaction ()
{
int cleared;
// set the transaction id and budgetid
int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt();
int budgetid = transaction->getBudgetID ( transactionid );
int lineitemid = transaction->getLineItemID ( transactionid );
// create edit transaction window
NewTransaction *newtransaction = new NewTransaction ( this );
int width = this->width();
newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) );
newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) );
// enter the date in the date box
newtransaction->year = transaction->getYear ( transactionid );
newtransaction->month = transaction->getMonth ( transactionid );
newtransaction->day = transaction->getDay ( transactionid );
newtransaction->transactiondate->setText ( preferences->getDate ( newtransaction->year, newtransaction->month, newtransaction->day ) );
// set the description
newtransaction->setDescription ( transaction->getTransactionDescription ( transactionid ) );
// add memory items to the transactionname combobox
memory->displayMemoryItems ( newtransaction->transactionname );
// add correct transaction name
newtransaction->transactionname->setEditText ( transaction->getPayee ( transactionid ) );
// add transaction number
newtransaction->transactionnumber->setText ( transaction->getNumber ( transactionid ) );
// add transaction amount
newtransaction->transactionamount->setText ( transaction->getAbsoluteAmount ( transactionid ) );
// check for and set the correct budget
if ( budgetid >= 1 ) // only do it if this transaction has a budget and line item
{
newtransaction->budgetbox->setCurrentItem ( newtransaction->getBudgetIndex ( budgetid ) + 1 );
if ( lineitemid >= 1 )
{
newtransaction->setLineItems ();
newtransaction->lineitembox->setCurrentItem ( newtransaction->getLineItemIndex ( lineitemid ) );
}
else
{
newtransaction->lineitemlabel->setEnabled ( FALSE );
newtransaction->lineitembox->setEnabled ( FALSE );
}
}
else
{
newtransaction->lineitemlabel->setEnabled ( FALSE );
newtransaction->lineitembox->setEnabled ( FALSE );