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

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

#include "networkconfig.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqlineedit.h>
#include <ntqlabel.h>
#include <ntqgroupbox.h>
#include <ntqlistbox.h>
#include <ntqspinbox.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "networkconfig.ui.h"

/*
 *  Constructs a NetworkConfig as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
NetworkConfig::NetworkConfig( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "NetworkConfig" );
    NetworkConfigLayout = new TQGridLayout( this, 1, 1, 11, 6, "NetworkConfigLayout"); 

    description = new TQLineEdit( this, "description" );

    NetworkConfigLayout->addMultiCellWidget( description, 1, 1, 4, 6 );

    textLabel10 = new TQLabel( this, "textLabel10" );
    textLabel10->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)5, 0, 0, textLabel10->sizePolicy().hasHeightForWidth() ) );

    NetworkConfigLayout->addWidget( textLabel10, 1, 3 );

    groupBox2 = new TQGroupBox( this, "groupBox2" );
    groupBox2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)3, 0, 0, groupBox2->sizePolicy().hasHeightForWidth() ) );
    groupBox2->setMargin( 4 );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( 6 );
    groupBox2->layout()->setMargin( 11 );
    groupBox2Layout = new TQGridLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

    hostList = new TQListBox( groupBox2, "hostList" );
    hostList->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)3, 0, 0, hostList->sizePolicy().hasHeightForWidth() ) );

    groupBox2Layout->addMultiCellWidget( hostList, 0, 2, 0, 3 );

    password = new TQLineEdit( groupBox2, "password" );
    password->setEchoMode( TQLineEdit::Password );

    groupBox2Layout->addMultiCellWidget( password, 4, 4, 1, 4 );

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

    groupBox2Layout->addWidget( textLabel6, 3, 2 );

    port = new TQSpinBox( groupBox2, "port" );
    port->setMaxValue( 65536 );
    port->setMinValue( 1 );
    port->setValue( 6667 );

    groupBox2Layout->addMultiCellWidget( port, 3, 3, 3, 4 );

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

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

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

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

    host = new TQLineEdit( groupBox2, "host" );
    host->setReadOnly( true );

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

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

    groupBox2Layout->addMultiCellWidget( useSSL, 5, 5, 0, 1 );

    removeHost = new TQPushButton( groupBox2, "removeHost" );
    removeHost->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, removeHost->sizePolicy().hasHeightForWidth() ) );

    groupBox2Layout->addMultiCellWidget( removeHost, 6, 6, 3, 4 );

    newHost = new TQPushButton( groupBox2, "newHost" );
    newHost->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, newHost->sizePolicy().hasHeightForWidth() ) );

    groupBox2Layout->addWidget( newHost, 6, 2 );
    spacer3 = new TQSpacerItem( 210, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    groupBox2Layout->addMultiCell( spacer3, 6, 6, 0, 1 );

    downButton = new TQPushButton( groupBox2, "downButton" );
    downButton->setEnabled( false );

    groupBox2Layout->addWidget( downButton, 2, 4 );
    spacer4 = new TQSpacerItem( 20, 151, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    groupBox2Layout->addItem( spacer4, 0, 4 );

    upButton = new TQPushButton( groupBox2, "upButton" );
    upButton->setEnabled( false );

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

    NetworkConfigLayout->addMultiCellWidget( groupBox2, 2, 2, 3, 6 );

    cancelButton = new TQPushButton( this, "cancelButton" );

    NetworkConfigLayout->addWidget( cancelButton, 3, 6 );

    saveButton = new TQPushButton( this, "saveButton" );

    NetworkConfigLayout->addWidget( saveButton, 3, 5 );

    newNetwork = new TQPushButton( this, "newNetwork" );

    NetworkConfigLayout->addWidget( newNetwork, 3, 0 );

    networkList = new TQListBox( this, "networkList" );
    networkList->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)7, 0, 0, networkList->sizePolicy().hasHeightForWidth() ) );

    NetworkConfigLayout->addMultiCellWidget( networkList, 0, 2, 0, 2 );
    spacer5 = new TQSpacerItem( 260, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    NetworkConfigLayout->addMultiCell( spacer5, 3, 3, 3, 4 );

    renameNetwork = new TQPushButton( this, "renameNetwork" );

    NetworkConfigLayout->addWidget( renameNetwork, 3, 1 );

    removeNetwork = new TQPushButton( this, "removeNetwork" );

    NetworkConfigLayout->addWidget( removeNetwork, 3, 2 );
    languageChange();
    resize( TQSize(670, 468).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( cancelButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( saveButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );

    // tab order
    setTabOrder( networkList, newNetwork );
    setTabOrder( newNetwork, renameNetwork );
    setTabOrder( renameNetwork, removeNetwork );
    setTabOrder( removeNetwork, description );
    setTabOrder( description, hostList );
    setTabOrder( hostList, upButton );
    setTabOrder( upButton, downButton );
    setTabOrder( downButton, host );
    setTabOrder( host, port );
    setTabOrder( port, password );
    setTabOrder( password, useSSL );
    setTabOrder( useSSL, newHost );
    setTabOrder( newHost, removeHost );
    setTabOrder( removeHost, saveButton );
    setTabOrder( saveButton, cancelButton );

    // buddies
    textLabel10->setBuddy( description );
    textLabel6->setBuddy( port );
    textLabel4->setBuddy( password );
    textLabel5->setBuddy( host );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void NetworkConfig::languageChange()
{
    setCaption( tr2i18n( "Network Configuration" ) );
    textLabel10->setText( tr2i18n( "&Description:" ) );
    groupBox2->setTitle( tr2i18n( "Host Con&figuration" ) );
    TQToolTip::add( hostList, tr2i18n( "The IRC servers associated with this network" ) );
    TQWhatsThis::add( hostList, tr2i18n( "The IRC servers associated with this network. Use the up and down buttons to alter the order in which connections are attempted." ) );
    TQToolTip::add( password, tr2i18n( "Most IRC servers do not require a password" ) );
    textLabel6->setText( tr2i18n( "Por&t:" ) );
    textLabel4->setText( tr2i18n( "&Password:" ) );
    textLabel5->setText( tr2i18n( "&Host:" ) );
    TQToolTip::add( host, TQString::null );
    useSSL->setText( tr2i18n( "Use SS&L" ) );
    TQToolTip::add( useSSL, tr2i18n( "Check this to enable SSL for this connection" ) );
    removeHost->setText( tr2i18n( "&Remove" ) );
    newHost->setText( tr2i18n( "&New..." ) );
    downButton->setText( tr2i18n( "Down" ) );
    TQToolTip::add( downButton, tr2i18n( "Move this server down" ) );
    TQWhatsThis::add( downButton, tr2i18n( "Move this server down in connection attempt priority" ) );
    upButton->setText( tr2i18n( "Up" ) );
    TQToolTip::add( upButton, tr2i18n( "Move this server up" ) );
    TQWhatsThis::add( upButton, tr2i18n( "Move this server up in connection attempt priority" ) );
    cancelButton->setText( tr2i18n( "&Cancel" ) );
    saveButton->setText( tr2i18n( "&Save" ) );
    newNetwork->setText( tr2i18n( "Ne&w" ) );
    renameNetwork->setText( tr2i18n( "Rena&me..." ) );
    removeNetwork->setText( tr2i18n( "Remo&ve" ) );
}

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

TQMetaObject *NetworkConfig::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_NetworkConfig( "NetworkConfig", &NetworkConfig::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* NetworkConfig::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 = TQDialog::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQUMethod slot_1 = {"accept", 0, 0 };
    static const TQUMethod slot_2 = {"reject", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "accept()", &slot_1, TQMetaData::Protected },
	{ "reject()", &slot_2, TQMetaData::Protected }
    };
    static const TQUMethod signal_0 = {"accepted", 0, 0 };
    static const TQUMethod signal_1 = {"rejected", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "accepted()", &signal_0, TQMetaData::Public },
	{ "rejected()", &signal_1, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"NetworkConfig", parentObject,
	slot_tbl, 3,
	signal_tbl, 2,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_NetworkConfig.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

// TQ_SIGNAL rejected
void NetworkConfig::rejected()
{
    activate_signal( staticMetaObject()->signalOffset() + 1 );
}

bool NetworkConfig::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: accept(); break;
    case 2: reject(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

bool NetworkConfig::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: accepted(); break;
    case 1: rejected(); break;
    default:
	return TQDialog::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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