File: CDriverPrompt.cpp

package info (click to toggle)
unixodbc 2.2.11-16
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 17,332 kB
  • ctags: 12,399
  • sloc: ansic: 116,624; cpp: 29,333; sh: 25,024; makefile: 3,002; lex: 241; yacc: 182; perl: 142; sed: 16; sql: 1
file content (116 lines) | stat: -rw-r--r-- 3,541 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**************************************************
 * 
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign. 
 * Released under GPL 31.JAN.99
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/
#include "CDriverPrompt.h"

CDriverPrompt::CDriverPrompt( QWidget* parent, const char* name )
	: QDialog( parent, name, TRUE )
{
	setCaption( "Select a Driver..." );
        setSizeGripEnabled( true );

	qsDriverName	= "";
	qsDescription		= "";
	qsDriver		= "";
	qsSetup			= "";

	pDrivers = new CDrivers( this, "Drivers" );
	pDrivers->setGeometry( 1, 25, 390, 300 );
	pDrivers->setMinimumSize( 0, 0 );
	pDrivers->setMaximumSize( 32767, 32767 );
	pDrivers->setFocusPolicy( QWidget::NoFocus );
	pDrivers->setBackgroundMode( QWidget::PaletteBackground );
    pDrivers->show();

	QLabel* qtarch_Label_10;
	qtarch_Label_10 = new QLabel( this, "Label_10" );
	qtarch_Label_10->setGeometry( 10, 10, 400, 20 );
	qtarch_Label_10->setMinimumSize( 0, 0 );
	qtarch_Label_10->setMaximumSize( 32767, 32767 );
	qtarch_Label_10->setFocusPolicy( QWidget::NoFocus );
	qtarch_Label_10->setBackgroundMode( QWidget::PaletteBackground );
	qtarch_Label_10->setText( "Select the DRIVER to use or Add a new one..." );
	qtarch_Label_10->setAlignment( 289 );
	qtarch_Label_10->setMargin( -1 );

	QFrame *fra	= new QFrame( this );
	fra->setGeometry( 400, 10, 2, 300 );
	fra->setFrameStyle( 33 );


	QPushButton* qtarch_pbOk;
	qtarch_pbOk = new QPushButton( this, "pbOk" );
	qtarch_pbOk->setGeometry( 420, 230, 100, 30 );
	qtarch_pbOk->setMinimumSize( 0, 0 );
	qtarch_pbOk->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbOk, SIGNAL(clicked()), SLOT(pbOk_Clicked()) );
	qtarch_pbOk->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbOk->setBackgroundMode( QWidget::PaletteBackground );
	qtarch_pbOk->setText( "&Ok" );
	qtarch_pbOk->setAutoRepeat( FALSE );
	qtarch_pbOk->setAutoResize( FALSE );

	QPushButton* qtarch_pbCancel;
	qtarch_pbCancel = new QPushButton( this, "pbCancel" );
	qtarch_pbCancel->setGeometry( 420, 270, 100, 30 );
	qtarch_pbCancel->setMinimumSize( 0, 0 );
	qtarch_pbCancel->setMaximumSize( 32767, 32767 );
	connect( qtarch_pbCancel, SIGNAL(clicked()), SLOT(pbCancel_Clicked()) );
	qtarch_pbCancel->setFocusPolicy( QWidget::TabFocus );
	qtarch_pbCancel->setBackgroundMode( QWidget::PaletteBackground );
	qtarch_pbCancel->setText( "&Cancel" );
	qtarch_pbCancel->setAutoRepeat( FALSE );
	qtarch_pbCancel->setAutoResize( FALSE );

	resize( 530,335 );
	setMinimumSize( 0, 0 );
	setMaximumSize( 32767, 32767 );
}


CDriverPrompt::~CDriverPrompt()
{
}

/********************************************
 * protected slots
 ********************************************/

void CDriverPrompt::pbCancel_Clicked()
{
	reject();
}

void CDriverPrompt::pbOk_Clicked()
{
    QListView		*pListView;
    QListViewItem	*pListViewItem;

	pListView		= pDrivers->getListView();
	pListViewItem	= pListView->currentItem();

	if ( pListViewItem )
	{
		qsDriverName	= pListViewItem->text( 0 );
		qsDescription		= pListViewItem->text( 1 );
		qsDriver		= pListViewItem->text( 2 );
		qsSetup			= pListViewItem->text( 3 );
		if ( qsDriverName == "" )
			QMessageBox::information(	this, "ODBC Config",  "Please select a listing which contains a Driver file name" );
		else
			accept();
	}
	else
		QMessageBox::information(	this, "ODBC Config",  "Please select a Driver from the list or click Cancel" );
}