summaryrefslogtreecommitdiff
path: root/noncore/apps
authordrw <drw>2004-02-22 00:08:21 (UTC)
committer drw <drw>2004-02-22 00:08:21 (UTC)
commite8aa81decb9a22828dcdbbaf3d08e2c6f1d2217f (patch) (side-by-side diff)
tree2ebc546b4cf84d014eae25b9753f2cb40be37b48 /noncore/apps
parent58f490cf6fd94ec27eec01c0ffc9d0411be594e8 (diff)
downloadopie-e8aa81decb9a22828dcdbbaf3d08e2c6f1d2217f.zip
opie-e8aa81decb9a22828dcdbbaf3d08e2c6f1d2217f.tar.gz
opie-e8aa81decb9a22828dcdbbaf3d08e2c6f1d2217f.tar.bz2
Checkbook: libopie->libopie2
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp917
-rw-r--r--noncore/apps/checkbook/checkbook.h110
-rw-r--r--noncore/apps/checkbook/checkbook.pro2
-rw-r--r--noncore/apps/checkbook/main.cpp3
-rw-r--r--noncore/apps/checkbook/opie-checkbook.control2
5 files changed, 517 insertions, 517 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index a5492e4..4ca764f 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -36,7 +36,6 @@
#include "mainwindow.h"
#include "cfg.h"
-#include <opie/otabwidget.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
@@ -61,44 +60,44 @@
// --- Checkbook --------------------------------------------------------------
Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg )
- : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
+ : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
- info = i;
+ info = i;
_pCfg=cfg;
// Title bar
- 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" ) );
+ 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" ) );
if( _pCfg->isShowLastTab() )
mainWidget->setCurrentTab( info->getLastTab() );
else
- mainWidget->setCurrentTab( tr( "Info" ) );
+ mainWidget->setCurrentTab( tr( "Info" ) );
connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) );
- // Load checkbook information
- loadCheckbook();
+ // Load checkbook information
+ loadCheckbook();
}
Checkbook::~Checkbook()
@@ -110,106 +109,106 @@ QWidget *Checkbook::initInfo()
{
QWidget *control = new QWidget( mainWidget, tr("Info") );
- 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." ) );
+ 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->insertStringList( _pCfg->getAccountTypes() );
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;
+ // 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;
}
// --- initTransactions -------------------------------------------------------
QWidget *Checkbook::initTransactions()
{
- QWidget *control = new QWidget( mainWidget, tr("Transactions") );
+ QWidget *control = new QWidget( mainWidget, tr("Transactions") );
- QGridLayout *layout = new QGridLayout( control );
- layout->setSpacing( 2 );
- layout->setMargin( 4 );
+ QGridLayout *layout = new QGridLayout( control );
+ layout->setSpacing( 2 );
+ layout->setMargin( 4 );
// Sort selector
QLabel *label = new QLabel( tr( "Sort by:" ), control );
- QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
- layout->addMultiCellWidget( label, 0, 0, 0, 1 );
+ QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
+ layout->addMultiCellWidget( label, 0, 0, 0, 1 );
_cbSortType=new QComboBox( control );
_cbSortType->insertItem( tr("Entry Order") );
_cbSortType->insertItem( tr("Date") );
@@ -222,7 +221,7 @@ QWidget *Checkbook::initTransactions()
QFont fnt(QPEApplication::font());
fnt.setPointSize( fnt.pointSize()-1 );
tranTable->setFont( fnt );
- 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." ) );
+ 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->setColumnWidthMode( COL_ID, QListView::Manual );
tranTable->setColumnWidth( COL_ID, 0);
@@ -230,121 +229,121 @@ QWidget *Checkbook::initTransactions()
tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual );
tranTable->setColumnWidth( COL_SORTDATE, 0);
tranTable->addColumn( tr( "Num" ) );
- tranTable->addColumn( tr( "Date" ) );
- //tranTable->addColumn( tr( "Cleared" ) );
- tranTable->addColumn( tr( "Description" ) );
- int column = tranTable->addColumn( tr( "Amount" ) );
- tranTable->setColumnAlignment( column, Qt::AlignRight );
+ tranTable->addColumn( tr( "Date" ) );
+ //tranTable->addColumn( tr( "Cleared" ) );
+ tranTable->addColumn( tr( "Description" ) );
+ int column = tranTable->addColumn( tr( "Amount" ) );
+ tranTable->setColumnAlignment( column, Qt::AlignRight );
column=tranTable->addColumn( tr("Balance") );
tranTable->setColumnAlignment( column, 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( slotMenuTran(QListViewItem *, const QPoint &) ) );
+ 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( slotMenuTran(QListViewItem *, const QPoint &) ) );
connect( tranTable, SIGNAL( doubleClicked( QListViewItem * ) ),
- this, SLOT( slotEditTran() ) );
+ this, SLOT( slotEditTran() ) );
_sortCol=COL_ID;
// Buttons
- 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 );
+ 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 );
}
// --- initCharts -------------------------------------------------------------
QWidget *Checkbook::initCharts()
{
- graphInfo = 0x0;
+ graphInfo = 0x0;
- QWidget *control = new QWidget( mainWidget, tr("Charts") );
+ QWidget *control = new QWidget( mainWidget, tr("Charts") );
- QGridLayout *layout = new QGridLayout( control );
- layout->setSpacing( 2 );
- layout->setMargin( 4 );
+ 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 );
+ 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" ) );
+ 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 );
+ 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() ) );
- layout->addWidget( btn, 1, 2 );
+ 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() ) );
+ layout->addWidget( btn, 1, 2 );
- return control;
+ return control;
}
// --- loadCheckbook ----------------------------------------------------------
void Checkbook::loadCheckbook()
{
- if ( !info )
- {
- return;
- }
-
- tranList = info->transactions();
-
- passwordCB->setChecked( !info->password().isNull() );
- nameEdit->setText( info->name() );
- QString temptext = info->type();
- int i = typeList->count();
- while ( i > 0 )
- {
- i--;
- typeList->setCurrentItem( i );
- if ( typeList->currentText() == temptext )
- {
- break;
- }
- }
+ if ( !info )
+ {
+ return;
+ }
+
+ tranList = info->transactions();
+
+ passwordCB->setChecked( !info->password().isNull() );
+ nameEdit->setText( info->name() );
+ QString temptext = info->type();
+ int i = typeList->count();
+ while ( i > 0 )
+ {
+ i--;
+ typeList->setCurrentItem( i );
+ if ( typeList->currentText() == temptext )
+ {
+ break;
+ }
+ }
if( i<=0 ) {
typeList->insertItem( temptext, 0 );
typeList->setCurrentItem(0);
}
- bankEdit->setText( info->bank() );
- acctNumEdit->setText( info->account() );
- pinNumEdit->setText( info->pin() );
- temptext.setNum( info->startingBalance(), 'f', 2 );
- balanceEdit->setText( temptext );
- notesEdit->setText( info->notes() );
-
- // Load transactions
- float amount;
+ bankEdit->setText( info->bank() );
+ acctNumEdit->setText( info->account() );
+ pinNumEdit->setText( info->pin() );
+ temptext.setNum( info->startingBalance(), 'f', 2 );
+ balanceEdit->setText( temptext );
+ notesEdit->setText( info->notes() );
+
+ // Load transactions
+ float amount;
QString stramount;
for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
- {
- amount = tran->amount();
- if ( tran->withdrawal() )
- {
- amount *= -1;
- }
- stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ {
+ amount = tran->amount();
+ if ( tran->withdrawal() )
+ {
+ amount *= -1;
+ }
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->datestr(false), tran->number(), tran->datestr(true), tran->desc(), stramount );
- }
+ }
// set sort order
bool bOk=false;
@@ -369,7 +368,7 @@ void Checkbook::loadCheckbook()
// --- adjustBalance ----------------------------------------------------------
void Checkbook::adjustBalance()
{
- // update running balance in register
+ // update running balance in register
QString sRunning;
float bal=info->startingBalance();
for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) {
@@ -392,112 +391,112 @@ void Checkbook::resort()
// --- accept -----------------------------------------------------------------
void Checkbook::accept()
{
- info->setName( nameEdit->text() );
- info->setType( typeList->currentText() );
- info->setBank( bankEdit->text() );
- info->setAccount( acctNumEdit->text() );
- info->setPin( pinNumEdit->text() );
- bool ok;
- info->setStartingBalance( balanceEdit->text().toFloat( &ok ) );
- info->setNotes( notesEdit->text() );
-
- QDialog::accept();
+ info->setName( nameEdit->text() );
+ info->setType( typeList->currentText() );
+ info->setBank( bankEdit->text() );
+ info->setAccount( acctNumEdit->text() );
+ info->setPin( pinNumEdit->text() );
+ bool ok;
+ info->setStartingBalance( balanceEdit->text().toFloat( &ok ) );
+ info->setNotes( notesEdit->text() );
+
+ QDialog::accept();
}
// --- slotPasswordClicked ----------------------------------------------------
void Checkbook::slotPasswordClicked()
{
- if ( info->password().isNull() && passwordCB->isChecked() )
- {
- Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) );
- if ( pw->exec() != QDialog::Accepted )
- {
- passwordCB->setChecked( FALSE );
- delete pw;
- return;
- }
- info->setPassword( pw->password );
- delete pw;
-
- pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) );
- if ( pw->exec() != QDialog::Accepted || pw->password != info->password() )
- {
- passwordCB->setChecked( FALSE );
- info->setPassword( QString::null );
- }
-
- delete pw;
- }
- else if ( !info->password().isNull() && !passwordCB->isChecked() )
- {
- Password *pw = new Password( this, tr( "Enter password" ),
- tr( "Please enter your password to confirm removal of password protection:" ) );
- if ( pw->exec() == QDialog::Accepted && pw->password == info->password() )
- {
- info->setPassword( QString::null );
- delete pw;
- return;
- }
- else
- {
- passwordCB->setChecked( TRUE );
- }
-
- delete pw;
- }
+ if ( info->password().isNull() && passwordCB->isChecked() )
+ {
+ Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) );
+ if ( pw->exec() != QDialog::Accepted )
+ {
+ passwordCB->setChecked( FALSE );
+ delete pw;
+ return;
+ }
+ info->setPassword( pw->password );
+ delete pw;
+
+ pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) );
+ if ( pw->exec() != QDialog::Accepted || pw->password != info->password() )
+ {
+ passwordCB->setChecked( FALSE );
+ info->setPassword( QString::null );
+ }
+
+ delete pw;
+ }
+ else if ( !info->password().isNull() && !passwordCB->isChecked() )
+ {
+ Password *pw = new Password( this, tr( "Enter password" ),
+ tr( "Please enter your password to confirm removal of password protection:" ) );
+ if ( pw->exec() == QDialog::Accepted && pw->password == info->password() )
+ {
+ info->setPassword( QString::null );
+ delete pw;
+ return;
+ }
+ else
+ {
+ passwordCB->setChecked( TRUE );
+ }
+
+ delete pw;
+ }
}
void Checkbook::slotNameChanged( const QString &newname )
{
- info->setName( newname );
-
- // TODO - need filedir
-// QString namestr = filedir;
-// namestr.append( newname );
-// namestr.append( ".qcb" );
-// info->setFilename( namestr );
-
- QString namestr = newname;
- namestr.append( " - " );
- namestr.append( tr( "Checkbook" ) );
- setCaption( namestr );
+ info->setName( newname );
+
+ // TODO - need filedir
+// QString namestr = filedir;
+// namestr.append( newname );
+// namestr.append( ".qcb" );
+// info->setFilename( namestr );
+
+ QString namestr = newname;
+ namestr.append( " - " );
+ namestr.append( tr( "Checkbook" ) );
+ setCaption( namestr );
}
// ---slotStartingBalanceChanged ----------------------------------------------
void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
{
- bool ok;
- info->setStartingBalance( newbalance.toFloat( &ok ) );
- adjustBalance();
+ bool ok;
+ info->setStartingBalance( newbalance.toFloat( &ok ) );
+ adjustBalance();
}
// --- slotNewTran ------------------------------------------------------------
void Checkbook::slotNewTran()
{
- TranInfo *traninfo = new TranInfo( info->getNextNumber() );
+ TranInfo *traninfo = new TranInfo( info->getNextNumber() );
if( !_dLastNew.isNull() )
traninfo->setDate(_dLastNew);
- Transaction *currtran = new Transaction( this, true, info->name(),
- traninfo,
- _pCfg );
- if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
- {
- // Add to transaction list
- info->addTransaction( traninfo );
-
- // Add to transaction table
- float amount;
- QString stramount;
- amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount();
- stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
- ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false),
+ Transaction *currtran = new Transaction( this, true, info->name(),
+ traninfo,
+ _pCfg );
+ if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
+ {
+ // Add to transaction list
+ info->addTransaction( traninfo );
+
+ // Add to transaction table
+ float amount;
+ QString stramount;
+ amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount();
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false),
traninfo->number(), traninfo->datestr(true), traninfo->desc(),
- stramount );
+ stramount );
resort();
- adjustBalance();
+ adjustBalance();
// save last date
_dLastNew = traninfo->date();
@@ -509,41 +508,41 @@ void Checkbook::slotNewTran()
pLst->sort();
_pCfg->setDirty(true);
}
- }
- else
- {
- delete traninfo;
- }
+ }
+ else
+ {
+ delete traninfo;
+ }
}
// --- slotEditTran -----------------------------------------------------------
void Checkbook::slotEditTran()
{
- QListViewItem *curritem = tranTable->currentItem();
- if ( !curritem )
- return;
-
- TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) );
-
- Transaction *currtran = new Transaction( this, false, info->name(),
- traninfo,
- _pCfg );
- if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
- {
- curritem->setText( COL_NUM, traninfo->number() );
+ QListViewItem *curritem = tranTable->currentItem();
+ if ( !curritem )
+ return;
+
+ TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) );
+
+ Transaction *currtran = new Transaction( this, false, info->name(),
+ traninfo,
+ _pCfg );
+ if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
+ {
+ curritem->setText( COL_NUM, traninfo->number() );
curritem->setText( COL_SORTDATE, traninfo->datestr(false) );
- curritem->setText( COL_DATE, traninfo->datestr(true) );
- curritem->setText( COL_DESC, traninfo->desc() );
-
- float amount = traninfo->amount();
- if ( traninfo->withdrawal() )
- {
- amount *= -1;
- }
- QString stramount;
- stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
- curritem->setText( COL_AMOUNT, stramount );
+ curritem->setText( COL_DATE, traninfo->datestr(true) );
+ curritem->setText( COL_DESC, traninfo->desc() );
+
+ float amount = traninfo->amount();
+ if ( traninfo->withdrawal() )
+ {
+ amount *= -1;
+ }
+ QString stramount;
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ curritem->setText( COL_AMOUNT, stramount );
resort();
adjustBalance();
@@ -554,9 +553,9 @@ void Checkbook::slotEditTran()
pLst->sort();
_pCfg->setDirty(true);
}
- }
+ }
- delete currtran;
+ delete currtran;
}
// --- slotMenuTran -----------------------------------------------------------
@@ -568,10 +567,10 @@ void Checkbook::slotMenuTran(QListViewItem *item, const QPoint &pnt)
// Display menu
QPopupMenu m;
- m.insertItem( QWidget::tr( "Edit" ), 1 );
- m.insertItem( QWidget::tr( "New" ), 2 );
- m.insertItem( QWidget::tr( "Delete" ), 3 );
- int r = m.exec( pnt );
+ m.insertItem( QWidget::tr( "Edit" ), 1 );
+ m.insertItem( QWidget::tr( "New" ), 2 );
+ m.insertItem( QWidget::tr( "Delete" ), 3 );
+ int r = m.exec( pnt );
switch(r) {
case 1:
slotEditTran();
@@ -589,177 +588,177 @@ void Checkbook::slotMenuTran(QListViewItem *item, const QPoint &pnt)
// --- slotDeleteTran ---------------------------------------------------------
void Checkbook::slotDeleteTran()
{
- QListViewItem *curritem = tranTable->currentItem();
- if ( !curritem )
- return;
+ QListViewItem *curritem = tranTable->currentItem();
+ if ( !curritem )
+ return;
- TranInfo *traninfo = info->findTransaction( curritem->text(COL_ID) );
+ TranInfo *traninfo = info->findTransaction( curritem->text(COL_ID) );
- if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
- {
- info->removeTransaction( traninfo );
- delete curritem;
+ if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
+ {
+ info->removeTransaction( traninfo );
+ delete curritem;
adjustBalance();
- }
+ }
}
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 );
+ 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 = info->startingBalance();
- float amount;
- QString label;
- int i = 0;
- int count = tranList->count();
-
- for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
- {
- i++;
- balance -= tran->fee();
- amount = tran->amount();
- if ( tran->withdrawal() )
- {
- amount *= -1;
- }
- balance += amount;
- if ( i == 1 || i == count / 2 || i == count )
- {
- label = tran->datestr(true);
- }
- else
- {
- label = "";
- }
- list->append( new DataPointInfo( label, balance ) );
- }
-
- graphInfo = new GraphInfo( GraphInfo::BarChart, list );
+ DataPointList *list = new DataPointList();
+
+ float balance = info->startingBalance();
+ float amount;
+ QString label;
+ int i = 0;
+ int count = tranList->count();
+
+ for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
+ {
+ i++;
+ balance -= tran->fee();
+ amount = tran->amount();
+ if ( tran->withdrawal() )
+ {
+ amount *= -1;
+ }
+ balance += amount;
+ if ( i == 1 || i == count / 2 || i == count )
+ {
+ label = tran->datestr(true);
+ }
+ 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 = tranList->first();
- if ( tran && tran->withdrawal() == withdrawals )
- {
- list->append( new DataPointInfo( tran->category(), tran->amount() ) );
- }
- tran = tranList->next();
-
- DataPointInfo *cat;
- for ( ; tran; tran = tranList->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 );
+ DataPointList *list = new DataPointList();
+
+ TranInfo *tran = tranList->first();
+ if ( tran && tran->withdrawal() == withdrawals )
+ {
+ list->append( new DataPointInfo( tran->category(), tran->amount() ) );
+ }
+ tran = tranList->next();
+
+ DataPointInfo *cat;
+ for ( ; tran; tran = tranList->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( TranInfo *pTran, 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 )
+ QString label3, QString label4, QString label5, QString label6, QString label7,
+ QString label8 )
+ : QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 )
{
_pTran=pTran;
- m_known = FALSE;
- owner = parent;
+ 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, cg.background() );
-
- QListViewItem::paintCell(p, _cg, column, width, 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, cg.background() );
+
+ QListViewItem::paintCell(p, _cg, column, width, align);
}
// --- CBListItem::isAltBackground --------------------------------------------
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;
+ 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;
}
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index e18f00c..e2f0e56 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -29,11 +29,13 @@
#ifndef CHECKBOOK_H
#define CHECKBOOK_H
+#include <opie2/otabwidget.h>
+
#include <qdatetime.h>
#include <qdialog.h>
#include <qlistview.h>
-class OTabWidget;
+using Opie::OTabWidget;
class CBInfo;
class Graph;
@@ -54,11 +56,11 @@ class QMouseEvent;
// --- Checkbook --------------------------------------------------------------
class Checkbook : public QDialog
{
- Q_OBJECT
+ Q_OBJECT
- public:
- Checkbook( QWidget *, CBInfo *, Cfg *cfg );
- ~Checkbook();
+ public:
+ Checkbook( QWidget *, CBInfo *, Cfg *cfg );
+ ~Checkbook();
// resort
void resort();
@@ -66,56 +68,56 @@ class Checkbook : public QDialog
// members
TranInfoList *getTranList() { return(tranList); }
- private:
- CBInfo *info;
- TranInfoList *tranList;
+ private:
+ CBInfo *info;
+ TranInfoList *tranList;
Cfg *_pCfg;
- OTabWidget *mainWidget;
- void loadCheckbook();
- void adjustBalance();
-
- // Info tab
- QWidget *initInfo();
- QCheckBox *passwordCB;
- QLineEdit *nameEdit;
- QComboBox *typeList;
- QLineEdit *bankEdit;
- QLineEdit *acctNumEdit;
- QLineEdit *pinNumEdit;
- QLineEdit *balanceEdit;
- QMultiLineEdit *notesEdit;
+ OTabWidget *mainWidget;
+ void loadCheckbook();
+ void adjustBalance();
+
+ // Info tab
+ QWidget *initInfo();
+ QCheckBox *passwordCB;
+ QLineEdit *nameEdit;
+ QComboBox *typeList;
+ QLineEdit *bankEdit;
+ QLineEdit *acctNumEdit;
+ QLineEdit *pinNumEdit;
+ QLineEdit *balanceEdit;
+ QMultiLineEdit *notesEdit;
int _sortCol;
- // Transactions tab
- QWidget *initTransactions();
- QListView *tranTable;
- QComboBox *_cbSortType;
+ // Transactions tab
+ QWidget *initTransactions();
+ QListView *tranTable;
+ QComboBox *_cbSortType;
QDate _dLastNew;
- // Charts tab
- QWidget *initCharts();
- GraphInfo *graphInfo;
- QComboBox *graphList;
- Graph *graphWidget;
+ // Charts tab
+ QWidget *initCharts();
+ GraphInfo *graphInfo;
+ QComboBox *graphList;
+ Graph *graphWidget;
- void drawBalanceChart();
- void drawCategoryChart( bool = TRUE );
+ void drawBalanceChart();
+ void drawCategoryChart( bool = TRUE );
- protected slots:
- void accept();
+ protected slots:
+ void accept();
void slotTab(QWidget *tab);
- private slots:
- void slotPasswordClicked();
- void slotNameChanged( const QString & );
- void slotStartingBalanceChanged( const QString & );
- void slotNewTran();
- void slotEditTran();
+ private slots:
+ void slotPasswordClicked();
+ void slotNameChanged( const QString & );
+ void slotStartingBalanceChanged( const QString & );
+ void slotNewTran();
+ void slotEditTran();
void slotMenuTran(QListViewItem *, const QPoint &);
- void slotDeleteTran();
- void slotDrawGraph();
+ void slotDeleteTran();
+ void slotDrawGraph();
void slotSortChanged( const QString & );
};
@@ -123,25 +125,25 @@ class Checkbook : public QDialog
// --- CBListItem -------------------------------------------------------------
class CBListItem : public QListViewItem
{
- //Q_OBJECT
+ //Q_OBJECT
- public:
- CBListItem( TranInfo *, 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 );
+ public:
+ CBListItem( TranInfo *, 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 );
+ void paintCell( QPainter *, const QColorGroup &, int, int, int );
// --- members
TranInfo *getTranInfo() { return(_pTran); }
- private:
+ private:
TranInfo *_pTran;
- QListView *owner;
- bool m_known;
- bool m_odd;
+ QListView *owner;
+ bool m_known;
+ bool m_odd;
- bool isAltBackground();
+ bool isAltBackground();
};
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro
index 58e4af1..421ce3e 100644
--- a/noncore/apps/checkbook/checkbook.pro
+++ b/noncore/apps/checkbook/checkbook.pro
@@ -26,7 +26,7 @@ SOURCES = main.cpp \
graph.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopiecore2 -lopieui2
TARGET = checkbook
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/checkbook/main.cpp b/noncore/apps/checkbook/main.cpp
index dcaab4a..0384620 100644
--- a/noncore/apps/checkbook/main.cpp
+++ b/noncore/apps/checkbook/main.cpp
@@ -26,8 +26,7 @@
*/
-#include <qpe/qpeapplication.h>
-#include <opie/oapplicationfactory.h>
+#include <opie2/oapplicationfactory.h>
#include "mainwindow.h"
diff --git a/noncore/apps/checkbook/opie-checkbook.control b/noncore/apps/checkbook/opie-checkbook.control
index 95da438..a0df839 100644
--- a/noncore/apps/checkbook/opie-checkbook.control
+++ b/noncore/apps/checkbook/opie-checkbook.control
@@ -4,7 +4,7 @@ Priority: optional
Section: opie/applications
Maintainer: Dan Williams <drw@handhelds.org>
Architecture: arm
-Depends: task-opie-minimal, libopie1
+Depends: task-opie-minimal, libopiecore2, libopieui2
Description: Checkbook keeping program.
The checkbook accounting program for the Opie environment.
Version: $QPE_VERSION$EXTRAVERSION