author | drw <drw> | 2002-10-26 19:12:24 (UTC) |
---|---|---|
committer | drw <drw> | 2002-10-26 19:12:24 (UTC) |
commit | ff2c581b50252714fb4621d088cbf0961ed23f2b (patch) (unidiff) | |
tree | eeae9967322a8ec4aa6b86d044c4b7ac0c700785 | |
parent | 0929d2489a2ae219fc6ab02f5fe0678a21f50190 (diff) | |
download | opie-ff2c581b50252714fb4621d088cbf0961ed23f2b.zip opie-ff2c581b50252714fb4621d088cbf0961ed23f2b.tar.gz opie-ff2c581b50252714fb4621d088cbf0961ed23f2b.tar.bz2 |
Use new pics for checkbook
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/checkbook/opie-checkbook.control | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index ee65784..4b81c6d 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -1,346 +1,346 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
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 "checkbook.h" | 29 | #include "checkbook.h" |
30 | #include "transaction.h" | 30 | #include "transaction.h" |
31 | 31 | ||
32 | #include <opie/otabwidget.h> | 32 | #include <opie/otabwidget.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/qpemessagebox.h> | 35 | #include <qpe/qpemessagebox.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | 37 | ||
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
43 | #include <qlistview.h> | 43 | #include <qlistview.h> |
44 | #include <qmultilineedit.h> | 44 | #include <qmultilineedit.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
47 | #include <qwidget.h> | 47 | #include <qwidget.h> |
48 | 48 | ||
49 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) | 49 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) |
50 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 50 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
51 | { | 51 | { |
52 | name = n; | 52 | name = n; |
53 | filename = fd + name + ".qcb"; | 53 | filename = fd + name + ".qcb"; |
54 | filedir = fd; | 54 | filedir = fd; |
55 | currencySymbol = symbol; | 55 | currencySymbol = symbol; |
56 | currBalance = 0.0; | 56 | currBalance = 0.0; |
57 | 57 | ||
58 | if ( name != "" ) | 58 | if ( name != "" ) |
59 | { | 59 | { |
60 | setCaption( name + " - " + tr( "Checkbook" ) ); | 60 | setCaption( name + " - " + tr( "Checkbook" ) ); |
61 | } | 61 | } |
62 | else | 62 | else |
63 | { | 63 | { |
64 | setCaption( tr( "New checkbook" ) ); | 64 | setCaption( tr( "New checkbook" ) ); |
65 | } | 65 | } |
66 | 66 | ||
67 | // Setup layout to make everything pretty | 67 | // Setup layout to make everything pretty |
68 | QVBoxLayout *layout = new QVBoxLayout( this ); | 68 | QVBoxLayout *layout = new QVBoxLayout( this ); |
69 | layout->setMargin( 2 ); | 69 | layout->setMargin( 2 ); |
70 | layout->setSpacing( 4 ); | 70 | layout->setSpacing( 4 ); |
71 | 71 | ||
72 | // Setup tabs for all info | 72 | // Setup tabs for all info |
73 | mainWidget = new OTabWidget( this ); | 73 | mainWidget = new OTabWidget( this ); |
74 | layout->addWidget( mainWidget ); | 74 | layout->addWidget( mainWidget ); |
75 | 75 | ||
76 | mainWidget->addTab( initInfo(), "help_icon", tr( "Info" ) ); | 76 | mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); |
77 | mainWidget->addTab( initTransactions(), "Spreadsheet", tr( "Transactions" ) ); | 77 | mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); |
78 | mainWidget->addTab( initCharts(), "DocumentTypePowerPoint", tr( "Charts" ) ); | 78 | mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); |
79 | mainWidget->setCurrentTab( tr( "Info" ) ); | 79 | mainWidget->setCurrentTab( tr( "Info" ) ); |
80 | 80 | ||
81 | // Load checkbook information | 81 | // Load checkbook information |
82 | loadCheckbook(); | 82 | loadCheckbook(); |
83 | } | 83 | } |
84 | 84 | ||
85 | Checkbook::~Checkbook() | 85 | Checkbook::~Checkbook() |
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | const QString &Checkbook::getName() | 89 | const QString &Checkbook::getName() |
90 | { | 90 | { |
91 | return( name ); | 91 | return( name ); |
92 | } | 92 | } |
93 | 93 | ||
94 | QWidget *Checkbook::initInfo() | 94 | QWidget *Checkbook::initInfo() |
95 | { | 95 | { |
96 | QWidget *control = new QWidget( mainWidget ); | 96 | QWidget *control = new QWidget( mainWidget ); |
97 | 97 | ||
98 | QVBoxLayout *vb = new QVBoxLayout( control ); | 98 | QVBoxLayout *vb = new QVBoxLayout( control ); |
99 | 99 | ||
100 | QScrollView *sv = new QScrollView( control ); | 100 | QScrollView *sv = new QScrollView( control ); |
101 | vb->addWidget( sv, 0, 0 ); | 101 | vb->addWidget( sv, 0, 0 ); |
102 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 102 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
103 | sv->setFrameStyle( QFrame::NoFrame ); | 103 | sv->setFrameStyle( QFrame::NoFrame ); |
104 | 104 | ||
105 | QWidget *container = new QWidget( sv->viewport() ); | 105 | QWidget *container = new QWidget( sv->viewport() ); |
106 | sv->addChild( container ); | 106 | sv->addChild( container ); |
107 | 107 | ||
108 | QGridLayout *layout = new QGridLayout( container ); | 108 | QGridLayout *layout = new QGridLayout( container ); |
109 | layout->setSpacing( 2 ); | 109 | layout->setSpacing( 2 ); |
110 | layout->setMargin( 4 ); | 110 | layout->setMargin( 4 ); |
111 | 111 | ||
112 | // Account name | 112 | // Account name |
113 | QLabel *label = new QLabel( tr( "Name:" ), container ); | 113 | QLabel *label = new QLabel( tr( "Name:" ), container ); |
114 | QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); | 114 | QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); |
115 | layout->addWidget( label, 0, 0 ); | 115 | layout->addWidget( label, 0, 0 ); |
116 | nameEdit = new QLineEdit( container ); | 116 | nameEdit = new QLineEdit( container ); |
117 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); | 117 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); |
118 | connect( nameEdit, SIGNAL( textChanged( const QString & ) ), | 118 | connect( nameEdit, SIGNAL( textChanged( const QString & ) ), |
119 | this, SLOT( slotNameChanged( const QString & ) ) ); | 119 | this, SLOT( slotNameChanged( const QString & ) ) ); |
120 | layout->addWidget( nameEdit, 0, 1 ); | 120 | layout->addWidget( nameEdit, 0, 1 ); |
121 | 121 | ||
122 | // Type of account | 122 | // Type of account |
123 | label = new QLabel( tr( "Type:" ), container ); | 123 | label = new QLabel( tr( "Type:" ), container ); |
124 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); | 124 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); |
125 | layout->addWidget( label, 1, 0 ); | 125 | layout->addWidget( label, 1, 0 ); |
126 | typeList = new QComboBox( container ); | 126 | typeList = new QComboBox( container ); |
127 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); | 127 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); |
128 | typeList->insertItem( tr( "Savings" ) ); // 0 | 128 | typeList->insertItem( tr( "Savings" ) ); // 0 |
129 | typeList->insertItem( tr( "Checking" ) ); // 1 | 129 | typeList->insertItem( tr( "Checking" ) ); // 1 |
130 | typeList->insertItem( tr( "CD" ) ); // 2 | 130 | typeList->insertItem( tr( "CD" ) ); // 2 |
131 | typeList->insertItem( tr( "Money market" ) );// 3 | 131 | typeList->insertItem( tr( "Money market" ) );// 3 |
132 | typeList->insertItem( tr( "Mutual fund" ) );// 4 | 132 | typeList->insertItem( tr( "Mutual fund" ) );// 4 |
133 | typeList->insertItem( tr( "Other" ) ); // 5 | 133 | typeList->insertItem( tr( "Other" ) ); // 5 |
134 | layout->addWidget( typeList, 1, 1 ); | 134 | layout->addWidget( typeList, 1, 1 ); |
135 | 135 | ||
136 | // Bank/institution name | 136 | // Bank/institution name |
137 | label = new QLabel( tr( "Bank:" ), container ); | 137 | label = new QLabel( tr( "Bank:" ), container ); |
138 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); | 138 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); |
139 | layout->addWidget( label, 2, 0 ); | 139 | layout->addWidget( label, 2, 0 ); |
140 | bankEdit = new QLineEdit( container ); | 140 | bankEdit = new QLineEdit( container ); |
141 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); | 141 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); |
142 | layout->addWidget( bankEdit, 2, 1 ); | 142 | layout->addWidget( bankEdit, 2, 1 ); |
143 | 143 | ||
144 | // Account number | 144 | // Account number |
145 | label = new QLabel( tr( "Account number:" ), container ); | 145 | label = new QLabel( tr( "Account number:" ), container ); |
146 | QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); | 146 | QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); |
147 | layout->addWidget( label, 3, 0 ); | 147 | layout->addWidget( label, 3, 0 ); |
148 | acctNumEdit = new QLineEdit( container ); | 148 | acctNumEdit = new QLineEdit( container ); |
149 | QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); | 149 | QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); |
150 | layout->addWidget( acctNumEdit, 3, 1 ); | 150 | layout->addWidget( acctNumEdit, 3, 1 ); |
151 | 151 | ||
152 | // PIN number | 152 | // PIN number |
153 | label = new QLabel( tr( "PIN number:" ), container ); | 153 | label = new QLabel( tr( "PIN number:" ), container ); |
154 | QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); | 154 | QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); |
155 | layout->addWidget( label, 4, 0 ); | 155 | layout->addWidget( label, 4, 0 ); |
156 | pinNumEdit = new QLineEdit( container ); | 156 | pinNumEdit = new QLineEdit( container ); |
157 | QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); | 157 | QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); |
158 | layout->addWidget( pinNumEdit, 4, 1 ); | 158 | layout->addWidget( pinNumEdit, 4, 1 ); |
159 | 159 | ||
160 | // Starting balance | 160 | // Starting balance |
161 | label = new QLabel( tr( "Starting balance:" ), container ); | 161 | label = new QLabel( tr( "Starting balance:" ), container ); |
162 | QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); | 162 | QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); |
163 | layout->addWidget( label, 5, 0 ); | 163 | layout->addWidget( label, 5, 0 ); |
164 | balanceEdit = new QLineEdit( container ); | 164 | balanceEdit = new QLineEdit( container ); |
165 | QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); | 165 | QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); |
166 | connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), | 166 | connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), |
167 | this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); | 167 | this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); |
168 | layout->addWidget( balanceEdit, 5, 1 ); | 168 | layout->addWidget( balanceEdit, 5, 1 ); |
169 | 169 | ||
170 | // Notes | 170 | // Notes |
171 | label = new QLabel( tr( "Notes:" ), container ); | 171 | label = new QLabel( tr( "Notes:" ), container ); |
172 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); | 172 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); |
173 | layout->addWidget( label, 6, 0 ); | 173 | layout->addWidget( label, 6, 0 ); |
174 | notesEdit = new QMultiLineEdit( container ); | 174 | notesEdit = new QMultiLineEdit( container ); |
175 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); | 175 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); |
176 | notesEdit->setMaximumHeight( 85 ); | 176 | notesEdit->setMaximumHeight( 85 ); |
177 | layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); | 177 | layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); |
178 | 178 | ||
179 | return control; | 179 | return control; |
180 | } | 180 | } |
181 | 181 | ||
182 | QWidget *Checkbook::initTransactions() | 182 | QWidget *Checkbook::initTransactions() |
183 | { | 183 | { |
184 | QWidget *control = new QWidget( mainWidget ); | 184 | QWidget *control = new QWidget( mainWidget ); |
185 | 185 | ||
186 | QGridLayout *layout = new QGridLayout( control ); | 186 | QGridLayout *layout = new QGridLayout( control ); |
187 | layout->setSpacing( 2 ); | 187 | layout->setSpacing( 2 ); |
188 | layout->setMargin( 4 ); | 188 | layout->setMargin( 4 ); |
189 | 189 | ||
190 | balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), | 190 | balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), |
191 | control ); | 191 | control ); |
192 | QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); | 192 | QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); |
193 | layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); | 193 | layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); |
194 | 194 | ||
195 | tranTable = new QListView( control ); | 195 | tranTable = new QListView( control ); |
196 | QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); | 196 | QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); |
197 | tranTable->addColumn( tr( "ID" ) ); | 197 | tranTable->addColumn( tr( "ID" ) ); |
198 | tranTable->addColumn( tr( "Date" ) ); | 198 | tranTable->addColumn( tr( "Date" ) ); |
199 | tranTable->addColumn( tr( "Description" ) ); | 199 | tranTable->addColumn( tr( "Description" ) ); |
200 | int colnum = tranTable->addColumn( tr( "Amount" ) ); | 200 | int colnum = tranTable->addColumn( tr( "Amount" ) ); |
201 | tranTable->setColumnAlignment( colnum, Qt::AlignRight ); | 201 | tranTable->setColumnAlignment( colnum, Qt::AlignRight ); |
202 | tranTable->setAllColumnsShowFocus( TRUE ); | 202 | tranTable->setAllColumnsShowFocus( TRUE ); |
203 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); | 203 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); |
204 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); | 204 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); |
205 | connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), | 205 | connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), |
206 | this, SLOT( slotEditTran() ) ); | 206 | this, SLOT( slotEditTran() ) ); |
207 | 207 | ||
208 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); | 208 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); |
209 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); | 209 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); |
210 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); | 210 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); |
211 | layout->addWidget( btn, 2, 0 ); | 211 | layout->addWidget( btn, 2, 0 ); |
212 | 212 | ||
213 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); | 213 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); |
214 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); | 214 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); |
215 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); | 215 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); |
216 | layout->addWidget( btn, 2, 1 ); | 216 | layout->addWidget( btn, 2, 1 ); |
217 | 217 | ||
218 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); | 218 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); |
219 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); | 219 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); |
220 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); | 220 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); |
221 | layout->addWidget( btn, 2, 2 ); | 221 | layout->addWidget( btn, 2, 2 ); |
222 | 222 | ||
223 | return( control ); | 223 | return( control ); |
224 | } | 224 | } |
225 | 225 | ||
226 | QWidget *Checkbook::initCharts() | 226 | QWidget *Checkbook::initCharts() |
227 | { | 227 | { |
228 | QWidget *control = new QWidget( mainWidget ); | 228 | QWidget *control = new QWidget( mainWidget ); |
229 | 229 | ||
230 | QGridLayout *layout = new QGridLayout( control ); | 230 | QGridLayout *layout = new QGridLayout( control ); |
231 | layout->setSpacing( 2 ); | 231 | layout->setSpacing( 2 ); |
232 | layout->setMargin( 4 ); | 232 | layout->setMargin( 4 ); |
233 | 233 | ||
234 | /* | 234 | /* |
235 | QLabel *label = new QLabel( control ); | 235 | QLabel *label = new QLabel( control ); |
236 | label->setText( tr( "Graph type:" ) ); | 236 | label->setText( tr( "Graph type:" ) ); |
237 | layout->addWidget( label, 0, 0 ); | 237 | layout->addWidget( label, 0, 0 ); |
238 | graphList = new QComboBox( control ); | 238 | graphList = new QComboBox( control ); |
239 | graphList->insertItem( tr( "By category" ) ); | 239 | graphList->insertItem( tr( "By category" ) ); |
240 | graphList->insertItem( tr( "..." ) ); | 240 | graphList->insertItem( tr( "..." ) ); |
241 | graphList->insertItem( tr( "..." ) ); | 241 | graphList->insertItem( tr( "..." ) ); |
242 | layout->addWidget( graphList, 0, 1 ); | 242 | layout->addWidget( graphList, 0, 1 ); |
243 | */ | 243 | */ |
244 | 244 | ||
245 | QWidget *graphWidget = new QWidget( control ); | 245 | QWidget *graphWidget = new QWidget( control ); |
246 | QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) ); | 246 | QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) ); |
247 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); | 247 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); |
248 | graphWidget->setBackgroundMode( QWidget::PaletteBase ); | 248 | graphWidget->setBackgroundMode( QWidget::PaletteBase ); |
249 | 249 | ||
250 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Draw" ), control ); | 250 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); |
251 | QWhatsThis::add( btn, tr( "Click here to draw the graph." ) ); | 251 | QWhatsThis::add( btn, tr( "Click here to draw the graph." ) ); |
252 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); | 252 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); |
253 | layout->addWidget( btn, 1, 1 ); | 253 | layout->addWidget( btn, 1, 1 ); |
254 | 254 | ||
255 | return control; | 255 | return control; |
256 | } | 256 | } |
257 | 257 | ||
258 | void Checkbook::loadCheckbook() | 258 | void Checkbook::loadCheckbook() |
259 | { | 259 | { |
260 | transactions.clear(); | 260 | transactions.clear(); |
261 | 261 | ||
262 | Config config(filename, Config::File); | 262 | Config config(filename, Config::File); |
263 | 263 | ||
264 | // Load info | 264 | // Load info |
265 | config.setGroup( "Account" ); | 265 | config.setGroup( "Account" ); |
266 | nameEdit->setText( name ); | 266 | nameEdit->setText( name ); |
267 | QString temptext = config.readEntry( "Type" ); | 267 | QString temptext = config.readEntry( "Type" ); |
268 | int i = typeList->count(); | 268 | int i = typeList->count(); |
269 | while ( i > 0 ) | 269 | while ( i > 0 ) |
270 | { | 270 | { |
271 | i--; | 271 | i--; |
272 | typeList->setCurrentItem( i ); | 272 | typeList->setCurrentItem( i ); |
273 | if ( typeList->currentText() == temptext ) | 273 | if ( typeList->currentText() == temptext ) |
274 | { | 274 | { |
275 | break; | 275 | break; |
276 | } | 276 | } |
277 | } | 277 | } |
278 | bankEdit->setText( config.readEntry( "Bank", "" ) ); | 278 | bankEdit->setText( config.readEntry( "Bank", "" ) ); |
279 | acctNumEdit->setText( config.readEntry( "Number", "" ) ); | 279 | acctNumEdit->setText( config.readEntry( "Number", "" ) ); |
280 | pinNumEdit->setText( config.readEntry( "PINNumber", "" ) ); | 280 | pinNumEdit->setText( config.readEntry( "PINNumber", "" ) ); |
281 | balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); | 281 | balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); |
282 | notesEdit->setText( config.readEntry( "Notes", "" ) ); | 282 | notesEdit->setText( config.readEntry( "Notes", "" ) ); |
283 | 283 | ||
284 | bool ok; | 284 | bool ok; |
285 | currBalance = balanceEdit->text().toFloat( &ok ); | 285 | currBalance = balanceEdit->text().toFloat( &ok ); |
286 | startBalance = currBalance; | 286 | startBalance = currBalance; |
287 | 287 | ||
288 | // Load transactions | 288 | // Load transactions |
289 | TranInfo *tran; | 289 | TranInfo *tran; |
290 | QString trandesc = ""; | 290 | QString trandesc = ""; |
291 | float amount; | 291 | float amount; |
292 | QString stramount; | 292 | QString stramount; |
293 | for ( int i = 1; trandesc != QString::null; i++ ) | 293 | for ( int i = 1; trandesc != QString::null; i++ ) |
294 | { | 294 | { |
295 | tran = new TranInfo( config, i ); | 295 | tran = new TranInfo( config, i ); |
296 | trandesc = tran->desc(); | 296 | trandesc = tran->desc(); |
297 | if ( trandesc != QString::null ) | 297 | if ( trandesc != QString::null ) |
298 | { | 298 | { |
299 | currBalance -= tran->fee(); | 299 | currBalance -= tran->fee(); |
300 | amount = tran->amount(); | 300 | amount = tran->amount(); |
301 | if ( tran->withdrawal() ) | 301 | if ( tran->withdrawal() ) |
302 | { | 302 | { |
303 | amount *= -1; | 303 | amount *= -1; |
304 | } | 304 | } |
305 | currBalance += amount; | 305 | currBalance += amount; |
306 | stramount.sprintf( "%c%.2f", currencySymbol, amount ); | 306 | stramount.sprintf( "%c%.2f", currencySymbol, amount ); |
307 | 307 | ||
308 | // Add to transaction list | 308 | // Add to transaction list |
309 | transactions.append( tran ); | 309 | transactions.append( tran ); |
310 | 310 | ||
311 | // Add to transaction table | 311 | // Add to transaction table |
312 | QDate date = tran->date(); | 312 | QDate date = tran->date(); |
313 | QString datestr = QString::number( date.month() ) + "/" + | 313 | QString datestr = QString::number( date.month() ) + "/" + |
314 | QString::number( date.day() ) + "/" + | 314 | QString::number( date.day() ) + "/" + |
315 | QString::number( date.year() ); | 315 | QString::number( date.year() ); |
316 | ( void ) new QListViewItem( tranTable, QString::number( i ), datestr, | 316 | ( void ) new QListViewItem( tranTable, QString::number( i ), datestr, |
317 | trandesc, stramount ); | 317 | trandesc, stramount ); |
318 | } | 318 | } |
319 | else | 319 | else |
320 | { | 320 | { |
321 | delete tran; | 321 | delete tran; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); | 324 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); |
325 | 325 | ||
326 | highTranNum = transactions.count(); | 326 | highTranNum = transactions.count(); |
327 | } | 327 | } |
328 | 328 | ||
329 | void Checkbook::adjustBalance( float amount ) | 329 | void Checkbook::adjustBalance( float amount ) |
330 | { | 330 | { |
331 | currBalance += amount; | 331 | currBalance += amount; |
332 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); | 332 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); |
333 | 333 | ||
334 | } | 334 | } |
335 | 335 | ||
336 | TranInfo *Checkbook::findTranByID( int id ) | 336 | TranInfo *Checkbook::findTranByID( int id ) |
337 | { | 337 | { |
338 | TranInfo *traninfo = transactions.first(); | 338 | TranInfo *traninfo = transactions.first(); |
339 | while ( traninfo && traninfo->id() != id ) | 339 | while ( traninfo && traninfo->id() != id ) |
340 | { | 340 | { |
341 | traninfo = transactions.next(); | 341 | traninfo = transactions.next(); |
342 | } | 342 | } |
343 | return( traninfo ); | 343 | return( traninfo ); |
344 | } | 344 | } |
345 | 345 | ||
346 | void Checkbook::accept() | 346 | void Checkbook::accept() |
diff --git a/noncore/apps/checkbook/opie-checkbook.control b/noncore/apps/checkbook/opie-checkbook.control index f8e14ca..7bde1db 100644 --- a/noncore/apps/checkbook/opie-checkbook.control +++ b/noncore/apps/checkbook/opie-checkbook.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook/checkbook.png | 1 | Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: applications | 3 | Section: applications |
4 | Maintainer: drw <drw@handhelds.org> | 4 | Maintainer: Dan Williams <williamsdr@acm.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) |
8 | Description: Checkbook keeping program. | 8 | Description: Checkbook keeping program. |
9 | The checkbook accounting program for the Opie environment. | 9 | The checkbook accounting program for the Opie environment. |