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

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

#include "addtooldlg.h"

#include <ntqvariant.h>
#include <kdialog.h>
#include <klineedit.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqframe.h>
#include <ntqpushbutton.h>
#include <kurlrequester.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "kapplicationtree.h"
#include "addtooldlg.ui.h"

/*
 *  Constructs a AddToolDialog 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.
 */
AddToolDialog::AddToolDialog( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "add_tool_dialog" );
    add_tool_dialogLayout = new TQGridLayout( this, 1, 1, KDialog::marginHint(), KDialog::spacingHint(), "add_tool_dialogLayout"); 

    cmdlineLabel_2 = new TQLabel( this, "cmdlineLabel_2" );

    add_tool_dialogLayout->addWidget( cmdlineLabel_2, 3, 0 );

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

    add_tool_dialogLayout->addMultiCellWidget( capturedBox, 4, 4, 0, 1 );

    cmdlineLabel = new TQLabel( this, "cmdlineLabel" );

    add_tool_dialogLayout->addWidget( cmdlineLabel, 2, 0 );

    Line1 = new TQFrame( this, "Line1" );
    Line1->setFrameShape( TQFrame::HLine );
    Line1->setFrameShadow( TQFrame::Sunken );
    Line1->setFrameShape( TQFrame::HLine );

    add_tool_dialogLayout->addMultiCellWidget( Line1, 5, 5, 0, 1 );

    menutextLabel = new TQLabel( this, "menutextLabel" );

    add_tool_dialogLayout->addWidget( menutextLabel, 1, 0 );

    paramEdit = new KLineEdit( this, "paramEdit" );

    add_tool_dialogLayout->addWidget( paramEdit, 3, 1 );

    menutextEdit = new KLineEdit( this, "menutextEdit" );

    add_tool_dialogLayout->addWidget( menutextEdit, 1, 1 );

    Layout2 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout2"); 
    Spacer4 = new TQSpacerItem( 20, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    Layout2->addItem( Spacer4 );

    okButton = new TQPushButton( this, "okButton" );
    okButton->setDefault( true );
    Layout2->addWidget( okButton );

    cancelButton = new TQPushButton( this, "cancelButton" );
    Layout2->addWidget( cancelButton );

    add_tool_dialogLayout->addMultiCellLayout( Layout2, 6, 6, 0, 1 );

    execEdit = new KURLRequester( this, "execEdit" );

    add_tool_dialogLayout->addWidget( execEdit, 2, 1 );

    tree = new KDevApplicationTree( this, "tree" );
    tree->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 0, tree->sizePolicy().hasHeightForWidth() ) );
    tree->setFocusPolicy( KDevApplicationTree::StrongFocus );

    add_tool_dialogLayout->addMultiCellWidget( tree, 0, 0, 0, 1 );
    languageChange();
    resize( TQSize(314, 514).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

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

    // tab order
    setTabOrder( tree, menutextEdit );
    setTabOrder( menutextEdit, execEdit );
    setTabOrder( execEdit, paramEdit );
    setTabOrder( paramEdit, capturedBox );
    setTabOrder( capturedBox, okButton );
    setTabOrder( okButton, cancelButton );

    // buddies
    cmdlineLabel_2->setBuddy( paramEdit );
    cmdlineLabel->setBuddy( execEdit );
    menutextLabel->setBuddy( menutextEdit );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void AddToolDialog::languageChange()
{
    setCaption( tr2i18n( "Add Tool" ) );
    cmdlineLabel_2->setText( tr2i18n( "&Parameters:" ) );
    capturedBox->setText( tr2i18n( "C&apture output" ) );
    TQWhatsThis::add( capturedBox, tr2i18n( "If this is checked, the output of the application will be shown in the application output view; otherwise, all output will be ignored." ) );
    cmdlineLabel->setText( tr2i18n( "&Executable:" ) );
    menutextLabel->setText( tr2i18n( "&Menu text:" ) );
    TQWhatsThis::add( paramEdit, tr2i18n( "<p>The following placeholders can be used:</p>\n"
"<p>\n"
"<b>%D</b> - The project directory<br>\n"
"<b>%S</b> - The current filename<br>\n"
"<b>%T</b> - The current selection<br>\n"
"<b>%W</b> - The current word under the cursor<br>\n"
"</p>\n"
"<p>If any of the used placeholders cannot be evaluated (for example\n"
"if you use %T but there is no current selection), the tool will not be\n"
"executed.</p>" ) );
    TQWhatsThis::add( menutextEdit, tr2i18n( "The text that appears in the Tools-Menu" ) );
    okButton->setText( tr2i18n( "&OK" ) );
    cancelButton->setText( tr2i18n( "&Cancel" ) );
    TQWhatsThis::add( execEdit, tr2i18n( "The path and name of the application to execute" ) );
}

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

TQMetaObject *AddToolDialog::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_AddToolDialog( "AddToolDialog", &AddToolDialog::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* AddToolDialog::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 = {"init", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_TQString, 0, TQUParameter::Out }
    };
    static const TQUMethod slot_1 = {"getApp", 1, param_slot_1 };
    static const TQUMethod slot_2 = {"languageChange", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ "lvi", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"treeSelectionChanged", 1, param_slot_3 };
    static const TQMetaData slot_tbl[] = {
	{ "init()", &slot_0, TQMetaData::Public },
	{ "getApp()", &slot_1, TQMetaData::Public },
	{ "languageChange()", &slot_2, TQMetaData::Protected },
	{ "treeSelectionChanged(TQListViewItem*)", &slot_3, TQMetaData::Private }
    };
    metaObj = TQMetaObject::new_metaobject(
	"AddToolDialog", parentObject,
	slot_tbl, 4,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_AddToolDialog.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool AddToolDialog::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: init(); break;
    case 1: static_QUType_TQString.set(_o,getApp()); break;
    case 2: languageChange(); break;
    case 3: treeSelectionChanged((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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