⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lxpindialog.cc

📁 LxBank是一个基于Qt/X的家庭储蓄应用程序
💻 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 LxPinDialog:LxBank pin input dialog for the HBCI-API*/ // ***************************************************************************//// $Name:  $//// $State: Exp $//// $Log: LxPinDialog.cc,v $// Revision 1.3  2003/02/08 15:25:21  franz// Mail address changed.//// 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 "LxPinDialog.h"#include "LxPushButton.h"#include "LxPushButtonActions.h"#include <math.h>#include <qlabel.h> #include <qlineedit.h> #include <qlayout.h>#include <qsignalmapper.h>#include <qvalidator.h>#include <stream.h>#include <limits.h>LxPinDialog::LxPinDialog(int pminlen,			 QString & prompt,			 QWidget * parent, 			 const char * name,			 bool modal,			 WFlags f )  :QDialog(parent, name, modal, f){  double pl = (double)(pminlen-1);  int pmax, pmin, pmaxdigits;  pmin = (int)pow (10., pl);  pmax = INT_MAX;  pmaxdigits = (int)ceil(log10((double)pmax));//   cerr << "LxPinDialog: pl         = " << pl << endl;//   cerr << "LxPinDialog: pmin       = " << pmin << endl;//   cerr << "LxPinDialog: pmax       = " << pmax << endl;//   cerr << "LxPinDialog: pmaxdigits = " << pmaxdigits << endl;  setCaption(tr("Pin Input"));  dialogBox = new QVBoxLayout (this);  dialogBox->setMargin ( 10 );  dialogBox->setSpacing  ( 20 );  pinInputLabel = new QLabel (prompt, this);  dialogBox->addWidget (pinInputLabel, 0);  pinInput = new QLineEdit (this);  pinInput->setMaxLength( pmaxdigits );  pinInput->setEchoMode ( QLineEdit::Password );  pinInput->setValidator(new QIntValidator(pmin, pmax, this));  dialogBox->addWidget (pinInput, 0);  sm = new QSignalMapper( this );  connect( sm, SIGNAL( mapped( int )), this, SLOT( done( int ) ));  buttonBox = new QHBoxLayout( dialogBox );  okButton = new LxPushButton(tr("OK"), this);  okButton->setEnabled( FALSE );  buttonBox->addWidget ( okButton, 0 );  sm->setMapping( okButton, Lx::Okay );  connect( okButton, SIGNAL( clicked() ), sm, SLOT( map() ) );  connect( pinInput, SIGNAL( textChanged( const QString & ) ),	     this, SLOT( keyChanged( const QString & ) ) );  buttonBox->addStretch ( 1 );  cancelButton=new LxPushButton(tr("Cancel"), this);  buttonBox->addWidget ( cancelButton, 0 );  sm->setMapping( cancelButton, Lx::Cancel );  connect( cancelButton, SIGNAL( clicked() ), sm, SLOT( map() ) );}LxPinDialog::~LxPinDialog(){}void LxPinDialog::keyChanged( const QString &text ){    QString t = text;    int p = 0;    bool on = ( pinInput->validator()->validate(t, p) == QValidator::Acceptable );//     cerr << "LxPinDialog::keyChanged: state = " << on << endl;    okButton->setEnabled( on );}void LxPinDialog::done ( int res ){//   cerr << "LxPinDialog::done: result = " << res << endl;  if ( res == Lx::Okay ){    pin = pinInput->text();  }else{    pin = "no pin!";  }//   cerr << "LxPinDialog::done: pin    = " << pin << endl;  QDialog::done ( res );}QString LxPinDialog::getPin (){  return pin;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -