📄 lxremittanceworkdialog.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 LxRemittanceWorkDialog: Account selection dialog for LxBank*/ // ***************************************************************************//// $Name: $//// $State: Exp $//// $Log: LxRemittanceWorkDialog.cc,v $// Revision 1.12 2003/05/08 02:39:53 arafang// Error checking of money transfer improved. Use library ktoblzcheck to validate account id's.//// Revision 1.11 2003/05/03 20:27:05 arafang// Use LxBankSelectionList within LxUserAddWizard to show a list// with BTX-names to put into the Short-Name input field.//// Revision 1.10 2003/05/03 16:24:04 arafang// New class LxBankSelectionList. Used in LxRemittanceWorkDialog to present information about all banks of one bank code id.//// Revision 1.9 2003/05/01 14:06:22 arafang// Format of bank code data file changed: was blz.txt - ascii, new blz.bin - binary//// Revision 1.8 2003/04/04 23:40:37 arafang// Strip whitespace from recipient's account id and BLZ. Validater added to date// field of money transfer form.//// Revision 1.7 2003/02/20 02:38:03 arafang// Default args in some constructor implementions removed.//// Revision 1.6 2003/02/10 00:27:12 franz// Make install target working//// Revision 1.5 2003/02/08 15:25:21 franz// Mail address changed.//// Revision 1.4 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.3 2003/01/02 15:04:45 franz// Started to use the openHBCI lib.//// Revision 1.2 2002/10/27 19:11:36 franz// Add configure support to the package.//// 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 <stdlib.h>#include "LxRemittanceWorkDialog.h"#ifndef LxCellLineEdit#include "LxCellLineEdit.h"#endif#include "LxAccount.h"#include "LxPushButton.h"#include "LxPushButtonActions.h"#include "LxBankSelectionList.h"#include <qapplication.h> #include <qlayout.h>#include <qsignalmapper.h>#include <qcolor.h>#include <qlabel.h>#include <qlineedit.h>#include <qstringlist.h>#include <qstring.h>#include <qregexp.h>#include <qdatetime.h>#include <qclipboard.h>#include <qvalidator.h>#include <qlistview.h> #include <qrect.h>LxRemittanceWorkDialog::LxRemittanceWorkDialog( int buttonFlags, LxHbci *hbciapi, LxAccount *acc, LxRemittance *rm, bool rdonly, QWidget *parent, const char *name, bool modal, WFlags f) : QDialog( parent, name, modal, f ), hbciApi(hbciapi), account(acc), remittance(rm), modButton(0), copyButton(0), pasteButton(0), saveButton(0), saveToButton(0), saveExButton(0), printButton(0), delButton(0), dismButton(0){ dialogBox = new QHBoxLayout( this, 3, 5, "RWD-VBox" ); form = new LxRemittanceForm( hbciApi, account, remittance, rdonly, this, "RemittanceForm"); dialogBox->addWidget( form, 0 ); sm = new QSignalMapper( this ); connect( sm, SIGNAL( mapped( int )), this, SLOT( done( int ) )); buttons = new QVBoxLayout( dialogBox ); createButtons( buttonFlags ); if ( dismButton ){ dismButton->setDefault ( TRUE ); }}void LxRemittanceWorkDialog::createButtons( int buttonFlags ){ int strA = 1, strB = 6, strC = 15; if ( buttonFlags & Lx::Modify ){ buttons->addStretch ( strA ); modButton = new LxPushButton(tr("Modify"), this); saveButton = new LxPushButton(tr("Save"), this); saveButton->hide(); addButton( modButton, Lx::NoAction ); connect ( modButton, SIGNAL( clicked() ), form, SLOT( setEditAble() ) ); connect ( modButton, SIGNAL( clicked() ), saveButton, SLOT( show() ) ); connect ( modButton, SIGNAL( clicked() ), modButton, SLOT( disableButton() ) ); connect ( saveButton, SIGNAL( clicked() ), this, SLOT( save() ) ); } if ( buttonFlags & Lx::Copy ){ buttons->addStretch ( strA ); copyButton = new LxPushButton(tr("Copy"), this); addButton( copyButton, Lx::NoAction ); connect ( copyButton, SIGNAL( clicked() ), this, SLOT( copy() ) ); } if ( buttonFlags & Lx::Paste || buttonFlags & Lx::Copy ){ buttons->addStretch ( strA ); pasteButton = new LxPushButton(tr("Paste"), this); addButton( pasteButton, Lx::NoAction ); connect ( pasteButton, SIGNAL( clicked() ), this, SLOT( paste() ) ); if ( !(buttonFlags & Lx::Paste) ){ pasteButton->hide(); if ( modButton ){ connect ( modButton, SIGNAL( clicked() ), pasteButton, SLOT( show() ) ); } } } if ( buttonFlags & Lx::Print ){ buttons->addStretch ( strA ); printButton = new LxPushButton(tr("Print"), this); addButton( printButton, Lx::NoAction ); printButton->disableButton(); } if ( buttonFlags & Lx::SaveEx ){ buttons->addStretch ( strA ); saveExButton = new LxPushButton(tr("Save"), this); addButton( saveExButton, Lx::SaveEx ); } if ( buttonFlags & Lx::SaveTo ){ buttons->addStretch ( strA ); saveToButton = new LxPushButton(tr("Save To"), this); addButton( saveToButton, Lx::SaveTo ); } if ( buttonFlags & Lx::Delete ){ buttons->addStretch ( strB ); delButton = new LxPushButton(tr("Delete"), this); addButton( delButton, Lx::Delete ); } if ( buttonFlags & Lx::Save || buttonFlags & Lx::Dismiss || buttonFlags & Lx::Cancel ){ buttons->addStretch ( strC ); } if ( buttonFlags & Lx::Save || buttonFlags & Lx::Modify ){ if ( !saveButton ){ saveButton = new LxPushButton(tr("Save"), this); connect ( saveButton, SIGNAL( clicked() ), this, SLOT( save() ) ); } addButton( saveButton, Lx::NoAction ); buttons->addStretch ( strA ); if ( buttonFlags & Lx::Save ){ saveButton->show(); } } if ( buttonFlags & Lx::Dismiss ){ dismButton = new LxPushButton(tr("Dismiss"), this); addButton( dismButton, Lx::Dismiss ); } if ( buttonFlags & Lx::Cancel ){ dismButton = new LxPushButton(tr("Cancel"), this); addButton( dismButton, Lx::Cancel ); } buttons->addStretch ( strA );}void LxRemittanceWorkDialog::addButton( LxPushButton *b, int result ){ buttons->addWidget( b, 0 ); if ( result ){ sm->setMapping( b, result ); connect( b, SIGNAL( clicked() ), sm, SLOT( map() ) ); }}void LxRemittanceWorkDialog::save (){ LxRemittance tmprm ( account, form->getDateStr(), form->getTanStr(), form->getAmountStr(), form->getCurrencyStr(), form->getReceiverStr(), form->getReceiverAccountNoStr(), form->getReceiverBLZStr(), form->getText1Str(), form->getText2Str() ); if ( remittance ){ account->modifyRemittance ( remittance, &tmprm ); }else{ remittance = new LxRemittance (tmprm); account->addRemittance ( remittance ); }}void LxRemittanceWorkDialog::copy (){ QClipboard *cb = QApplication::clipboard(); QString delim ("\n"); QString txt = form->getReceiverStr() + delim + form->getReceiverAccountNoStr() + delim + form->getReceiverBLZStr() + delim + form->getAmountStr() + delim + form->getText1Str() + delim + form->getText2Str(); cb->clear (); cb->setText ( txt );}void LxRemittanceWorkDialog::paste (){ QClipboard *cb = QApplication::clipboard(); QString txt ( cb->text( ) ); QStringList lines = QStringList::split( '\n', txt ); if ( lines.count() < 6 ) return; form->setReceiverStr(lines[0]); form->setReceiverAccountNoStr(lines[1]); form->setReceiverBLZStr(lines[2]); form->setAmountStr(lines[3]); form->setText1Str(lines[4]); form->setText2Str(lines[5]);}LxRemittanceForm::LxRemittanceForm (LxHbci *hbciapi, LxAccount *acc, LxRemittance *rm, bool rdonly, QWidget *parent, const char *name) : QWidget( parent, name ), hbciApi(hbciapi), account(acc), remittance(rm){ QPixmap bg( TRMFORMGIF ); setFixedSize ( bg.width(), bg.height() ); setBackgroundMode ( Qt::FixedPixmap ); setPaletteBackgroundPixmap ( bg ); receiver = new LxCellLineEdit ( this ); receiverAccountNo = new LxCellLineEdit ( this ); receiverAccountNo->setValidator(new QRegExpValidator(QRegExp("^ *[0-9]{10}"), receiverAccountNo)); receiverBLZ = new LxCellLineEdit ( this ); receiverBLZ->setValidator(new QRegExpValidator(QRegExp("^ *[0-9]{8}"), receiverBLZ)); getRecInstitute = new QPushButton ( "?", this ); receiverInstitute = new LxCellLineEdit ( this ); receiverInstDetails = new QPushButton ( "?", this ); currency = new LxCellLineEdit ( this ); amount = new LxCellLineEdit ( this ); amount->setValidator(new QRegExpValidator(QRegExp("^ *\\+?[0-9]+[,.]?[0-9]?[0-9]?"), amount)); text1 = new LxCellLineEdit ( this ); text2 = new LxCellLineEdit ( this ); accountBearer = new LxCellLineEdit ( this ); bearerAccountNo = new LxCellLineEdit ( this ); tan = new LxCellLineEdit ( this ); QString dateLabStr(tr("Zahlungstermin:")); QLabel *dateLab = new QLabel (dateLabStr, this); QFontMetrics fm(font()); int dateLabLg = fm.width ( dateLabStr, -1 ) + 3; date = new QLineEdit ( this ); date->setValidator(new QRegExpValidator( QRegExp("^ *[0-3]?[0-9]{1}\\.[01]?[0-9]{1}\\.[0-9]{2,4}"), amount)); date->setAlignment ( Qt::AlignHCenter ); receiverInstitute-> setReadOnly ( TRUE ); currency-> setReadOnly ( TRUE ); accountBearer-> setReadOnly ( TRUE ); bearerAccountNo-> setReadOnly ( TRUE ); receiverInstitute-> setFocusPolicy ( QWidget::NoFocus ); currency-> setFocusPolicy ( QWidget::NoFocus ); accountBearer-> setFocusPolicy ( QWidget::NoFocus ); bearerAccountNo-> setFocusPolicy ( QWidget::NoFocus ); receiver-> setFrameStyle ( QFrame::Plain ); receiverAccountNo-> setFrameStyle ( QFrame::Plain ); receiverBLZ-> setFrameStyle ( QFrame::Plain ); receiverInstitute-> setFrameStyle ( QFrame::Plain );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -