📄 lxremittanceview.cc
字号:
// ****************************************************************************// // LxBank - home-banking for Linux using the HBCI standard// // Author: Franz Zimmermann 83043 Bad Aibling// // Copyright (C) 2002-2003 Franz Zimmermann - arafang@users.sourceforge.net// // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// // This program 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 program; if not, write to the Free Software// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.// // ***************************************************************************//// ***************************************************************************// /*! \file \brief LxRemittanceView: Remittance View widget for LxBank*/ // ***************************************************************************//// $Name: $//// $State: Exp $//// $Log: LxRemittanceView.cc,v $// Revision 1.14 2003/05/08 02:39:53 arafang// Error checking of money transfer improved. Use library ktoblzcheck to validate account id's.//// Revision 1.13 2003/05/01 14:06:21 arafang// Format of bank code data file changed: was blz.txt - ascii, new blz.bin - binary//// Revision 1.12 2003/04/12 00:38:56 arafang// Fix problems with assignment QString to string//// Revision 1.11 2003/03/26 22:24:35 arafang// Add method to check outgoing money transfers syntactically.//// Revision 1.10 2003/02/08 15:25:21 franz// Mail address changed.//// Revision 1.9 2003/02/08 11:45:19 franz// Money transfer (single mode) works.//// Revision 1.8 2003/02/03 23:06:10 franz// Class LxRemittance adapted to needs of HBCI. Remittances saved on Account// config. LxRemittanceWorkDialog and constructor of class LxRemittance improved// to avoid possible core dumps with QString method latin1 and class QStringList.// Make checks in LxAccount::updateBalanceAndAccStmt weather a job has been// performed successfully or not.//// Revision 1.7 2003/01/26 23:09:41 franz// LxAccountSelectDialog: New method to delete accounts (remove).// Class LxAccountStmtPrint adapted to new account statement view layout.// Account update implemented.//// Revision 1.6 2003/01/11 18:35:22 franz// Complete methods of class LxInteractor.// Worked on class LxPinDialog.// Improve class LxUserAddWizard.// Implement methods removeUser and getAccounts in class LxUserListDialog.// Button enable/dissable bug fixed in class LxRemittanceView.//// Revision 1.5 2003/01/03 17:15:32 franz// LxUserAddWizard able to create a DDV-Card user.//// Revision 1.4 2003/01/02 15:04:45 franz// Started to use the openHBCI lib.//// Revision 1.3 2002/07/04 23:18:31 franz// Optimize performance of class LxAccount.// Add account close function.//// Revision 1.2 2002/07/02 23:09:45 franz// Now the accounts from the global accounts list are used within the program//// Revision 1.1 2002/06/02 22:03:19 franz// Remittance view lists improved.// Remittance work dialogs implemented.////#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "LxRemittanceView.h"#include "LxRemittanceListViewItem.h"#include "LxRemittanceWorkDialog.h"#include "LxAccountSelectDialog.h"#include "LxPushButtonActions.h"#include <qlistview.h> #include <qpushbutton.h> #include <qmessagebox.h>#include <qlayout.h>#include <qstring.h> #include <qregexp.h> #include <stream.h> extern AccountList accounts;LxRemittanceView::LxRemittanceView( LxHbci *hbciapi, LxRemittance::RemittanceStatus rt, int bFlags, QWidget *parent, const char *name ) : QWidget( parent, name ), objName(name), hbciApi(hbciapi), account(0), remittanceListView(0), buttons(0), rTyp(rt), newButton(0), viewButton(0), modButton(0), copyButton(0), submitButton(0), printButton(0), delButton(0){ vLayout = new QVBoxLayout( this, 5 ); remittanceListView = new QListView (this, "RemittanceView"); remittanceListView->setAllColumnsShowFocus ( TRUE ); remittanceListView->setSelectionMode ( QListView::Single ); remittanceListView->setShowSortIndicator ( TRUE ); remittanceListView->font().setWeight( QFont::Bold ); remittanceListView->font().setBold( TRUE ); remittanceListView->font().setPointSize ( 10 ); int c1, c2, c3, c4, c5, c6, c7, c8; c1 = remittanceListView->addColumn ( "Nr.", -1 ); c2 = remittanceListView->addColumn ( "Datum", -1 ); c3 = remittanceListView->addColumn ( "Empf鋘ger", -1 ); c4 = remittanceListView->addColumn ( "Konto-Nr/BLZ", -1 ); c5 = remittanceListView->addColumn ( "Betrag", -1 ); c6 = remittanceListView->addColumn ( "W", -1 ); c7 = remittanceListView->addColumn ( "Verwendungszweck", -1 ); c8 = remittanceListView->addColumn ( "TAN", -1 ); remittanceListView->setColumnAlignment ( c1, AlignRight ); remittanceListView->setColumnAlignment ( c2, AlignRight ); remittanceListView->setColumnAlignment ( c4, AlignRight ); remittanceListView->setColumnAlignment ( c5, AlignRight ); vLayout->addWidget( remittanceListView, 10 ); buttons = new QHBoxLayout( vLayout ); buttons->addStretch ( 10 ); createButtons( bFlags ); connect( remittanceListView, SIGNAL( selectionChanged(QListViewItem *) ), this, SLOT( selectionChanged(QListViewItem *) ) ); connect( remittanceListView, SIGNAL( pressed(QListViewItem *) ), this, SLOT( pressedInList(QListViewItem *) ) ); if (newButton){ if ( account ){ newButton->setEnabled(TRUE); }else{ newButton->setEnabled(FALSE); } }}LxRemittanceView::~LxRemittanceView(){}void LxRemittanceView::setAccount ( LxAccount* acc){ account = acc; if (newButton){ if ( account ){ newButton->setEnabled(TRUE); }else{ newButton->setEnabled(FALSE); } }}void LxRemittanceView::createButtons( int buttonFlags ){ if ( buttonFlags & Lx::New ){ newButton = new QPushButton(tr("New"), this); addButton( newButton ); newButton->setDisabled ( FALSE ); connect(newButton, SIGNAL( clicked () ), this, SLOT( create () )); } if ( buttonFlags & Lx::View ){ viewButton = new QPushButton(tr("View"), this); addButton( viewButton ); connect(viewButton, SIGNAL( clicked () ), this, SLOT( view () )); } if ( buttonFlags & Lx::Modify ){ modButton = new QPushButton(tr("Modify"), this); addButton( modButton ); connect(modButton, SIGNAL( clicked () ), this, SLOT( modify () )); } if ( buttonFlags & Lx::Copy ){ copyButton = new QPushButton(tr("Copy"), this); addButton( copyButton ); connect(copyButton, SIGNAL( clicked () ), this, SLOT( copy () )); } if ( buttonFlags & Lx::Submit ){ submitButton = new QPushButton(tr("Submit"), this); addButton( submitButton ); connect(submitButton, SIGNAL( clicked () ), this, SLOT( submit () )); } if ( buttonFlags & Lx::Print ){ printButton = new QPushButton(tr("Print"), this); addButton( printButton ); } if ( buttonFlags & Lx::Delete ){ delButton = new QPushButton(tr("Delete"), this); addButton( delButton ); connect(delButton, SIGNAL( clicked () ), this, SLOT( erase () )); }}void LxRemittanceView::addButton( QPushButton *b ){ buttons->addWidget( b, 0 ); buttons->addStretch ( 10 ); b->setDisabled ( TRUE );}void LxRemittanceView::updateListView( RemittanceList& rmLst){ remittanceListView->clear (); setButtonState ( 0 ); if ( !rmLst.isEmpty () ){ double am; QStringList dates, accNoBLZ; QString num, datum, receiver, amount; QDate date; LxRemittance *remittance; LxRemittanceListViewItem *item; for (remittance = rmLst.first(); remittance != 0; remittance = rmLst.next()){ // number num = QString::number(remittance->getNumber()); // remittance-dates dates.clear(); date = remittance->getDateOfExecution(); if ( !date.isNull () ){ datum.sprintf ("%d.%d.%02d", date.day(), date.month(), date.year()%100); dates.append(datum); } date = remittance->getDate(); datum.sprintf ("%d.%d.%02d", date.day(), date.month(), date.year()%100); dates.append(datum); // account no and blz accNoBLZ.clear(); accNoBLZ.append(remittance->getAccountNo()); accNoBLZ.append(remittance->getBLZ()); // amount am = remittance->getAmount(); amount = QString::number(am, 'f', 2); amount.replace(QRegExp("\\."), ","); item = new LxRemittanceListViewItem (remittanceListView, num, remittance->getNumberSortKey(), // number dates, remittance->getDateSortKey(), // dates remittance->getReceiver(), // receiver accNoBLZ, remittance->getRecAccNoSortKey(), // account-no/blz amount, remittance->getAmountSortKey(), // amount remittance->getCurrency(), // currency remittance->getText(), // text remittance->getTAN(), // tan remittance); } remittanceListView->setSorting ( 0 ); }}void LxRemittanceView::deleteRemittance ( LxRemittance *rm ){ if ( !rm || !account ){ return; } switch( QMessageBox::warning ( this, tr("Confirm Delete"), tr("Do you really want to delete this remittance?"), tr("Ok"), tr("Cancel"), QString::null, 1, 1 ) ){ case 0: // The user clicked the Ok button account->removeRemittance ( rm ); break; case 1: // The user clicked the Cancel button, or pressed Enter or Escape return; break; }}void LxRemittanceView::saveRemittance ( LxRemittance *rm ){ if ( !rm || !account ){ return; } LxRemittance *tmprm = new LxRemittance ( *rm ); account->addRemittance ( tmprm );}void LxRemittanceView::saveRemittanceToAccount ( LxRemittance *rm ){ if ( !rm || !account ){ return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -