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

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

#include "replacedlg.h"

#include <ntqvariant.h>
#include <kcombobox.h>
#include <kdialog.h>
#include <kurlrequester.h>
#include <ntqpushbutton.h>
#include <ntqgroupbox.h>
#include <ntqcheckbox.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqlabel.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a ReplaceDlg 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.
 */
ReplaceDlg::ReplaceDlg( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "ReplaceDlg" );
    setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
    setMaximumSize( TQSize( 32767, 32767 ) );
    ReplaceDlgLayout = new TQGridLayout( this, 1, 1, KDialog::marginHint(), KDialog::spacingHint(), "ReplaceDlgLayout"); 

    groupBox2 = new TQGroupBox( this, "groupBox2" );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( KDialog::spacingHint() );
    groupBox2->layout()->setMargin( KDialog::marginHint() );
    groupBox2Layout = new TQVBoxLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

    case_box = new TQCheckBox( groupBox2, "case_box" );
    case_box->setChecked( true );
    groupBox2Layout->addWidget( case_box );

    buttonGroup2 = new TQButtonGroup( groupBox2, "buttonGroup2" );
    buttonGroup2->setFrameShape( TQButtonGroup::NoFrame );
    buttonGroup2->setColumnLayout(0, TQt::Vertical );
    buttonGroup2->layout()->setSpacing( KDialog::spacingHint() );
    buttonGroup2->layout()->setMargin( 0 );
    buttonGroup2Layout = new TQVBoxLayout( buttonGroup2->layout() );
    buttonGroup2Layout->setAlignment( TQt::AlignTop );

    strings_all_radio = new TQRadioButton( buttonGroup2, "strings_all_radio" );
    strings_all_radio->setChecked( true );
    buttonGroup2Layout->addWidget( strings_all_radio );

    strings_wholewords_radio = new TQRadioButton( buttonGroup2, "strings_wholewords_radio" );
    buttonGroup2Layout->addWidget( strings_wholewords_radio );

    layout3 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "layout3"); 

    strings_regexp_radio = new TQRadioButton( buttonGroup2, "strings_regexp_radio" );
    layout3->addWidget( strings_regexp_radio );

    regexp_button = new TQPushButton( buttonGroup2, "regexp_button" );
    regexp_button->setEnabled( false );
    layout3->addWidget( regexp_button );
    buttonGroup2Layout->addLayout( layout3 );
    groupBox2Layout->addWidget( buttonGroup2 );

    regexp_combo = new KHistoryCombo( groupBox2, "regexp_combo" );
    regexp_combo->setEnabled( false );
    groupBox2Layout->addWidget( regexp_combo );

    ReplaceDlgLayout->addWidget( groupBox2, 1, 0 );

    buttonGroup1 = new TQButtonGroup( this, "buttonGroup1" );
    buttonGroup1->setColumnLayout(0, TQt::Vertical );
    buttonGroup1->layout()->setSpacing( KDialog::spacingHint() );
    buttonGroup1->layout()->setMargin( KDialog::marginHint() );
    buttonGroup1Layout = new TQVBoxLayout( buttonGroup1->layout() );
    buttonGroup1Layout->setAlignment( TQt::AlignTop );

    files_all_radio = new TQRadioButton( buttonGroup1, "files_all_radio" );
    files_all_radio->setChecked( true );
    buttonGroup1Layout->addWidget( files_all_radio );

    files_open_radio = new TQRadioButton( buttonGroup1, "files_open_radio" );
    buttonGroup1Layout->addWidget( files_open_radio );

    files_path_radio = new TQRadioButton( buttonGroup1, "files_path_radio" );
    buttonGroup1Layout->addWidget( files_path_radio );

    path_urlreq = new KURLRequester( buttonGroup1, "path_urlreq" );
    path_urlreq->setEnabled( false );
    buttonGroup1Layout->addWidget( path_urlreq );

    ReplaceDlgLayout->addWidget( buttonGroup1, 2, 0 );

    layout4 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "layout4"); 

    expression_varning_label = new TQLabel( this, "expression_varning_label" );
    TQFont expression_varning_label_font(  expression_varning_label->font() );
    expression_varning_label_font.setBold( true );
    expression_varning_label->setFont( expression_varning_label_font ); 
    layout4->addWidget( expression_varning_label );
    spacer1 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout4->addItem( spacer1 );

    find_button = new TQPushButton( this, "find_button" );
    find_button->setDefault( true );
    layout4->addWidget( find_button );

    cancel_button = new TQPushButton( this, "cancel_button" );
    layout4->addWidget( cancel_button );

    ReplaceDlgLayout->addLayout( layout4, 3, 0 );

    groupBox1 = new TQGroupBox( this, "groupBox1" );
    groupBox1->setColumnLayout(0, TQt::Vertical );
    groupBox1->layout()->setSpacing( KDialog::spacingHint() );
    groupBox1->layout()->setMargin( KDialog::marginHint() );
    groupBox1Layout = new TQGridLayout( groupBox1->layout() );
    groupBox1Layout->setAlignment( TQt::AlignTop );

    textLabel1 = new TQLabel( groupBox1, "textLabel1" );

    groupBox1Layout->addWidget( textLabel1, 0, 0 );

    find_combo = new KHistoryCombo( groupBox1, "find_combo" );

    groupBox1Layout->addWidget( find_combo, 1, 0 );

    textLabel2 = new TQLabel( groupBox1, "textLabel2" );

    groupBox1Layout->addWidget( textLabel2, 2, 0 );

    replacement_combo = new KHistoryCombo( groupBox1, "replacement_combo" );

    groupBox1Layout->addWidget( replacement_combo, 3, 0 );

    ReplaceDlgLayout->addWidget( groupBox1, 0, 0 );
    languageChange();
    resize( TQSize(428, 487).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( cancel_button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( find_button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( strings_regexp_radio, TQ_SIGNAL( toggled(bool) ), regexp_button, TQ_SLOT( setEnabled(bool) ) );
    connect( files_path_radio, TQ_SIGNAL( toggled(bool) ), path_urlreq, TQ_SLOT( setEnabled(bool) ) );
    connect( strings_regexp_radio, TQ_SIGNAL( toggled(bool) ), find_combo, TQ_SLOT( setDisabled(bool) ) );
    connect( strings_regexp_radio, TQ_SIGNAL( toggled(bool) ), regexp_combo, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( find_combo, replacement_combo );
    setTabOrder( replacement_combo, case_box );
    setTabOrder( case_box, strings_all_radio );
    setTabOrder( strings_all_radio, strings_regexp_radio );
    setTabOrder( strings_regexp_radio, regexp_button );
    setTabOrder( regexp_button, regexp_combo );
    setTabOrder( regexp_combo, files_all_radio );
    setTabOrder( files_all_radio, path_urlreq );
    setTabOrder( path_urlreq, find_button );
    setTabOrder( find_button, cancel_button );
    setTabOrder( cancel_button, strings_wholewords_radio );
    setTabOrder( strings_wholewords_radio, files_path_radio );

    // buddies
    textLabel1->setBuddy( find_combo );
    textLabel2->setBuddy( replacement_combo );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ReplaceDlg::languageChange()
{
    setCaption( tr2i18n( "Project Wide String Replacement" ) );
    groupBox2->setTitle( tr2i18n( "Options" ) );
    case_box->setText( tr2i18n( "C&ase sensitive" ) );
    buttonGroup2->setTitle( TQString::null );
    strings_all_radio->setText( tr2i18n( "All s&ubstrings" ) );
    strings_wholewords_radio->setText( tr2i18n( "Whole words onl&y" ) );
    strings_regexp_radio->setText( tr2i18n( "Regular e&xpression:" ) );
    TQToolTip::add( strings_regexp_radio, tr2i18n( "Use regexp to specify target" ) );
    regexp_button->setText( tr2i18n( "E&dit" ) );
    TQToolTip::add( regexp_button, tr2i18n( "Opens the regexp editor. Only enabled if installed." ) );
    TQToolTip::add( regexp_combo, tr2i18n( "Enter the regexp here" ) );
    buttonGroup1->setTitle( tr2i18n( "Target Files in Project" ) );
    files_all_radio->setText( tr2i18n( "A&ll files" ) );
    TQToolTip::add( files_all_radio, tr2i18n( "All files in the project will be considered." ) );
    files_open_radio->setText( tr2i18n( "&Open files only" ) );
    TQToolTip::add( files_open_radio, tr2i18n( "Only open project files will be considered." ) );
    files_path_radio->setText( tr2i18n( "Files under &path:" ) );
    TQToolTip::add( files_path_radio, tr2i18n( "Only project files in this dir and its subdirs will be considered." ) );
    expression_varning_label->setText( tr2i18n( "Expression is invalid." ) );
    find_button->setText( tr2i18n( "Fi&nd" ) );
    TQToolTip::add( find_button, tr2i18n( "Start looking for possible replacement targets." ) );
    cancel_button->setText( tr2i18n( "&Cancel" ) );
    groupBox1->setTitle( tr2i18n( "Strings" ) );
    textLabel1->setText( tr2i18n( "&Text to find:" ) );
    TQToolTip::add( find_combo, tr2i18n( "Target string" ) );
    textLabel2->setText( tr2i18n( "&Replacement text:" ) );
    TQToolTip::add( replacement_combo, tr2i18n( "The replacement string" ) );
}

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

TQMetaObject *ReplaceDlg::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_ReplaceDlg( "ReplaceDlg", &ReplaceDlg::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* ReplaceDlg::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 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"ReplaceDlg", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_ReplaceDlg.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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