summaryrefslogtreecommitdiff
authordrw <drw>2002-11-30 18:22:59 (UTC)
committer drw <drw>2002-11-30 18:22:59 (UTC)
commit197b74a6193151cca8b7f5f725fb19098cb76eb2 (patch) (unidiff)
treed2a3e190c3d404ba952c7645eb195de58e2b2d2e
parent6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a (diff)
downloadopie-197b74a6193151cca8b7f5f725fb19098cb76eb2.zip
opie-197b74a6193151cca8b7f5f725fb19098cb76eb2.tar.gz
opie-197b74a6193151cca8b7f5f725fb19098cb76eb2.tar.bz2
Made checkbook transaction list prettier & updated contact info
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp93
-rw-r--r--noncore/apps/checkbook/checkbook.h24
-rw-r--r--noncore/apps/checkbook/graph.cpp2
-rw-r--r--noncore/apps/checkbook/graph.h2
-rw-r--r--noncore/apps/checkbook/graphinfo.cpp2
-rw-r--r--noncore/apps/checkbook/graphinfo.h2
-rw-r--r--noncore/apps/checkbook/main.cpp2
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp2
-rw-r--r--noncore/apps/checkbook/mainwindow.h2
-rw-r--r--noncore/apps/checkbook/opie-checkbook.control2
-rw-r--r--noncore/apps/checkbook/traninfo.cpp4
-rw-r--r--noncore/apps/checkbook/traninfo.h2
-rw-r--r--noncore/apps/checkbook/transaction.cpp2
-rw-r--r--noncore/apps/checkbook/transaction.h2
14 files changed, 114 insertions, 29 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index ab25516..09b0b46 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -1,596 +1,661 @@
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 <drw@handhelds.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#include "graph.h" 31#include "graph.h"
32#include "graphinfo.h" 32#include "graphinfo.h"
33 33
34#include <opie/otabwidget.h> 34#include <opie/otabwidget.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qpemessagebox.h> 37#include <qpe/qpemessagebox.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qcombobox.h> 40#include <qcombobox.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qfontmetrics.h>
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qlayout.h> 44#include <qlayout.h>
44#include <qlineedit.h> 45#include <qlineedit.h>
45#include <qlistview.h>
46#include <qmultilineedit.h> 46#include <qmultilineedit.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qwhatsthis.h> 48#include <qwhatsthis.h>
49#include <qwidget.h> 49#include <qwidget.h>
50 50
51Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) 51Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol )
52 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 52 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
53{ 53{
54 name = n; 54 name = n;
55 filename = fd; 55 filename = fd;
56 filename.append( name ); 56 filename.append( name );
57 filename.append( ".qcb" ); 57 filename.append( ".qcb" );
58 filedir = fd; 58 filedir = fd;
59 currencySymbol = symbol; 59 currencySymbol = symbol;
60 currBalance = 0.0; 60 currBalance = 0.0;
61 61
62 if ( name != "" ) 62 if ( name != "" )
63 { 63 {
64 QString tempstr = name; 64 QString tempstr = name;
65 tempstr.append( " - " ); 65 tempstr.append( " - " );
66 tempstr.append( tr( "Checkbook" ) ); 66 tempstr.append( tr( "Checkbook" ) );
67 setCaption( tempstr ); 67 setCaption( tempstr );
68 } 68 }
69 else 69 else
70 { 70 {
71 setCaption( tr( "New checkbook" ) ); 71 setCaption( tr( "New checkbook" ) );
72 } 72 }
73 73
74 // Setup layout to make everything pretty 74 // Setup layout to make everything pretty
75 QVBoxLayout *layout = new QVBoxLayout( this ); 75 QVBoxLayout *layout = new QVBoxLayout( this );
76 layout->setMargin( 2 ); 76 layout->setMargin( 2 );
77 layout->setSpacing( 4 ); 77 layout->setSpacing( 4 );
78 78
79 // Setup tabs for all info 79 // Setup tabs for all info
80 mainWidget = new OTabWidget( this ); 80 mainWidget = new OTabWidget( this );
81 layout->addWidget( mainWidget ); 81 layout->addWidget( mainWidget );
82 82
83 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); 83 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
84 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); 84 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
85 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); 85 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
86 mainWidget->setCurrentTab( tr( "Info" ) ); 86 mainWidget->setCurrentTab( tr( "Info" ) );
87 87
88 // Load checkbook information 88 // Load checkbook information
89 loadCheckbook(); 89 loadCheckbook();
90} 90}
91 91
92Checkbook::~Checkbook() 92Checkbook::~Checkbook()
93{ 93{
94} 94}
95 95
96const QString &Checkbook::getName() 96const QString &Checkbook::getName()
97{ 97{
98 return( name ); 98 return( name );
99} 99}
100 100
101QWidget *Checkbook::initInfo() 101QWidget *Checkbook::initInfo()
102{ 102{
103 QWidget *control = new QWidget( mainWidget ); 103 QWidget *control = new QWidget( mainWidget );
104 104
105 QVBoxLayout *vb = new QVBoxLayout( control ); 105 QVBoxLayout *vb = new QVBoxLayout( control );
106 106
107 QScrollView *sv = new QScrollView( control ); 107 QScrollView *sv = new QScrollView( control );
108 vb->addWidget( sv, 0, 0 ); 108 vb->addWidget( sv, 0, 0 );
109 sv->setResizePolicy( QScrollView::AutoOneFit ); 109 sv->setResizePolicy( QScrollView::AutoOneFit );
110 sv->setFrameStyle( QFrame::NoFrame ); 110 sv->setFrameStyle( QFrame::NoFrame );
111 111
112 QWidget *container = new QWidget( sv->viewport() ); 112 QWidget *container = new QWidget( sv->viewport() );
113 sv->addChild( container ); 113 sv->addChild( container );
114 114
115 QGridLayout *layout = new QGridLayout( container ); 115 QGridLayout *layout = new QGridLayout( container );
116 layout->setSpacing( 2 ); 116 layout->setSpacing( 2 );
117 layout->setMargin( 4 ); 117 layout->setMargin( 4 );
118 118
119 // Account name 119 // Account name
120 QLabel *label = new QLabel( tr( "Name:" ), container ); 120 QLabel *label = new QLabel( tr( "Name:" ), container );
121 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); 121 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
122 layout->addWidget( label, 0, 0 ); 122 layout->addWidget( label, 0, 0 );
123 nameEdit = new QLineEdit( container ); 123 nameEdit = new QLineEdit( container );
124 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); 124 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
125 connect( nameEdit, SIGNAL( textChanged( const QString & ) ), 125 connect( nameEdit, SIGNAL( textChanged( const QString & ) ),
126 this, SLOT( slotNameChanged( const QString & ) ) ); 126 this, SLOT( slotNameChanged( const QString & ) ) );
127 layout->addWidget( nameEdit, 0, 1 ); 127 layout->addWidget( nameEdit, 0, 1 );
128 128
129 // Type of account 129 // Type of account
130 label = new QLabel( tr( "Type:" ), container ); 130 label = new QLabel( tr( "Type:" ), container );
131 QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); 131 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
132 layout->addWidget( label, 1, 0 ); 132 layout->addWidget( label, 1, 0 );
133 typeList = new QComboBox( container ); 133 typeList = new QComboBox( container );
134 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); 134 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
135 typeList->insertItem( tr( "Savings" ) ); // 0 135 typeList->insertItem( tr( "Savings" ) ); // 0
136 typeList->insertItem( tr( "Checking" ) ); // 1 136 typeList->insertItem( tr( "Checking" ) ); // 1
137 typeList->insertItem( tr( "CD" ) ); // 2 137 typeList->insertItem( tr( "CD" ) ); // 2
138 typeList->insertItem( tr( "Money market" ) );// 3 138 typeList->insertItem( tr( "Money market" ) );// 3
139 typeList->insertItem( tr( "Mutual fund" ) );// 4 139 typeList->insertItem( tr( "Mutual fund" ) );// 4
140 typeList->insertItem( tr( "Other" ) ); // 5 140 typeList->insertItem( tr( "Other" ) ); // 5
141 layout->addWidget( typeList, 1, 1 ); 141 layout->addWidget( typeList, 1, 1 );
142 142
143 // Bank/institution name 143 // Bank/institution name
144 label = new QLabel( tr( "Bank:" ), container ); 144 label = new QLabel( tr( "Bank:" ), container );
145 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); 145 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
146 layout->addWidget( label, 2, 0 ); 146 layout->addWidget( label, 2, 0 );
147 bankEdit = new QLineEdit( container ); 147 bankEdit = new QLineEdit( container );
148 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); 148 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
149 layout->addWidget( bankEdit, 2, 1 ); 149 layout->addWidget( bankEdit, 2, 1 );
150 150
151 // Account number 151 // Account number
152 label = new QLabel( tr( "Account number:" ), container ); 152 label = new QLabel( tr( "Account number:" ), container );
153 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); 153 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
154 layout->addWidget( label, 3, 0 ); 154 layout->addWidget( label, 3, 0 );
155 acctNumEdit = new QLineEdit( container ); 155 acctNumEdit = new QLineEdit( container );
156 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); 156 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
157 layout->addWidget( acctNumEdit, 3, 1 ); 157 layout->addWidget( acctNumEdit, 3, 1 );
158 158
159 // PIN number 159 // PIN number
160 label = new QLabel( tr( "PIN number:" ), container ); 160 label = new QLabel( tr( "PIN number:" ), container );
161 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); 161 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
162 layout->addWidget( label, 4, 0 ); 162 layout->addWidget( label, 4, 0 );
163 pinNumEdit = new QLineEdit( container ); 163 pinNumEdit = new QLineEdit( container );
164 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); 164 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
165 layout->addWidget( pinNumEdit, 4, 1 ); 165 layout->addWidget( pinNumEdit, 4, 1 );
166 166
167 // Starting balance 167 // Starting balance
168 label = new QLabel( tr( "Starting balance:" ), container ); 168 label = new QLabel( tr( "Starting balance:" ), container );
169 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); 169 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
170 layout->addWidget( label, 5, 0 ); 170 layout->addWidget( label, 5, 0 );
171 balanceEdit = new QLineEdit( container ); 171 balanceEdit = new QLineEdit( container );
172 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); 172 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
173 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), 173 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ),
174 this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); 174 this, SLOT( slotStartingBalanceChanged( const QString & ) ) );
175 layout->addWidget( balanceEdit, 5, 1 ); 175 layout->addWidget( balanceEdit, 5, 1 );
176 176
177 // Notes 177 // Notes
178 label = new QLabel( tr( "Notes:" ), container ); 178 label = new QLabel( tr( "Notes:" ), container );
179 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); 179 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
180 layout->addWidget( label, 6, 0 ); 180 layout->addWidget( label, 6, 0 );
181 notesEdit = new QMultiLineEdit( container ); 181 notesEdit = new QMultiLineEdit( container );
182 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); 182 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
183 notesEdit->setMaximumHeight( 85 ); 183 notesEdit->setMaximumHeight( 85 );
184 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); 184 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 );
185 185
186 return control; 186 return control;
187} 187}
188 188
189QWidget *Checkbook::initTransactions() 189QWidget *Checkbook::initTransactions()
190{ 190{
191 QWidget *control = new QWidget( mainWidget ); 191 QWidget *control = new QWidget( mainWidget );
192 192
193 QGridLayout *layout = new QGridLayout( control ); 193 QGridLayout *layout = new QGridLayout( control );
194 layout->setSpacing( 2 ); 194 layout->setSpacing( 2 );
195 layout->setMargin( 4 ); 195 layout->setMargin( 4 );
196 196
197 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), 197 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ),
198 control ); 198 control );
199 QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); 199 QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) );
200 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); 200 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 );
201 201
202 tranTable = new QListView( control ); 202 tranTable = new QListView( control );
203 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." ) ); 203 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." ) );
204 tranTable->addColumn( tr( "ID" ) ); 204 tranTable->addColumn( tr( "Num" ) );
205 tranTable->addColumn( tr( "Date" ) ); 205 tranTable->addColumn( tr( "Date" ) );
206 //tranTable->addColumn( tr( "Cleared" ) );
206 tranTable->addColumn( tr( "Description" ) ); 207 tranTable->addColumn( tr( "Description" ) );
207 int colnum = tranTable->addColumn( tr( "Amount" ) ); 208 int colnum = tranTable->addColumn( tr( "Amount" ) );
208 tranTable->setColumnAlignment( colnum, Qt::AlignRight ); 209 tranTable->setColumnAlignment( colnum, Qt::AlignRight );
209 tranTable->setAllColumnsShowFocus( TRUE ); 210 tranTable->setAllColumnsShowFocus( TRUE );
211 tranTable->setSorting( 1 );
210 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 212 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
211 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 213 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
212 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 214 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
213 this, SLOT( slotEditTran() ) ); 215 this, SLOT( slotEditTran() ) );
214 216
215 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 217 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
216 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 218 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
217 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 219 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
218 layout->addWidget( btn, 2, 0 ); 220 layout->addWidget( btn, 2, 0 );
219 221
220 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); 222 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
221 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 223 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
222 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); 224 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
223 layout->addWidget( btn, 2, 1 ); 225 layout->addWidget( btn, 2, 1 );
224 226
225 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); 227 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
226 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 228 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
227 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); 229 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
228 layout->addWidget( btn, 2, 2 ); 230 layout->addWidget( btn, 2, 2 );
229 231
230 return( control ); 232 return( control );
231} 233}
232 234
233QWidget *Checkbook::initCharts() 235QWidget *Checkbook::initCharts()
234{ 236{
235 graphInfo = 0x0; 237 graphInfo = 0x0;
236 238
237 QWidget *control = new QWidget( mainWidget ); 239 QWidget *control = new QWidget( mainWidget );
238 240
239 QGridLayout *layout = new QGridLayout( control ); 241 QGridLayout *layout = new QGridLayout( control );
240 layout->setSpacing( 2 ); 242 layout->setSpacing( 2 );
241 layout->setMargin( 4 ); 243 layout->setMargin( 4 );
242 244
243 graphWidget = new Graph( control ); 245 graphWidget = new Graph( control );
244 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); 246 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) );
245 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); 247 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 );
246 248
247 graphList = new QComboBox( control ); 249 graphList = new QComboBox( control );
248 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); 250 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) );
249 graphList->insertItem( tr( "Account balance" ) ); 251 graphList->insertItem( tr( "Account balance" ) );
250 graphList->insertItem( tr( "Withdrawals by category" ) ); 252 graphList->insertItem( tr( "Withdrawals by category" ) );
251 graphList->insertItem( tr( "Deposits by category" ) ); 253 graphList->insertItem( tr( "Deposits by category" ) );
252 254
253 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); 255 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 );
254 256
255 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); 257 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
256 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); 258 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) );
257 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); 259 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
258 layout->addWidget( btn, 1, 2 ); 260 layout->addWidget( btn, 1, 2 );
259 261
260 return control; 262 return control;
261} 263}
262 264
263void Checkbook::loadCheckbook() 265void Checkbook::loadCheckbook()
264{ 266{
265 transactions.clear(); 267 transactions.clear();
266 268
267 Config config(filename, Config::File); 269 Config config(filename, Config::File);
268 270
269 // Load info 271 // Load info
270 config.setGroup( "Account" ); 272 config.setGroup( "Account" );
271 nameEdit->setText( name ); 273 nameEdit->setText( name );
272 QString temptext = config.readEntry( "Type" ); 274 QString temptext = config.readEntry( "Type" );
273 int i = typeList->count(); 275 int i = typeList->count();
274 while ( i > 0 ) 276 while ( i > 0 )
275 { 277 {
276 i--; 278 i--;
277 typeList->setCurrentItem( i ); 279 typeList->setCurrentItem( i );
278 if ( typeList->currentText() == temptext ) 280 if ( typeList->currentText() == temptext )
279 { 281 {
280 break; 282 break;
281 } 283 }
282 } 284 }
283 bankEdit->setText( config.readEntry( "Bank", "" ) ); 285 bankEdit->setText( config.readEntry( "Bank", "" ) );
284 acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); 286 acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) );
285 pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); 287 pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) );
286 balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); 288 balanceEdit->setText( config.readEntry( "Balance", "0.0" ) );
287 notesEdit->setText( config.readEntry( "Notes", "" ) ); 289 notesEdit->setText( config.readEntry( "Notes", "" ) );
288 290
289 bool ok; 291 bool ok;
290 currBalance = balanceEdit->text().toFloat( &ok ); 292 currBalance = balanceEdit->text().toFloat( &ok );
291 startBalance = currBalance; 293 startBalance = currBalance;
292 294
293 // Load transactions 295 // Load transactions
294 TranInfo *tran; 296 TranInfo *tran;
295 QString trandesc = ""; 297 QString trandesc = "";
296 float amount; 298 float amount;
297 QString stramount; 299 QString stramount;
298 for ( int i = 1; trandesc != QString::null; i++ ) 300 for ( int i = 1; trandesc != QString::null; i++ )
299 { 301 {
300 tran = new TranInfo( config, i ); 302 tran = new TranInfo( config, i );
301 trandesc = tran->desc(); 303 trandesc = tran->desc();
302 if ( trandesc != QString::null ) 304 if ( trandesc != QString::null )
303 { 305 {
304 currBalance -= tran->fee(); 306 currBalance -= tran->fee();
305 amount = tran->amount(); 307 amount = tran->amount();
306 if ( tran->withdrawal() ) 308 if ( tran->withdrawal() )
307 { 309 {
308 amount *= -1; 310 amount *= -1;
309 } 311 }
310 currBalance += amount; 312 currBalance += amount;
311 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 313 stramount.sprintf( "%c%.2f", currencySymbol, amount );
312 314
313 // Add to transaction list 315 // Add to transaction list
314 transactions.inSort( tran ); 316 transactions.inSort( tran );
315 317
316 // Add to transaction table 318 // Add to transaction table
317 ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(), 319 ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), trandesc, stramount );
318 trandesc, stramount );
319 } 320 }
320 else 321 else
321 { 322 {
322 delete tran; 323 delete tran;
323 } 324 }
324 } 325 }
325 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 326 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
326 327
327 highTranNum = transactions.count(); 328 highTranNum = transactions.count();
328} 329}
329 330
330void Checkbook::adjustBalance( float amount ) 331void Checkbook::adjustBalance( float amount )
331{ 332{
332 currBalance += amount; 333 currBalance += amount;
333 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 334 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
334 335
335} 336}
336 337
337TranInfo *Checkbook::findTranByID( int id ) 338TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc )
338{ 339{
339 TranInfo *traninfo = transactions.first(); 340 TranInfo *traninfo = transactions.first();
340 while ( traninfo && traninfo->id() != id ) 341 while ( traninfo )
341 { 342 {
343 if ( traninfo->number() == checknum && traninfo->datestr() == date &&
344 traninfo->desc() == desc )
345 break;
342 traninfo = transactions.next(); 346 traninfo = transactions.next();
343 } 347 }
344 return( traninfo ); 348 return( traninfo );
345} 349}
346 350
347void Checkbook::accept() 351void Checkbook::accept()
348{ 352{
349 QFile f( filename ); 353 QFile f( filename );
350 if ( f.exists() ) 354 if ( f.exists() )
351 { 355 {
352 f.remove(); 356 f.remove();
353 } 357 }
354 358
355 Config *config = new Config(filename, Config::File); 359 Config *config = new Config(filename, Config::File);
356 360
357 // Save info 361 // Save info
358 config->setGroup( "Account" ); 362 config->setGroup( "Account" );
359 config->writeEntry( "Type", typeList->currentText() ); 363 config->writeEntry( "Type", typeList->currentText() );
360 config->writeEntry( "Bank", bankEdit->text() ); 364 config->writeEntry( "Bank", bankEdit->text() );
361 config->writeEntryCrypt( "Number", acctNumEdit->text() ); 365 config->writeEntryCrypt( "Number", acctNumEdit->text() );
362 config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); 366 config->writeEntryCrypt( "PINNumber", pinNumEdit->text() );
363 config->writeEntry( "Balance", balanceEdit->text() ); 367 config->writeEntry( "Balance", balanceEdit->text() );
364 config->writeEntry( "Notes", notesEdit->text() ); 368 config->writeEntry( "Notes", notesEdit->text() );
365 369
366 // Save transactions 370 // Save transactions
367 int i = 1; 371 int i = 1;
368 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() ) 372 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() )
369 { 373 {
370 tran->write( config, i ); 374 tran->write( config, i );
371 i++; 375 i++;
372 } 376 }
373 config->write(); 377 config->write();
374 378
375 QDialog::accept(); 379 QDialog::accept();
376} 380}
377 381
378void Checkbook::slotNameChanged( const QString &newname ) 382void Checkbook::slotNameChanged( const QString &newname )
379{ 383{
380 name = newname; 384 name = newname;
381 filename = filedir; 385 filename = filedir;
382 filename.append( newname ); 386 filename.append( newname );
383 filename.append( ".qcb" ); 387 filename.append( ".qcb" );
384 QString tempstr = name; 388 QString tempstr = name;
385 tempstr.append( " - " ); 389 tempstr.append( " - " );
386 tempstr.append( tr( "Checkbook" ) ); 390 tempstr.append( tr( "Checkbook" ) );
387 setCaption( tempstr ); 391 setCaption( tempstr );
388} 392}
389 393
390void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) 394void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
391{ 395{
392 currBalance -= startBalance; 396 currBalance -= startBalance;
393 bool ok; 397 bool ok;
394 startBalance = newbalance.toFloat( &ok ); 398 startBalance = newbalance.toFloat( &ok );
395 adjustBalance( startBalance ); 399 adjustBalance( startBalance );
396} 400}
397 401
398void Checkbook::slotNewTran() 402void Checkbook::slotNewTran()
399{ 403{
400 highTranNum++; 404 highTranNum++;
401 TranInfo *traninfo = new TranInfo( highTranNum ); 405 TranInfo *traninfo = new TranInfo( highTranNum );
402 406
403 Transaction *currtran = new Transaction( this, name, 407 Transaction *currtran = new Transaction( this, name,
404 traninfo, 408 traninfo,
405 currencySymbol ); 409 currencySymbol );
406 currtran->showMaximized(); 410 currtran->showMaximized();
407 if ( currtran->exec() == QDialog::Accepted ) 411 if ( currtran->exec() == QDialog::Accepted )
408 { 412 {
409 float amount = traninfo->amount(); 413 float amount = traninfo->amount();
410 if ( traninfo->withdrawal() ) 414 if ( traninfo->withdrawal() )
411 { 415 {
412 amount *= -1; 416 amount *= -1;
413 } 417 }
414 QString stramount; 418 QString stramount;
415 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 419 stramount.sprintf( "%c%.2f", currencySymbol, amount );
416 420
417 // Add to transaction list 421 // Add to transaction list
418 transactions.inSort( traninfo ); 422 transactions.inSort( traninfo );
419 423
420 // Add to transaction table 424 // Add to transaction table
421 ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), 425 ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(),
422 traninfo->datestr(), traninfo->desc(), stramount ); 426 stramount );
423 427
424 adjustBalance( amount ); 428 adjustBalance( amount );
425 } 429 }
426 else 430 else
427 { 431 {
428 highTranNum--; 432 highTranNum--;
429 delete traninfo; 433 delete traninfo;
430 } 434 }
431} 435}
432 436
433void Checkbook::slotEditTran() 437void Checkbook::slotEditTran()
434{ 438{
435 bool ok; 439 bool ok;
436 QListViewItem *curritem = tranTable->currentItem(); 440 QListViewItem *curritem = tranTable->currentItem();
437 if ( !curritem ) 441 if ( !curritem )
438 { 442 {
439 return; 443 return;
440 } 444 }
441 445
442 int tranid = curritem->text( 0 ).toInt( &ok ); 446 TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) );
443 TranInfo *traninfo = findTranByID( tranid );
444 float origamt = traninfo->amount(); 447 float origamt = traninfo->amount();
445 if ( traninfo->withdrawal() ) 448 if ( traninfo->withdrawal() )
446 { 449 {
447 origamt *= -1; 450 origamt *= -1;
448 } 451 }
449 452
450 Transaction *currtran = new Transaction( this, name, 453 Transaction *currtran = new Transaction( this, name,
451 traninfo, 454 traninfo,
452 currencySymbol ); 455 currencySymbol );
453 currtran->showMaximized(); 456 currtran->showMaximized();
454 if ( currtran->exec() == QDialog::Accepted ) 457 if ( currtran->exec() == QDialog::Accepted )
455 { 458 {
456 curritem->setText( 1, traninfo->datestr() ); 459 curritem->setText( 1, traninfo->datestr() );
457 460
458 curritem->setText( 2, traninfo->desc() ); 461 curritem->setText( 2, traninfo->desc() );
459 462
460 float amount = traninfo->amount(); 463 float amount = traninfo->amount();
461 if ( traninfo->withdrawal() ) 464 if ( traninfo->withdrawal() )
462 { 465 {
463 amount *= -1; 466 amount *= -1;
464 } 467 }
465 adjustBalance( origamt * -1 ); 468 adjustBalance( origamt * -1 );
466 adjustBalance( amount ); 469 adjustBalance( amount );
467 QString stramount; 470 QString stramount;
468 stramount.sprintf( "%c%.2f", currencySymbol, amount ); 471 stramount.sprintf( "%c%.2f", currencySymbol, amount );
469 curritem->setText( 3, stramount ); 472 curritem->setText( 3, stramount );
470 473
471 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); 474 balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
472 475
473 delete currtran; 476 delete currtran;
474 } 477 }
475} 478}
476 479
477void Checkbook::slotDeleteTran() 480void Checkbook::slotDeleteTran()
478{ 481{
479 QListViewItem *curritem = tranTable->currentItem(); 482 QListViewItem *curritem = tranTable->currentItem();
480 if ( !curritem ) 483 if ( !curritem )
481 { 484 {
482 return; 485 return;
483 } 486 }
484 487
485 bool ok; 488 TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) );
486 int tranid = curritem->text( 0 ).toInt( &ok );
487 TranInfo *traninfo = findTranByID( tranid );
488 489
489 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) 490 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
490 { 491 {
491 float amount = traninfo->amount(); 492 float amount = traninfo->amount();
492 if ( traninfo->withdrawal() ) 493 if ( traninfo->withdrawal() )
493 { 494 {
494 amount *= -1; 495 amount *= -1;
495 } 496 }
496 497
497 transactions.remove( traninfo ); 498 transactions.remove( traninfo );
498 delete traninfo; 499 delete traninfo;
499 delete curritem; 500 delete curritem;
500 501
501 adjustBalance( amount * -1 ); 502 adjustBalance( amount * -1 );
502 } 503 }
503} 504}
504 505
505void Checkbook::slotDrawGraph() 506void Checkbook::slotDrawGraph()
506{ 507{
507 if ( graphInfo ) 508 if ( graphInfo )
508 { 509 {
509 delete graphInfo; 510 delete graphInfo;
510 } 511 }
511 512
512 switch ( graphList->currentItem() ) 513 switch ( graphList->currentItem() )
513 { 514 {
514 case 0 : drawBalanceChart(); 515 case 0 : drawBalanceChart();
515 break; 516 break;
516 case 1 : drawCategoryChart( TRUE ); 517 case 1 : drawCategoryChart( TRUE );
517 break; 518 break;
518 case 2 : drawCategoryChart( FALSE ); 519 case 2 : drawCategoryChart( FALSE );
519 break; 520 break;
520 }; 521 };
521 522
522 graphWidget->setGraphInfo( graphInfo ); 523 graphWidget->setGraphInfo( graphInfo );
523 graphWidget->drawGraph( TRUE ); 524 graphWidget->drawGraph( TRUE );
524} 525}
525 526
526void Checkbook::drawBalanceChart() 527void Checkbook::drawBalanceChart()
527{ 528{
528 DataPointList *list = new DataPointList(); 529 DataPointList *list = new DataPointList();
529 530
530 float balance = startBalance; 531 float balance = startBalance;
531 float amount; 532 float amount;
532 QString label; 533 QString label;
533 int i = 0; 534 int i = 0;
534 int count = transactions.count(); 535 int count = transactions.count();
535 536
536 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() ) 537 for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() )
537 { 538 {
538 i++; 539 i++;
539 balance -= tran->fee(); 540 balance -= tran->fee();
540 amount = tran->amount(); 541 amount = tran->amount();
541 if ( tran->withdrawal() ) 542 if ( tran->withdrawal() )
542 { 543 {
543 amount *= -1; 544 amount *= -1;
544 } 545 }
545 balance += amount; 546 balance += amount;
546 if ( i == 1 || i == count / 2 || i == count ) 547 if ( i == 1 || i == count / 2 || i == count )
547 { 548 {
548 label = tran->datestr(); 549 label = tran->datestr();
549 } 550 }
550 else 551 else
551 { 552 {
552 label = ""; 553 label = "";
553 } 554 }
554 list->append( new DataPointInfo( label, balance ) ); 555 list->append( new DataPointInfo( label, balance ) );
555 } 556 }
556 557
557 graphInfo = new GraphInfo( GraphInfo::BarChart, list ); 558 graphInfo = new GraphInfo( GraphInfo::BarChart, list );
558} 559}
559 560
560void Checkbook::drawCategoryChart( bool withdrawals ) 561void Checkbook::drawCategoryChart( bool withdrawals )
561{ 562{
562 DataPointList *list = new DataPointList(); 563 DataPointList *list = new DataPointList();
563 564
564 TranInfo *tran = transactions.first(); 565 TranInfo *tran = transactions.first();
565 if ( tran && tran->withdrawal() == withdrawals ) 566 if ( tran && tran->withdrawal() == withdrawals )
566 { 567 {
567 list->append( new DataPointInfo( tran->category(), tran->amount() ) ); 568 list->append( new DataPointInfo( tran->category(), tran->amount() ) );
568 } 569 }
569 tran = transactions.next(); 570 tran = transactions.next();
570 571
571 DataPointInfo *cat; 572 DataPointInfo *cat;
572 for ( ; tran; tran = transactions.next() ) 573 for ( ; tran; tran = transactions.next() )
573 { 574 {
574 if ( tran->withdrawal() == withdrawals ) 575 if ( tran->withdrawal() == withdrawals )
575 { 576 {
576 // Find category in list 577 // Find category in list
577 for ( cat = list->first(); cat; cat = list->next() ) 578 for ( cat = list->first(); cat; cat = list->next() )
578 { 579 {
579 if ( cat->label() == tran->category() ) 580 if ( cat->label() == tran->category() )
580 { 581 {
581 break; 582 break;
582 } 583 }
583 } 584 }
584 if ( cat && cat->label() == tran->category() ) 585 if ( cat && cat->label() == tran->category() )
585 { // Found category, add to transaction to category total 586 { // Found category, add to transaction to category total
586 cat->addToValue( tran->amount() ); 587 cat->addToValue( tran->amount() );
587 } 588 }
588 else 589 else
589 { // Didn't find category, add category to list 590 { // Didn't find category, add category to list
590 list->append( new DataPointInfo( tran->category(), tran->amount() ) ); 591 list->append( new DataPointInfo( tran->category(), tran->amount() ) );
591 } 592 }
592 } 593 }
593 } 594 }
594 595
595 graphInfo = new GraphInfo( GraphInfo::PieChart, list ); 596 graphInfo = new GraphInfo( GraphInfo::PieChart, list );
596} 597}
598
599CBListItem::CBListItem( QListView *parent, QString label1, QString label2,
600 QString label3, QString label4, QString label5, QString label6, QString label7,
601 QString label8 )
602 : QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 )
603{
604 m_known = FALSE;
605 owner = parent;
606}
607
608void CBListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
609{
610 QColorGroup _cg = cg;
611 const QPixmap *pm = listView()->viewport()->backgroundPixmap();
612 if ( pm && !pm->isNull() )
613 {
614 _cg.setBrush( QColorGroup::Base, QBrush( cg.base(), *pm ) );
615 p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() );
616 }
617 else if ( isAltBackground() )
618 _cg.setColor(QColorGroup::Base, QColor( 200, 255, 200 ) );
619
620 QListViewItem::paintCell(p, _cg, column, width, align);
621}
622
623bool CBListItem::isAltBackground()
624{
625 QListView *lv = static_cast<QListView *>( listView() );
626 if ( lv )
627 {
628 CBListItem *above = 0;
629 above = (CBListItem *)( itemAbove() );
630 m_known = above ? above->m_known : true;
631 if ( m_known )
632 {
633 m_odd = above ? !above->m_odd : false;
634 }
635 else
636 {
637 CBListItem *item;
638 bool previous = true;
639 if ( parent() )
640 {
641 item = (CBListItem *)( parent() );
642 if ( item )
643 previous = item->m_odd;
644 item = (CBListItem *)( parent()->firstChild() );
645 }
646 else
647 {
648 item = (CBListItem *)( lv->firstChild() );
649 }
650
651 while(item)
652 {
653 item->m_odd = previous = !previous;
654 item->m_known = true;
655 item = (CBListItem *)( item->nextSibling() );
656 }
657 }
658 return m_odd;
659 }
660 return false;
661} \ No newline at end of file
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index 287788a..0260b43 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -1,108 +1,128 @@
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 <drw@handhelds.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#ifndef CHECKBOOK_H 29#ifndef CHECKBOOK_H
30#define CHECKBOOK_H 30#define CHECKBOOK_H
31 31
32#include "traninfo.h" 32#include "traninfo.h"
33 33
34#include <qdialog.h> 34#include <qdialog.h>
35#include <qlistview.h>
35 36
36class OTabWidget; 37class OTabWidget;
37 38
38class Graph; 39class Graph;
39class GraphInfo; 40class GraphInfo;
40class QComboBox; 41class QComboBox;
41class QLabel; 42class QLabel;
42class QLineEdit; 43class QLineEdit;
43class QListView; 44class QListView;
44class QMultiLineEdit; 45class QMultiLineEdit;
45class QString; 46class QString;
46 47
47class Checkbook : public QDialog 48class Checkbook : public QDialog
48{ 49{
49 Q_OBJECT 50 Q_OBJECT
50 51
51 public: 52 public:
52 Checkbook( QWidget * = 0x0, const QString & = 0x0, const QString & = 0x0, char = '$' ); 53 Checkbook( QWidget * = 0x0, const QString & = 0x0, const QString & = 0x0, char = '$' );
53 ~Checkbook(); 54 ~Checkbook();
54 55
55 const QString &getName(); 56 const QString &getName();
56 57
57 private: 58 private:
58 TranInfoList transactions; 59 TranInfoList transactions;
59 QString name; 60 QString name;
60 QString filename; 61 QString filename;
61 QString filedir; 62 QString filedir;
62 char currencySymbol; 63 char currencySymbol;
63 int highTranNum; 64 int highTranNum;
64 65
65 OTabWidget *mainWidget; 66 OTabWidget *mainWidget;
66 void loadCheckbook(); 67 void loadCheckbook();
67 void adjustBalance( float ); 68 void adjustBalance( float );
68 TranInfo *findTranByID( int ); 69 TranInfo *findTran( const QString &, const QString &, const QString & );
69 70
70 // Info tab 71 // Info tab
71 QWidget *initInfo(); 72 QWidget *initInfo();
72 QLineEdit *nameEdit; 73 QLineEdit *nameEdit;
73 QComboBox *typeList; 74 QComboBox *typeList;
74 QLineEdit *bankEdit; 75 QLineEdit *bankEdit;
75 QLineEdit *acctNumEdit; 76 QLineEdit *acctNumEdit;
76 QLineEdit *pinNumEdit; 77 QLineEdit *pinNumEdit;
77 QLineEdit *balanceEdit; 78 QLineEdit *balanceEdit;
78 QMultiLineEdit *notesEdit; 79 QMultiLineEdit *notesEdit;
79 float startBalance; 80 float startBalance;
80 81
81 // Transactions tab 82 // Transactions tab
82 QWidget *initTransactions(); 83 QWidget *initTransactions();
83 QListView *tranTable; 84 QListView *tranTable;
84 QLabel *balanceLabel; 85 QLabel *balanceLabel;
85 float currBalance; 86 float currBalance;
86 87
87 // Charts tab 88 // Charts tab
88 QWidget *initCharts(); 89 QWidget *initCharts();
89 GraphInfo *graphInfo; 90 GraphInfo *graphInfo;
90 QComboBox *graphList; 91 QComboBox *graphList;
91 Graph *graphWidget; 92 Graph *graphWidget;
92 93
93 void drawBalanceChart(); 94 void drawBalanceChart();
94 void drawCategoryChart( bool = TRUE ); 95 void drawCategoryChart( bool = TRUE );
95 96
96 protected slots: 97 protected slots:
97 void accept(); 98 void accept();
98 99
99 private slots: 100 private slots:
100 void slotNameChanged( const QString & ); 101 void slotNameChanged( const QString & );
101 void slotStartingBalanceChanged( const QString & ); 102 void slotStartingBalanceChanged( const QString & );
102 void slotNewTran(); 103 void slotNewTran();
103 void slotEditTran(); 104 void slotEditTran();
104 void slotDeleteTran(); 105 void slotDeleteTran();
105 void slotDrawGraph(); 106 void slotDrawGraph();
106}; 107};
107 108
109class CBListItem : public QListViewItem
110{
111 //Q_OBJECT
112
113 public:
114 CBListItem( QListView *, QString = QString::null, QString = QString::null,
115 QString = QString::null, QString = QString::null, QString = QString::null,
116 QString = QString::null, QString = QString::null, QString = QString::null );
117
118 void paintCell( QPainter *, const QColorGroup &, int, int, int );
119
120 private:
121 QListView *owner;
122 bool m_known;
123 bool m_odd;
124
125 bool isAltBackground();
126};
127
108#endif 128#endif
diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp
index 0f25453..8ae835c 100644
--- a/noncore/apps/checkbook/graph.cpp
+++ b/noncore/apps/checkbook/graph.cpp
@@ -1,181 +1,181 @@
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 <drw@handhelds.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 "graph.h" 29#include "graph.h"
30#include "graphinfo.h" 30#include "graphinfo.h"
31 31
32#include <qcolor.h> 32#include <qcolor.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpainter.h> 34#include <qpainter.h>
35 35
36#include <math.h> 36#include <math.h>
37 37
38Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) 38Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags )
39 : QWidget( parent, name, flags ) 39 : QWidget( parent, name, flags )
40{ 40{
41 data = d; 41 data = d;
42 42
43 graph.setOptimization( QPixmap::BestOptim ); 43 graph.setOptimization( QPixmap::BestOptim );
44} 44}
45 45
46void Graph::setGraphInfo( GraphInfo *d ) 46void Graph::setGraphInfo( GraphInfo *d )
47{ 47{
48 data = d; 48 data = d;
49} 49}
50 50
51void Graph::drawGraph( bool regen ) 51void Graph::drawGraph( bool regen )
52{ 52{
53 if ( regen ) 53 if ( regen )
54 { 54 {
55 initGraph(); 55 initGraph();
56 } 56 }
57 QPainter p( this ); 57 QPainter p( this );
58 p.drawPixmap( 0, 0, graph ); 58 p.drawPixmap( 0, 0, graph );
59} 59}
60 60
61void Graph::paintEvent( QPaintEvent * ) 61void Graph::paintEvent( QPaintEvent * )
62{ 62{
63 drawGraph( FALSE ); 63 drawGraph( FALSE );
64} 64}
65 65
66void Graph::resizeEvent( QResizeEvent * ) 66void Graph::resizeEvent( QResizeEvent * )
67{ 67{
68 drawGraph( TRUE ); 68 drawGraph( TRUE );
69} 69}
70 70
71void Graph::initGraph() 71void Graph::initGraph()
72{ 72{
73 graph.resize( width(), height() ); 73 graph.resize( width(), height() );
74 graph.fill( QColor( 255, 255, 255 ) ); 74 graph.fill( QColor( 255, 255, 255 ) );
75 75
76 if ( !data ) 76 if ( !data )
77 { 77 {
78 return; 78 return;
79 } 79 }
80 80
81 // Any common stuff here (titles, ???) 81 // Any common stuff here (titles, ???)
82 82
83 switch ( data->graphType() ) 83 switch ( data->graphType() )
84 { 84 {
85 case GraphInfo::BarChart : 85 case GraphInfo::BarChart :
86 { 86 {
87 drawBarChart( width(), height(), data->maxValue() ); 87 drawBarChart( width(), height(), data->maxValue() );
88 } 88 }
89 break; 89 break;
90 case GraphInfo::LineChart : 90 case GraphInfo::LineChart :
91 { 91 {
92 //drawLineChart( p, s, min, max ); 92 //drawLineChart( p, s, min, max );
93 } 93 }
94 break; 94 break;
95 case GraphInfo::PieChart : 95 case GraphInfo::PieChart :
96 { 96 {
97 drawPieChart( width(), height(), data->totalValue() ); 97 drawPieChart( width(), height(), data->totalValue() );
98 } 98 }
99 }; 99 };
100} 100}
101 101
102void Graph::drawBarChart( int width, int height, float max ) 102void Graph::drawBarChart( int width, int height, float max )
103{ 103{
104 QPainter p( &graph ); 104 QPainter p( &graph );
105 105
106 // Try to set the font size smaller for text 106 // Try to set the font size smaller for text
107 QFont f = font(); 107 QFont f = font();
108 f.setPointSize( 8 ); 108 f.setPointSize( 8 );
109 p.setFont( f ); 109 p.setFont( f );
110 110
111 int x = 0; 111 int x = 0;
112 int i = 0; 112 int i = 0;
113 int n = data->numberDataPoints(); 113 int n = data->numberDataPoints();
114 QFontMetrics fm=fontMetrics(); 114 QFontMetrics fm=fontMetrics();
115 int fh = fm.height(); 115 int fh = fm.height();
116 int fw; 116 int fw;
117 117
118 QColor c( 0, 0, 255); 118 QColor c( 0, 0, 255);
119 p.setBrush( c ); 119 p.setBrush( c );
120 120
121 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) 121 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
122 { 122 {
123 int bw = ( width - width / 4 - x ) / ( n - i ); 123 int bw = ( width - width / 4 - x ) / ( n - i );
124 int bh = int( ( height - height / 4 - 1 ) * dp->value() / max ); 124 int bh = int( ( height - height / 4 - 1 ) * dp->value() / max );
125 p.drawRect( width / 8 + x, height - height / 8 - 1 - bh, bw, bh ); 125 p.drawRect( width / 8 + x, height - height / 8 - 1 - bh, bw, bh );
126 fw = fm.width( dp->label() ); 126 fw = fm.width( dp->label() );
127 p.drawText( width / 8 + x - fw / 2 + bw / 2, height - height / 8, fw, 127 p.drawText( width / 8 + x - fw / 2 + bw / 2, height - height / 8, fw,
128 fh + height / 8, AlignTop | AlignHCenter, dp->label() ); 128 fh + height / 8, AlignTop | AlignHCenter, dp->label() );
129 // WordBreak | AlignTop | AlignHCenter, dp->label() ); 129 // WordBreak | AlignTop | AlignHCenter, dp->label() );
130 i++; 130 i++;
131 x += bw; 131 x += bw;
132 } 132 }
133} 133}
134 134
135void Graph::drawLineChart( int width, int height, float max ) 135void Graph::drawLineChart( int width, int height, float max )
136{ 136{
137} 137}
138 138
139void Graph::drawPieChart( int width, int height, float sum ) 139void Graph::drawPieChart( int width, int height, float sum )
140{ 140{
141 QPainter p( &graph ); 141 QPainter p( &graph );
142 142
143 // Try to set the font size smaller for text 143 // Try to set the font size smaller for text
144 QFont f = font(); 144 QFont f = font();
145 f.setPointSize( 8 ); 145 f.setPointSize( 8 );
146 p.setFont( f ); 146 p.setFont( f );
147 147
148 int n = data->numberDataPoints(); 148 int n = data->numberDataPoints();
149 149
150 int apos = -90 * 16; 150 int apos = -90 * 16;
151 151
152 int xd = width - width / 5; 152 int xd = width - width / 5;
153 int yd = height - height / 5; 153 int yd = height - height / 5;
154 154
155 int i = 0; 155 int i = 0;
156 156
157 QColor c; 157 QColor c;
158 158
159 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) 159 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
160 { 160 {
161 c.setHsv( ( i *255) / n, 255, 255 ); 161 c.setHsv( ( i *255) / n, 255, 255 );
162 p.setBrush( c ); 162 p.setBrush( c );
163 163
164 int a = int( ( dp->value() * 360.0 ) / sum * 16.0 + 0.5 ); 164 int a = int( ( dp->value() * 360.0 ) / sum * 16.0 + 0.5 );
165 p.drawPie( width/10, height/10, xd, yd, -apos, -a ); 165 p.drawPie( width/10, height/10, xd, yd, -apos, -a );
166 apos += a; 166 apos += a;
167 i++; 167 i++;
168 } 168 }
169 169
170 double apos2 = -90 * 3.14159 / 180; 170 double apos2 = -90 * 3.14159 / 180;
171 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) 171 for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() )
172 { 172 {
173 double a = dp->value() *360 / sum * 3.14159 / 180; 173 double a = dp->value() *360 / sum * 3.14159 / 180;
174 int x = int( cos( apos2 + a/2 ) * width * 5/16 + width/2 + 0.5 ); 174 int x = int( cos( apos2 + a/2 ) * width * 5/16 + width/2 + 0.5 );
175 int y = int( sin( apos2 + a/2 ) * height * 5/16 + height/2 + 0.5 ); 175 int y = int( sin( apos2 + a/2 ) * height * 5/16 + height/2 + 0.5 );
176 p.drawText( x - width/8, y - height/8, width/4, height/4, WordBreak | AlignCenter, 176 p.drawText( x - width/8, y - height/8, width/4, height/4, WordBreak | AlignCenter,
177 dp->label() ); 177 dp->label() );
178 apos2 += a; 178 apos2 += a;
179 } 179 }
180} 180}
181 181
diff --git a/noncore/apps/checkbook/graph.h b/noncore/apps/checkbook/graph.h
index 40b23cd..0361718 100644
--- a/noncore/apps/checkbook/graph.h
+++ b/noncore/apps/checkbook/graph.h
@@ -1,64 +1,64 @@
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 <drw@handhelds.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#ifndef GRAPH_H 29#ifndef GRAPH_H
30#define GRAPH_H 30#define GRAPH_H
31 31
32#include <qpixmap.h> 32#include <qpixmap.h>
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35class GraphInfo; 35class GraphInfo;
36class QPainter; 36class QPainter;
37 37
38class Graph : public QWidget 38class Graph : public QWidget
39{ 39{
40 Q_OBJECT 40 Q_OBJECT
41 41
42 public: 42 public:
43 Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 ); 43 Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 );
44 44
45 void setGraphInfo( GraphInfo * ); 45 void setGraphInfo( GraphInfo * );
46 46
47 void drawGraph( bool = FALSE ); 47 void drawGraph( bool = FALSE );
48 48
49 protected: 49 protected:
50 void paintEvent( QPaintEvent * ); 50 void paintEvent( QPaintEvent * );
51 void resizeEvent( QResizeEvent * ); 51 void resizeEvent( QResizeEvent * );
52 52
53 private: 53 private:
54 GraphInfo *data; 54 GraphInfo *data;
55 55
56 QPixmap graph; 56 QPixmap graph;
57 57
58 void initGraph(); 58 void initGraph();
59 void drawBarChart( int, int, float ); 59 void drawBarChart( int, int, float );
60 void drawLineChart( int, int, float ); 60 void drawLineChart( int, int, float );
61 void drawPieChart( int, int, float ); 61 void drawPieChart( int, int, float );
62}; 62};
63 63
64#endif 64#endif
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp
index ec6a465..fec6896 100644
--- a/noncore/apps/checkbook/graphinfo.cpp
+++ b/noncore/apps/checkbook/graphinfo.cpp
@@ -1,123 +1,123 @@
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 <drw@handhelds.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 "graphinfo.h" 29#include "graphinfo.h"
30 30
31GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title, 31GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title,
32 const QString &xtitle, const QString &ytitle ) 32 const QString &xtitle, const QString &ytitle )
33{ 33{
34 t = type; 34 t = type;
35 d = data; 35 d = data;
36 gt = title; 36 gt = title;
37 xt = xtitle; 37 xt = xtitle;
38 yt = ytitle; 38 yt = ytitle;
39} 39}
40 40
41GraphInfo::~GraphInfo() 41GraphInfo::~GraphInfo()
42{ 42{
43 if ( d ) 43 if ( d )
44 { 44 {
45 for ( DataPointInfo *data = d->first(); data; data = d->next() ) 45 for ( DataPointInfo *data = d->first(); data; data = d->next() )
46 { 46 {
47 delete data; 47 delete data;
48 } 48 }
49 } 49 }
50} 50}
51 51
52GraphInfo::GraphType GraphInfo::graphType() 52GraphInfo::GraphType GraphInfo::graphType()
53{ 53{
54 return t; 54 return t;
55} 55}
56 56
57void GraphInfo::setGraphType( GraphType type ) 57void GraphInfo::setGraphType( GraphType type )
58{ 58{
59 t = type; 59 t = type;
60} 60}
61 61
62DataPointList *GraphInfo::dataPoints() 62DataPointList *GraphInfo::dataPoints()
63{ 63{
64 return d; 64 return d;
65} 65}
66 66
67void GraphInfo::setDataPoints( DataPointList *data ) 67void GraphInfo::setDataPoints( DataPointList *data )
68{ 68{
69 d = data; 69 d = data;
70} 70}
71 71
72DataPointInfo *GraphInfo::firstDataPoint() 72DataPointInfo *GraphInfo::firstDataPoint()
73{ 73{
74 return( d->first() ); 74 return( d->first() );
75} 75}
76 76
77DataPointInfo *GraphInfo::nextDataPoint() 77DataPointInfo *GraphInfo::nextDataPoint()
78{ 78{
79 return( d->next() ); 79 return( d->next() );
80} 80}
81 81
82int GraphInfo::numberDataPoints() 82int GraphInfo::numberDataPoints()
83{ 83{
84 return( d->count() ); 84 return( d->count() );
85} 85}
86 86
87float GraphInfo::maxValue() 87float GraphInfo::maxValue()
88{ 88{
89 float max = 0.0; 89 float max = 0.0;
90 for ( DataPointInfo *data = d->first(); data; data = d->next() ) 90 for ( DataPointInfo *data = d->first(); data; data = d->next() )
91 { 91 {
92 if ( data->value() > max ) 92 if ( data->value() > max )
93 { 93 {
94 max = data->value(); 94 max = data->value();
95 } 95 }
96 } 96 }
97 return max; 97 return max;
98} 98}
99 99
100float GraphInfo::totalValue() 100float GraphInfo::totalValue()
101{ 101{
102 float sum = 0.0; 102 float sum = 0.0;
103 for ( DataPointInfo *data = d->first(); data; data = d->next() ) 103 for ( DataPointInfo *data = d->first(); data; data = d->next() )
104 { 104 {
105 sum += data->value(); 105 sum += data->value();
106 } 106 }
107 return sum; 107 return sum;
108} 108}
109 109
110void GraphInfo::setGraphTitle( const QString &title ) 110void GraphInfo::setGraphTitle( const QString &title )
111{ 111{
112 gt = title; 112 gt = title;
113} 113}
114 114
115void GraphInfo::setXAxisTitle( const QString &xtitle ) 115void GraphInfo::setXAxisTitle( const QString &xtitle )
116{ 116{
117 xt = xtitle; 117 xt = xtitle;
118} 118}
119 119
120void GraphInfo::setYAxisTitle( const QString &ytitle ) 120void GraphInfo::setYAxisTitle( const QString &ytitle )
121{ 121{
122 yt = ytitle; 122 yt = ytitle;
123} 123}
diff --git a/noncore/apps/checkbook/graphinfo.h b/noncore/apps/checkbook/graphinfo.h
index 620da74..3bcf676 100644
--- a/noncore/apps/checkbook/graphinfo.h
+++ b/noncore/apps/checkbook/graphinfo.h
@@ -1,88 +1,88 @@
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 <drw@handhelds.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#ifndef GRAPHINFO_H 29#ifndef GRAPHINFO_H
30#define GRAPHINFO_H 30#define GRAPHINFO_H
31 31
32#include <qlist.h> 32#include <qlist.h>
33#include <qstringlist.h> 33#include <qstringlist.h>
34 34
35class DataPointInfo 35class DataPointInfo
36{ 36{
37 public: 37 public:
38 DataPointInfo() 38 DataPointInfo()
39 : l( 0x0 ), v( 0.0 ) {} 39 : l( 0x0 ), v( 0.0 ) {}
40 DataPointInfo( const QString &label, float value ) 40 DataPointInfo( const QString &label, float value )
41 : l( label ), v( value ) {} 41 : l( label ), v( value ) {}
42 42
43 const QString &label() { return l; } 43 const QString &label() { return l; }
44 float value() { return v; } 44 float value() { return v; }
45 45
46 void addToValue( float value ) { v += value; } 46 void addToValue( float value ) { v += value; }
47 47
48 private: 48 private:
49 QString l; 49 QString l;
50 float v; 50 float v;
51}; 51};
52 52
53typedef QList<DataPointInfo> DataPointList; 53typedef QList<DataPointInfo> DataPointList;
54 54
55class GraphInfo 55class GraphInfo
56{ 56{
57 public: 57 public:
58 enum GraphType { BarChart, LineChart, PieChart }; 58 enum GraphType { BarChart, LineChart, PieChart };
59 59
60 GraphInfo( GraphType = BarChart, DataPointList * = 0x0, 60 GraphInfo( GraphType = BarChart, DataPointList * = 0x0,
61 const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 ); 61 const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 );
62 ~GraphInfo(); 62 ~GraphInfo();
63 63
64 GraphInfo::GraphType graphType(); 64 GraphInfo::GraphType graphType();
65 void setGraphType( GraphType ); 65 void setGraphType( GraphType );
66 66
67 DataPointList *dataPoints(); 67 DataPointList *dataPoints();
68 void setDataPoints( DataPointList * ); 68 void setDataPoints( DataPointList * );
69 DataPointInfo *firstDataPoint(); 69 DataPointInfo *firstDataPoint();
70 DataPointInfo *nextDataPoint(); 70 DataPointInfo *nextDataPoint();
71 int numberDataPoints(); 71 int numberDataPoints();
72 72
73 float maxValue(); 73 float maxValue();
74 float totalValue(); 74 float totalValue();
75 75
76 void setGraphTitle( const QString & ); 76 void setGraphTitle( const QString & );
77 void setXAxisTitle( const QString & ); 77 void setXAxisTitle( const QString & );
78 void setYAxisTitle( const QString & ); 78 void setYAxisTitle( const QString & );
79 79
80 private: 80 private:
81 GraphType t; 81 GraphType t;
82 DataPointList *d; 82 DataPointList *d;
83 QString gt; 83 QString gt;
84 QString xt; 84 QString xt;
85 QString yt; 85 QString yt;
86}; 86};
87 87
88#endif 88#endif
diff --git a/noncore/apps/checkbook/main.cpp b/noncore/apps/checkbook/main.cpp
index 832bd09..abfa633 100644
--- a/noncore/apps/checkbook/main.cpp
+++ b/noncore/apps/checkbook/main.cpp
@@ -1,42 +1,42 @@
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 <drw@handhelds.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 "mainwindow.h" 29#include "mainwindow.h"
30 30
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32 32
33int main(int argc, char **argv) 33int main(int argc, char **argv)
34{ 34{
35 QPEApplication app(argc, argv); 35 QPEApplication app(argc, argv);
36 36
37 MainWindow *cb = new MainWindow(); 37 MainWindow *cb = new MainWindow();
38 app.setMainWidget(cb); 38 app.setMainWidget(cb);
39 cb->showMaximized(); 39 cb->showMaximized();
40 40
41 return app.exec(); 41 return app.exec();
42} 42}
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index 2eb8396..567b8ad 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -1,168 +1,168 @@
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 <drw@handhelds.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 "mainwindow.h" 29#include "mainwindow.h"
30#include "checkbook.h" 30#include "checkbook.h"
31 31
32#include <qpe/global.h> 32#include <qpe/global.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qpe/qpemessagebox.h> 35#include <qpe/qpemessagebox.h>
36#include <qpe/qpetoolbar.h> 36#include <qpe/qpetoolbar.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38 38
39#include <qaction.h> 39#include <qaction.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qlistbox.h> 41#include <qlistbox.h>
42#include <qpopupmenu.h> 42#include <qpopupmenu.h>
43#include <qstring.h> 43#include <qstring.h>
44#include <qwhatsthis.h> 44#include <qwhatsthis.h>
45 45
46MainWindow::MainWindow() 46MainWindow::MainWindow()
47 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) 47 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
48{ 48{
49 setCaption( tr( "Checkbook" ) ); 49 setCaption( tr( "Checkbook" ) );
50 50
51 cbDir = Global::applicationFileName( "checkbook", "" ); 51 cbDir = Global::applicationFileName( "checkbook", "" );
52 52
53 // Build menu and tool bars 53 // Build menu and tool bars
54 setToolBarsMovable( FALSE ); 54 setToolBarsMovable( FALSE );
55 55
56 QPEToolBar *bar = new QPEToolBar( this ); 56 QPEToolBar *bar = new QPEToolBar( this );
57 bar->setHorizontalStretchable( TRUE ); 57 bar->setHorizontalStretchable( TRUE );
58 QPEMenuBar *mb = new QPEMenuBar( bar ); 58 QPEMenuBar *mb = new QPEMenuBar( bar );
59 mb->setMargin( 0 ); 59 mb->setMargin( 0 );
60 QPopupMenu *popup = new QPopupMenu( this ); 60 QPopupMenu *popup = new QPopupMenu( this );
61 61
62 bar = new QPEToolBar( this ); 62 bar = new QPEToolBar( this );
63 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 63 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
64 a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); 64 a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) );
65 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); 65 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) );
66 a->addTo( popup ); 66 a->addTo( popup );
67 a->addTo( bar ); 67 a->addTo( bar );
68 68
69 actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 69 actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
70 0, this, 0 ); 70 0, this, 0 );
71 actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); 71 actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) );
72 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); 72 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) );
73 actionOpen->addTo( popup ); 73 actionOpen->addTo( popup );
74 actionOpen->addTo( bar ); 74 actionOpen->addTo( bar );
75 75
76 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 76 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
77 0, this, 0 ); 77 0, this, 0 );
78 actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); 78 actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) );
79 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); 79 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) );
80 actionDelete->addTo( popup ); 80 actionDelete->addTo( popup );
81 actionDelete->addTo( bar ); 81 actionDelete->addTo( bar );
82 82
83 mb->insertItem( tr( "Checkbook" ), popup ); 83 mb->insertItem( tr( "Checkbook" ), popup );
84 84
85 // Build Checkbook selection list control 85 // Build Checkbook selection list control
86 cbList = new QListBox( this ); 86 cbList = new QListBox( this );
87 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); 87 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
88 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); 88 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold );
89 connect( cbList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ), 89 connect( cbList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ),
90 this, SLOT( slotEdit() ) ); 90 this, SLOT( slotEdit() ) );
91 setCentralWidget( cbList ); 91 setCentralWidget( cbList );
92 92
93 // Load Checkbook selection list 93 // Load Checkbook selection list
94 QDir checkdir( cbDir ); 94 QDir checkdir( cbDir );
95 if (checkdir.exists() == true) 95 if (checkdir.exists() == true)
96 { 96 {
97 QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, 97 QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable,
98 QDir::Time ); 98 QDir::Time );
99 for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ ) 99 for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ )
100 { 100 {
101 (*it) = (*it).remove( (*it).find('.'), (*it).length() ); 101 (*it) = (*it).remove( (*it).find('.'), (*it).length() );
102 } 102 }
103 cbList->insertStringList( checkbooks ); 103 cbList->insertStringList( checkbooks );
104 } 104 }
105 cbList->sort(); 105 cbList->sort();
106 cbList->setSelected( 0, TRUE ); 106 cbList->setSelected( 0, TRUE );
107 107
108 currencySymbol = '$'; 108 currencySymbol = '$';
109} 109}
110 110
111MainWindow::~MainWindow() 111MainWindow::~MainWindow()
112{ 112{
113} 113}
114 114
115void MainWindow::slotNew() 115void MainWindow::slotNew()
116{ 116{
117 Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol ); 117 Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol );
118 currcb->showMaximized(); 118 currcb->showMaximized();
119 if ( currcb->exec() == QDialog::Accepted ) 119 if ( currcb->exec() == QDialog::Accepted )
120 { 120 {
121 cbList->insertItem( currcb->getName() ); 121 cbList->insertItem( currcb->getName() );
122 cbList->sort(); 122 cbList->sort();
123 delete currcb; 123 delete currcb;
124 } 124 }
125} 125}
126 126
127void MainWindow::slotEdit() 127void MainWindow::slotEdit()
128{ 128{
129 QString currname = cbList->currentText(); 129 QString currname = cbList->currentText();
130 Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); 130 Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol );
131 currcb->showMaximized(); 131 currcb->showMaximized();
132 if ( currcb->exec() == QDialog::Accepted ) 132 if ( currcb->exec() == QDialog::Accepted )
133 { 133 {
134 QString newname = currcb->getName(); 134 QString newname = currcb->getName();
135 if ( currname != newname ) 135 if ( currname != newname )
136 { 136 {
137 cbList->changeItem( newname, cbList->currentItem() ); 137 cbList->changeItem( newname, cbList->currentItem() );
138 cbList->sort(); 138 cbList->sort();
139 139
140 QString tempstr = cbDir; 140 QString tempstr = cbDir;
141 tempstr.append( currname ); 141 tempstr.append( currname );
142 tempstr.append( ".qcb" ); 142 tempstr.append( ".qcb" );
143 QFile f( tempstr ); 143 QFile f( tempstr );
144 if ( f.exists() ) 144 if ( f.exists() )
145 { 145 {
146 f.remove(); 146 f.remove();
147 } 147 }
148 } 148 }
149 delete currcb; 149 delete currcb;
150 } 150 }
151} 151}
152 152
153void MainWindow::slotDelete() 153void MainWindow::slotDelete()
154{ 154{
155 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) 155 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) )
156 { 156 {
157 QString tempstr = cbDir; 157 QString tempstr = cbDir;
158 tempstr.append( cbList->currentText() ); 158 tempstr.append( cbList->currentText() );
159 tempstr.append( ".qcb" ); 159 tempstr.append( ".qcb" );
160 QFile f( tempstr ); 160 QFile f( tempstr );
161 if ( f.exists() ) 161 if ( f.exists() )
162 { 162 {
163 f.remove(); 163 f.remove();
164 } 164 }
165 165
166 cbList->removeItem( cbList->currentItem() ); 166 cbList->removeItem( cbList->currentItem() );
167 } 167 }
168} 168}
diff --git a/noncore/apps/checkbook/mainwindow.h b/noncore/apps/checkbook/mainwindow.h
index 2c5d93b..1b460fa 100644
--- a/noncore/apps/checkbook/mainwindow.h
+++ b/noncore/apps/checkbook/mainwindow.h
@@ -1,60 +1,60 @@
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 <drw@handhelds.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#ifndef MAINWINDOW_H 29#ifndef MAINWINDOW_H
30#define MAINWINDOW_H 30#define MAINWINDOW_H
31 31
32#include <qmainwindow.h> 32#include <qmainwindow.h>
33 33
34class QAction; 34class QAction;
35class QListBox; 35class QListBox;
36class QListBoxItem; 36class QListBoxItem;
37class QString; 37class QString;
38 38
39class MainWindow : public QMainWindow 39class MainWindow : public QMainWindow
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 MainWindow(); 44 MainWindow();
45 ~MainWindow(); 45 ~MainWindow();
46 46
47 private: 47 private:
48 QListBox *cbList; 48 QListBox *cbList;
49 QString cbDir; 49 QString cbDir;
50 QAction *actionOpen; 50 QAction *actionOpen;
51 QAction *actionDelete; 51 QAction *actionDelete;
52 char currencySymbol; 52 char currencySymbol;
53 53
54 private slots: 54 private slots:
55 void slotNew(); 55 void slotNew();
56 void slotEdit(); 56 void slotEdit();
57 void slotDelete(); 57 void slotDelete();
58}; 58};
59 59
60#endif 60#endif
diff --git a/noncore/apps/checkbook/opie-checkbook.control b/noncore/apps/checkbook/opie-checkbook.control
index 7bde1db..817426c 100644
--- a/noncore/apps/checkbook/opie-checkbook.control
+++ b/noncore/apps/checkbook/opie-checkbook.control
@@ -1,9 +1,9 @@
1Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook 1Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook
2Priority: optional 2Priority: optional
3Section: applications 3Section: applications
4Maintainer: Dan Williams <williamsdr@acm.org> 4Maintainer: Dan Williams <drw@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
8Description: Checkbook keeping program. 8Description: Checkbook keeping program.
9 The checkbook accounting program for the Opie environment. 9 The checkbook accounting program for the Opie environment.
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index dcba869..65c190c 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -1,190 +1,190 @@
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 <drw@handhelds.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 "traninfo.h" 29#include "traninfo.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32 32
33QString tempstr; 33QString tempstr;
34 34
35TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, 35TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal,
36 const QString &type, const QString &category, float amount, 36 const QString &type, const QString &category, float amount,
37 float fee, const QString &number, const QString &notes ) 37 float fee, const QString &number, const QString &notes )
38{ 38{
39 i = id; 39 i = id;
40 d = desc; 40 d = desc;
41 td = date; 41 td = date;
42 w = withdrawal; 42 w = withdrawal;
43 t = type; 43 t = type;
44 c = category; 44 c = category;
45 a = amount; 45 a = amount;
46 f = fee; 46 f = fee;
47 cn = number; 47 cn = number;
48 n = notes; 48 n = notes;
49} 49}
50 50
51TranInfo::TranInfo( Config config, int entry ) 51TranInfo::TranInfo( Config config, int entry )
52{ 52{
53 config.setGroup( QString::number( entry ) ); 53 config.setGroup( QString::number( entry ) );
54 QString desc = config.readEntry( "Description", "Not Found" ); 54 QString desc = config.readEntry( "Description", "Not Found" );
55 if ( desc != "Not Found" ) 55 if ( desc != "Not Found" )
56 { 56 {
57 // ID 57 // ID
58 i = entry; 58 i = entry;
59 59
60 // Description 60 // Description
61 d = desc; 61 d = desc;
62 62
63 // Transaction date 63 // Transaction date
64 int yr, mn, dy; 64 int yr, mn, dy;
65 QString datestr = config.readEntry( "Date", "" ); 65 QString datestr = config.readEntry( "Date", "" );
66 int begin, end; 66 int begin, end;
67 begin = datestr.find( '/' ); 67 begin = datestr.find( '/' );
68 mn = datestr.left( begin ).toInt(); 68 mn = datestr.left( begin ).toInt();
69 end = datestr.find( '/', ++begin ); 69 end = datestr.find( '/', ++begin );
70 dy = datestr.mid( begin, end - begin ).toInt(); 70 dy = datestr.mid( begin, end - begin ).toInt();
71 yr = datestr.right( datestr.length() - end - 1).toInt(); 71 yr = datestr.right( datestr.length() - end - 1).toInt();
72 td.setYMD( yr, mn, dy ); 72 td.setYMD( yr, mn, dy );
73 73
74 // Deposit/withdrawal indicator ( withdrawal == TRUE ) 74 // Deposit/withdrawal indicator ( withdrawal == TRUE )
75 w = ( config.readEntry( "Payment", "false" ) == "true" ); 75 w = ( config.readEntry( "Payment", "false" ) == "true" );
76 76
77 // Type 77 // Type
78 QString type = config.readEntry( "Type", "0" ); 78 QString type = config.readEntry( "Type", "0" );
79 if ( w ) 79 if ( w )
80 { // Withdrawal types 80 { // Withdrawal types
81 if( type == "0" ) 81 if( type == "0" )
82 t = "Debit Charge"; 82 t = "Debit Charge";
83 else if( type == "1" ) 83 else if( type == "1" )
84 t = "Written Check"; 84 t = "Written Check";
85 else if( type == "2" ) 85 else if( type == "2" )
86 t = "Transfer"; 86 t = "Transfer";
87 else if( type == "3" ) 87 else if( type == "3" )
88 t = "Credit Card"; 88 t = "Credit Card";
89 } 89 }
90 else 90 else
91 { 91 {
92 if( type == "0" ) 92 if( type == "0" )
93 t = "Written Check"; 93 t = "Written Check";
94 else if( type == "1" ) 94 else if( type == "1" )
95 t = "Automatic Payment"; 95 t = "Automatic Payment";
96 else if( type == "2" ) 96 else if( type == "2" )
97 t = "Transfer"; 97 t = "Transfer";
98 else if( type == "3" ) 98 else if( type == "3" )
99 t = "Cash"; 99 t = "Cash";
100 } 100 }
101 101
102 // Category 102 // Category
103 c = config.readEntry( "Category", "" ); 103 c = config.readEntry( "Category", "" );
104 104
105 // Transaction amount 105 // Transaction amount
106 QString stramount = config.readEntry( "Amount", "0.00" ); 106 QString stramount = config.readEntry( "Amount", "0.00" );
107 bool ok; 107 bool ok;
108 a = stramount.toFloat( &ok ); 108 a = stramount.toFloat( &ok );
109 109
110 // Transaction fee 110 // Transaction fee
111 stramount = config.readEntry( "TransactionFee", "0.00" ); 111 stramount = config.readEntry( "TransactionFee", "0.00" );
112 f = stramount.toFloat( &ok ); 112 f = stramount.toFloat( &ok );
113 113
114 // Transaction number 114 // Transaction number
115 cn = config.readEntry( "CheckNumber", "" ); 115 cn = config.readEntry( "CheckNumber", "" );
116 116
117 // Notes 117 // Notes
118 n = config.readEntry( "Comments", "" ); 118 n = config.readEntry( "Comments", "" );
119 } 119 }
120} 120}
121 121
122const QString &TranInfo::datestr() 122const QString &TranInfo::datestr()
123{ 123{
124 tempstr = QString::number( td.year() ); 124 tempstr = QString::number( td.year() );
125 tempstr.append( '/' ); 125 tempstr.append( '/' );
126 int tempfield = td.month(); 126 int tempfield = td.month();
127 if ( tempfield < 10 ) tempstr.append( '0' ); 127 if ( tempfield < 10 ) tempstr.append( '0' );
128 tempstr.append( QString::number( tempfield ) ); 128 tempstr.append( QString::number( tempfield ) );
129 tempstr.append( '/' ); 129 tempstr.append( '/' );
130 tempfield = td.day(); 130 tempfield = td.day();
131 if ( tempfield < 10 ) tempstr.append( '0' ); 131 if ( tempfield < 10 ) tempstr.append( '0' );
132 tempstr.append( QString::number( tempfield ) ); 132 tempstr.append( QString::number( tempfield ) );
133 133
134 return( tempstr ); 134 return( tempstr );
135} 135}
136 136
137void TranInfo::write( Config *config, int entry ) 137void TranInfo::write( Config *config, int entry )
138{ 138{
139 config->setGroup( QString::number( entry ) ); 139 config->setGroup( QString::number( entry ) );
140 140
141 config->writeEntry( "Description", d ); 141 config->writeEntry( "Description", d );
142 142
143 tempstr = QString::number( td.month() ); 143 tempstr = QString::number( td.month() );
144 tempstr.append( '/' ); 144 tempstr.append( '/' );
145 tempstr.append( QString::number( td.day() ) ); 145 tempstr.append( QString::number( td.day() ) );
146 tempstr.append( '/' ); 146 tempstr.append( '/' );
147 tempstr.append( QString::number( td.year() ) ); 147 tempstr.append( QString::number( td.year() ) );
148 config->writeEntry( "Date", tempstr ); 148 config->writeEntry( "Date", tempstr );
149 149
150 w ? tempstr = "true" 150 w ? tempstr = "true"
151 : tempstr = "false"; 151 : tempstr = "false";
152 config->writeEntry( "Payment", tempstr ); 152 config->writeEntry( "Payment", tempstr );
153 153
154 if ( t == "Debit Charge" || t == "Written Check" ) 154 if ( t == "Debit Charge" || t == "Written Check" )
155 tempstr = "0"; 155 tempstr = "0";
156 else if ( t == "Written Check" || t == "Automatic Payment" ) 156 else if ( t == "Written Check" || t == "Automatic Payment" )
157 tempstr = "1"; 157 tempstr = "1";
158 else if ( t == "Transfer" ) 158 else if ( t == "Transfer" )
159 tempstr = "2"; 159 tempstr = "2";
160 else if ( t == "Credit Card" || t == "Cash" ) 160 else if ( t == "Credit Card" || t == "Cash" )
161 tempstr = "3"; 161 tempstr = "3";
162 config->writeEntry( "Type", tempstr ); 162 config->writeEntry( "Type", tempstr );
163 163
164 config->writeEntry( "Category", c ); 164 config->writeEntry( "Category", c );
165 165
166 tempstr.setNum( a, 'f', 2 ); 166 tempstr.setNum( a, 'f', 2 );
167 config->writeEntry( "Amount", tempstr ); 167 config->writeEntry( "Amount", tempstr );
168 168
169 tempstr.setNum( f, 'f', 2 ); 169 tempstr.setNum( f, 'f', 2 );
170 config->writeEntry( "TransactionFee", tempstr ); 170 config->writeEntry( "TransactionFee", tempstr );
171 171
172 config->writeEntry( "CheckNumber", cn ); 172 config->writeEntry( "CheckNumber", cn );
173 173
174 config->writeEntry( "Comments", n ); 174 config->writeEntry( "Comments", n );
175} 175}
176 176
177int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) 177int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 )
178{ 178{
179 QDate d1 = ((TranInfo *)item1)->date(); 179 QDate d1 = ((TranInfo *)item1)->date();
180 QDate d2 = ((TranInfo *)item2)->date(); 180 QDate d2 = ((TranInfo *)item2)->date();
181 int r = -1; 181 int r = -1;
182 182
183 if ( d1 < d2 ) 183 if ( d1 < d2 )
184 r = -1; 184 r = -1;
185 else if ( d1 == d2 ) 185 else if ( d1 == d2 )
186 r = 0; 186 r = 0;
187 else if ( d1 > d2 ) 187 else if ( d1 > d2 )
188 r = 1; 188 r = 1;
189 return( r ); 189 return( r );
190} \ No newline at end of file 190}
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h
index e488816..59cfe14 100644
--- a/noncore/apps/checkbook/traninfo.h
+++ b/noncore/apps/checkbook/traninfo.h
@@ -1,92 +1,92 @@
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 <drw@handhelds.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#ifndef TRANINFO_H 29#ifndef TRANINFO_H
30#define TRANINFO_H 30#define TRANINFO_H
31 31
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qlist.h> 33#include <qlist.h>
34#include <qstring.h> 34#include <qstring.h>
35 35
36class Config; 36class Config;
37 37
38class TranInfo 38class TranInfo
39{ 39{
40 public: 40 public:
41 TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), 41 TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(),
42 bool = TRUE, const QString & = 0x0, const QString & = 0x0, 42 bool = TRUE, const QString & = 0x0, const QString & = 0x0,
43 float = 0.0, float = 0.0, 43 float = 0.0, float = 0.0,
44 const QString & = 0x0, const QString & = 0x0 ); 44 const QString & = 0x0, const QString & = 0x0 );
45 TranInfo( Config, int ); 45 TranInfo( Config, int );
46 46
47 int id() const { return i; } 47 int id() const { return i; }
48 const QString &desc() const { return d; } 48 const QString &desc() const { return d; }
49 const QDate &date() const { return td; } 49 const QDate &date() const { return td; }
50 const QString &datestr(); 50 const QString &datestr();
51 bool withdrawal()const { return w; } 51 bool withdrawal()const { return w; }
52 const QString &type() const { return t; } 52 const QString &type() const { return t; }
53 const QString &category()const { return c; } 53 const QString &category()const { return c; }
54 float amount() const { return a; } 54 float amount() const { return a; }
55 float fee() const { return f; } 55 float fee() const { return f; }
56 const QString &number() const { return cn; } 56 const QString &number() const { return cn; }
57 const QString &notes() const { return n; } 57 const QString &notes() const { return n; }
58 58
59 void setDesc( const QString &desc ) { d = desc; } 59 void setDesc( const QString &desc ) { d = desc; }
60 void setDate( const QDate &date ) { td = date; } 60 void setDate( const QDate &date ) { td = date; }
61 void setWithdrawal( bool withdrawal ){ w = withdrawal; } 61 void setWithdrawal( bool withdrawal ){ w = withdrawal; }
62 void setType( const QString &type ) { t = type; } 62 void setType( const QString &type ) { t = type; }
63 void setCategory( const QString &cat ){ c = cat; } 63 void setCategory( const QString &cat ){ c = cat; }
64 void setAmount( float amount ) { a = amount; } 64 void setAmount( float amount ) { a = amount; }
65 void setFee( float fee ) { f = fee; } 65 void setFee( float fee ) { f = fee; }
66 void setNumber( const QString &num ){ cn = num; } 66 void setNumber( const QString &num ){ cn = num; }
67 void setNotes( const QString &notes ){ n = notes; } 67 void setNotes( const QString &notes ){ n = notes; }
68 68
69 void write( Config *, int ); 69 void write( Config *, int );
70 70
71 private: 71 private:
72 int i; 72 int i;
73 QString d; 73 QString d;
74 QDate td; 74 QDate td;
75 bool w; 75 bool w;
76 QString t; 76 QString t;
77 QString c; 77 QString c;
78 float a; 78 float a;
79 float f; 79 float f;
80 QString cn; 80 QString cn;
81 QString n; 81 QString n;
82}; 82};
83 83
84class TranInfoList : public QList<TranInfo> 84class TranInfoList : public QList<TranInfo>
85{ 85{
86 protected: 86 protected:
87 int compareItems( QCollection::Item, QCollection::Item ); 87 int compareItems( QCollection::Item, QCollection::Item );
88}; 88};
89 89
90//typedef TranList<TranInfo> TranInfoList; 90//typedef TranList<TranInfo> TranInfoList;
91 91
92#endif 92#endif
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index a921491..122c8d6 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -1,279 +1,279 @@
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 <drw@handhelds.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 "transaction.h" 29#include "transaction.h"
30#include "traninfo.h" 30#include "traninfo.h"
31 31
32#include <qpe/datebookmonth.h> 32#include <qpe/datebookmonth.h>
33#include <qpe/timestring.h> 33#include <qpe/timestring.h>
34 34
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qcombobox.h> 36#include <qcombobox.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qmultilineedit.h> 40#include <qmultilineedit.h>
41#include <qpopupmenu.h> 41#include <qpopupmenu.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qradiobutton.h> 43#include <qradiobutton.h>
44#include <qscrollview.h> 44#include <qscrollview.h>
45#include <qstring.h> 45#include <qstring.h>
46#include <qwhatsthis.h> 46#include <qwhatsthis.h>
47 47
48Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, 48Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info,
49 char symbol ) 49 char symbol )
50 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 50 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
51{ 51{
52 QString tempstr = tr( "Transaction for " ); 52 QString tempstr = tr( "Transaction for " );
53 tempstr.append( acctname ); 53 tempstr.append( acctname );
54 setCaption( tempstr ); 54 setCaption( tempstr );
55 55
56 tran = info; 56 tran = info;
57 currencySymbol = symbol; 57 currencySymbol = symbol;
58 58
59 QVBoxLayout *vb = new QVBoxLayout( this ); 59 QVBoxLayout *vb = new QVBoxLayout( this );
60 60
61 QScrollView *sv = new QScrollView( this ); 61 QScrollView *sv = new QScrollView( this );
62 vb->addWidget( sv, 0, 0 ); 62 vb->addWidget( sv, 0, 0 );
63 sv->setResizePolicy( QScrollView::AutoOneFit ); 63 sv->setResizePolicy( QScrollView::AutoOneFit );
64 sv->setFrameStyle( QFrame::NoFrame ); 64 sv->setFrameStyle( QFrame::NoFrame );
65 65
66 QWidget *container = new QWidget( sv->viewport() ); 66 QWidget *container = new QWidget( sv->viewport() );
67 sv->addChild( container ); 67 sv->addChild( container );
68 68
69 QGridLayout *layout = new QGridLayout( container ); 69 QGridLayout *layout = new QGridLayout( container );
70 layout->setSpacing( 2 ); 70 layout->setSpacing( 2 );
71 layout->setMargin( 4 ); 71 layout->setMargin( 4 );
72 72
73 // Withdrawal/Deposit 73 // Withdrawal/Deposit
74 QButtonGroup *btngrp = new QButtonGroup( container ); 74 QButtonGroup *btngrp = new QButtonGroup( container );
75 btngrp->setColumnLayout(0, Qt::Vertical ); 75 btngrp->setColumnLayout(0, Qt::Vertical );
76 btngrp->layout()->setSpacing( 0 ); 76 btngrp->layout()->setSpacing( 0 );
77 btngrp->layout()->setMargin( 0 ); 77 btngrp->layout()->setMargin( 0 );
78 btngrp->setMaximumWidth( 220 ); 78 btngrp->setMaximumWidth( 220 );
79 QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); 79 QGridLayout *layout2 = new QGridLayout( btngrp->layout() );
80 layout2->setSpacing( 2 ); 80 layout2->setSpacing( 2 );
81 layout2->setMargin( 2 ); 81 layout2->setMargin( 2 );
82 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); 82 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp );
83 QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); 83 QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
84 layout2->addWidget( withBtn, 0, 0 ); 84 layout2->addWidget( withBtn, 0, 0 );
85 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); 85 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) );
86 depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); 86 depBtn = new QRadioButton( tr( "Deposit" ), btngrp );
87 QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); 87 QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
88 layout2->addWidget( depBtn, 0, 1 ); 88 layout2->addWidget( depBtn, 0, 1 );
89 btngrp->setMaximumSize( 320, withBtn->height() ); 89 btngrp->setMaximumSize( 320, withBtn->height() );
90 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); 90 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) );
91 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); 91 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 );
92 92
93 // Date 93 // Date
94 QLabel *label = new QLabel( tr( "Date:" ), container ); 94 QLabel *label = new QLabel( tr( "Date:" ), container );
95 QWhatsThis::add( label, tr( "Select date of transaction here." ) ); 95 QWhatsThis::add( label, tr( "Select date of transaction here." ) );
96 layout->addWidget( label, 1, 0 ); 96 layout->addWidget( label, 1, 0 );
97 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), 97 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ),
98 container ); 98 container );
99 QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); 99 QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) );
100 QPopupMenu *m1 = new QPopupMenu( container ); 100 QPopupMenu *m1 = new QPopupMenu( container );
101 datePicker = new DateBookMonth( m1, 0, TRUE ); 101 datePicker = new DateBookMonth( m1, 0, TRUE );
102 m1->insertItem( datePicker ); 102 m1->insertItem( datePicker );
103 dateBtn->setPopup( m1 ); 103 dateBtn->setPopup( m1 );
104 connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), 104 connect( datePicker, SIGNAL( dateClicked( int, int, int ) ),
105 this, SLOT( slotDateChanged( int, int, int ) ) ); 105 this, SLOT( slotDateChanged( int, int, int ) ) );
106 layout->addWidget( dateBtn, 1, 1 ); 106 layout->addWidget( dateBtn, 1, 1 );
107 107
108 // Check number 108 // Check number
109 label = new QLabel( tr( "Number:" ), container ); 109 label = new QLabel( tr( "Number:" ), container );
110 QWhatsThis::add( label, tr( "Enter check number here." ) ); 110 QWhatsThis::add( label, tr( "Enter check number here." ) );
111 layout->addWidget( label, 1, 2 ); 111 layout->addWidget( label, 1, 2 );
112 numEdit = new QLineEdit( container ); 112 numEdit = new QLineEdit( container );
113 QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); 113 QWhatsThis::add( numEdit, tr( "Enter check number here." ) );
114 numEdit->setMaximumWidth( 40 ); 114 numEdit->setMaximumWidth( 40 );
115 layout->addWidget( numEdit, 1, 3 ); 115 layout->addWidget( numEdit, 1, 3 );
116 116
117 // Description 117 // Description
118 label = new QLabel( tr( "Description:" ), container ); 118 label = new QLabel( tr( "Description:" ), container );
119 QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); 119 QWhatsThis::add( label, tr( "Enter description of transaction here." ) );
120 layout->addWidget( label, 2, 0 ); 120 layout->addWidget( label, 2, 0 );
121 descEdit = new QLineEdit( container ); 121 descEdit = new QLineEdit( container );
122 QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) ); 122 QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) );
123 layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); 123 layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 );
124 124
125 // Category 125 // Category
126 label = new QLabel( tr( "Category:" ), container ); 126 label = new QLabel( tr( "Category:" ), container );
127 QWhatsThis::add( label, tr( "Select transaction category here." ) ); 127 QWhatsThis::add( label, tr( "Select transaction category here." ) );
128 layout->addWidget( label, 3, 0 ); 128 layout->addWidget( label, 3, 0 );
129 catList = new QComboBox( container ); 129 catList = new QComboBox( container );
130 QWhatsThis::add( catList, tr( "Select transaction category here." ) ); 130 QWhatsThis::add( catList, tr( "Select transaction category here." ) );
131 layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); 131 layout->addMultiCellWidget( catList, 3, 3, 1, 3 );
132 132
133 // Type 133 // Type
134 label = new QLabel( tr( "Type:" ), container ); 134 label = new QLabel( tr( "Type:" ), container );
135 QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); 135 QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
136 layout->addWidget( label, 4, 0 ); 136 layout->addWidget( label, 4, 0 );
137 typeList = new QComboBox( container ); 137 typeList = new QComboBox( container );
138 QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); 138 QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
139 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); 139 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 );
140 140
141 // Amount 141 // Amount
142 label = new QLabel( tr( "Amount:" ), container ); 142 label = new QLabel( tr( "Amount:" ), container );
143 QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); 143 QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
144 layout->addWidget( label, 5, 0 ); 144 layout->addWidget( label, 5, 0 );
145 amtEdit = new QLineEdit( container ); 145 amtEdit = new QLineEdit( container );
146 QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); 146 QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
147 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); 147 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 );
148 148
149 // Fee 149 // Fee
150 label = new QLabel( tr( "Fee:" ), container ); 150 label = new QLabel( tr( "Fee:" ), container );
151 QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); 151 QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
152 layout->addWidget( label, 6, 0 ); 152 layout->addWidget( label, 6, 0 );
153 feeEdit = new QLineEdit( container ); 153 feeEdit = new QLineEdit( container );
154 QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); 154 QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
155 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); 155 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 );
156 156
157 // Notes 157 // Notes
158 label = new QLabel( tr( "Notes:" ), container ); 158 label = new QLabel( tr( "Notes:" ), container );
159 QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); 159 QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) );
160 layout->addWidget( label, 7, 0 ); 160 layout->addWidget( label, 7, 0 );
161 noteEdit = new QMultiLineEdit( container ); 161 noteEdit = new QMultiLineEdit( container );
162 QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); 162 QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) );
163 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); 163 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 );
164 164
165 // Populate current values if provided 165 // Populate current values if provided
166 if ( info ) 166 if ( info )
167 { 167 {
168 if ( info->withdrawal() ) 168 if ( info->withdrawal() )
169 { 169 {
170 withBtn->setChecked( TRUE ); 170 withBtn->setChecked( TRUE );
171 slotWithdrawalClicked(); 171 slotWithdrawalClicked();
172 } 172 }
173 else 173 else
174 { 174 {
175 depBtn->setChecked( TRUE ); 175 depBtn->setChecked( TRUE );
176 slotDepositClicked(); 176 slotDepositClicked();
177 } 177 }
178 QDate dt = info->date(); 178 QDate dt = info->date();
179 slotDateChanged( dt.year(), dt.month(), dt.day() ); 179 slotDateChanged( dt.year(), dt.month(), dt.day() );
180 datePicker->setDate( dt ); 180 datePicker->setDate( dt );
181 numEdit->setText( info->number() ); 181 numEdit->setText( info->number() );
182 descEdit->setText( info->desc() ); 182 descEdit->setText( info->desc() );
183 QString temptext = info->category(); 183 QString temptext = info->category();
184 int i = catList->count(); 184 int i = catList->count();
185 while ( i > 0 ) 185 while ( i > 0 )
186 { 186 {
187 i--; 187 i--;
188 catList->setCurrentItem( i ); 188 catList->setCurrentItem( i );
189 if ( catList->currentText() == temptext ) 189 if ( catList->currentText() == temptext )
190 { 190 {
191 break; 191 break;
192 } 192 }
193 } 193 }
194 temptext = info->type(); 194 temptext = info->type();
195 i = typeList->count(); 195 i = typeList->count();
196 while ( i > 0 ) 196 while ( i > 0 )
197 { 197 {
198 i--; 198 i--;
199 typeList->setCurrentItem( i ); 199 typeList->setCurrentItem( i );
200 if ( typeList->currentText() == temptext ) 200 if ( typeList->currentText() == temptext )
201 { 201 {
202 break; 202 break;
203 } 203 }
204 } 204 }
205 amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); 205 amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) );
206 feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); 206 feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) );
207 noteEdit->setText( info->notes() ); 207 noteEdit->setText( info->notes() );
208 } 208 }
209 else 209 else
210 { 210 {
211 withBtn->setChecked( TRUE ); 211 withBtn->setChecked( TRUE );
212 } 212 }
213} 213}
214 214
215Transaction::~Transaction() 215Transaction::~Transaction()
216{ 216{
217} 217}
218 218
219void Transaction::accept() 219void Transaction::accept()
220{ 220{
221 tran->setDesc( descEdit->text() ); 221 tran->setDesc( descEdit->text() );
222 tran->setDate( datePicker->selectedDate() ); 222 tran->setDate( datePicker->selectedDate() );
223 tran->setWithdrawal( withBtn->isChecked() ); 223 tran->setWithdrawal( withBtn->isChecked() );
224 tran->setType( typeList->currentText() ); 224 tran->setType( typeList->currentText() );
225 tran->setCategory( catList->currentText() ); 225 tran->setCategory( catList->currentText() );
226 bool ok; 226 bool ok;
227 tran->setAmount( amtEdit->text().toFloat( &ok ) ); 227 tran->setAmount( amtEdit->text().toFloat( &ok ) );
228 tran->setFee( feeEdit->text().toFloat( &ok ) ); 228 tran->setFee( feeEdit->text().toFloat( &ok ) );
229 tran->setNumber( numEdit->text() ); 229 tran->setNumber( numEdit->text() );
230 tran->setNotes( noteEdit->text() ); 230 tran->setNotes( noteEdit->text() );
231 231
232 QDialog::accept(); 232 QDialog::accept();
233} 233}
234 234
235void Transaction::slotWithdrawalClicked() 235void Transaction::slotWithdrawalClicked()
236{ 236{
237 catList->clear(); 237 catList->clear();
238 catList->insertItem( tr( "Automobile" ) ); 238 catList->insertItem( tr( "Automobile" ) );
239 catList->insertItem( tr( "Bills" ) ); 239 catList->insertItem( tr( "Bills" ) );
240 catList->insertItem( tr( "CDs" ) ); 240 catList->insertItem( tr( "CDs" ) );
241 catList->insertItem( tr( "Clothing" ) ); 241 catList->insertItem( tr( "Clothing" ) );
242 catList->insertItem( tr( "Computer" ) ); 242 catList->insertItem( tr( "Computer" ) );
243 catList->insertItem( tr( "DVDs" ) ); 243 catList->insertItem( tr( "DVDs" ) );
244 catList->insertItem( tr( "Eletronics" ) ); 244 catList->insertItem( tr( "Eletronics" ) );
245 catList->insertItem( tr( "Entertainment" ) ); 245 catList->insertItem( tr( "Entertainment" ) );
246 catList->insertItem( tr( "Food" ) ); 246 catList->insertItem( tr( "Food" ) );
247 catList->insertItem( tr( "Gasoline" ) ); 247 catList->insertItem( tr( "Gasoline" ) );
248 catList->insertItem( tr( "Misc" ) ); 248 catList->insertItem( tr( "Misc" ) );
249 catList->insertItem( tr( "Movies" ) ); 249 catList->insertItem( tr( "Movies" ) );
250 catList->insertItem( tr( "Rent" ) ); 250 catList->insertItem( tr( "Rent" ) );
251 catList->insertItem( tr( "Travel" ) ); 251 catList->insertItem( tr( "Travel" ) );
252 catList->setCurrentItem( 0 ); 252 catList->setCurrentItem( 0 );
253 typeList->clear(); 253 typeList->clear();
254 typeList->insertItem( tr( "Debit Charge" ) ); 254 typeList->insertItem( tr( "Debit Charge" ) );
255 typeList->insertItem( tr( "Written Check" ) ); 255 typeList->insertItem( tr( "Written Check" ) );
256 typeList->insertItem( tr( "Transfer" ) ); 256 typeList->insertItem( tr( "Transfer" ) );
257 typeList->insertItem( tr( "Credit Card" ) ); 257 typeList->insertItem( tr( "Credit Card" ) );
258} 258}
259 259
260void Transaction::slotDepositClicked() 260void Transaction::slotDepositClicked()
261{ 261{
262 catList->clear(); 262 catList->clear();
263 catList->insertItem( tr( "Work" ) ); 263 catList->insertItem( tr( "Work" ) );
264 catList->insertItem( tr( "Family Member" ) ); 264 catList->insertItem( tr( "Family Member" ) );
265 catList->insertItem( tr( "Misc. Credit" ) ); 265 catList->insertItem( tr( "Misc. Credit" ) );
266 catList->setCurrentItem( 0 ); 266 catList->setCurrentItem( 0 );
267 typeList->clear(); 267 typeList->clear();
268 typeList->insertItem( tr( "Written Check" ) ); 268 typeList->insertItem( tr( "Written Check" ) );
269 typeList->insertItem( tr( "Automatic Payment" ) ); 269 typeList->insertItem( tr( "Automatic Payment" ) );
270 typeList->insertItem( tr( "Transfer" ) ); 270 typeList->insertItem( tr( "Transfer" ) );
271 typeList->insertItem( tr( "Cash" ) ); 271 typeList->insertItem( tr( "Cash" ) );
272} 272}
273 273
274void Transaction::slotDateChanged( int y, int m, int d ) 274void Transaction::slotDateChanged( int y, int m, int d )
275{ 275{
276 QDate date; 276 QDate date;
277 date.setYMD( y, m, d ); 277 date.setYMD( y, m, d );
278 dateBtn->setText( TimeString::shortDate( date ) ); 278 dateBtn->setText( TimeString::shortDate( date ) );
279} 279}
diff --git a/noncore/apps/checkbook/transaction.h b/noncore/apps/checkbook/transaction.h
index 274e1f2..89ca8e4 100644
--- a/noncore/apps/checkbook/transaction.h
+++ b/noncore/apps/checkbook/transaction.h
@@ -1,79 +1,79 @@
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 <drw@handhelds.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#ifndef TRANSACTION_H 29#ifndef TRANSACTION_H
30#define TRANSACTION_H 30#define TRANSACTION_H
31 31
32#include <qdialog.h> 32#include <qdialog.h>
33 33
34class DateBookMonth; 34class DateBookMonth;
35class QComboBox; 35class QComboBox;
36class QLineEdit; 36class QLineEdit;
37class QMultiLineEdit; 37class QMultiLineEdit;
38class QPushButton; 38class QPushButton;
39class QRadioButton; 39class QRadioButton;
40class QString; 40class QString;
41class QWidget; 41class QWidget;
42class TranInfo; 42class TranInfo;
43 43
44class Transaction : public QDialog 44class Transaction : public QDialog
45{ 45{
46 Q_OBJECT 46 Q_OBJECT
47 47
48 public: 48 public:
49 Transaction( QWidget * = 0x0, const QString & = 0x0, TranInfo * = 0x0, 49 Transaction( QWidget * = 0x0, const QString & = 0x0, TranInfo * = 0x0,
50 char = '$' ); 50 char = '$' );
51 ~Transaction(); 51 ~Transaction();
52 52
53 private: 53 private:
54 TranInfo *tran; 54 TranInfo *tran;
55 55
56 char currencySymbol; 56 char currencySymbol;
57 57
58 QRadioButton *withBtn; 58 QRadioButton *withBtn;
59 QRadioButton *depBtn; 59 QRadioButton *depBtn;
60 QPushButton *dateBtn; 60 QPushButton *dateBtn;
61 DateBookMonth *datePicker; 61 DateBookMonth *datePicker;
62 QLineEdit *numEdit; 62 QLineEdit *numEdit;
63 QLineEdit *descEdit; 63 QLineEdit *descEdit;
64 QComboBox *catList; 64 QComboBox *catList;
65 QComboBox *typeList; 65 QComboBox *typeList;
66 QLineEdit *amtEdit; 66 QLineEdit *amtEdit;
67 QLineEdit *feeEdit; 67 QLineEdit *feeEdit;
68 QMultiLineEdit *noteEdit; 68 QMultiLineEdit *noteEdit;
69 69
70 protected slots: 70 protected slots:
71 void accept(); 71 void accept();
72 72
73 private slots: 73 private slots:
74 void slotWithdrawalClicked(); 74 void slotWithdrawalClicked();
75 void slotDepositClicked(); 75 void slotDepositClicked();
76 void slotDateChanged( int, int, int ); 76 void slotDateChanged( int, int, int );
77}; 77};
78 78
79#endif 79#endif