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

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

#include "ipfilterwidgetbase.h"

#include <ntqvariant.h>
#include <kpushbutton.h>
#include <tdelistview.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqgroupbox.h>
#include <klineedit.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a BlacklistWidgetBase 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.
 */
BlacklistWidgetBase::BlacklistWidgetBase( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "BlacklistWidgetBase" );
    BlacklistWidgetBaseLayout = new TQGridLayout( this, 1, 1, 11, 6, "BlacklistWidgetBaseLayout"); 
    BlacklistWidgetBaseLayout->setResizeMode( TQLayout::Minimum );

    textLabel2 = new TQLabel( this, "textLabel2" );
    textLabel2->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );

    BlacklistWidgetBaseLayout->addWidget( textLabel2, 1, 0 );

    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 );

    lstPeers = new TDEListView( groupBox1, "lstPeers" );
    lstPeers->addColumn( tr2i18n( "Peer IP address" ) );
    lstPeers->setFullWidth( true );

    groupBox1Layout->addWidget( lstPeers, 2, 0 );
    spacer5_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed );
    groupBox1Layout->addItem( spacer5_2, 1, 0 );

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

    textLabel1 = new TQLabel( groupBox1, "textLabel1" );
    layout8->addWidget( textLabel1 );

    peerIP = new KLineEdit( groupBox1, "peerIP" );
    layout8->addWidget( peerIP );

    groupBox1Layout->addLayout( layout8, 0, 0 );

    layout7 = new TQVBoxLayout( 0, 0, 6, "layout7"); 

    btnAdd = new KPushButton( groupBox1, "btnAdd" );
    btnAdd->setProperty( "stdItem", 27 );
    layout7->addWidget( btnAdd );
    spacer5 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed );
    layout7->addItem( spacer5 );

    btnRemove = new KPushButton( groupBox1, "btnRemove" );
    btnRemove->setProperty( "stdItem", 28 );
    layout7->addWidget( btnRemove );

    btnClear = new KPushButton( groupBox1, "btnClear" );
    btnClear->setProperty( "stdItem", 10 );
    layout7->addWidget( btnClear );
    spacer4 = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Fixed );
    layout7->addItem( spacer4 );

    btnOpen = new KPushButton( groupBox1, "btnOpen" );
    btnOpen->setProperty( "stdItem", 18 );
    layout7->addWidget( btnOpen );

    btnSave = new KPushButton( groupBox1, "btnSave" );
    btnSave->setProperty( "stdItem", 8 );
    layout7->addWidget( btnSave );
    spacer2 = new TQSpacerItem( 20, 30, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    layout7->addItem( spacer2 );

    btnOk = new KPushButton( groupBox1, "btnOk" );
    btnOk->setProperty( "stdItem", 1 );
    layout7->addWidget( btnOk );

    btnApply = new KPushButton( groupBox1, "btnApply" );
    btnApply->setProperty( "stdItem", 9 );
    layout7->addWidget( btnApply );

    btnCancel = new KPushButton( groupBox1, "btnCancel" );
    btnCancel->setProperty( "stdItem", 2 );
    layout7->addWidget( btnCancel );

    groupBox1Layout->addMultiCellLayout( layout7, 0, 2, 1, 1 );

    BlacklistWidgetBaseLayout->addWidget( groupBox1, 0, 0 );
    languageChange();
    resize( TQSize(490, 437).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( btnCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( btnAdd, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnAdd_clicked() ) );
    connect( btnRemove, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnRemove_clicked() ) );
    connect( btnClear, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnClear_clicked() ) );
    connect( btnOpen, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnOpen_clicked() ) );
    connect( btnSave, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnSave_clicked() ) );
    connect( btnOk, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnOk_clicked() ) );
    connect( btnApply, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnApply_clicked() ) );

    // tab order
    setTabOrder( btnOk, btnApply );
    setTabOrder( btnApply, btnCancel );
    setTabOrder( btnCancel, lstPeers );
    setTabOrder( lstPeers, btnRemove );
    setTabOrder( btnRemove, btnClear );
    setTabOrder( btnClear, btnOpen );
    setTabOrder( btnOpen, btnSave );
    setTabOrder( btnSave, peerIP );
    setTabOrder( peerIP, btnAdd );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void BlacklistWidgetBase::languageChange()
{
    setCaption( tr2i18n( "KTorrent Blacklist" ) );
    textLabel2->setText( tr2i18n( "Note: Blacklist applies to current session only. Use save/open to save your entries or use IPFilter plugin (PeerGuardian)." ) );
    groupBox1->setTitle( tr2i18n( "Banned Peers" ) );
    lstPeers->header()->setLabel( 0, tr2i18n( "Peer IP address" ) );
    textLabel1->setText( tr2i18n( "Add peer:" ) );
    peerIP->setText( tr2i18n( "127.0.0.1" ) );
    btnAdd->setText( tr2i18n( "Add" ) );
    TQToolTip::add( btnAdd, tr2i18n( "Adds a peer to blacklist" ) );
    btnRemove->setText( tr2i18n( "Remove" ) );
    TQToolTip::add( btnRemove, tr2i18n( "Removes selected peer from blacklist" ) );
    btnClear->setText( tr2i18n( "C&lear" ) );
    TQToolTip::add( btnClear, tr2i18n( "Clears this list" ) );
    btnOpen->setText( tr2i18n( "&Open..." ) );
    btnSave->setText( tr2i18n( "Save &As..." ) );
    TQToolTip::add( btnSave, tr2i18n( "Save this blacklist to use with KTorrent IPFilter plugin" ) );
    btnOk->setText( tr2i18n( "&OK" ) );
    btnApply->setText( tr2i18n( "&Apply" ) );
    btnCancel->setText( tr2i18n( "&Cancel" ) );
}

void BlacklistWidgetBase::btnAdd_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnAdd_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnRemove_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnRemove_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnClear_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnClear_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnOpen_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnOpen_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnSave_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnSave_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnOk_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnOk_clicked(): Not implemented yet" );
}

void BlacklistWidgetBase::btnApply_clicked()
{
    tqWarning( "BlacklistWidgetBase::btnApply_clicked(): Not implemented yet" );
}

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

TQMetaObject *BlacklistWidgetBase::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_BlacklistWidgetBase( "BlacklistWidgetBase", &BlacklistWidgetBase::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* BlacklistWidgetBase::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 = {"btnAdd_clicked", 0, 0 };
    static const TQUMethod slot_1 = {"btnRemove_clicked", 0, 0 };
    static const TQUMethod slot_2 = {"btnClear_clicked", 0, 0 };
    static const TQUMethod slot_3 = {"btnOpen_clicked", 0, 0 };
    static const TQUMethod slot_4 = {"btnSave_clicked", 0, 0 };
    static const TQUMethod slot_5 = {"btnOk_clicked", 0, 0 };
    static const TQUMethod slot_6 = {"btnApply_clicked", 0, 0 };
    static const TQUMethod slot_7 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "btnAdd_clicked()", &slot_0, TQMetaData::Public },
	{ "btnRemove_clicked()", &slot_1, TQMetaData::Public },
	{ "btnClear_clicked()", &slot_2, TQMetaData::Public },
	{ "btnOpen_clicked()", &slot_3, TQMetaData::Public },
	{ "btnSave_clicked()", &slot_4, TQMetaData::Public },
	{ "btnOk_clicked()", &slot_5, TQMetaData::Public },
	{ "btnApply_clicked()", &slot_6, TQMetaData::Public },
	{ "languageChange()", &slot_7, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"BlacklistWidgetBase", parentObject,
	slot_tbl, 8,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_BlacklistWidgetBase.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool BlacklistWidgetBase::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: btnAdd_clicked(); break;
    case 1: btnRemove_clicked(); break;
    case 2: btnClear_clicked(); break;
    case 3: btnOpen_clicked(); break;
    case 4: btnSave_clicked(); break;
    case 5: btnOk_clicked(); break;
    case 6: btnApply_clicked(); break;
    case 7: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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