Diffstat (limited to 'noncore/apps/checkbook/transaction.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index c94b989..138d0e6 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp | |||
@@ -23,38 +23,39 @@ | |||
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "transaction.h" | 29 | #include "transaction.h" |
30 | #include "traninfo.h" | 30 | #include "traninfo.h" |
31 | #include "cfg.h" | ||
31 | 32 | ||
32 | #include <qpe/datebookmonth.h> | 33 | #include <qpe/datebookmonth.h> |
33 | 34 | ||
34 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
35 | #include <qcombobox.h> | 36 | #include <qcombobox.h> |
36 | #include <qlabel.h> | 37 | #include <qlabel.h> |
37 | #include <qlayout.h> | 38 | #include <qlayout.h> |
38 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
39 | #include <qmultilineedit.h> | 40 | #include <qmultilineedit.h> |
40 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
41 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
42 | 43 | ||
43 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, | 44 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, |
44 | const QString &symbol ) | 45 | Cfg *pCfg ) |
45 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 46 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
46 | { | 47 | { |
47 | QString tempstr = tr( "Transaction for " ); | 48 | QString tempstr = tr( "Transaction for " ); |
48 | tempstr.append( acctname ); | 49 | tempstr.append( acctname ); |
49 | setCaption( tempstr ); | 50 | setCaption( tempstr ); |
50 | 51 | ||
51 | tran = info; | 52 | tran = info; |
52 | currencySymbol = symbol; | 53 | _pCfg=pCfg; |
53 | 54 | ||
54 | QVBoxLayout *vb = new QVBoxLayout( this ); | 55 | QVBoxLayout *vb = new QVBoxLayout( this ); |
55 | 56 | ||
56 | QScrollView *sv = new QScrollView( this ); | 57 | QScrollView *sv = new QScrollView( this ); |
57 | vb->addWidget( sv, 0, 0 ); | 58 | vb->addWidget( sv, 0, 0 ); |
58 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 59 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
59 | sv->setFrameStyle( QFrame::NoFrame ); | 60 | sv->setFrameStyle( QFrame::NoFrame ); |
60 | 61 | ||
@@ -218,52 +219,47 @@ void Transaction::accept() | |||
218 | tran->setWithdrawal( withBtn->isChecked() ); | 219 | tran->setWithdrawal( withBtn->isChecked() ); |
219 | tran->setType( typeList->currentText() ); | 220 | tran->setType( typeList->currentText() ); |
220 | tran->setCategory( catList->currentText() ); | 221 | tran->setCategory( catList->currentText() ); |
221 | bool ok; | 222 | bool ok; |
222 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); | 223 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); |
223 | tran->setFee( feeEdit->text().toFloat( &ok ) ); | 224 | tran->setFee( feeEdit->text().toFloat( &ok ) ); |
224 | tran->setNumber( numEdit->text() ); | 225 | tran->setNumber( numEdit->text() ); |
225 | tran->setNotes( noteEdit->text() ); | 226 | tran->setNotes( noteEdit->text() ); |
226 | 227 | ||
227 | QDialog::accept(); | 228 | QDialog::accept(); |
228 | } | 229 | } |
229 | 230 | ||
230 | void Transaction::slotWithdrawalClicked() | 231 | void Transaction::slotWithdrawalClicked() |
231 | { | 232 | { |
232 | catList->clear(); | 233 | catList->clear(); |
233 | catList->insertItem( tr( "Automobile" ) ); | 234 | CategoryList *pCatList=_pCfg->getCategoryList(); |
234 | catList->insertItem( tr( "Bills" ) ); | 235 | for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) { |
235 | catList->insertItem( tr( "CDs" ) ); | 236 | if( !pCat->isIncome() ) |
236 | catList->insertItem( tr( "Clothing" ) ); | 237 | catList->insertItem( pCat->getName() ); |
237 | catList->insertItem( tr( "Computer" ) ); | 238 | } |
238 | catList->insertItem( tr( "DVDs" ) ); | 239 | catList->setCurrentItem(0); |
239 | catList->insertItem( tr( "Electronics" ) ); | 240 | |
240 | catList->insertItem( tr( "Entertainment" ) ); | ||
241 | catList->insertItem( tr( "Food" ) ); | ||
242 | catList->insertItem( tr( "Gasoline" ) ); | ||
243 | catList->insertItem( tr( "Misc" ) ); | ||
244 | catList->insertItem( tr( "Movies" ) ); | ||
245 | catList->insertItem( tr( "Rent" ) ); | ||
246 | catList->insertItem( tr( "Travel" ) ); | ||
247 | catList->setCurrentItem( 0 ); | ||
248 | typeList->clear(); | 241 | typeList->clear(); |
249 | typeList->insertItem( tr( "Debit Charge" ) ); | 242 | typeList->insertItem( tr( "Debit Charge" ) ); |
250 | typeList->insertItem( tr( "Written Check" ) ); | 243 | typeList->insertItem( tr( "Written Check" ) ); |
251 | typeList->insertItem( tr( "Transfer" ) ); | 244 | typeList->insertItem( tr( "Transfer" ) ); |
252 | typeList->insertItem( tr( "Credit Card" ) ); | 245 | typeList->insertItem( tr( "Credit Card" ) ); |
253 | } | 246 | } |
254 | 247 | ||
255 | void Transaction::slotDepositClicked() | 248 | void Transaction::slotDepositClicked() |
256 | { | 249 | { |
257 | catList->clear(); | 250 | catList->clear(); |
258 | catList->insertItem( tr( "Work" ) ); | 251 | CategoryList *pCatList=_pCfg->getCategoryList(); |
259 | catList->insertItem( tr( "Family Member" ) ); | 252 | for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) { |
260 | catList->insertItem( tr( "Misc. Credit" ) ); | 253 | if( pCat->isIncome() ) |
261 | catList->setCurrentItem( 0 ); | 254 | catList->insertItem( pCat->getName() ); |
255 | } | ||
256 | catList->setCurrentItem( 0 ); | ||
257 | |||
262 | typeList->clear(); | 258 | typeList->clear(); |
263 | typeList->insertItem( tr( "Written Check" ) ); | 259 | typeList->insertItem( tr( "Written Check" ) ); |
264 | typeList->insertItem( tr( "Automatic Payment" ) ); | 260 | typeList->insertItem( tr( "Automatic Payment" ) ); |
265 | typeList->insertItem( tr( "Transfer" ) ); | 261 | typeList->insertItem( tr( "Transfer" ) ); |
266 | typeList->insertItem( tr( "Cash" ) ); | 262 | typeList->insertItem( tr( "Cash" ) ); |
267 | } | 263 | } |
268 | 264 | ||
269 | void Transaction::slotDateChanged( int y, int m, int d ) | 265 | void Transaction::slotDateChanged( int y, int m, int d ) |