author | llornkcor <llornkcor> | 2003-07-17 15:00:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-17 15:00:34 (UTC) |
commit | 6140e0d6a131ac127ebfc583990cb6ceefdd30ad (patch) (side-by-side diff) | |
tree | 7b0f5f856dc16b535454f9737b59dff18d7b3626 | |
parent | 53237dd02577d118e1ad19a18819f86f1a4ea207 (diff) | |
download | opie-6140e0d6a131ac127ebfc583990cb6ceefdd30ad.zip opie-6140e0d6a131ac127ebfc583990cb6ceefdd30ad.tar.gz opie-6140e0d6a131ac127ebfc583990cb6ceefdd30ad.tar.bz2 |
fixincludes
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/checkbook/configuration.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/graph.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/checkbook/password.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/traninfo.h | 1 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 5 |
7 files changed, 0 insertions, 19 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 5fe660c..653ee4a 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -1,245 +1,241 @@ /* This file is part of the OPIE Project =. .=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 "cbinfo.h" #include "transaction.h" #include "traninfo.h" #include "graph.h" #include "graphinfo.h" #include "password.h" #include <opie/otabwidget.h> -#include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qcheckbox.h> #include <qcombobox.h> -#include <qfile.h> -#include <qfontmetrics.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qwhatsthis.h> -#include <qwidget.h> Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { info = i; currencySymbol = symbol; if ( info->name() != "" ) { QString tempstr = info->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() { } QWidget *Checkbook::initInfo() { QWidget *control = new QWidget( mainWidget ); QVBoxLayout *vb = new QVBoxLayout( control ); QScrollView *sv = new QScrollView( control ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); // Password protection passwordCB = new QCheckBox( tr( "Password protect" ), container ); QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); // Account name QLabel *label = new QLabel( tr( "Name:" ), container ); QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); layout->addWidget( label, 1, 0 ); nameEdit = new QLineEdit( container ); QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); connect( nameEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotNameChanged( const QString & ) ) ); layout->addWidget( nameEdit, 1, 1 ); // Type of account label = new QLabel( tr( "Type:" ), container ); QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); layout->addWidget( label, 2, 0 ); typeList = new QComboBox( container ); QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); typeList->insertItem( tr( "Savings" ) ); // 0 typeList->insertItem( tr( "Checking" ) ); // 1 typeList->insertItem( tr( "CD" ) ); // 2 typeList->insertItem( tr( "Money market" ) ); // 3 typeList->insertItem( tr( "Mutual fund" ) ); // 4 typeList->insertItem( tr( "Other" ) ); // 5 layout->addWidget( typeList, 2, 1 ); // Bank/institution name label = new QLabel( tr( "Bank:" ), container ); QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( label, 3, 0 ); bankEdit = new QLineEdit( container ); QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( bankEdit, 3, 1 ); // Account number label = new QLabel( tr( "Account number:" ), container ); QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( label, 4, 0 ); acctNumEdit = new QLineEdit( container ); QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( acctNumEdit, 4, 1 ); // PIN number label = new QLabel( tr( "PIN number:" ), container ); QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( label, 5, 0 ); pinNumEdit = new QLineEdit( container ); QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( pinNumEdit, 5, 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, 6, 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, 6, 1 ); // Notes label = new QLabel( tr( "Notes:" ), container ); QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); layout->addWidget( label, 7, 0 ); notesEdit = new QMultiLineEdit( container ); QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); notesEdit->setMinimumHeight( 25 ); notesEdit->setMaximumHeight( 65 ); layout->addMultiCellWidget( notesEdit, 8, 8, 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( "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 ); diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp index 37208da..7731cf3 100644 --- a/noncore/apps/checkbook/configuration.cpp +++ b/noncore/apps/checkbook/configuration.cpp @@ -1,76 +1,74 @@ /* This file is part of the OPIE Project =. .=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 "configuration.h" #include <qcheckbox.h> -#include <qfontmetrics.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> -#include <qstring.h> #include <qwhatsthis.h> Configuration::Configuration( QWidget *parent, const QString &cs, bool sl, bool sb ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { setCaption( tr( "Configure Checkbook" ) ); QFontMetrics fm = fontMetrics(); int fh = fm.height(); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); QLabel *label = new QLabel( tr( "Enter currency symbol:" ), this ); QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) ); label->setMaximumHeight( fh + 3 ); layout->addWidget( label, 0, 0 ); symbolEdit = new QLineEdit( cs, this ); QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) ); symbolEdit->setMaximumHeight( fh + 5 ); symbolEdit->setFocus(); layout->addWidget( symbolEdit, 0, 1 ); lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), this ); QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) ); lockCB->setChecked( sl ); layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 ); balCB = new QCheckBox( tr( "Show checkbook balances" ), this ); QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); balCB->setMaximumHeight( fh + 5 ); balCB->setChecked( sb ); layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); } Configuration::~Configuration() { } diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp index acdb846..389972e 100644 --- a/noncore/apps/checkbook/graph.cpp +++ b/noncore/apps/checkbook/graph.cpp @@ -1,172 +1,170 @@ /* This file is part of the OPIE Project =. .=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 ) { if ( regen ) { initGraph(); } QPainter p( this ); p.drawPixmap( 0, 0, graph ); } void Graph::paintEvent( QPaintEvent * ) { drawGraph( FALSE ); } void Graph::resizeEvent( QResizeEvent * ) { drawGraph( TRUE ); } void Graph::initGraph() { graph.resize( width(), height() ); graph.fill( QColor( 255, 255, 255 ) ); if ( !data ) { return; } // Any common stuff here (titles, ???) switch ( data->graphType() ) { case GraphInfo::BarChart : { drawBarChart( width(), height(), data->maxValue() ); } break; case GraphInfo::PieChart : { drawPieChart( width(), height(), data->totalValue() ); } }; } void Graph::drawBarChart( int width, int height, float max ) { QPainter p( &graph ); // Try to set the font size smaller for text QFont f = font(); f.setPointSize( 8 ); p.setFont( f ); int x = 0; int i = 0; int n = data->numberDataPoints(); QFontMetrics fm=fontMetrics(); int fh = fm.height(); int fw; QColor c( 0, 0, 255); p.setBrush( c ); for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) { int bw = ( width - width / 4 - x ) / ( n - i ); int bh = int( ( height - height / 4 - 1 ) * dp->value() / max ); p.drawRect( width / 8 + x, height - height / 8 - 1 - bh, bw, bh ); fw = fm.width( dp->label() ); p.drawText( width / 8 + x - fw / 2 + bw / 2, height - height / 8, fw, fh + height / 8, AlignTop | AlignHCenter, dp->label() ); // WordBreak | AlignTop | AlignHCenter, dp->label() ); i++; x += bw; } } void Graph::drawPieChart( int width, int height, float sum ) { QPainter p( &graph ); // Try to set the font size smaller for text QFont f = font(); f.setPointSize( 8 ); p.setFont( f ); int n = data->numberDataPoints(); int apos = -90 * 16; int xd = width - width / 5; int yd = height - height / 5; int i = 0; QColor c; for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) { c.setHsv( ( i *255) / n, 255, 255 ); p.setBrush( c ); int a = int( ( dp->value() * 360.0 ) / sum * 16.0 + 0.5 ); p.drawPie( width/10, height/10, xd, yd, -apos, -a ); apos += a; i++; } double apos2 = -90 * 3.14159 / 180; for (DataPointInfo *dp = data->firstDataPoint(); dp; dp = data->nextDataPoint() ) { double a = dp->value() *360 / sum * 3.14159 / 180; int x = int( cos( apos2 + a/2 ) * width * 5/16 + width/2 + 0.5 ); int y = int( sin( apos2 + a/2 ) * height * 5/16 + height/2 + 0.5 ); p.drawText( x - width/8, y - height/8, width/4, height/4, WordBreak | AlignCenter, dp->label() ); apos2 += a; } } diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index ab1ceef..6d1d7b9 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -1,241 +1,238 @@ /* This file is part of the OPIE Project =. .=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 "cbinfo.h" #include "configuration.h" #include "password.h" #include "checkbook.h" #include <qpe/config.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 <qcheckbox.h> #include <qdir.h> #include <qlineedit.h> -#include <qlistview.h> -#include <qpopupmenu.h> -#include <qstring.h> #include <qwhatsthis.h> MainWindow::MainWindow() : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); cbDir = Global::applicationFileName( "checkbook", "" ); lockIcon = Resource::loadPixmap( "locked" ); // Load configuration options Config config( "checkbook" ); config.setGroup( "Config" ); currencySymbol = config.readEntry( "CurrencySymbol", "$" ); showLocks = config.readBoolEntry( "ShowLocks", FALSE ); showBalances = config.readBoolEntry( "ShowBalances", FALSE ); // Build menu and tool bars setToolBarsMovable( FALSE ); QPEToolBar *bar = new QPEToolBar( this ); bar->setHorizontalStretchable( TRUE ); QPEMenuBar *mb = new QPEMenuBar( bar ); mb->setMargin( 0 ); QPopupMenu *popup = new QPopupMenu( this ); bar = new QPEToolBar( this ); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->addTo( popup ); a->addTo( bar ); actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); actionOpen->addTo( popup ); actionOpen->addTo( bar ); actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); actionDelete->addTo( popup ); actionDelete->addTo( bar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this app." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); a->addTo( popup ); a->addTo( bar ); mb->insertItem( tr( "Checkbook" ), popup ); // Load Checkbook selection list checkbooks = new CBInfoList(); QDir checkdir( cbDir ); if (checkdir.exists() == true) { QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time ); CBInfo *cb = 0x0; QString filename; for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) { filename = cbDir; filename.append( (*it) ); cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); checkbooks->inSort( cb ); } } // Build Checkbook selection list control cbList = 0x0; buildList(); } MainWindow::~MainWindow() { // config.write(); } void MainWindow::buildList() { if ( cbList ) { delete cbList; } cbList = new QListView( this ); QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); if ( showLocks ) { cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); posName = 1; } else { posName = 0; } cbList->addColumn( tr( "Checkbook Name" ) ); if ( showBalances ) { int colnum = cbList->addColumn( tr( "Balance" ) ); cbList->setColumnAlignment( colnum, Qt::AlignRight ); } cbList->setAllColumnsShowFocus( TRUE ); cbList->setSorting( posName ); QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( slotEdit() ) ); setCentralWidget( cbList ); for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) { addCheckbook( cb ); } } void MainWindow::addCheckbook( CBInfo *cb ) { QListViewItem *lvi = new QListViewItem( cbList ); if ( showLocks && !cb->password().isNull() ) { lvi->setPixmap( 0, lockIcon ); } lvi->setText( posName, cb->name() ); if ( showBalances ) { QString balance; balance.sprintf( "%s%.2f", currencySymbol.latin1(), cb->balance() ); lvi->setText( posName + 1, balance ); } } void MainWindow::buildFilename( const QString &name ) { tempFilename = cbDir; tempFilename.append( name ); tempFilename.append( ".qcb" ); } void MainWindow::slotNew() { CBInfo *cb = new CBInfo(); Checkbook *currcb = new Checkbook( this, cb, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { // Save new checkbook buildFilename( cb->name() ); cb->setFilename( tempFilename ); cb->write(); // Add to listbox checkbooks->inSort( cb ); addCheckbook( cb ); } delete currcb; } void MainWindow::slotEdit() { QListViewItem *curritem = cbList->currentItem(); if ( !curritem ) { return; } QString currname = curritem->text( posName ); CBInfo *cb = checkbooks->first(); while ( cb ) { if ( cb->name() == currname ) break; cb = checkbooks->next(); } if ( !cb ) { return; } buildFilename( currname ); diff --git a/noncore/apps/checkbook/password.cpp b/noncore/apps/checkbook/password.cpp index 82020d5..f381271 100644 --- a/noncore/apps/checkbook/password.cpp +++ b/noncore/apps/checkbook/password.cpp @@ -1,99 +1,97 @@ /* This file is part of the OPIE Project =. .=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 "password.h" #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> -#include <qpixmap.h> #include <qpushbutton.h> -#include <qwidget.h> static const char* const showhideimage_data[] = { "16 16 2 1", ". c None", "# c #000000", "................", "...#...###...##.", "..#.#..#..#.##..", "..###..###.##...", ".#...#.#..##....", ".#...#.#.##.....", "........##.#..#.", "..##...##...##..", ".#..#.###...##..", ".#...##..#.#..#.", ".#..##..........", ".#.##.#..#.#..#.", "..##...##...##..", ".##....##...##..", ".#....#..#.#..#.", "................"}; Password::Password( QWidget *parent, const char *caption, const char *prompt ) : QDialog( parent, 0x0, TRUE, 0x0 ) { setCaption( caption ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2 ); layout->setMargin( 4 ); QLabel *label = new QLabel( prompt, this ); label->setAlignment( AlignLeft | AlignTop | WordBreak ); layout->addMultiCellWidget( label, 0, 0, 0, 1 ); pw = new QLineEdit( this ); pw->setEchoMode( QLineEdit::Password ); layout->addWidget( pw, 1, 0 ); QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data ); QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this ); btn->setMaximumSize( pic->width() + 10, pic->height() + 10 ); btn->setToggleButton( TRUE ); connect( btn, SIGNAL( toggled( bool ) ), this, SLOT( slotTogglePassword( bool ) ) ); layout->addWidget( btn, 1, 1 ); password == ""; } Password::~Password() { } void Password::accept() { password = pw->text(); QDialog::accept(); } void Password::slotTogglePassword( bool showPW ) { showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password ); } diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h index 5f67262..f6c5cae 100644 --- a/noncore/apps/checkbook/traninfo.h +++ b/noncore/apps/checkbook/traninfo.h @@ -1,90 +1,89 @@ /* This file is part of the OPIE Project =. .=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; } const QString &category() const { return c; } float amount() const { return a; } float fee() const { return f; } const QString &number() const { return cn; } const QString ¬es() const { return n; } void setDesc( const QString &desc ) { d = desc; } void setDate( const QDate &date ) { td = date; } void setWithdrawal( bool withdrawal ) { w = withdrawal; } void setType( const QString &type ) { t = type; } void setCategory( const QString &cat ) { c = cat; } void setAmount( float amount ) { a = amount; } void setFee( float fee ) { f = fee; } void setNumber( const QString &num ) { cn = num; } void setNotes( const QString ¬es ) { n = notes; } void write( Config *, int ); private: int i; QString d; QDate td; bool w; QString t; QString c; float a; float f; QString cn; QString n; }; class TranInfoList : public QList<TranInfo> { protected: int compareItems( QCollection::Item, QCollection::Item ); }; #endif diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 17be669..07d5ae1 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -1,237 +1,232 @@ /* This file is part of the OPIE Project =. .=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, const QString &symbol ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { QString tempstr = tr( "Transaction for " ); tempstr.append( acctname ); setCaption( tempstr ); tran = info; currencySymbol = symbol; QVBoxLayout *vb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); // Withdrawal/Deposit QButtonGroup *btngrp = new QButtonGroup( container ); btngrp->setColumnLayout(0, Qt::Vertical ); btngrp->layout()->setSpacing( 0 ); btngrp->layout()->setMargin( 0 ); btngrp->setMaximumWidth( 220 ); QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); layout2->setSpacing( 2 ); layout2->setMargin( 2 ); withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( withBtn, 0, 0 ); connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( depBtn, 0, 1 ); btngrp->setMaximumSize( 320, withBtn->height() ); connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); // Date QLabel *label = new QLabel( tr( "Date:" ), container ); QWhatsThis::add( label, tr( "Select date of transaction here." ) ); layout->addWidget( label, 1, 0 ); dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), container ); QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); QPopupMenu *m1 = new QPopupMenu( container ); datePicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( datePicker ); dateBtn->setPopup( m1 ); connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( slotDateChanged( int, int, int ) ) ); layout->addWidget( dateBtn, 1, 1 ); // Check number label = new QLabel( tr( "Number:" ), container ); QWhatsThis::add( label, tr( "Enter check number here." ) ); layout->addWidget( label, 1, 2 ); numEdit = new QLineEdit( container ); QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); numEdit->setMaximumWidth( 40 ); layout->addWidget( numEdit, 1, 3 ); // Description label = new QLabel( tr( "Description:" ), container ); QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); layout->addWidget( label, 2, 0 ); descEdit = new QLineEdit( container ); QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) ); layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); // Category label = new QLabel( tr( "Category:" ), container ); QWhatsThis::add( label, tr( "Select transaction category here." ) ); layout->addWidget( label, 3, 0 ); catList = new QComboBox( container ); QWhatsThis::add( catList, tr( "Select transaction category here." ) ); layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); // Type label = new QLabel( tr( "Type:" ), container ); QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addWidget( label, 4, 0 ); typeList = new QComboBox( container ); QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); // Amount label = new QLabel( tr( "Amount:" ), container ); QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 5, 0 ); amtEdit = new QLineEdit( container ); QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); // Fee label = new QLabel( tr( "Fee:" ), container ); QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 6, 0 ); feeEdit = new QLineEdit( container ); QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); // Notes label = new QLabel( tr( "Notes:" ), container ); QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); layout->addWidget( label, 7, 0 ); noteEdit = new QMultiLineEdit( container ); QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); // Populate current values if provided if ( info ) { if ( info->withdrawal() ) { withBtn->setChecked( TRUE ); slotWithdrawalClicked(); } else { depBtn->setChecked( TRUE ); slotDepositClicked(); } QDate dt = info->date(); slotDateChanged( dt.year(), dt.month(), dt.day() ); datePicker->setDate( dt ); numEdit->setText( info->number() ); descEdit->setText( info->desc() ); QString temptext = info->category(); int i = catList->count(); while ( i > 0 ) { i--; catList->setCurrentItem( i ); if ( catList->currentText() == temptext ) { break; } } temptext = info->type(); i = typeList->count(); while ( i > 0 ) { i--; typeList->setCurrentItem( i ); if ( typeList->currentText() == temptext ) { break; } } amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); noteEdit->setText( info->notes() ); } else { withBtn->setChecked( TRUE ); } } Transaction::~Transaction() { } void Transaction::accept() { tran->setDesc( descEdit->text() ); tran->setDate( datePicker->selectedDate() ); tran->setWithdrawal( withBtn->isChecked() ); tran->setType( typeList->currentText() ); tran->setCategory( catList->currentText() ); bool ok; tran->setAmount( amtEdit->text().toFloat( &ok ) ); tran->setFee( feeEdit->text().toFloat( &ok ) ); tran->setNumber( numEdit->text() ); tran->setNotes( noteEdit->text() ); QDialog::accept(); } void Transaction::slotWithdrawalClicked() { catList->clear(); |