author | drw <drw> | 2002-11-30 18:22:59 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-30 18:22:59 (UTC) |
commit | 197b74a6193151cca8b7f5f725fb19098cb76eb2 (patch) (side-by-side diff) | |
tree | d2a3e190c3d404ba952c7645eb195de58e2b2d2e | |
parent | 6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a (diff) | |
download | opie-197b74a6193151cca8b7f5f725fb19098cb76eb2.zip opie-197b74a6193151cca8b7f5f725fb19098cb76eb2.tar.gz opie-197b74a6193151cca8b7f5f725fb19098cb76eb2.tar.bz2 |
Made checkbook transaction list prettier & updated contact info
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 93 | ||||
-rw-r--r-- | noncore/apps/checkbook/checkbook.h | 24 | ||||
-rw-r--r-- | noncore/apps/checkbook/graph.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/graph.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/graphinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/graphinfo.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/main.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/opie-checkbook.control | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.h | 2 |
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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "checkbook.h" #include "transaction.h" #include "graph.h" #include "graphinfo.h" #include <opie/otabwidget.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qcombobox.h> #include <qfile.h> +#include <qfontmetrics.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> -#include <qlistview.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qwhatsthis.h> #include <qwidget.h> Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { name = n; filename = fd; filename.append( name ); filename.append( ".qcb" ); filedir = fd; currencySymbol = symbol; currBalance = 0.0; if ( name != "" ) { QString tempstr = name; tempstr.append( " - " ); tempstr.append( tr( "Checkbook" ) ); setCaption( tempstr ); } else { setCaption( tr( "New checkbook" ) ); } // Setup layout to make everything pretty QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 2 ); layout->setSpacing( 4 ); // Setup tabs for all info mainWidget = new OTabWidget( this ); layout->addWidget( mainWidget ); mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); mainWidget->setCurrentTab( tr( "Info" ) ); // Load checkbook information loadCheckbook(); } Checkbook::~Checkbook() { @@ -156,102 +156,104 @@ QWidget *Checkbook::initInfo() QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( acctNumEdit, 3, 1 ); // PIN number label = new QLabel( tr( "PIN number:" ), container ); QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( label, 4, 0 ); pinNumEdit = new QLineEdit( container ); QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( pinNumEdit, 4, 1 ); // Starting balance label = new QLabel( tr( "Starting balance:" ), container ); QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); layout->addWidget( label, 5, 0 ); balanceEdit = new QLineEdit( container ); QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); layout->addWidget( balanceEdit, 5, 1 ); // Notes label = new QLabel( tr( "Notes:" ), container ); QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); layout->addWidget( label, 6, 0 ); notesEdit = new QMultiLineEdit( container ); QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); notesEdit->setMaximumHeight( 85 ); layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); return control; } QWidget *Checkbook::initTransactions() { QWidget *control = new QWidget( mainWidget ); QGridLayout *layout = new QGridLayout( control ); layout->setSpacing( 2 ); layout->setMargin( 4 ); balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), control ); QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); tranTable = new QListView( control ); 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." ) ); - tranTable->addColumn( tr( "ID" ) ); + tranTable->addColumn( tr( "Num" ) ); tranTable->addColumn( tr( "Date" ) ); + //tranTable->addColumn( tr( "Cleared" ) ); tranTable->addColumn( tr( "Description" ) ); int colnum = tranTable->addColumn( tr( "Amount" ) ); tranTable->setColumnAlignment( colnum, Qt::AlignRight ); tranTable->setAllColumnsShowFocus( TRUE ); + tranTable->setSorting( 1 ); layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( slotEditTran() ) ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); layout->addWidget( btn, 2, 0 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); layout->addWidget( btn, 2, 1 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); layout->addWidget( btn, 2, 2 ); return( control ); } QWidget *Checkbook::initCharts() { graphInfo = 0x0; QWidget *control = new QWidget( mainWidget ); QGridLayout *layout = new QGridLayout( control ); layout->setSpacing( 2 ); layout->setMargin( 4 ); graphWidget = new Graph( control ); QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); graphList = new QComboBox( control ); QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); graphList->insertItem( tr( "Account balance" ) ); graphList->insertItem( tr( "Withdrawals by category" ) ); graphList->insertItem( tr( "Deposits by category" ) ); layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); @@ -269,267 +271,266 @@ void Checkbook::loadCheckbook() // Load info config.setGroup( "Account" ); nameEdit->setText( name ); QString temptext = config.readEntry( "Type" ); int i = typeList->count(); while ( i > 0 ) { i--; typeList->setCurrentItem( i ); if ( typeList->currentText() == temptext ) { break; } } bankEdit->setText( config.readEntry( "Bank", "" ) ); acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) ); pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) ); balanceEdit->setText( config.readEntry( "Balance", "0.0" ) ); notesEdit->setText( config.readEntry( "Notes", "" ) ); bool ok; currBalance = balanceEdit->text().toFloat( &ok ); startBalance = currBalance; // Load transactions TranInfo *tran; QString trandesc = ""; float amount; QString stramount; for ( int i = 1; trandesc != QString::null; i++ ) { tran = new TranInfo( config, i ); trandesc = tran->desc(); if ( trandesc != QString::null ) { currBalance -= tran->fee(); amount = tran->amount(); if ( tran->withdrawal() ) { amount *= -1; } currBalance += amount; stramount.sprintf( "%c%.2f", currencySymbol, amount ); // Add to transaction list transactions.inSort( tran ); // Add to transaction table - ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(), - trandesc, stramount ); + ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), trandesc, stramount ); } else { delete tran; } } balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); highTranNum = transactions.count(); } void Checkbook::adjustBalance( float amount ) { currBalance += amount; balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); } -TranInfo *Checkbook::findTranByID( int id ) +TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc ) { TranInfo *traninfo = transactions.first(); - while ( traninfo && traninfo->id() != id ) + while ( traninfo ) { + if ( traninfo->number() == checknum && traninfo->datestr() == date && + traninfo->desc() == desc ) + break; traninfo = transactions.next(); } return( traninfo ); } void Checkbook::accept() { QFile f( filename ); if ( f.exists() ) { f.remove(); } Config *config = new Config(filename, Config::File); // Save info config->setGroup( "Account" ); config->writeEntry( "Type", typeList->currentText() ); config->writeEntry( "Bank", bankEdit->text() ); config->writeEntryCrypt( "Number", acctNumEdit->text() ); config->writeEntryCrypt( "PINNumber", pinNumEdit->text() ); config->writeEntry( "Balance", balanceEdit->text() ); config->writeEntry( "Notes", notesEdit->text() ); // Save transactions int i = 1; for ( TranInfo *tran = transactions.first(); tran; tran = transactions.next() ) { tran->write( config, i ); i++; } config->write(); QDialog::accept(); } void Checkbook::slotNameChanged( const QString &newname ) { name = newname; filename = filedir; filename.append( newname ); filename.append( ".qcb" ); QString tempstr = name; tempstr.append( " - " ); tempstr.append( tr( "Checkbook" ) ); setCaption( tempstr ); } void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) { currBalance -= startBalance; bool ok; startBalance = newbalance.toFloat( &ok ); adjustBalance( startBalance ); } void Checkbook::slotNewTran() { highTranNum++; TranInfo *traninfo = new TranInfo( highTranNum ); Transaction *currtran = new Transaction( this, name, traninfo, currencySymbol ); currtran->showMaximized(); if ( currtran->exec() == QDialog::Accepted ) { float amount = traninfo->amount(); if ( traninfo->withdrawal() ) { amount *= -1; } QString stramount; stramount.sprintf( "%c%.2f", currencySymbol, amount ); // Add to transaction list transactions.inSort( traninfo ); // Add to transaction table - ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), - traninfo->datestr(), traninfo->desc(), stramount ); + ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(), + stramount ); adjustBalance( amount ); } else { highTranNum--; delete traninfo; } } void Checkbook::slotEditTran() { bool ok; QListViewItem *curritem = tranTable->currentItem(); if ( !curritem ) { return; } - int tranid = curritem->text( 0 ).toInt( &ok ); - TranInfo *traninfo = findTranByID( tranid ); + TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); float origamt = traninfo->amount(); if ( traninfo->withdrawal() ) { origamt *= -1; } Transaction *currtran = new Transaction( this, name, traninfo, currencySymbol ); currtran->showMaximized(); if ( currtran->exec() == QDialog::Accepted ) { curritem->setText( 1, traninfo->datestr() ); curritem->setText( 2, traninfo->desc() ); float amount = traninfo->amount(); if ( traninfo->withdrawal() ) { amount *= -1; } adjustBalance( origamt * -1 ); adjustBalance( amount ); QString stramount; stramount.sprintf( "%c%.2f", currencySymbol, amount ); curritem->setText( 3, stramount ); balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) ); delete currtran; } } void Checkbook::slotDeleteTran() { QListViewItem *curritem = tranTable->currentItem(); if ( !curritem ) { return; } - bool ok; - int tranid = curritem->text( 0 ).toInt( &ok ); - TranInfo *traninfo = findTranByID( tranid ); + TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) { float amount = traninfo->amount(); if ( traninfo->withdrawal() ) { amount *= -1; } transactions.remove( traninfo ); delete traninfo; delete curritem; adjustBalance( amount * -1 ); } } void Checkbook::slotDrawGraph() { if ( graphInfo ) { delete graphInfo; } switch ( graphList->currentItem() ) { case 0 : drawBalanceChart(); break; case 1 : drawCategoryChart( TRUE ); break; case 2 : drawCategoryChart( FALSE ); break; }; graphWidget->setGraphInfo( graphInfo ); graphWidget->drawGraph( TRUE ); } void Checkbook::drawBalanceChart() { DataPointList *list = new DataPointList(); float balance = startBalance; float amount; QString label; int i = 0; int count = transactions.count(); @@ -549,48 +550,112 @@ void Checkbook::drawBalanceChart() } else { label = ""; } list->append( new DataPointInfo( label, balance ) ); } graphInfo = new GraphInfo( GraphInfo::BarChart, list ); } void Checkbook::drawCategoryChart( bool withdrawals ) { DataPointList *list = new DataPointList(); TranInfo *tran = transactions.first(); if ( tran && tran->withdrawal() == withdrawals ) { list->append( new DataPointInfo( tran->category(), tran->amount() ) ); } tran = transactions.next(); DataPointInfo *cat; for ( ; tran; tran = transactions.next() ) { if ( tran->withdrawal() == withdrawals ) { // Find category in list for ( cat = list->first(); cat; cat = list->next() ) { if ( cat->label() == tran->category() ) { break; } } if ( cat && cat->label() == tran->category() ) { // Found category, add to transaction to category total cat->addToValue( tran->amount() ); } else { // Didn't find category, add category to list list->append( new DataPointInfo( tran->category(), tran->amount() ) ); } } } graphInfo = new GraphInfo( GraphInfo::PieChart, list ); } + +CBListItem::CBListItem( QListView *parent, QString label1, QString label2, + QString label3, QString label4, QString label5, QString label6, QString label7, + QString label8 ) + : QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 ) +{ + m_known = FALSE; + owner = parent; +} + +void CBListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) +{ + QColorGroup _cg = cg; + const QPixmap *pm = listView()->viewport()->backgroundPixmap(); + if ( pm && !pm->isNull() ) + { + _cg.setBrush( QColorGroup::Base, QBrush( cg.base(), *pm ) ); + p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); + } + else if ( isAltBackground() ) + _cg.setColor(QColorGroup::Base, QColor( 200, 255, 200 ) ); + + QListViewItem::paintCell(p, _cg, column, width, align); +} + +bool CBListItem::isAltBackground() +{ + QListView *lv = static_cast<QListView *>( listView() ); + if ( lv ) + { + CBListItem *above = 0; + above = (CBListItem *)( itemAbove() ); + m_known = above ? above->m_known : true; + if ( m_known ) + { + m_odd = above ? !above->m_odd : false; + } + else + { + CBListItem *item; + bool previous = true; + if ( parent() ) + { + item = (CBListItem *)( parent() ); + if ( item ) + previous = item->m_odd; + item = (CBListItem *)( parent()->firstChild() ); + } + else + { + item = (CBListItem *)( lv->firstChild() ); + } + + while(item) + { + item->m_odd = previous = !previous; + item->m_known = true; + item = (CBListItem *)( item->nextSibling() ); + } + } + return m_odd; + } + return false; +}
\ 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef CHECKBOOK_H #define CHECKBOOK_H #include "traninfo.h" #include <qdialog.h> +#include <qlistview.h> class OTabWidget; class Graph; class GraphInfo; class QComboBox; class QLabel; class QLineEdit; class QListView; class QMultiLineEdit; class QString; class Checkbook : public QDialog { Q_OBJECT public: Checkbook( QWidget * = 0x0, const QString & = 0x0, const QString & = 0x0, char = '$' ); ~Checkbook(); const QString &getName(); private: TranInfoList transactions; QString name; QString filename; QString filedir; char currencySymbol; int highTranNum; OTabWidget *mainWidget; void loadCheckbook(); void adjustBalance( float ); - TranInfo *findTranByID( int ); + TranInfo *findTran( const QString &, const QString &, const QString & ); // Info tab QWidget *initInfo(); QLineEdit *nameEdit; QComboBox *typeList; QLineEdit *bankEdit; QLineEdit *acctNumEdit; QLineEdit *pinNumEdit; QLineEdit *balanceEdit; QMultiLineEdit *notesEdit; float startBalance; // Transactions tab QWidget *initTransactions(); QListView *tranTable; QLabel *balanceLabel; float currBalance; // Charts tab QWidget *initCharts(); GraphInfo *graphInfo; QComboBox *graphList; Graph *graphWidget; void drawBalanceChart(); void drawCategoryChart( bool = TRUE ); protected slots: void accept(); private slots: void slotNameChanged( const QString & ); void slotStartingBalanceChanged( const QString & ); void slotNewTran(); void slotEditTran(); void slotDeleteTran(); void slotDrawGraph(); }; +class CBListItem : public QListViewItem +{ + //Q_OBJECT + + public: + CBListItem( QListView *, QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, QString = QString::null ); + + void paintCell( QPainter *, const QColorGroup &, int, int, int ); + + private: + QListView *owner; + bool m_known; + bool m_odd; + + bool isAltBackground(); +}; + #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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "graph.h" #include "graphinfo.h" #include <qcolor.h> #include <qfontmetrics.h> #include <qpainter.h> #include <math.h> Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags ) : QWidget( parent, name, flags ) { data = d; graph.setOptimization( QPixmap::BestOptim ); } void Graph::setGraphInfo( GraphInfo *d ) { data = d; } void Graph::drawGraph( bool regen ) { 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GRAPH_H #define GRAPH_H #include <qpixmap.h> #include <qwidget.h> class GraphInfo; class QPainter; class Graph : public QWidget { Q_OBJECT public: Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 ); void setGraphInfo( GraphInfo * ); void drawGraph( bool = FALSE ); protected: void paintEvent( QPaintEvent * ); void resizeEvent( QResizeEvent * ); 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "graphinfo.h" GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title, const QString &xtitle, const QString &ytitle ) { t = type; d = data; gt = title; xt = xtitle; yt = ytitle; } GraphInfo::~GraphInfo() { if ( d ) { for ( DataPointInfo *data = d->first(); data; data = d->next() ) { delete data; } } } GraphInfo::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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GRAPHINFO_H #define GRAPHINFO_H #include <qlist.h> #include <qstringlist.h> class DataPointInfo { public: DataPointInfo() : l( 0x0 ), v( 0.0 ) {} DataPointInfo( const QString &label, float value ) : l( label ), v( value ) {} const QString &label() { return l; } float value() { return v; } void addToValue( float value ) { v += value; } private: QString l; float v; }; 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mainwindow.h" #include <qpe/qpeapplication.h> int main(int argc, char **argv) { QPEApplication app(argc, argv); MainWindow *cb = new MainWindow(); app.setMainWidget(cb); cb->showMaximized(); return app.exec(); } 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mainwindow.h" #include "checkbook.h" #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/qpemenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qaction.h> #include <qdir.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qstring.h> #include <qwhatsthis.h> MainWindow::MainWindow() : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); cbDir = Global::applicationFileName( "checkbook", "" ); 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <qmainwindow.h> class QAction; class QListBox; class QListBoxItem; class QString; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); ~MainWindow(); private: QListBox *cbList; QString cbDir; QAction *actionOpen; QAction *actionDelete; 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 @@ Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook Priority: optional Section: applications -Maintainer: Dan Williams <williamsdr@acm.org> +Maintainer: Dan Williams <drw@handhelds.org> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) Description: Checkbook keeping program. 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "traninfo.h" #include <qpe/config.h> QString tempstr; TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, const QString &type, const QString &category, float amount, float fee, const QString &number, const QString ¬es ) { i = id; d = desc; td = date; w = withdrawal; t = type; c = category; a = amount; f = fee; cn = number; n = notes; } TranInfo::TranInfo( Config config, int entry ) { @@ -142,49 +142,49 @@ void TranInfo::write( Config *config, int entry ) tempstr = QString::number( td.month() ); tempstr.append( '/' ); tempstr.append( QString::number( td.day() ) ); tempstr.append( '/' ); tempstr.append( QString::number( td.year() ) ); config->writeEntry( "Date", tempstr ); w ? tempstr = "true" : tempstr = "false"; config->writeEntry( "Payment", tempstr ); if ( t == "Debit Charge" || t == "Written Check" ) tempstr = "0"; else if ( t == "Written Check" || t == "Automatic Payment" ) tempstr = "1"; else if ( t == "Transfer" ) tempstr = "2"; else if ( t == "Credit Card" || t == "Cash" ) tempstr = "3"; config->writeEntry( "Type", tempstr ); config->writeEntry( "Category", c ); tempstr.setNum( a, 'f', 2 ); config->writeEntry( "Amount", tempstr ); tempstr.setNum( f, 'f', 2 ); config->writeEntry( "TransactionFee", tempstr ); config->writeEntry( "CheckNumber", cn ); config->writeEntry( "Comments", n ); } int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) { QDate d1 = ((TranInfo *)item1)->date(); QDate d2 = ((TranInfo *)item2)->date(); int r = -1; if ( d1 < d2 ) r = -1; else if ( d1 == d2 ) r = 0; else if ( d1 > d2 ) r = 1; return( r ); -}
\ No newline at end of file +} 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TRANINFO_H #define TRANINFO_H #include <qdatetime.h> #include <qlist.h> #include <qstring.h> class Config; class TranInfo { public: TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), bool = TRUE, const QString & = 0x0, const QString & = 0x0, float = 0.0, float = 0.0, const QString & = 0x0, const QString & = 0x0 ); TranInfo( Config, int ); int id() const { return i; } const QString &desc() const { return d; } const QDate &date() const { return td; } const QString &datestr(); bool withdrawal() const { return w; } 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "transaction.h" #include "traninfo.h" #include <qpe/datebookmonth.h> #include <qpe/timestring.h> #include <qbuttongroup.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qscrollview.h> #include <qstring.h> #include <qwhatsthis.h> Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, char symbol ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { 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 @@ /* This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TRANSACTION_H #define TRANSACTION_H #include <qdialog.h> class DateBookMonth; class QComboBox; class QLineEdit; class QMultiLineEdit; class QPushButton; class QRadioButton; class QString; class QWidget; class TranInfo; class Transaction : public QDialog { Q_OBJECT public: Transaction( QWidget * = 0x0, const QString & = 0x0, TranInfo * = 0x0, char = '$' ); ~Transaction(); |