summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/transaction.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/checkbook/transaction.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/transaction.cpp6
1 files changed, 5 insertions, 1 deletions
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;
}