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

📄 lxcontextselectdialog.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 LxContextSelectDialog: Account selection dialog for LxBank*/ // ***************************************************************************//// $Name:  $//// $State: Exp $//// $Log: LxContextSelectDialog.cc,v $// Revision 1.3  2003/02/20 02:38:03  arafang// Default args in some constructor implementions removed.//// Revision 1.2  2003/02/08 15:25:21  franz// Mail address changed.//// 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 "LxContextSelectDialog.h"#include "LxPushButton.h"#include <qapplication.h> #include <qlistview.h> #include <qlayout.h>#include <qsignalmapper.h>LxContextSelectDialog::LxContextSelectDialog(vector<LxInstituteContextData> &data, 					     QWidget *parent, const char *name, 					     bool modal, WFlags f)  : QDialog( parent, name, modal, f ), contextData(data), okButton(0){  sm = new QSignalMapper( this );  vBox = new QVBoxLayout( this, 3, 5);  lView = new QListView( this, "ContextList" );  vBox->addWidget( lView, 10 );  lView->setAllColumnsShowFocus ( TRUE );   lView->setSelectionMode ( QListView::Single );  int c1, c2, c3, c4, c5, c6, c7;  c1 = lView->addColumn ( tr("No.") );  c2 = lView->addColumn ( tr("Code (BLZ)") );	        c3 = lView->addColumn ( tr("Country") );	        c4 = lView->addColumn ( tr("Institute") );     c5 = lView->addColumn ( tr("Server") );  c6 = lView->addColumn ( tr("User Id") );  c7 = lView->addColumn ( tr("State") );  //     setColumnAlignment ( c4, AlignRight );  lView->setItemMargin ( 2 );  QListViewItem *item;  unsigned n;  for ( n = 0; n < contextData.size(); ++n ) {    LxInstituteContextData &ctxData = contextData[n];    const HBCICard::instituteData &instData = ctxData.instData();    item = new QListViewItem( lView,			      QString::number(n+1),			      instData.code().c_str(),			      QString::number(instData.country()),			      instData.name().c_str(),			      instData.address().c_str(),			      instData.user().c_str(),			      ctxData.getStateStr().c_str());  }  hBox = new QHBoxLayout(vBox, 3);  hBox->addStretch ( 10 );  bool disable;  item = lView->firstChild ();  if (item){    disable = FALSE;    lView->setSelected ( item, TRUE );  }else{    disable = TRUE;  }  okButton = new LxPushButton(tr("OK"), this);  hBox->addWidget ( okButton, 0 );  hBox->addStretch ( 10 );  sm->setMapping( okButton, 1 );  connect( okButton, SIGNAL( clicked() ), sm, SLOT( map() ) );  cancelButton = new LxPushButton(tr("Cancel"), this);  hBox->addWidget ( cancelButton, 0 );  hBox->addStretch ( 10 );  sm->setMapping( cancelButton, 0 );  connect( cancelButton, SIGNAL( clicked() ), sm, SLOT( map() ) );  if ( disable ){    okButton->setDisabled ( TRUE );  }  connect( lView, SIGNAL( selectionChanged(QListViewItem *) ),	   this, SLOT( selectionChanged(QListViewItem *) ) );  connect( lView, SIGNAL( pressed(QListViewItem *) ),	   this, SLOT( pressedInList(QListViewItem *) ) );  connect(lView, SIGNAL( doubleClicked ( QListViewItem * ) ), 	  this, SLOT(selectionDone(QListViewItem *)) );  connect(lView, SIGNAL( returnPressed ( QListViewItem * ) ), 	  this, SLOT(selectionDone(QListViewItem *)) );  connect( sm, SIGNAL( mapped( int )), this, SLOT( done( int ) ));}void LxContextSelectDialog::done ( int res ){  int result;  if ( res ){    QListViewItem *item;    item = lView->selectedItem();    if ( item ){      result = item->text(0).toInt();    }else{      result = 0;    }  }else{    result = 0;  }   QDialog::done ( result );}void LxContextSelectDialog::selectionDone ( QListViewItem *lvItem ){  done ( 1 ); }void LxContextSelectDialog::selectionChanged ( QListViewItem *lvItem ){  if ( lvItem && lView->selectedItem() ){    okButton->setEnabled(TRUE);  }else{    okButton->setEnabled(FALSE);  }}void LxContextSelectDialog::pressedInList ( QListViewItem *lvItem ){  if ( lvItem && lView->selectedItem() ){    okButton->setEnabled(TRUE);  }else{    okButton->setEnabled(FALSE);  }}

⌨️ 快捷键说明

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