author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/apps/checkbook | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
-rw-r--r-- | noncore/apps/checkbook/checkbook.pro | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/checkbook/tabledef.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 6 |
4 files changed, 18 insertions, 7 deletions
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro index 34641f4..1472df6 100644 --- a/noncore/apps/checkbook/checkbook.pro +++ b/noncore/apps/checkbook/checkbook.pro @@ -1,32 +1,32 @@ -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = mainwindow.h \ cbinfo.h \ traninfo.h \ graphinfo.h \ configuration.h \ password.h \ checkbook.h \ transaction.h \ tabledef.h \ listedit.h \ cfg.h \ graph.h SOURCES = main.cpp \ mainwindow.cpp \ cbinfo.cpp \ traninfo.cpp \ graphinfo.cpp \ configuration.cpp \ password.cpp \ checkbook.cpp \ transaction.cpp \ tabledef.cpp \ listedit.cpp \ cfg.cpp \ graph.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 TARGET = checkbook include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index d00e305..5026c9d 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp @@ -1,85 +1,90 @@ /* 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 "listedit.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qwidgetstack.h> #include <qcombobox.h> #include <qpushbutton.h> -#include <qpe/resource.h> - // --- ListEdit --------------------------------------------------------------- ListEdit::ListEdit( QWidget *parent, const char *sName ) : QWidget(parent, sName), TableDef(sName) { // get font height int fh = fontMetrics().height(); // create layout QGridLayout *layout=new QGridLayout(this); layout->setSpacing( 2 ); layout->setMargin( 4 ); // type table _typeTable = new QListView( this ); ColumnDef *def=first(); while( def ) { _typeTable->addColumn( def->getName() ); def=next(); } connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); layout->addMultiCellWidget(_typeTable, 0,4,0,4); _currentItem=NULL; // edit field _stack=new QWidgetStack( this ); _stack->setMaximumHeight(fh+5); layout->addMultiCellWidget(_stack, 5,5,0,2); _typeEdit = new QLineEdit( _stack ); _stack->raiseWidget(_typeEdit ); connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); // combo box _box=new QComboBox( _stack ); connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); // add button QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); layout->addWidget( btn, 5, 3 ); // delete button btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); layout->addWidget( btn, 5, 4 ); } @@ -257,88 +262,88 @@ void ListEdit::storeInList(QStringList &lst) if( i>=1 ) sAdd+=";"; sAdd += itm->text(i); } lst.append( sAdd ); itm=itm->nextSibling(); } } // --- slotClicked ------------------------------------------------------------ void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) { (void)pnt; // get rid of unused warning; // save values _currentItem=itm; _currentColumn=col; if( itm==NULL ) { _typeEdit->setText(""); _stack->raiseWidget(_typeEdit); return; } // display value if( _currentColumn<0 ) _currentColumn=0; ColumnDef *pDef=this->at(_currentColumn); if( pDef->isType(ColumnDef::typeString) ) { _typeEdit->setText( _currentItem->text(_currentColumn) ); _stack->raiseWidget(_typeEdit); } else if( pDef->isType(ColumnDef::typeList) ){ _box->clear(); _box->insertStringList( pDef->getValueList() ); QStringList::Iterator itr; int i=0; for(itr=pDef->getValueList().begin(); itr!=pDef->getValueList().end(); itr++) { if( (*itr)==_currentItem->text(_currentColumn) ) { _box->setCurrentItem(i); i=-1; break; } i++; } if( i>=0 ) { _box->insertItem( _currentItem->text(_currentColumn) ); _box->setCurrentItem(i); } _stack->raiseWidget(_box); } else { - qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() ); + odebug << "Unsupported column type for column " << (const char *)pDef->getName() << "" << oendl; _typeEdit->setText(""); _stack->raiseWidget(_typeEdit); } } // --- addColumnDef ----------------------------------------------------------- void ListEdit::addColumnDef(ColumnDef *pDef) { _typeTable->addColumn( pDef->getName() ); _vColumns.append(pDef); } // --- addData ---------------------------------------------------------------- void ListEdit::addData(QStringList &lst) { // run through list QStringList::Iterator itr; for(itr=lst.begin(); itr!=lst.end(); itr++) { QStringList split=QStringList::split(";", *itr, true); QStringList::Iterator entry; QString args[8]; int i=0; for(entry=split.begin(); entry!=split.end() && i<8; entry++, i++) { args[i]= (*entry); } while(i<8) { args[i++]=""; } new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); } } // --- slotActivated ---------------------------------------------------------- void ListEdit::slotActivated(const QString &str) { if( _currentItem==NULL || _currentColumn<0 ) return; _currentItem->setText(_currentColumn, str); } diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp index 9a42308..745cd80 100644 --- a/noncore/apps/checkbook/tabledef.cpp +++ b/noncore/apps/checkbook/tabledef.cpp @@ -1,74 +1,76 @@ /* 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 "tabledef.h" +#include <opie2/odebug.h> +using namespace Opie::Core; // --- ColumnDef -------------------------------------------------------------- ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue) { _sName=sName; _type=type; _sNewValue=sNewValue; } // --- addColumnValue --------------------------------------------------------- void ColumnDef::addColumnValue(const QString &sValue) { if( (_type & 0x00ffffff) !=typeList ) - qDebug("Column %s is not a list", (const char *)_sName); + odebug << "Column " << (const char *)_sName << " is not a list" << oendl; else _valueList.append(sValue); } void ColumnDef::addColumnValue(const char *sValue) { if( (_type & 0x00ffffff)!=typeList ) - qDebug("Column %s is not a list", (const char *)_sName); + odebug << "Column " << (const char *)_sName << " is not a list" << oendl; else _valueList.append(sValue); } // --- TableDef --------------------------------------------------------------- TableDef::TableDef(const char *sName) { _sName=sName; _vColumns.setAutoDelete(TRUE); } // --- ~TableDef -------------------------------------------------------------- TableDef::~TableDef() { } // --- addColumnDef ----------------------------------------------------------- void TableDef::addColumnDef(ColumnDef *pDef) { _vColumns.append(pDef); } diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 1b08b24..aafb588 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -1,83 +1,87 @@ /* 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 "cfg.h" #include "checkbook.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/datebookmonth.h> +using namespace Opie::Core; +/* QT */ #include <qbuttongroup.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qradiobutton.h> #include <qwhatsthis.h> Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, TranInfo *info, Cfg *pCfg ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { QString tempstr = tr( "Transaction for " ); tempstr.append( acctname ); setCaption( tempstr ); _bNew=bNew; tran = info; _pCfg=pCfg; 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() ) ); @@ -287,51 +291,51 @@ void Transaction::slotWithdrawalClicked() void Transaction::slotDepositClicked() { catList->clear(); CategoryList *pCatList=_pCfg->getCategoryList(); for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) { if( pCat->isIncome() ) catList->insertItem( pCat->getName() ); } catList->setCurrentItem( 0 ); typeList->clear(); typeList->insertItem( tr( "Written Check" ) ); typeList->insertItem( tr( "Automatic Payment" ) ); typeList->insertItem( tr( "Transfer" ) ); typeList->insertItem( tr( "Cash" ) ); } // --- slotDateChanged -------------------------------------------------------- void Transaction::slotDateChanged( int y, int m, int d ) { QDate date; date.setYMD( y, m, d ); dateBtn->setText( TimeString::shortDate( date ) ); } // --- slotActivated ---------------------------------------------------------- // Search for the most recent transaction with this description/payee and // fill amount etc here, as long the new flag is set void Transaction::slotActivated(const QString &arg ) { if( !_bNew ) return; TranInfoList *pTl=((Checkbook *)parentWidget())->getTranList(); if( pTl ) { TranInfo *pTi=pTl->findMostRecentByDesc( arg ); if( pTi ) { initFromInfo( pTi, true ); amtEdit->setFocus(); amtEdit->setSelection(0, amtEdit->text().length() ); amtEdit->setCursorPosition(0); } } } // slotNotNew ----------------------------------------------------------------- void Transaction::slotNotNew() { - qDebug("Not new"); + odebug << "Not new" << oendl; _bNew=false; } |