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
|
/*!
* \file
*
* \author Peter Harvey <pharvey@peterharvey.org>
* \author \sa AUTHORS file
* \version 2
* \date 2007
* \license Copyright unixODBC Project 2007-2008, LGPL
*/
#include <QtGui>
#include "CDriverPrompt.h"
#include "CDriverList.h"
#include "ODBC.xpm"
CDriverPrompt::CDriverPrompt( QWidget *pwidgetParent )
: QDialog( pwidgetParent )
{
QVBoxLayout * playout = new QVBoxLayout;
QLabel * pLabel = new QLabel( tr( "Select a driver for which you want to set up a data source..." ) );
QDialogButtonBox * pdialogbuttonbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help );
pDriverList = new CDriverList;
playout->addWidget( pLabel );
playout->addWidget( pDriverList );
playout->addWidget( pdialogbuttonbox );
connect( pdialogbuttonbox, SIGNAL(accepted()), this, SLOT(slotOk()) );
connect( pdialogbuttonbox, SIGNAL(rejected()), this, SLOT(reject()) );
setLayout( playout );
setWindowTitle( tr( "Create New Data Source..." ) );
setWindowIcon( QPixmap( xpmODBC ) );
doLoadState();
}
CDriverPrompt::~CDriverPrompt()
{
doSaveState();
}
QString CDriverPrompt::getFriendlyName()
{
return pDriverList->getFriendlyName();
}
QString CDriverPrompt::getDescription()
{
return pDriverList->getDescription();
}
QString CDriverPrompt::getDriver()
{
return pDriverList->getDriver();
}
QString CDriverPrompt::getSetup()
{
return pDriverList->getSetup();
}
void CDriverPrompt::slotOk()
{
if ( getFriendlyName().isEmpty() )
QMessageBox::information( this, tr( "ODBC Administrator" ), tr( "please select a Driver" ) );
else
accept();
}
void CDriverPrompt::doLoadState()
{
QSettings settings;
int nW = settings.value( "CDriverPrompt/w", geometry().width() ).toInt();
int nH = settings.value( "CDriverPrompt/h", geometry().height() ).toInt();
resize( nW, nH );
}
void CDriverPrompt::doSaveState()
{
QSettings settings;
settings.setValue( "CDriverPrompt/w", width() );
settings.setValue( "CDriverPrompt/h", height() );
}
|