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

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

#include "procattachbase.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqlineedit.h>
#include <ntqtoolbutton.h>
#include <ntqheader.h>
#include <ntqlistview.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a ProcAttachBase 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.
 */
ProcAttachBase::ProcAttachBase( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "ProcAttachBase" );
    setSizeGripEnabled( true );
    ProcAttachBaseLayout = new TQHBoxLayout( this, 10, 6, "ProcAttachBaseLayout"); 

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

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

    filterLabel = new TQLabel( this, "filterLabel" );
    layout6->addWidget( filterLabel );

    filterEdit = new TQLineEdit( this, "filterEdit" );
    filterEdit->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)5, 0, 0, filterEdit->sizePolicy().hasHeightForWidth() ) );
    filterEdit->setMaxLength( 20 );
    layout6->addWidget( filterEdit );

    filterClear = new TQToolButton( this, "filterClear" );
    layout6->addWidget( filterClear );
    layout7->addLayout( layout6 );

    processList = new TQListView( this, "processList" );
    processList->addColumn( tr2i18n( "Command" ) );
    processList->addColumn( tr2i18n( "PID" ) );
    processList->addColumn( tr2i18n( "PPID" ) );
    processList->setMinimumSize( TQSize( 300, 200 ) );
    processList->setAllColumnsShowFocus( true );
    layout7->addWidget( processList );

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

    buttonRefresh = new TQPushButton( this, "buttonRefresh" );
    buttonRefresh->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, buttonRefresh->sizePolicy().hasHeightForWidth() ) );
    layout3->addWidget( buttonRefresh );
    spacingBtns = new TQSpacerItem( 242, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout3->addItem( spacingBtns );

    buttonOk = new TQPushButton( this, "buttonOk" );
    buttonOk->setEnabled( false );
    buttonOk->setAutoDefault( true );
    buttonOk->setDefault( true );
    layout3->addWidget( buttonOk );

    buttonCancel = new TQPushButton( this, "buttonCancel" );
    buttonCancel->setAutoDefault( true );
    layout3->addWidget( buttonCancel );
    layout7->addLayout( layout3 );
    ProcAttachBaseLayout->addLayout( layout7 );
    languageChange();
    resize( TQSize(560, 416).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( buttonOk, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( buttonCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( buttonRefresh, TQ_SIGNAL( clicked() ), this, TQ_SLOT( refresh() ) );
    connect( filterEdit, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( filterEdited(const TQString&) ) );
    connect( filterClear, TQ_SIGNAL( clicked() ), filterEdit, TQ_SLOT( clear() ) );
    connect( processList, TQ_SIGNAL( selectionChanged() ), this, TQ_SLOT( selectedChanged() ) );

    // tab order
    setTabOrder( filterEdit, processList );
    setTabOrder( processList, buttonRefresh );
    setTabOrder( buttonRefresh, buttonOk );
    setTabOrder( buttonOk, buttonCancel );

    // buddies
    filterLabel->setBuddy( filterEdit );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ProcAttachBase::languageChange()
{
    setCaption( tr2i18n( "Attach to Process" ) );
    filterLabel->setText( tr2i18n( "&Filter or PID:" ) );
    TQWhatsThis::add( filterEdit, tr2i18n( "Type the name of the process or its process ID (PID) here to reduce the number of entries in the list." ) );
    filterClear->setText( tr2i18n( "..." ) );
    TQToolTip::add( filterClear, tr2i18n( "Clear filter" ) );
    TQWhatsThis::add( filterClear, tr2i18n( "Use this button to clear the filter text so that all processes are displayed." ) );
    processList->header()->setLabel( 0, tr2i18n( "Command" ) );
    processList->header()->setLabel( 1, tr2i18n( "PID" ) );
    processList->header()->setLabel( 2, tr2i18n( "PPID" ) );
    TQWhatsThis::add( processList, tr2i18n( "<p>This list displays all processes that are currently running. You must select the process that you want KDbg to attach to. Use the <b>Filter or PID</b> edit box to reduce the number of entries in this list.<p>The text in the <i>Command</i> column is usually, but not always, the command that was used to start the process. The <i>PID</i> column shows the process ID. The <i>PPID</i> column shows the process ID of the parent process. Additional columns show more information about the processes that is also available via the system's <i>ps</i> command.</p><p>The list is not updated automatically. Use the <b>Refresh</b> button to update it.</p>" ) );
    buttonRefresh->setText( tr2i18n( "&Refresh" ) );
    TQWhatsThis::add( buttonRefresh, tr2i18n( "This button updates the list of processes." ) );
    buttonOk->setText( tr2i18n( "&OK" ) );
    TQWhatsThis::add( buttonOk, tr2i18n( "You must select a process from the list. Then click the <b>OK</b> button to attach to that process." ) );
    buttonCancel->setText( tr2i18n( "&Cancel" ) );
}

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

TQMetaObject *ProcAttachBase::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_ProcAttachBase( "ProcAttachBase", &ProcAttachBase::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* ProcAttachBase::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 = {"refresh", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"filterEdited", 1, param_slot_1 };
    static const TQUMethod slot_2 = {"selectedChanged", 0, 0 };
    static const TQUMethod slot_3 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "refresh()", &slot_0, TQMetaData::Public },
	{ "filterEdited(const TQString&)", &slot_1, TQMetaData::Public },
	{ "selectedChanged()", &slot_2, TQMetaData::Public },
	{ "languageChange()", &slot_3, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"ProcAttachBase", parentObject,
	slot_tbl, 4,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_ProcAttachBase.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool ProcAttachBase::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: refresh(); break;
    case 1: filterEdited((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 2: selectedChanged(); break;
    case 3: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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