author | llornkcor <llornkcor> | 2002-07-10 13:03:28 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-10 13:03:28 (UTC) |
commit | 32954f729822e2d25f9e116400cbf2522a88ce42 (patch) (side-by-side diff) | |
tree | 34031f25f40a8778c8cfc152b999d89151f605c6 | |
parent | 71326cb76ff4794167abd6fee14c4b5aaf0649d9 (diff) | |
download | opie-32954f729822e2d25f9e116400cbf2522a88ce42.zip opie-32954f729822e2d25f9e116400cbf2522a88ce42.tar.gz opie-32954f729822e2d25f9e116400cbf2522a88ce42.tar.bz2 |
change tab order
-rw-r--r-- | noncore/apps/checkbook/qcheckentry.cpp | 435 | ||||
-rw-r--r-- | noncore/apps/checkbook/qcheckentrybase.ui | 9 |
2 files changed, 228 insertions, 216 deletions
diff --git a/noncore/apps/checkbook/qcheckentry.cpp b/noncore/apps/checkbook/qcheckentry.cpp index 9ff02c9..2e8da1c 100644 --- a/noncore/apps/checkbook/qcheckentry.cpp +++ b/noncore/apps/checkbook/qcheckentry.cpp @@ -1,251 +1,256 @@ #include "qcheckentry.h" QCheckEntry::QCheckEntry() - : QCheckEntryBase() + : QCheckEntryBase() { - connect(transAmount, SIGNAL(textChanged(const QString &)), this, SLOT(amountChanged(const QString &))); - connect(transFee, SIGNAL(textChanged(const QString &)), this, SLOT(transFeeChanged(const QString &))); - connect(payment, SIGNAL(clicked()), this, SLOT(paymentClicked())); - connect(deposit, SIGNAL(clicked()), this, SLOT(depositClicked())); + connect(transAmount, SIGNAL(textChanged(const QString &)), this, SLOT(amountChanged(const QString &))); + connect(transFee, SIGNAL(textChanged(const QString &)), this, SLOT(transFeeChanged(const QString &))); + connect(payment, SIGNAL(clicked()), this, SLOT(paymentClicked())); + connect(deposit, SIGNAL(clicked()), this, SLOT(depositClicked())); - QString todaysdate = QString::number(QDate::currentDate().month()); - todaysdate.append("/"); - todaysdate.append(QString::number(QDate::currentDate().day())); - todaysdate.append("/"); - todaysdate.append(QString::number(QDate::currentDate().year())); - dateEdit->setText(todaysdate); + QString todaysdate = QString::number(QDate::currentDate().month()); + todaysdate.append("/"); + todaysdate.append(QString::number(QDate::currentDate().day())); + todaysdate.append("/"); + todaysdate.append(QString::number(QDate::currentDate().year())); + dateEdit->setText(todaysdate); - descriptionCombo->setFocus(); + descriptionCombo->setFocus(); - dateEdit->setValidChars("0123456789./-"); - dateEdit->setMaxLength(10); + dateEdit->setValidChars("0123456789./-"); + dateEdit->setMaxLength(10); - descriptionCombo->lineEdit()->setMaxLength(30); + descriptionCombo->lineEdit()->setMaxLength(30); - checkNumber->setValidChars("0123456789-"); - checkNumber->setMaxLength(10); + checkNumber->setValidChars("0123456789-"); + checkNumber->setMaxLength(10); - transAmount->setValidChars("0123456789."); + transAmount->setValidChars("0123456789."); - transFee->setMaxLength(5); - transFee->setValidChars("0123456789."); + transFee->setMaxLength(5); + transFee->setValidChars("0123456789."); + setTabOrder(transType,checkNumber); + setTabOrder(checkNumber,transAmount); + setTabOrder(transAmount,transFee); + setTabOrder(transFee,dateEdit); + setTabOrder(dateEdit, additionalNotes ); } void QCheckEntry::paymentClicked() { - cmbCategory->clear(); - cmbCategory->insertItem( tr( "Automobile" ) ); - cmbCategory->insertItem( tr( "Bills" ) ); - cmbCategory->insertItem( tr( "CDs" ) ); - cmbCategory->insertItem( tr( "Clothing" ) ); - cmbCategory->insertItem( tr( "Computer" ) ); - cmbCategory->insertItem( tr( "DVDs" ) ); - cmbCategory->insertItem( tr( "Eletronics" ) ); - cmbCategory->insertItem( tr( "Entertainment" ) ); - cmbCategory->insertItem( tr( "Food" ) ); - cmbCategory->insertItem( tr( "Gasoline" ) ); - cmbCategory->insertItem( tr( "Misc" ) ); - cmbCategory->insertItem( tr( "Movies" ) ); - cmbCategory->insertItem( tr( "Rent" ) ); - cmbCategory->insertItem( tr( "Travel" ) ); - cmbCategory->setCurrentItem( 0 ); - transType->clear(); - transType->insertItem( tr( "Debit Charge" ) ); - transType->insertItem( tr( "Written Check" ) ); - transType->insertItem( tr( "Transfer" ) ); - transType->insertItem( tr( "Credit Card" ) ); + cmbCategory->clear(); + cmbCategory->insertItem( tr( "Automobile" ) ); + cmbCategory->insertItem( tr( "Bills" ) ); + cmbCategory->insertItem( tr( "CDs" ) ); + cmbCategory->insertItem( tr( "Clothing" ) ); + cmbCategory->insertItem( tr( "Computer" ) ); + cmbCategory->insertItem( tr( "DVDs" ) ); + cmbCategory->insertItem( tr( "Eletronics" ) ); + cmbCategory->insertItem( tr( "Entertainment" ) ); + cmbCategory->insertItem( tr( "Food" ) ); + cmbCategory->insertItem( tr( "Gasoline" ) ); + cmbCategory->insertItem( tr( "Misc" ) ); + cmbCategory->insertItem( tr( "Movies" ) ); + cmbCategory->insertItem( tr( "Rent" ) ); + cmbCategory->insertItem( tr( "Travel" ) ); + cmbCategory->setCurrentItem( 0 ); + transType->clear(); + transType->insertItem( tr( "Debit Charge" ) ); + transType->insertItem( tr( "Written Check" ) ); + transType->insertItem( tr( "Transfer" ) ); + transType->insertItem( tr( "Credit Card" ) ); } void QCheckEntry::depositClicked() { - cmbCategory->clear(); - cmbCategory->insertItem( tr( "Work" ) ); - cmbCategory->insertItem( tr( "Family Member" ) ); - cmbCategory->insertItem( tr( "Misc. Credit" ) ); - cmbCategory->setCurrentItem( 0 ); - transType->clear(); - transType->insertItem( tr( "Written Check" ) ); - transType->insertItem( tr( "Automatic Payment" ) ); - transType->insertItem( tr( "Transfer" ) ); - transType->insertItem( tr( "Cash" ) ); + cmbCategory->clear(); + cmbCategory->insertItem( tr( "Work" ) ); + cmbCategory->insertItem( tr( "Family Member" ) ); + cmbCategory->insertItem( tr( "Misc. Credit" ) ); + cmbCategory->setCurrentItem( 0 ); + transType->clear(); + transType->insertItem( tr( "Written Check" ) ); + transType->insertItem( tr( "Automatic Payment" ) ); + transType->insertItem( tr( "Transfer" ) ); + transType->insertItem( tr( "Cash" ) ); } QStringList QCheckEntry::popupEntry(const QStringList &originaldata) { - QCheckEntry qce; - - // This is how the list looks: - // 0: true or false, true == payment, false == deposit - // 1: description of the transaction - // 2: category name - // 3: transaction type (stores the integer value of the index of the combobox) - // 4: check number of the transaction (if any) - // 5: transaction amount - // 6: transaction fee (e.g. service charge, or ATM charge). - // 7: date of the transaction - // 8: additional notes - // 9: recently used descriptions - if (originaldata.count() > 1) - { - if (originaldata[0] == "true") - { - qce.payment->setChecked(true); - qce.paymentClicked(); - } else { - if (originaldata[0] == "false") - { - qce.deposit->setChecked(true); - qce.depositClicked(); - } - } - qce.descriptionCombo->lineEdit()->setText(originaldata[1]); - qce.cmbCategory->lineEdit()->setText(originaldata[2]); - qce.transType->setCurrentItem(originaldata[3].toInt()); - qce.checkNumber->setText(originaldata[4]); - qce.transAmount->setText(originaldata[5]); - qce.transFee->setText(originaldata[6]); - qce.dateEdit->setText(originaldata[7]); - qce.additionalNotes->setText(originaldata[8]); - QStringList recentlist; - if (!originaldata[9].isEmpty()) - { - recentlist = QStringList::split(',', originaldata[9], false); - } - if (!recentlist.isEmpty()) - { - qce.descriptionCombo->insertStringList(recentlist); - } - } else { - QStringList recentlist; - if (!originaldata[0].isEmpty()) - { - recentlist = QStringList::split(',', originaldata[0], false); - } - if (!recentlist.isEmpty()) - { - qce.descriptionCombo->insertStringList(recentlist); - } - } - - qce.setWFlags(Qt::WType_Modal); - qce.showMaximized(); - - qce.descriptionCombo->lineEdit()->clear(); - - if (qce.exec() == QDialog::Accepted) - { - // Validate that the user has inputed a valid dollar amount - if (qce.transFee->text().contains('.') == 0) - { - QString text = qce.transFee->text(); - text.append(".00"); - qce.transFee->setText(text); - } else { - QString tmp = qce.transFee->text(); - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) - { - tmp.append("00"); - qce.transFee->setText(tmp); - } else { - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) - { - tmp.append("0"); - qce.transFee->setText(tmp); - } - } - } - if (qce.transAmount->text().contains('.') == 0) - { - QString text = qce.transAmount->text(); - text.append(".00"); - qce.transAmount->setText(text); - } else { - QString tmp = qce.transAmount->text(); - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) - { - tmp.append("00"); - qce.transAmount->setText(tmp); - } else { - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) - { - tmp.append("0"); - qce.transAmount->setText(tmp); - } - } - } - - QString recent; - if (qce.descriptionCombo->count() != 0) - { - QStringList recentlist = QStringList::split(',', originaldata[9], false); - if (recentlist.count() >= 10) - { - recentlist.remove(recentlist.last()); - } - recentlist.prepend(qce.descriptionCombo->lineEdit()->text()); - recent = recentlist.join(","); - } else { - recent = qce.descriptionCombo->lineEdit()->text(); - } - - QString checkNumberString = qce.checkNumber->text(); - if (checkNumberString.isEmpty() == true) - { - checkNumberString = "0"; - } - - QString paymentChecked = "true"; - if (qce.payment->isChecked() == false) - { - paymentChecked = "false"; - } - QStringList returnvalue; - returnvalue << paymentChecked << qce.descriptionCombo->lineEdit()->text() << qce.cmbCategory->lineEdit()->text() << QString::number(qce.transType->currentItem()) << checkNumberString << qce.transAmount->text() << qce.transFee->text() << qce.dateEdit->text() << qce.additionalNotes->text() << recent; - return returnvalue; - } else { - QStringList blank; - return blank; - } + QCheckEntry qce; + + // This is how the list looks: + // 0: true or false, true == payment, false == deposit + // 1: description of the transaction + // 2: category name + // 3: transaction type (stores the integer value of the index of the combobox) + // 4: check number of the transaction (if any) + // 5: transaction amount + // 6: transaction fee (e.g. service charge, or ATM charge). + // 7: date of the transaction + // 8: additional notes + // 9: recently used descriptions + if (originaldata.count() > 1) + { + if (originaldata[0] == "true") + { + qce.payment->setChecked(true); + qce.paymentClicked(); + } else { + if (originaldata[0] == "false") + { + qce.deposit->setChecked(true); + qce.depositClicked(); + } + } + qce.descriptionCombo->lineEdit()->setText(originaldata[1]); + qce.cmbCategory->lineEdit()->setText(originaldata[2]); + qce.transType->setCurrentItem(originaldata[3].toInt()); + qce.checkNumber->setText(originaldata[4]); + qce.transAmount->setText(originaldata[5]); + qce.transFee->setText(originaldata[6]); + qce.dateEdit->setText(originaldata[7]); + qce.additionalNotes->setText(originaldata[8]); + QStringList recentlist; + if (!originaldata[9].isEmpty()) + { + recentlist = QStringList::split(',', originaldata[9], false); + } + if (!recentlist.isEmpty()) + { + qce.descriptionCombo->insertStringList(recentlist); + } + } else { + QStringList recentlist; + if (!originaldata[0].isEmpty()) + { + recentlist = QStringList::split(',', originaldata[0], false); + } + if (!recentlist.isEmpty()) + { + qce.descriptionCombo->insertStringList(recentlist); + } + } + + qce.setWFlags(Qt::WType_Modal); + qce.showMaximized(); + + qce.descriptionCombo->lineEdit()->clear(); + + if (qce.exec() == QDialog::Accepted) + { + // Validate that the user has inputed a valid dollar amount + if (qce.transFee->text().contains('.') == 0) + { + QString text = qce.transFee->text(); + text.append(".00"); + qce.transFee->setText(text); + } else { + QString tmp = qce.transFee->text(); + if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) + { + tmp.append("00"); + qce.transFee->setText(tmp); + } else { + if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) + { + tmp.append("0"); + qce.transFee->setText(tmp); + } + } + } + if (qce.transAmount->text().contains('.') == 0) + { + QString text = qce.transAmount->text(); + text.append(".00"); + qce.transAmount->setText(text); + } else { + QString tmp = qce.transAmount->text(); + if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) + { + tmp.append("00"); + qce.transAmount->setText(tmp); + } else { + if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) + { + tmp.append("0"); + qce.transAmount->setText(tmp); + } + } + } + + QString recent; + if (qce.descriptionCombo->count() != 0) + { + QStringList recentlist = QStringList::split(',', originaldata[9], false); + if (recentlist.count() >= 10) + { + recentlist.remove(recentlist.last()); + } + recentlist.prepend(qce.descriptionCombo->lineEdit()->text()); + recent = recentlist.join(","); + } else { + recent = qce.descriptionCombo->lineEdit()->text(); + } + + QString checkNumberString = qce.checkNumber->text(); + if (checkNumberString.isEmpty() == true) + { + checkNumberString = "0"; + } + + QString paymentChecked = "true"; + if (qce.payment->isChecked() == false) + { + paymentChecked = "false"; + } + QStringList returnvalue; + returnvalue << paymentChecked << qce.descriptionCombo->lineEdit()->text() << qce.cmbCategory->lineEdit()->text() << QString::number(qce.transType->currentItem()) << checkNumberString << qce.transAmount->text() << qce.transFee->text() << qce.dateEdit->text() << qce.additionalNotes->text() << recent; + return returnvalue; + } else { + QStringList blank; + return blank; + } } void QCheckEntry::transFeeChanged(const QString &input) { - QString tmpinput = input; - if (tmpinput.contains('.') > 1) - { - int first = tmpinput.find('.'); - tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); - } - if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) - { - tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); - } - transFee->setText(tmpinput); + QString tmpinput = input; + if (tmpinput.contains('.') > 1) + { + int first = tmpinput.find('.'); + tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); + } + if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) + { + tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); + } + transFee->setText(tmpinput); } void QCheckEntry::amountChanged(const QString &input) { - QString tmpinput = input; - if (tmpinput.contains('.') > 1) - { - int first = tmpinput.find('.'); - tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); - } - if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) - { - tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); - } - transAmount->setText(tmpinput); + QString tmpinput = input; + if (tmpinput.contains('.') > 1) + { + int first = tmpinput.find('.'); + tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); + } + if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) + { + tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); + } + transAmount->setText(tmpinput); } void QCheckEntry::accept() { - // Does the description combo not have any text in it? Do something if it doesn't! - if (descriptionCombo->lineEdit()->text().isEmpty() == true) - { - QMessageBox::critical(this, "Field Missing.", "<qt>You didn't enter a description for this transaction. Please fill out the \"Transaction Description\" field and try again.</qt>"); - descriptionCombo->setFocus(); - return; - } - QDialog::accept(); + // Does the description combo not have any text in it? Do something if it doesn't! + if (descriptionCombo->lineEdit()->text().isEmpty() == true) + { + QMessageBox::critical(this, "Field Missing.", "<qt>You didn't enter a description for this transaction. Please fill out the \"Transaction Description\" field and try again.</qt>"); + descriptionCombo->setFocus(); + return; + } + QDialog::accept(); } diff --git a/noncore/apps/checkbook/qcheckentrybase.ui b/noncore/apps/checkbook/qcheckentrybase.ui index a57d761..efc35ff 100644 --- a/noncore/apps/checkbook/qcheckentrybase.ui +++ b/noncore/apps/checkbook/qcheckentrybase.ui @@ -1,142 +1,142 @@ <!DOCTYPE UI><UI> <class>QCheckEntryBase</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>QCheckEntryBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>228</width> + <width>224</width> <height>291</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Account Transaction</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>5</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <spacer row="7" column="8" rowspan="1" colspan="4" > <property> <name>name</name> <cstring>Spacer3</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <spacer row="3" column="1" rowspan="1" colspan="4" > <property> <name>name</name> <cstring>Spacer5</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="5" column="5" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel6</cstring> </property> <property stdset="1"> <name>font</name> <font> <family>adobe-helvetica</family> <bold>1</bold> </font> </property> <property stdset="1"> <name>text</name> <string>$</string> </property> </widget> <spacer row="4" column="6" > <property> <name>name</name> <cstring>Spacer8</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="2" column="0" rowspan="1" colspan="3" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>text</name> <string>Category:</string> </property> </widget> <spacer row="5" column="2" rowspan="1" colspan="3" > <property> <name>name</name> <cstring>Spacer7</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> @@ -475,129 +475,136 @@ <item> <property> <name>text</name> <string>Written Check</string> </property> </item> <item> <property> <name>text</name> <string>Transfer</string> </property> </item> <item> <property> <name>text</name> <string>Credit Card</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>transType</cstring> </property> </widget> <widget row="8" column="0" rowspan="1" colspan="12" > <class>QMultiLineEdit</class> <property stdset="1"> <name>name</name> <cstring>additionalNotes</cstring> </property> </widget> <widget row="0" column="0" rowspan="1" colspan="12" > <class>QButtonGroup</class> <property stdset="1"> <name>name</name> <cstring>ButtonGroup3</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>title</name> <string></string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget row="0" column="1" > <class>QRadioButton</class> <property stdset="1"> <name>name</name> <cstring>deposit</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>1</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string>Deposit</string> </property> </widget> <widget row="0" column="0" > <class>QRadioButton</class> <property stdset="1"> <name>name</name> <cstring>payment</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>1</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string>Payment</string> </property> <property stdset="1"> <name>checked</name> <bool>true</bool> </property> </widget> </grid> </widget> </grid> </widget> <customwidgets> <customwidget> <class>QRestrictedLine</class> <header location="local">qrestrictedline.h</header> <sizehint> <width>-1</width> <height>-1</height> </sizehint> <container>0</container> <sizepolicy> <hordata>5</hordata> <verdata>5</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="649">789c6dd23b0ec2300c00d03da7b0e22d42e9476c88232031222186c80c3074813220c4dd214dddd84dac0e759fe2386e1a07a7e3015c639e6318ef04740b0f70d7d730bccf97fdc7d8be87f8406737c62210606869dbb531f531a57f4a299d03a7e06c11cca1055508412c2889acc2ef425423b34840a645f28244936860d2c265d7923bae8b2f05cb35a91739002d2b5727d535cbe954a43ad1e22f700755caf7407cf4799fe286c47dbe3bf303014167a2</data> </image> </images> +<tabstops> + <tabstop>payment</tabstop> + <tabstop>descriptionCombo</tabstop> + <tabstop>cmbCategory</tabstop> + <tabstop>transType</tabstop> + <tabstop>additionalNotes</tabstop> +</tabstops> </UI> |