summaryrefslogtreecommitdiff
Unidiff
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,93 +1,93 @@
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{
@@ -156,102 +156,104 @@ QWidget *Checkbook::initInfo()
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() ) );
@@ -269,267 +271,266 @@ void Checkbook::loadCheckbook()
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
@@ -549,48 +550,112 @@ void Checkbook::drawBalanceChart()
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,52 +1,52 @@
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{
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,52 +1,52 @@
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
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,52 +1,52 @@
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()
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,52 +1,52 @@
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
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,52 +1,52 @@
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
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,52 +1,52 @@
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;
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,52 +1,52 @@
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{
@@ -142,49 +142,49 @@ void TranInfo::write( Config *config, int entry )
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,52 +1,52 @@
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; }
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,52 +1,52 @@
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 " );
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,52 +1,52 @@
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