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

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

#include "hostprofiles.h"

#include <ntqvariant.h>
#include <kdialog.h>
#include <tdelistview.h>
#include <ntqpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "hostprofiles.ui.h"

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

    hostListView = new TDEListView( this, "hostListView" );
    hostListView->addColumn( tr2i18n( "Host" ) );
    hostListView->addColumn( tr2i18n( "Type" ) );
    hostListView->addColumn( tr2i18n( "Settings" ) );
    hostListView->setProperty( "selectionMode", "Multi" );
    hostListView->setAllColumnsShowFocus( true );
    hostListView->setFullWidth( true );
    hostListView->setItemsMovable( false );

    HostProfilesLayout->addMultiCellWidget( hostListView, 0, 0, 0, 2 );
    spacer3 = new TQSpacerItem( 117, 21, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    HostProfilesLayout->addItem( spacer3, 1, 0 );

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

    HostProfilesLayout->addWidget( removeHostButton, 1, 1 );

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

    HostProfilesLayout->addWidget( removeAllButton, 1, 2 );
    languageChange();
    resize( TQSize(451, 222).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( removeHostButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( removeHost() ) );
    connect( removeAllButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( removeAllHosts() ) );
    connect( hostListView, TQ_SIGNAL( selectionChanged() ), this, TQ_SLOT( selectionChanged() ) );
    connect( hostListView, TQ_SIGNAL( doubleClicked(TQListViewItem*,const TQPoint&,int) ), this, TQ_SLOT( slotHostDoubleClicked(TQListViewItem*) ) );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void HostProfiles::languageChange()
{
    hostListView->header()->setLabel( 0, tr2i18n( "Host" ) );
    hostListView->header()->setLabel( 1, tr2i18n( "Type" ) );
    hostListView->header()->setLabel( 2, tr2i18n( "Settings" ) );
    TQWhatsThis::add( hostListView, tr2i18n( "This list shows all hosts that you have visited and a summary of your settings for them. If you want to reset the setting for a host, you can delete it using the buttons below. When you connect again you can then re-configure them." ) );
    removeHostButton->setText( tr2i18n( "&Remove Selected Host" ) );
    TQWhatsThis::add( removeHostButton, tr2i18n( "Deletes the hosts that you have selected in the list above." ) );
    removeAllButton->setText( tr2i18n( "Remove &All Hosts" ) );
    TQWhatsThis::add( removeAllButton, tr2i18n( "Removes all hosts from the list." ) );
}

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

TQMetaObject *HostProfiles::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_HostProfiles( "HostProfiles", &HostProfiles::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* HostProfiles::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 = {"removeHost", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"slotHostDoubleClicked", 1, param_slot_1 };
    static const TQUMethod slot_2 = {"languageChange", 0, 0 };
    static const TQUMethod slot_3 = {"removeAllHosts", 0, 0 };
    static const TQUMethod slot_4 = {"selectionChanged", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "removeHost()", &slot_0, TQMetaData::Public },
	{ "slotHostDoubleClicked(TQListViewItem*)", &slot_1, TQMetaData::Public },
	{ "languageChange()", &slot_2, TQMetaData::Protected },
	{ "removeAllHosts()", &slot_3, TQMetaData::Protected },
	{ "selectionChanged()", &slot_4, TQMetaData::Protected }
    };
    static const TQUParameter param_signal_0[] = {
	{ 0, &static_QUType_ptr, "HostPrefPtr", TQUParameter::In }
    };
    static const TQUMethod signal_0 = {"hostDoubleClicked", 1, param_signal_0 };
    static const TQMetaData signal_tbl[] = {
	{ "hostDoubleClicked(HostPrefPtr)", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"HostProfiles", parentObject,
	slot_tbl, 5,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_HostProfiles.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

#include <ntqobjectdefs.h>
#include <ntqsignalslotimp.h>

// TQ_SIGNAL hostDoubleClicked
void HostProfiles::hostDoubleClicked( HostPrefPtr t0 )
{
    if ( signalsBlocked() )
	return;
    TQConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 0 );
    if ( !clist )
	return;
    TQUObject o[2];
    static_QUType_ptr.set(o+1,&t0);
    o[1].isLastObject = true;
    activate_signal( clist, o );
}

bool HostProfiles::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: removeHost(); break;
    case 1: slotHostDoubleClicked((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 2: languageChange(); break;
    case 3: removeAllHosts(); break;
    case 4: selectionChanged(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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