#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'dbconnection.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "dbconnection.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqspinbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a DatabaseConnectionWidget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
DatabaseConnectionWidget::DatabaseConnectionWidget( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "DatabaseConnectionWidget" );
    DatabaseConnectionWidgetLayout = new TQGridLayout( this, 1, 1, 0, 6, "DatabaseConnectionWidgetLayout"); 

    TextLabel3 = new TQLabel( this, "TextLabel3" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel3, 2, 0 );

    TextLabel4 = new TQLabel( this, "TextLabel4" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel4, 3, 0 );

    TextLabel4_2 = new TQLabel( this, "TextLabel4_2" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel4_2, 4, 0 );

    TextLabel2 = new TQLabel( this, "TextLabel2" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel2, 1, 0 );

    editName = new KLineEdit( this, "editName" );
    editName->setEnabled( false );

    DatabaseConnectionWidgetLayout->addWidget( editName, 0, 1 );

    TextLabel5 = new TQLabel( this, "TextLabel5" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel5, 5, 0 );

    comboDriver = new TQComboBox( false, this, "comboDriver" );
    comboDriver->setEnabled( false );
    comboDriver->setEditable( true );

    DatabaseConnectionWidgetLayout->addWidget( comboDriver, 1, 1 );

    TextLabel1 = new TQLabel( this, "TextLabel1" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel1, 0, 0 );

    editHostname = new KLineEdit( this, "editHostname" );
    editHostname->setEnabled( false );

    DatabaseConnectionWidgetLayout->addWidget( editHostname, 5, 1 );

    TextLabel1_2 = new TQLabel( this, "TextLabel1_2" );

    DatabaseConnectionWidgetLayout->addWidget( TextLabel1_2, 6, 0 );

    editUsername = new KLineEdit( this, "editUsername" );
    editUsername->setEnabled( false );

    DatabaseConnectionWidgetLayout->addWidget( editUsername, 3, 1 );

    editPassword = new KLineEdit( this, "editPassword" );
    editPassword->setEnabled( false );
    editPassword->setEchoMode( KLineEdit::Password );

    DatabaseConnectionWidgetLayout->addWidget( editPassword, 4, 1 );

    editDatabase = new KLineEdit( this, "editDatabase" );
    editDatabase->setEnabled( false );

    DatabaseConnectionWidgetLayout->addWidget( editDatabase, 2, 1 );

    editPort = new TQSpinBox( this, "editPort" );
    editPort->setEnabled( false );
    editPort->setMaxValue( 65535 );
    editPort->setMinValue( -1 );
    editPort->setValue( -1 );

    DatabaseConnectionWidgetLayout->addWidget( editPort, 6, 1 );
    languageChange();
    resize( TQSize(199, 185).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections

    // tab order
    setTabOrder( editName, comboDriver );
    setTabOrder( comboDriver, editDatabase );
    setTabOrder( editDatabase, editUsername );
    setTabOrder( editUsername, editPassword );
    setTabOrder( editPassword, editHostname );
    setTabOrder( editHostname, editPort );

    // buddies
    TextLabel3->setBuddy( editDatabase );
    TextLabel4->setBuddy( editUsername );
    TextLabel4_2->setBuddy( editPassword );
    TextLabel2->setBuddy( comboDriver );
    TextLabel5->setBuddy( editHostname );
    TextLabel1->setBuddy( editName );
    TextLabel1_2->setBuddy( editPort );
    init();
}

/*
 *  Destroys the object and frees any allocated resources
 */
DatabaseConnectionWidget::~DatabaseConnectionWidget()
{
    destroy();
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void DatabaseConnectionWidget::languageChange()
{
    setCaption( tr2i18n( "Edit Database Connection" ) );
    TextLabel3->setText( tr2i18n( "&Database name:" ) );
    TextLabel4->setText( tr2i18n( "&Username:" ) );
    TextLabel4_2->setText( tr2i18n( "&Password:" ) );
    TextLabel2->setText( tr2i18n( "D&river:" ) );
    TextLabel5->setText( tr2i18n( "&Hostname:" ) );
    TextLabel1->setText( tr2i18n( "&Name:" ) );
    TextLabel1_2->setText( tr2i18n( "P&ort:" ) );
    editPort->setSpecialValueText( tr2i18n( "Default" ) );
}

void DatabaseConnectionWidget::init()
{
}

void DatabaseConnectionWidget::destroy()
{
}

/****************************************************************************
** DatabaseConnectionWidget meta object code from reading C++ file 'dbconnection.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "dbconnection.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *DatabaseConnectionWidget::className() const
{
    return "DatabaseConnectionWidget";
}

TQMetaObject *DatabaseConnectionWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_DatabaseConnectionWidget( "DatabaseConnectionWidget", &DatabaseConnectionWidget::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString DatabaseConnectionWidget::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "DatabaseConnectionWidget", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString DatabaseConnectionWidget::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "DatabaseConnectionWidget", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* DatabaseConnectionWidget::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQUMethod slot_1 = {"init", 0, 0 };
    static const TQUMethod slot_2 = {"destroy", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "init()", &slot_1, TQMetaData::Protected },
	{ "destroy()", &slot_2, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"DatabaseConnectionWidget", parentObject,
	slot_tbl, 3,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_DatabaseConnectionWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* DatabaseConnectionWidget::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "DatabaseConnectionWidget" ) )
	return this;
    return TQWidget::tqt_cast( clname );
}

bool DatabaseConnectionWidget::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: init(); break;
    case 2: destroy(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool DatabaseConnectionWidget::tqt_emit( int _id, TQUObject* _o )
{
    return TQWidget::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool DatabaseConnectionWidget::tqt_property( int id, int f, TQVariant* v)
{
    return TQWidget::tqt_property( id, f, v);
}

bool DatabaseConnectionWidget::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
