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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
/**************************************************
*
*
**************************************************
* 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 );
#ifdef QT_V4LAYOUT
pDrivers->setFocusPolicy( Qt::NoFocus );
pDrivers->setBackgroundMode( Qt::PaletteBackground );
#else
pDrivers->setFocusPolicy( QWidget::NoFocus );
pDrivers->setBackgroundMode( QWidget::PaletteBackground );
#endif
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 );
#ifdef QT_V4LAYOUT
qtarch_Label_10->setFocusPolicy( Qt::NoFocus );
qtarch_Label_10->setBackgroundMode( Qt::PaletteBackground );
#else
qtarch_Label_10->setFocusPolicy( QWidget::NoFocus );
qtarch_Label_10->setBackgroundMode( QWidget::PaletteBackground );
#endif
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()) );
#ifdef QT_V4LAYOUT
qtarch_pbOk->setFocusPolicy( Qt::TabFocus );
qtarch_pbOk->setBackgroundMode( Qt::PaletteBackground );
#else
qtarch_pbOk->setFocusPolicy( QWidget::TabFocus );
qtarch_pbOk->setBackgroundMode( QWidget::PaletteBackground );
#endif
qtarch_pbOk->setText( "&Ok" );
qtarch_pbOk->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
qtarch_pbOk->setAutoResize( FALSE );
#endif
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()) );
#ifdef QT_V4LAYOUT
qtarch_pbCancel->setFocusPolicy( Qt::TabFocus );
qtarch_pbCancel->setBackgroundMode( Qt::PaletteBackground );
#else
qtarch_pbCancel->setFocusPolicy( QWidget::TabFocus );
qtarch_pbCancel->setBackgroundMode( QWidget::PaletteBackground );
#endif
qtarch_pbCancel->setText( "&Cancel" );
qtarch_pbCancel->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
qtarch_pbCancel->setAutoResize( FALSE );
#endif
resize( 530,335 );
setMinimumSize( 0, 0 );
setMaximumSize( 32767, 32767 );
}
CDriverPrompt::~CDriverPrompt()
{
}
/********************************************
* protected slots
********************************************/
void CDriverPrompt::pbCancel_Clicked()
{
reject();
}
void CDriverPrompt::pbOk_Clicked()
{
#ifdef QT_V4LAYOUT
Q3ListView *pListView;
Q3ListViewItem *pListViewItem;
#else
QListView *pListView;
QListViewItem *pListViewItem;
#endif
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" );
}
|