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,7 +1,7 @@
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
@@ -39,10 +39,10 @@
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>
@@ -201,12 +201,14 @@ QWidget *Checkbook::initTransactions()
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 ) ),
@@ -314,8 +316,7 @@ void Checkbook::loadCheckbook()
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 {
@@ -334,11 +335,14 @@ void Checkbook::adjustBalance( float amount )
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 );
@@ -418,8 +422,8 @@ void Checkbook::slotNewTran()
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 }
@@ -439,8 +443,7 @@ void Checkbook::slotEditTran()
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 {
@@ -482,9 +485,7 @@ void Checkbook::slotDeleteTran()
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 {
@@ -594,3 +595,67 @@ void Checkbook::drawCategoryChart( bool withdrawals )
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,7 +1,7 @@
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
@@ -32,6 +32,7 @@
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
@@ -65,7 +66,7 @@ class Checkbook : public QDialog
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();
@@ -105,4 +106,23 @@ class Checkbook : public QDialog
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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)
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,7 +1,7 @@
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
@@ -187,4 +187,4 @@ int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2
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,7 +1,7 @@
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
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,7 +1,7 @@
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
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,7 +1,7 @@
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