📄 lxinteractor.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 LxInteractor: LxBank interactor for the HBCI::API*/ // ***************************************************************************//// $Name: $//// $State: Exp $//// $Log: LxInteractor.cc,v $// Revision 1.5 2003/04/12 00:38:56 arafang// Fix problems with assignment QString to string//// Revision 1.4 2003/02/08 15:25:21 franz// Mail address changed.//// Revision 1.3 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.2 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.1 2003/01/02 15:04:45 franz// Started to use the openHBCI lib.////#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "LxInteractor.h"#include "LxPinDialog.h"#include "LxPushButtonActions.h"#include <qstring.h>#include <openhbci.h>#include <string>#include <qmessagebox.h>// #include <qinputdialog.h>LxInteractor::LxInteractor() :Interactor(){}LxInteractor::~LxInteractor(){}bool LxInteractor::msgInputPin(HBCI::Pointer<HBCI::User> user, string &pin, int minsize, bool newPin){ int res; bool state = false; QString promptStr;// cerr << "msgInputPin: minsize = " << minsize << endl;// cerr << "msgInputPin: newPin = " << newPin << endl; if ( user.isValid() ){ promptStr = QWidget::tr("User: "); promptStr += (*user).userName().c_str(); promptStr += "\n\n"; HBCI::Pointer<HBCI::Bank> bank = (*user).bank(); if ( bank.isValid() ){ string bankName( (*bank).name() ); promptStr += QWidget::tr("Enter your Pin for "); if ( !bankName.empty() ){ promptStr += bankName.c_str(); promptStr += ":"; }else{ promptStr += (*bank).bankCode().c_str(); promptStr += ":"; } }else{ promptStr += QWidget::tr("Enter your Pin:"); } }else{ promptStr = QWidget::tr("Enter your Pin:"); } LxPinDialog *pininp = new LxPinDialog (minsize, promptStr); res = pininp->exec(); switch ( res ){ case Lx::Okay: pin = pininp->getPin ().latin1(); state = true; abort ( false ); break; case Lx::Cancel: state = false; abort ( true ); break; default: state = false; abort ( true ); } delete pininp; return state;}bool LxInteractor::msgInsertMediumOrAbort(HBCI::Pointer<HBCI::User> user, MediumType t){ bool retStat; int buttonIdx; QString promptStr; if ( user.isValid() ){ promptStr = QWidget::tr("User: "); promptStr += (*user).userName().c_str(); promptStr += "\n\n"; HBCI::Pointer<HBCI::Bank> bank = (*user).bank(); if ( bank.isValid() ){ string bankName( (*bank).name() ); promptStr += QWidget::tr("There is no card in the reader!\n\n"); promptStr += QWidget::tr("Insert card for "); if ( !bankName.empty() ){ promptStr += bankName.c_str(); promptStr += QWidget::tr(" and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); }else{ promptStr += (*bank).bankCode().c_str(); promptStr += QWidget::tr(" and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } }else{ promptStr += QWidget::tr("There is no card in the reader!\n\n"); promptStr += QWidget::tr("Insert card and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } }else{ promptStr += QWidget::tr("There is no card in the reader!\n\n"); promptStr += QWidget::tr("Insert card and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } buttonIdx = QMessageBox::information ( 0, QWidget::tr("Card Error"), promptStr, QMessageBox::Ok, QMessageBox::Abort); if ( buttonIdx == QMessageBox::Ok ){ abort ( false ); retStat = true; }else{ abort ( true ); retStat = false; } return retStat;}bool LxInteractor::msgInsertCorrectMediumOrAbort(HBCI::Pointer<HBCI::User> user, MediumType t){ bool retStat; int buttonIdx; QString promptStr; if ( user.isValid() ){ promptStr = QWidget::tr("User: "); promptStr += (*user).userName().c_str(); promptStr += "\n\n"; HBCI::Pointer<HBCI::Bank> bank = (*user).bank(); if ( bank.isValid() ){ string bankName( (*bank).name() ); promptStr += QWidget::tr("There is the wrong card in the reader!\n\n"); promptStr += QWidget::tr("Insert correct card for "); if ( !bankName.empty() ){ promptStr += bankName.c_str(); promptStr += QWidget::tr(" and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); }else{ promptStr += (*bank).bankCode().c_str(); promptStr += QWidget::tr(" and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } }else{ promptStr += QWidget::tr("There is the wrong card in the reader!\n\n"); promptStr += QWidget::tr("Insert correct card and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } }else{ promptStr += QWidget::tr("There is the wrong card in the reader!\n\n"); promptStr += QWidget::tr("Insert correct card and press Ok,\n"); promptStr += QWidget::tr("otherwise press Abort."); } buttonIdx = QMessageBox::information ( 0, QWidget::tr("Card Error"), promptStr, QMessageBox::Ok, QMessageBox::Abort); if ( buttonIdx == QMessageBox::Ok ){ abort ( false ); retStat = true; }else{ abort ( true ); retStat = false; } return retStat;}void LxInteractor::msgStateResponse(const string& msg){ QString msgTxt(msg.c_str()); QMessageBox::information ( 0, QWidget::tr("State Response"), msgTxt, QMessageBox::Ok);}bool LxInteractor::keepAlive(){ if ( aborted() ){ return false; } return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -