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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
@@ -41,2 +41,3 @@
41#include <qfile.h> 41#include <qfile.h>
42#include <qfontmetrics.h>
42#include <qlabel.h> 43#include <qlabel.h>
@@ -44,3 +45,2 @@
44#include <qlineedit.h> 45#include <qlineedit.h>
45#include <qlistview.h>
46#include <qmultilineedit.h> 46#include <qmultilineedit.h>
@@ -203,4 +203,5 @@ QWidget *Checkbook::initTransactions()
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" ) );
@@ -209,2 +210,3 @@ QWidget *Checkbook::initTransactions()
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 );
@@ -316,4 +318,3 @@ void Checkbook::loadCheckbook()
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 }
@@ -336,7 +337,10 @@ void Checkbook::adjustBalance( float amount )
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();
@@ -420,4 +424,4 @@ void Checkbook::slotNewTran()
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
@@ -441,4 +445,3 @@ void Checkbook::slotEditTran()
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();
@@ -484,5 +487,3 @@ void Checkbook::slotDeleteTran()
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
@@ -596 +597,65 @@ void Checkbook::drawCategoryChart( bool withdrawals )
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
@@ -34,2 +34,3 @@
34#include <qdialog.h> 34#include <qdialog.h>
35#include <qlistview.h>
35 36
@@ -67,3 +68,3 @@ class Checkbook : public QDialog
67 void adjustBalance( float ); 68 void adjustBalance( float );
68 TranInfo *findTranByID( int ); 69 TranInfo *findTran( const QString &, const QString &, const QString & );
69 70
@@ -107,2 +108,21 @@ class Checkbook : public QDialog
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@ Priority: optional
3Section: applications 3Section: applications
4Maintainer: Dan Williams <williamsdr@acm.org> 4Maintainer: Dan Williams <drw@handhelds.org>
5Architecture: arm 5Architecture: arm
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
@@ -189,2 +189,2 @@ int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
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
@@ -3,3 +3,3 @@
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=