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

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

#include "dcc_preferencesui.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqspinbox.h>
#include <ntqgroupbox.h>
#include <ntqlineedit.h>
#include <ntqcombobox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

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

    DCC_ConfigUILayout->addWidget( dccPathLbl, 0, 0 );

    kcfg_DccPath = new KURLRequester( this, "kcfg_DccPath" );
    kcfg_DccPath->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)5, 0, 0, kcfg_DccPath->sizePolicy().hasHeightForWidth() ) );
    kcfg_DccPath->setMode( 2 );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccPath, 0, 0, 1, 3 );

    kcfg_DccAddPartner = new TQCheckBox( this, "kcfg_DccAddPartner" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccAddPartner, 1, 1, 0, 3 );

    kcfg_DccCreateFolder = new TQCheckBox( this, "kcfg_DccCreateFolder" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccCreateFolder, 2, 2, 0, 3 );

    kcfg_DccSpaceToUnderscore = new TQCheckBox( this, "kcfg_DccSpaceToUnderscore" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccSpaceToUnderscore, 3, 3, 0, 3 );

    kcfg_DccAutoGet = new TQCheckBox( this, "kcfg_DccAutoGet" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccAutoGet, 4, 4, 0, 3 );

    kcfg_DccAutoResume = new TQCheckBox( this, "kcfg_DccAutoResume" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccAutoResume, 5, 5, 0, 3 );

    kcfg_DccFastSend = new TQCheckBox( this, "kcfg_DccFastSend" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccFastSend, 6, 6, 0, 3 );
    spacer4_2 = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    DCC_ConfigUILayout->addItem( spacer4_2, 13, 2 );

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

    DCC_ConfigUILayout->addMultiCellWidget( textLabel6, 10, 10, 0, 1 );

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

    DCC_ConfigUILayout->addMultiCellWidget( textLabel7, 9, 9, 0, 1 );

    kcfg_DccIPv4Fallback = new TQCheckBox( this, "kcfg_DccIPv4Fallback" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccIPv4Fallback, 8, 8, 0, 1 );

    kcfg_DccBufferSize = new TQSpinBox( this, "kcfg_DccBufferSize" );
    kcfg_DccBufferSize->setMaxValue( 65536 );
    kcfg_DccBufferSize->setMinValue( 512 );
    kcfg_DccBufferSize->setLineStep( 128 );

    DCC_ConfigUILayout->addWidget( kcfg_DccBufferSize, 10, 2 );

    kcfg_DccSendTimeout = new TQSpinBox( this, "kcfg_DccSendTimeout" );
    kcfg_DccSendTimeout->setMaxValue( 300 );
    kcfg_DccSendTimeout->setMinValue( 1 );

    DCC_ConfigUILayout->addWidget( kcfg_DccSendTimeout, 9, 2 );

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

    DCC_ConfigUILayout->addWidget( kcfg_DccIPv4FallbackIface, 8, 2 );

    kcfg_DccPassiveSend = new TQCheckBox( this, "kcfg_DccPassiveSend" );

    DCC_ConfigUILayout->addMultiCellWidget( kcfg_DccPassiveSend, 7, 7, 0, 1 );
    spacer5 = new TQSpacerItem( 70, 20, TQSizePolicy::Maximum, TQSizePolicy::Minimum );
    DCC_ConfigUILayout->addItem( spacer5, 8, 3 );
    spacer3 = new TQSpacerItem( 70, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    DCC_ConfigUILayout->addItem( spacer3, 9, 3 );
    spacer3_2 = new TQSpacerItem( 70, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    DCC_ConfigUILayout->addItem( spacer3_2, 10, 3 );

    groupBox1 = new TQGroupBox( this, "groupBox1" );
    groupBox1->setColumnLayout(0, TQt::Vertical );
    groupBox1->layout()->setSpacing( 6 );
    groupBox1->layout()->setMargin( 11 );
    groupBox1Layout = new TQGridLayout( groupBox1->layout() );
    groupBox1Layout->setAlignment( TQt::AlignTop );

    kcfg_DccSpecificOwnIp = new TQLineEdit( groupBox1, "kcfg_DccSpecificOwnIp" );

    groupBox1Layout->addWidget( kcfg_DccSpecificOwnIp, 1, 1 );

    textLabel4 = new TQLabel( groupBox1, "textLabel4" );

    groupBox1Layout->addWidget( textLabel4, 0, 0 );

    ownIP = new TQLabel( groupBox1, "ownIP" );

    groupBox1Layout->addWidget( ownIP, 1, 0 );

    kcfg_DccMethodToGetOwnIp = new TQComboBox( false, groupBox1, "kcfg_DccMethodToGetOwnIp" );

    groupBox1Layout->addWidget( kcfg_DccMethodToGetOwnIp, 0, 1 );

    DCC_ConfigUILayout->addMultiCellWidget( groupBox1, 11, 11, 0, 3 );

    groupBox2 = new TQGroupBox( this, "groupBox2" );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( 6 );
    groupBox2->layout()->setMargin( 11 );
    groupBox2Layout = new TQGridLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

    kcfg_DccSpecificChatPorts = new TQCheckBox( groupBox2, "kcfg_DccSpecificChatPorts" );

    groupBox2Layout->addWidget( kcfg_DccSpecificChatPorts, 1, 0 );
    spacer6 = new TQSpacerItem( 50, 21, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    groupBox2Layout->addItem( spacer6, 1, 1 );

    kcfg_DccChatPortsFirst = new TQSpinBox( groupBox2, "kcfg_DccChatPortsFirst" );
    kcfg_DccChatPortsFirst->setEnabled( false );
    kcfg_DccChatPortsFirst->setMaxValue( 65535 );
    kcfg_DccChatPortsFirst->setMinValue( 1026 );

    groupBox2Layout->addWidget( kcfg_DccChatPortsFirst, 1, 2 );

    textLabel2_2 = new TQLabel( groupBox2, "textLabel2_2" );
    textLabel2_2->setEnabled( false );
    textLabel2_2->setAlignment( int( TQLabel::AlignCenter ) );

    groupBox2Layout->addWidget( textLabel2_2, 1, 3 );

    kcfg_DccChatPortsLast = new TQSpinBox( groupBox2, "kcfg_DccChatPortsLast" );
    kcfg_DccChatPortsLast->setEnabled( false );
    kcfg_DccChatPortsLast->setMaxValue( 65535 );
    kcfg_DccChatPortsLast->setMinValue( 1027 );

    groupBox2Layout->addWidget( kcfg_DccChatPortsLast, 1, 4 );

    kcfg_DccSpecificSendPorts = new TQCheckBox( groupBox2, "kcfg_DccSpecificSendPorts" );

    groupBox2Layout->addWidget( kcfg_DccSpecificSendPorts, 0, 0 );
    spacer4 = new TQSpacerItem( 50, 21, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    groupBox2Layout->addItem( spacer4, 0, 1 );

    kcfg_DccSendPortsFirst = new TQSpinBox( groupBox2, "kcfg_DccSendPortsFirst" );
    kcfg_DccSendPortsFirst->setEnabled( false );
    kcfg_DccSendPortsFirst->setMaxValue( 65535 );
    kcfg_DccSendPortsFirst->setMinValue( 1026 );

    groupBox2Layout->addWidget( kcfg_DccSendPortsFirst, 0, 2 );

    textLabel1_2 = new TQLabel( groupBox2, "textLabel1_2" );
    textLabel1_2->setEnabled( false );
    textLabel1_2->setAlignment( int( TQLabel::AlignCenter ) );

    groupBox2Layout->addWidget( textLabel1_2, 0, 3 );

    kcfg_DccSendPortsLast = new TQSpinBox( groupBox2, "kcfg_DccSendPortsLast" );
    kcfg_DccSendPortsLast->setEnabled( false );
    kcfg_DccSendPortsLast->setMaxValue( 65535 );
    kcfg_DccSendPortsLast->setMinValue( 1027 );

    groupBox2Layout->addWidget( kcfg_DccSendPortsLast, 0, 4 );

    DCC_ConfigUILayout->addMultiCellWidget( groupBox2, 12, 12, 0, 3 );
    languageChange();
    resize( TQSize(578, 517).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( kcfg_DccSpecificSendPorts, TQ_SIGNAL( toggled(bool) ), kcfg_DccSendPortsFirst, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccSpecificSendPorts, TQ_SIGNAL( toggled(bool) ), textLabel1_2, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccSpecificSendPorts, TQ_SIGNAL( toggled(bool) ), kcfg_DccSendPortsLast, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccSpecificChatPorts, TQ_SIGNAL( toggled(bool) ), kcfg_DccChatPortsFirst, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccSpecificChatPorts, TQ_SIGNAL( toggled(bool) ), textLabel2_2, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccSpecificChatPorts, TQ_SIGNAL( toggled(bool) ), kcfg_DccChatPortsLast, TQ_SLOT( setEnabled(bool) ) );
    connect( kcfg_DccIPv4Fallback, TQ_SIGNAL( toggled(bool) ), kcfg_DccIPv4FallbackIface, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( kcfg_DccPath, kcfg_DccAddPartner );
    setTabOrder( kcfg_DccAddPartner, kcfg_DccCreateFolder );
    setTabOrder( kcfg_DccCreateFolder, kcfg_DccSpaceToUnderscore );
    setTabOrder( kcfg_DccSpaceToUnderscore, kcfg_DccAutoGet );
    setTabOrder( kcfg_DccAutoGet, kcfg_DccAutoResume );
    setTabOrder( kcfg_DccAutoResume, kcfg_DccFastSend );
    setTabOrder( kcfg_DccFastSend, kcfg_DccPassiveSend );
    setTabOrder( kcfg_DccPassiveSend, kcfg_DccIPv4Fallback );
    setTabOrder( kcfg_DccIPv4Fallback, kcfg_DccIPv4FallbackIface );
    setTabOrder( kcfg_DccIPv4FallbackIface, kcfg_DccSendTimeout );
    setTabOrder( kcfg_DccSendTimeout, kcfg_DccBufferSize );
    setTabOrder( kcfg_DccBufferSize, kcfg_DccMethodToGetOwnIp );
    setTabOrder( kcfg_DccMethodToGetOwnIp, kcfg_DccSpecificOwnIp );
    setTabOrder( kcfg_DccSpecificOwnIp, kcfg_DccSpecificSendPorts );
    setTabOrder( kcfg_DccSpecificSendPorts, kcfg_DccSendPortsFirst );
    setTabOrder( kcfg_DccSendPortsFirst, kcfg_DccSendPortsLast );
    setTabOrder( kcfg_DccSendPortsLast, kcfg_DccSpecificChatPorts );
    setTabOrder( kcfg_DccSpecificChatPorts, kcfg_DccChatPortsFirst );
    setTabOrder( kcfg_DccChatPortsFirst, kcfg_DccChatPortsLast );

    // buddies
    dccPathLbl->setBuddy( kcfg_DccPath );
    textLabel6->setBuddy( kcfg_DccBufferSize );
    textLabel7->setBuddy( kcfg_DccSendTimeout );
    textLabel4->setBuddy( kcfg_DccMethodToGetOwnIp );
    ownIP->setBuddy( kcfg_DccSpecificOwnIp );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void DCC_ConfigUI::languageChange()
{
    setCaption( tr2i18n( "DCC_Settings" ) );
    dccPathLbl->setText( tr2i18n( "Download &folder:" ) );
    kcfg_DccAddPartner->setText( tr2i18n( "&Add sender to file name" ) );
    kcfg_DccCreateFolder->setText( tr2i18n( "Cr&eate folder for sender" ) );
    kcfg_DccSpaceToUnderscore->setText( tr2i18n( "Convert spaces in file names to underscores before sending" ) );
    kcfg_DccAutoGet->setText( tr2i18n( "Automaticall&y accept download offer" ) );
    kcfg_DccAutoResume->setText( tr2i18n( "Au&tomatically resume download" ) );
    kcfg_DccFastSend->setText( tr2i18n( "Enable fast DCC send (Might &not work with all clients)" ) );
    textLabel6->setText( tr2i18n( "Buffer si&ze:" ) );
    textLabel7->setText( tr2i18n( "DCC send t&imeout:" ) );
    kcfg_DccIPv4Fallback->setText( tr2i18n( "Fallback to an IPv&4 interface for DCC send:" ) );
    TQWhatsThis::add( kcfg_DccIPv4Fallback, tr2i18n( "If this option enabled dcc transfers for IPv6 connections will be done over IPv4 interface set here" ) );
    kcfg_DccBufferSize->setSuffix( tr2i18n( " bytes" ) );
    kcfg_DccSendTimeout->setSuffix( tr2i18n( " sec" ) );
    kcfg_DccPassiveSend->setText( tr2i18n( "Enable passive DCC send" ) );
    groupBox1->setTitle( tr2i18n( "IP" ) );
    textLabel4->setText( tr2i18n( "&Method to get own IP:" ) );
    ownIP->setText( tr2i18n( "O&wn IP:" ) );
    groupBox2->setTitle( tr2i18n( "Ports" ) );
    kcfg_DccSpecificChatPorts->setText( tr2i18n( "Enable specific p&orts for DCC chat:" ) );
    textLabel2_2->setText( tr2i18n( "to" ) );
    kcfg_DccSpecificSendPorts->setText( tr2i18n( "Enable specific &ports for DCC transfer server:" ) );
    textLabel1_2->setText( tr2i18n( "to" ) );
}

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

TQMetaObject *DCC_ConfigUI::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_DCC_ConfigUI( "DCC_ConfigUI", &DCC_ConfigUI::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* DCC_ConfigUI::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 TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"DCC_ConfigUI", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_DCC_ConfigUI.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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