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

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

#include "kmyfirewallmultiportwidget.h"

#include <ntqvariant.h>
#include <tqwidget.h>
#include <ntqpushbutton.h>
#include <ntqlistbox.h>
#include <ntqspinbox.h>
#include <ntqlabel.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

    lb_ports = new TQListBox( this, "lb_ports" );
    lb_ports->setEnabled( false );
    lb_ports->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)4, (TQSizePolicy::SizeType)7, 0, 0, lb_ports->sizePolicy().hasHeightForWidth() ) );

    KMyFirewallMultiPortWidgetLayout->addMultiCellWidget( lb_ports, 0, 3, 3, 3 );

    b_remove = new TQPushButton( this, "b_remove" );
    b_remove->setEnabled( false );

    KMyFirewallMultiPortWidgetLayout->addWidget( b_remove, 3, 2 );

    b_add = new TQPushButton( this, "b_add" );
    b_add->setEnabled( false );

    KMyFirewallMultiPortWidgetLayout->addWidget( b_add, 3, 1 );

    sb_port = new TQSpinBox( this, "sb_port" );
    sb_port->setEnabled( false );
    sb_port->setMaxValue( 65335 );
    sb_port->setMinValue( 1 );

    KMyFirewallMultiPortWidgetLayout->addWidget( sb_port, 2, 2 );

    TextLabel3 = new TQLabel( this, "TextLabel3" );
    TextLabel3->setEnabled( false );
    TextLabel3->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );

    KMyFirewallMultiPortWidgetLayout->addWidget( TextLabel3, 2, 1 );

    ButtonGroup1 = new TQButtonGroup( this, "ButtonGroup1" );
    ButtonGroup1->setEnabled( false );
    ButtonGroup1->setLineWidth( 1 );
    ButtonGroup1->setExclusive( true );
    ButtonGroup1->setColumnLayout(0, TQt::Vertical );
    ButtonGroup1->layout()->setSpacing( 6 );
    ButtonGroup1->layout()->setMargin( 11 );
    ButtonGroup1Layout = new TQGridLayout( ButtonGroup1->layout() );
    ButtonGroup1Layout->setAlignment( TQt::AlignTop );

    rb_equ = new TQRadioButton( ButtonGroup1, "rb_equ" );

    ButtonGroup1Layout->addWidget( rb_equ, 2, 0 );

    rb_dest = new TQRadioButton( ButtonGroup1, "rb_dest" );

    ButtonGroup1Layout->addWidget( rb_dest, 1, 0 );

    rb_src = new TQRadioButton( ButtonGroup1, "rb_src" );
    rb_src->setChecked( true );

    ButtonGroup1Layout->addWidget( rb_src, 0, 0 );

    KMyFirewallMultiPortWidgetLayout->addMultiCellWidget( ButtonGroup1, 0, 1, 1, 2 );

    TextLabel1 = new TQLabel( this, "TextLabel1" );
    TextLabel1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
    TextLabel1->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignTop ) );

    KMyFirewallMultiPortWidgetLayout->addMultiCellWidget( TextLabel1, 1, 3, 0, 0 );

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

    KMyFirewallMultiPortWidgetLayout->addWidget( c_use_multiport, 0, 0 );
    languageChange();
    resize( TQSize(625, 190).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), ButtonGroup1, TQ_SLOT( setEnabled(bool) ) );
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), lb_ports, TQ_SLOT( setEnabled(bool) ) );
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), TextLabel3, TQ_SLOT( setEnabled(bool) ) );
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), sb_port, TQ_SLOT( setEnabled(bool) ) );
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), b_add, TQ_SLOT( setEnabled(bool) ) );
    connect( c_use_multiport, TQ_SIGNAL( toggled(bool) ), b_remove, TQ_SLOT( setEnabled(bool) ) );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KMyFirewallMultiPortWidget::languageChange()
{
    setCaption( tr2i18n( "MultiPortWidget" ) );
    b_remove->setText( tr2i18n( "&Remove" ) );
    b_add->setText( tr2i18n( "&Add" ) );
    TextLabel3->setText( tr2i18n( "Port:" ) );
    ButtonGroup1->setTitle( TQString::null );
    rb_equ->setText( tr2i18n( "Equal ports" ) );
    rb_dest->setText( tr2i18n( "Destination ports" ) );
    rb_src->setText( tr2i18n( "Source ports" ) );
    TextLabel1->setText( tr2i18n( "<p>You may filter for up to 15 ports within one rule if you are using the multiport extention.<br>\n"
"Use this to avoid too large (slow) rulesets." ) );
    c_use_multiport->setText( tr2i18n( "Use multiport extention" ) );
}

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

TQMetaObject *KMyFirewallMultiPortWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KMyFirewallMultiPortWidget( "KMyFirewallMultiPortWidget", &KMyFirewallMultiPortWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* KMyFirewallMultiPortWidget::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 }
    };
    static const TQUParameter param_signal_0[] = {
	{ 0, &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod signal_0 = {"sigMultiPortChanged", 1, param_signal_0 };
    static const TQMetaData signal_tbl[] = {
	{ "sigMultiPortChanged(bool)", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KMyFirewallMultiPortWidget", parentObject,
	slot_tbl, 1,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KMyFirewallMultiPortWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL sigMultiPortChanged
void KMyFirewallMultiPortWidget::sigMultiPortChanged( bool t0 )
{
    activate_signal_bool( staticMetaObject()->signalOffset() + 0, t0 );
}

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

bool KMyFirewallMultiPortWidget::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: sigMultiPortChanged((bool)static_QUType_bool.get(_o+1)); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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