1
/**************************************************
4
**************************************************
5
* This code was created by Peter Harvey @ CodeByDesign.
6
* Released under GPL 18.FEB.99
8
* Contributions from...
9
* -----------------------------------------------
10
* Peter Harvey - pharvey@codebydesign.com
11
**************************************************/
13
#include "classLogin.h"
14
#include <qpushbutton.h>
18
#include <sys/types.h>
19
#include "LinuxODBC.xpm"
21
#include <classODBC.h>
23
classLogin::classLogin( QWidget *pParent, ConnectionScoper &dbc, const QString &dataSource )
24
: QDialog( pParent, "classLogin", TRUE ) , dbc( dbc ) , qsDataSourceName( dataSource )
29
QPushButton *pbCancel;
31
setCaption( "Login - " + qsDataSourceName );
32
setIcon( QPixmap( LinuxODBC_xpm ) );
34
lblUID = new QLabel( "ID:", this );
35
lblPWD = new QLabel( "PWD:", this );
36
txtUID = new QLineEdit( "", this );
37
txtPWD = new QLineEdit( "", this );
38
pbOk = new QPushButton( "&Ok", this );
39
pbCancel = new QPushButton( "&Cancel", this );
41
lblUID->setGeometry( 5, 10, 30, 25 );
42
lblPWD->setGeometry( 5, 40, 30, 25 );
43
txtUID->setGeometry( 35, 10, 200, 25 );
44
txtPWD->setGeometry( 35, 40, 200, 25 );
45
pbOk->setGeometry( 35, 70, 100, 25 );
46
pbCancel->setGeometry( 135, 70, 100, 25 );
48
txtUID->setText( ((struct passwd *)getpwuid(getuid()))->pw_name );
49
txtPWD->setEchoMode( QLineEdit::Password );
51
connect( pbOk, SIGNAL(clicked()), this, SLOT(pbOk_Clicked()) );
52
connect( pbCancel, SIGNAL(clicked()), this, SLOT(pbCancel_Clicked()) );
54
pbOk->setDefault( TRUE );
58
void classLogin::pbOk_Clicked()
60
if ( dbc.connect( qsDataSourceName, txtUID->text(), txtPWD->text() ) )
62
// Clear security values
63
txtUID->setText( "") ;
64
txtPWD->setText( "") ;
69
void classLogin::pbCancel_Clicked()