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

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

#include "sqlconfigwidget.h"

#include <ntqvariant.h>
#include <kpushbutton.h>
#include <ntqtable.h>
#include <ntqlabel.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

#include "sqlconfigwidget.ui.h"

/*
 *  Constructs a SqlConfigWidget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
SqlConfigWidget::SqlConfigWidget( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "SqlConfigWidget" );
    SqlConfigWidgetLayout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint(), "SqlConfigWidgetLayout"); 

    dbTable = new TQTable( this, "dbTable" );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Plugin" ) );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Database Name" ) );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Host" ) );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Port" ) );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Username" ) );
    dbTable->setNumCols( dbTable->numCols() + 1 );
    dbTable->horizontalHeader()->setLabel( dbTable->numCols() - 1, tr2i18n( "Password" ) );
    dbTable->setNumRows( 0 );
    dbTable->setNumCols( 6 );
    dbTable->setSelectionMode( TQTable::SingleRow );
    SqlConfigWidgetLayout->addWidget( dbTable );

    textLabel1 = new TQLabel( this, "textLabel1" );
    SqlConfigWidgetLayout->addWidget( textLabel1 );

    layout5 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "layout5"); 
    spacer4 = new TQSpacerItem( 81, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout5->addItem( spacer4 );

    removeBtn = new KPushButton( this, "removeBtn" );
    layout5->addWidget( removeBtn );

    testBtn = new KPushButton( this, "testBtn" );
    layout5->addWidget( testBtn );
    SqlConfigWidgetLayout->addLayout( layout5 );
    languageChange();
    resize( TQSize(578, 367).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( dbTable, TQ_SIGNAL( valueChanged(int,int) ), this, TQ_SLOT( valueChanged(int,int) ) );
    connect( removeBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( removeDb() ) );
    connect( testBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( testDb() ) );
    connect( dbTable, TQ_SIGNAL( currentChanged(int,int) ), this, TQ_SLOT( updateButtons() ) );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SqlConfigWidget::languageChange()
{
    dbTable->horizontalHeader()->setLabel( 0, tr2i18n( "Plugin" ) );
    dbTable->horizontalHeader()->setLabel( 1, tr2i18n( "Database Name" ) );
    dbTable->horizontalHeader()->setLabel( 2, tr2i18n( "Host" ) );
    dbTable->horizontalHeader()->setLabel( 3, tr2i18n( "Port" ) );
    dbTable->horizontalHeader()->setLabel( 4, tr2i18n( "Username" ) );
    dbTable->horizontalHeader()->setLabel( 5, tr2i18n( "Password" ) );
    textLabel1->setText( tr2i18n( "<i>Warning:</i> password will be saved with weak encryption." ) );
    removeBtn->setText( tr2i18n( "&Remove" ) );
    testBtn->setText( tr2i18n( "&Test" ) );
}

/****************************************************************************
** SqlConfigWidget meta object code from reading C++ file 'sqlconfigwidget.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 "sqlconfigwidget.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 *SqlConfigWidget::className() const
{
    return "SqlConfigWidget";
}

TQMetaObject *SqlConfigWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_SqlConfigWidget( "SqlConfigWidget", &SqlConfigWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* SqlConfigWidget::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 = {"init", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::In },
	{ 0, &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"valueChanged", 2, param_slot_1 };
    static const TQUMethod slot_2 = {"removeDb", 0, 0 };
    static const TQUMethod slot_3 = {"updateButtons", 0, 0 };
    static const TQUMethod slot_4 = {"testDb", 0, 0 };
    static const TQUMethod slot_5 = {"accept", 0, 0 };
    static const TQUParameter param_slot_6[] = {
	{ "doc", &static_QUType_ptr, "TQDomDocument", TQUParameter::In }
    };
    static const TQUMethod slot_6 = {"setProjectDom", 1, param_slot_6 };
    static const TQUMethod slot_7 = {"loadConfig", 0, 0 };
    static const TQUMethod slot_8 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "init()", &slot_0, TQMetaData::Public },
	{ "valueChanged(int,int)", &slot_1, TQMetaData::Public },
	{ "removeDb()", &slot_2, TQMetaData::Public },
	{ "updateButtons()", &slot_3, TQMetaData::Public },
	{ "testDb()", &slot_4, TQMetaData::Public },
	{ "accept()", &slot_5, TQMetaData::Public },
	{ "setProjectDom(TQDomDocument*)", &slot_6, TQMetaData::Public },
	{ "loadConfig()", &slot_7, TQMetaData::Public },
	{ "languageChange()", &slot_8, TQMetaData::Protected }
    };
    static const TQUMethod signal_0 = {"newConfigSaved", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "newConfigSaved()", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"SqlConfigWidget", parentObject,
	slot_tbl, 9,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_SqlConfigWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL newConfigSaved
void SqlConfigWidget::newConfigSaved()
{
    activate_signal( staticMetaObject()->signalOffset() + 0 );
}

bool SqlConfigWidget::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: init(); break;
    case 1: valueChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 2: removeDb(); break;
    case 3: updateButtons(); break;
    case 4: testDb(); break;
    case 5: accept(); break;
    case 6: setProjectDom((TQDomDocument*)static_QUType_ptr.get(_o+1)); break;
    case 7: loadConfig(); break;
    case 8: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool SqlConfigWidget::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: newConfigSaved(); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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