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

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

#include "dbsetup.h"

#include <ntqvariant.h>
#include <knuminput.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <ntqpushbutton.h>
#include <ntqwidgetstack.h>
#include <ntqframe.h>
#include <ntqgroupbox.h>
#include <ntqlabel.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "amarokconfig.h"
#include "config.h"
#include "debug.h"
#include "dbsetup.ui.h"

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

    configStack = new TQWidgetStack( this, "configStack" );
    configStack->setFrameShadow( TQWidgetStack::Plain );

    SQLLite = new TQWidget( configStack, "SQLLite" );
    configStack->addWidget( SQLLite, 0 );

    MySQL = new TQWidget( configStack, "MySQL" );
    MySQLLayout = new TQHBoxLayout( MySQL, 0, 6, "MySQLLayout"); 

    mySqlFrame = new TQFrame( MySQL, "mySqlFrame" );
    mySqlFrame->setFrameShape( TQFrame::NoFrame );
    mySqlFrame->setFrameShadow( TQFrame::Raised );
    mySqlFrame->setLineWidth( 0 );
    mySqlFrameLayout = new TQGridLayout( mySqlFrame, 1, 1, 0, 6, "mySqlFrameLayout"); 

    mysqlConfig = new TQGroupBox( mySqlFrame, "mysqlConfig" );
    mysqlConfig->setColumnLayout(0, TQt::Vertical );
    mysqlConfig->layout()->setSpacing( 6 );
    mysqlConfig->layout()->setMargin( 11 );
    mysqlConfigLayout = new TQGridLayout( mysqlConfig->layout() );
    mysqlConfigLayout->setAlignment( TQt::AlignTop );

    textLabel1 = new TQLabel( mysqlConfig, "textLabel1" );

    mysqlConfigLayout->addWidget( textLabel1, 0, 0 );

    textLabel5 = new TQLabel( mysqlConfig, "textLabel5" );

    mysqlConfigLayout->addWidget( textLabel5, 1, 0 );

    kcfg_MySqlPort = new KIntSpinBox( mysqlConfig, "kcfg_MySqlPort" );
    kcfg_MySqlPort->setMaximumSize( TQSize( 100, 32767 ) );
    kcfg_MySqlPort->setMaxValue( 65535 );

    mysqlConfigLayout->addWidget( kcfg_MySqlPort, 0, 3 );

    textLabel2 = new TQLabel( mysqlConfig, "textLabel2" );

    mysqlConfigLayout->addWidget( textLabel2, 0, 2 );

    kcfg_MySqlHost = new KLineEdit( mysqlConfig, "kcfg_MySqlHost" );

    mysqlConfigLayout->addWidget( kcfg_MySqlHost, 0, 1 );

    kcfg_MySqlDbName = new KLineEdit( mysqlConfig, "kcfg_MySqlDbName" );

    mysqlConfigLayout->addWidget( kcfg_MySqlDbName, 1, 1 );

    line1 = new TQFrame( mysqlConfig, "line1" );
    line1->setFrameShape( TQFrame::HLine );
    line1->setFrameShadow( TQFrame::Sunken );
    line1->setFrameShape( TQFrame::HLine );

    mysqlConfigLayout->addMultiCellWidget( line1, 2, 2, 0, 3 );

    layout4 = new TQHBoxLayout( 0, 0, 6, "layout4"); 

    textLabel3 = new TQLabel( mysqlConfig, "textLabel3" );
    layout4->addWidget( textLabel3 );

    kcfg_MySqlUser = new KLineEdit( mysqlConfig, "kcfg_MySqlUser" );
    layout4->addWidget( kcfg_MySqlUser );

    textLabel4 = new TQLabel( mysqlConfig, "textLabel4" );
    layout4->addWidget( textLabel4 );

    kcfg_MySqlPassword2 = new KLineEdit( mysqlConfig, "kcfg_MySqlPassword2" );
    kcfg_MySqlPassword2->setEchoMode( KLineEdit::Password );
    layout4->addWidget( kcfg_MySqlPassword2 );

    mysqlConfigLayout->addMultiCellLayout( layout4, 3, 3, 0, 3 );

    mySqlFrameLayout->addWidget( mysqlConfig, 0, 0 );
    MySQLLayout->addWidget( mySqlFrame );
    configStack->addWidget( MySQL, 1 );

    PostgreSQL = new TQWidget( configStack, "PostgreSQL" );
    PostgreSQLLayout = new TQHBoxLayout( PostgreSQL, 0, 6, "PostgreSQLLayout"); 

    postgreSqlFrame = new TQFrame( PostgreSQL, "postgreSqlFrame" );
    postgreSqlFrame->setFrameShape( TQFrame::NoFrame );
    postgreSqlFrame->setFrameShadow( TQFrame::Raised );
    postgreSqlFrameLayout = new TQGridLayout( postgreSqlFrame, 1, 1, 0, 6, "postgreSqlFrameLayout"); 

    postgresqlConfig = new TQGroupBox( postgreSqlFrame, "postgresqlConfig" );
    postgresqlConfig->setColumnLayout(0, TQt::Vertical );
    postgresqlConfig->layout()->setSpacing( 6 );
    postgresqlConfig->layout()->setMargin( 11 );
    postgresqlConfigLayout = new TQGridLayout( postgresqlConfig->layout() );
    postgresqlConfigLayout->setAlignment( TQt::AlignTop );

    textLabel1_2 = new TQLabel( postgresqlConfig, "textLabel1_2" );

    postgresqlConfigLayout->addWidget( textLabel1_2, 0, 0 );

    textLabel5_2 = new TQLabel( postgresqlConfig, "textLabel5_2" );

    postgresqlConfigLayout->addWidget( textLabel5_2, 1, 0 );

    kcfg_PostgresqlPort = new KIntSpinBox( postgresqlConfig, "kcfg_PostgresqlPort" );
    kcfg_PostgresqlPort->setMaximumSize( TQSize( 100, 32767 ) );
    kcfg_PostgresqlPort->setMaxValue( 65535 );

    postgresqlConfigLayout->addWidget( kcfg_PostgresqlPort, 0, 3 );

    textLabel2_2 = new TQLabel( postgresqlConfig, "textLabel2_2" );

    postgresqlConfigLayout->addWidget( textLabel2_2, 0, 2 );

    kcfg_PostgresqlHost = new KLineEdit( postgresqlConfig, "kcfg_PostgresqlHost" );

    postgresqlConfigLayout->addWidget( kcfg_PostgresqlHost, 0, 1 );

    kcfg_PostgresqlDbName = new KLineEdit( postgresqlConfig, "kcfg_PostgresqlDbName" );

    postgresqlConfigLayout->addWidget( kcfg_PostgresqlDbName, 1, 1 );

    line1_2 = new TQFrame( postgresqlConfig, "line1_2" );
    line1_2->setFrameShape( TQFrame::HLine );
    line1_2->setFrameShadow( TQFrame::Sunken );
    line1_2->setFrameShape( TQFrame::HLine );

    postgresqlConfigLayout->addMultiCellWidget( line1_2, 2, 2, 0, 3 );

    layout4_2 = new TQHBoxLayout( 0, 0, 6, "layout4_2"); 

    textLabel3_2 = new TQLabel( postgresqlConfig, "textLabel3_2" );
    layout4_2->addWidget( textLabel3_2 );

    kcfg_PostgresqlUser = new KLineEdit( postgresqlConfig, "kcfg_PostgresqlUser" );
    layout4_2->addWidget( kcfg_PostgresqlUser );

    textLabel4_2 = new TQLabel( postgresqlConfig, "textLabel4_2" );
    layout4_2->addWidget( textLabel4_2 );

    kcfg_PostgresqlPassword2 = new KLineEdit( postgresqlConfig, "kcfg_PostgresqlPassword2" );
    kcfg_PostgresqlPassword2->setEchoMode( KLineEdit::Password );
    layout4_2->addWidget( kcfg_PostgresqlPassword2 );

    postgresqlConfigLayout->addMultiCellLayout( layout4_2, 3, 3, 0, 3 );

    postgreSqlFrameLayout->addWidget( postgresqlConfig, 0, 0 );
    PostgreSQLLayout->addWidget( postgreSqlFrame );
    configStack->addWidget( PostgreSQL, 2 );

    DbSetupLayout->addMultiCellWidget( configStack, 1, 1, 0, 1 );

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

    DbSetupLayout->addWidget( textLabel1_2_2, 0, 0 );

    databaseEngine = new KComboBox( false, this, "databaseEngine" );
    databaseEngine->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, databaseEngine->sizePolicy().hasHeightForWidth() ) );

    DbSetupLayout->addWidget( databaseEngine, 0, 1 );
    languageChange();
    resize( TQSize(385, 155).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( databaseEngine, TQ_SIGNAL( activated(int) ), configStack, TQ_SLOT( raiseWidget(int) ) );
    connect( databaseEngine, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( databaseEngine_activated(int) ) );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void DbSetup::languageChange()
{
    setCaption( tr2i18n( "Database Setup" ) );
    mysqlConfig->setTitle( tr2i18n( "MySQL Configuration" ) );
    textLabel1->setText( tr2i18n( "Hostname:" ) );
    textLabel5->setText( tr2i18n( "Database:" ) );
    TQToolTip::add( kcfg_MySqlPort, tr2i18n( "Which port mysql should connect to." ) );
    TQWhatsThis::add( kcfg_MySqlPort, tr2i18n( "Which port mysql should connect to." ) );
    textLabel2->setText( tr2i18n( "Port:" ) );
    TQToolTip::add( kcfg_MySqlHost, tr2i18n( "Hostname where database lives." ) );
    TQWhatsThis::add( kcfg_MySqlHost, tr2i18n( "Hostname where database lives." ) );
    TQToolTip::add( kcfg_MySqlDbName, tr2i18n( "Name of the database." ) );
    TQWhatsThis::add( kcfg_MySqlDbName, tr2i18n( "Name of the database." ) );
    textLabel3->setText( tr2i18n( "Username:" ) );
    TQToolTip::add( kcfg_MySqlUser, tr2i18n( "Username with which to connect to." ) );
    TQWhatsThis::add( kcfg_MySqlUser, tr2i18n( "Username with which to connect to." ) );
    textLabel4->setText( tr2i18n( "Password:" ) );
    TQToolTip::add( kcfg_MySqlPassword2, tr2i18n( "Password with which to connect to." ) );
    TQWhatsThis::add( kcfg_MySqlPassword2, tr2i18n( "Password with which to connect to." ) );
    postgresqlConfig->setTitle( tr2i18n( "PostgreSQL Configuration" ) );
    textLabel1_2->setText( tr2i18n( "Hostname:" ) );
    textLabel5_2->setText( tr2i18n( "Database:" ) );
    TQToolTip::add( kcfg_PostgresqlPort, tr2i18n( "Which port postgresql should connect to." ) );
    TQWhatsThis::add( kcfg_PostgresqlPort, tr2i18n( "Which port postgresql should connect to." ) );
    textLabel2_2->setText( tr2i18n( "Port:" ) );
    TQToolTip::add( kcfg_PostgresqlHost, tr2i18n( "Hostname where database lives." ) );
    TQWhatsThis::add( kcfg_PostgresqlHost, tr2i18n( "Hostname where database lives." ) );
    TQToolTip::add( kcfg_PostgresqlDbName, tr2i18n( "Name of the database." ) );
    TQWhatsThis::add( kcfg_PostgresqlDbName, tr2i18n( "Name of the database." ) );
    textLabel3_2->setText( tr2i18n( "Username:" ) );
    TQToolTip::add( kcfg_PostgresqlUser, tr2i18n( "Username with which to connect to." ) );
    TQWhatsThis::add( kcfg_PostgresqlUser, tr2i18n( "Username with which to connect to." ) );
    textLabel4_2->setText( tr2i18n( "Password:" ) );
    TQToolTip::add( kcfg_PostgresqlPassword2, tr2i18n( "Password with which to connect to." ) );
    TQWhatsThis::add( kcfg_PostgresqlPassword2, tr2i18n( "Password with which to connect to." ) );
    textLabel1_2_2->setText( tr2i18n( "Database:" ) );
    databaseEngine->clear();
    databaseEngine->insertItem( tr2i18n( "SQLite" ) );
}

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

TQMetaObject *DbSetup::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_DbSetup( "DbSetup", &DbSetup::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* DbSetup::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 TQUParameter param_slot_0[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"databaseEngine_activated", 1, param_slot_0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "databaseEngine_activated(int)", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"DbSetup", parentObject,
	slot_tbl, 2,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_DbSetup.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool DbSetup::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: databaseEngine_activated((int)static_QUType_int.get(_o+1)); break;
    case 1: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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