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

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

#include "sq_filters.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqframe.h>
#include <ntqgroupbox.h>
#include <ntqheader.h>
#include <ntqlistview.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "sq_config.h"
#include "sq_iconloader.h"
#include "ksquirrel.h"
#include "sq_filters.ui.h"

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

    pushOK = new TQPushButton( this, "pushOK" );
    pushOK->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, pushOK->sizePolicy().hasHeightForWidth() ) );
    pushOK->setDefault( true );

    SQ_FiltersLayout->addWidget( pushOK, 3, 1 );

    pushCancel = new TQPushButton( this, "pushCancel" );
    pushCancel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, pushCancel->sizePolicy().hasHeightForWidth() ) );

    SQ_FiltersLayout->addMultiCellWidget( pushCancel, 3, 3, 2, 3 );
    spacer5 = new TQSpacerItem( 411, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    SQ_FiltersLayout->addItem( spacer5, 3, 0 );

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

    SQ_FiltersLayout->addMultiCellWidget( line2, 2, 2, 0, 3 );

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

    groupBox2 = new TQGroupBox( this, "groupBox2" );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( 6 );
    groupBox2->layout()->setMargin( 5 );
    groupBox2Layout = new TQGridLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

    pushNew = new TQPushButton( groupBox2, "pushNew" );
    pushNew->setFlat( true );

    groupBox2Layout->addWidget( pushNew, 0, 0 );

    pushDelete = new TQPushButton( groupBox2, "pushDelete" );
    pushDelete->setAutoRepeat( true );
    pushDelete->setFlat( true );

    groupBox2Layout->addWidget( pushDelete, 1, 0 );

    pushClearAll = new TQPushButton( groupBox2, "pushClearAll" );
    pushClearAll->setFlat( true );

    groupBox2Layout->addWidget( pushClearAll, 2, 0 );
    layout7->addWidget( groupBox2 );

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

    pushFilterUp = new TQPushButton( groupBox1, "pushFilterUp" );
    pushFilterUp->setEnabled( true );
    pushFilterUp->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, pushFilterUp->sizePolicy().hasHeightForWidth() ) );
    pushFilterUp->setMinimumSize( TQSize( 22, 22 ) );
    pushFilterUp->setAutoRepeat( true );
    pushFilterUp->setFlat( true );

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

    pushFilterDown = new TQPushButton( groupBox1, "pushFilterDown" );
    pushFilterDown->setEnabled( true );
    pushFilterDown->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, pushFilterDown->sizePolicy().hasHeightForWidth() ) );
    pushFilterDown->setMinimumSize( TQSize( 22, 22 ) );
    pushFilterDown->setAutoRepeat( true );
    pushFilterDown->setFlat( true );

    groupBox1Layout->addWidget( pushFilterDown, 1, 0 );
    layout7->addWidget( groupBox1 );

    SQ_FiltersLayout->addLayout( layout7, 0, 3 );
    spacer12 = new TQSpacerItem( 20, 145, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    SQ_FiltersLayout->addItem( spacer12, 1, 3 );

    layout7_2 = new TQGridLayout( 0, 1, 1, 0, 6, "layout7_2"); 

    listFilters = new TQListView( this, "listFilters" );
    listFilters->addColumn( tr2i18n( "Name" ) );
    listFilters->addColumn( tr2i18n( "Extensions" ) );
    listFilters->setAcceptDrops( true );
    listFilters->setResizePolicy( TQScrollView::Manual );
    listFilters->setSelectionMode( TQListView::Single );
    listFilters->setAllColumnsShowFocus( true );
    listFilters->setShowSortIndicator( false );
    listFilters->setItemMargin( 1 );
    listFilters->setResizeMode( TQListView::AllColumns );
    listFilters->setDefaultRenameAction( TQListView::Reject );

    layout7_2->addMultiCellWidget( listFilters, 0, 0, 0, 2 );

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

    layout7_2->addMultiCellWidget( checkBoth, 2, 2, 0, 2 );

    SQ_FiltersLayout->addMultiCellLayout( layout7_2, 0, 1, 0, 2 );
    languageChange();
    resize( TQSize(562, 417).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( pushFilterUp, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotFilterUp() ) );
    connect( pushFilterDown, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotFilterDown() ) );
    connect( listFilters, TQ_SIGNAL( rightButtonClicked(TQListViewItem*,const TQPoint&,int) ), this, TQ_SLOT( slotFilterRenameRequest(TQListViewItem*,const TQPoint&,int) ) );
    connect( pushOK, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( pushCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( pushNew, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotNewFilter() ) );
    connect( pushClearAll, TQ_SIGNAL( clicked() ), listFilters, TQ_SLOT( clear() ) );
    connect( pushDelete, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotFilterClear() ) );

    // tab order
    setTabOrder( listFilters, checkBoth );
    setTabOrder( checkBoth, pushNew );
    setTabOrder( pushNew, pushDelete );
    setTabOrder( pushDelete, pushClearAll );
    setTabOrder( pushClearAll, pushFilterUp );
    setTabOrder( pushFilterUp, pushFilterDown );
    setTabOrder( pushFilterDown, pushOK );
    setTabOrder( pushOK, pushCancel );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SQ_Filters::languageChange()
{
    setCaption( tr2i18n( "Adjust filters" ) );
    pushOK->setText( tr2i18n( "OK" ) );
    pushCancel->setText( tr2i18n( "Cancel" ) );
    groupBox2->setTitle( TQString::null );
    pushNew->setText( TQString::null );
    TQToolTip::add( pushNew, tr2i18n( "New filter" ) );
    pushDelete->setText( TQString::null );
    TQToolTip::add( pushDelete, tr2i18n( "Delete" ) );
    pushClearAll->setText( TQString::null );
    TQToolTip::add( pushClearAll, tr2i18n( "Clear All" ) );
    groupBox1->setTitle( TQString::null );
    pushFilterUp->setText( TQString::null );
    TQToolTip::add( pushFilterUp, tr2i18n( "Move filter up" ) );
    pushFilterDown->setText( TQString::null );
    TQToolTip::add( pushFilterDown, tr2i18n( "Move filter down" ) );
    listFilters->header()->setLabel( 0, tr2i18n( "Name" ) );
    listFilters->header()->setLabel( 1, tr2i18n( "Extensions" ) );
    checkBoth->setText( tr2i18n( "Menu item contains both name and extension" ) );
}

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

TQMetaObject *SQ_Filters::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_SQ_Filters( "SQ_Filters", &SQ_Filters::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* SQ_Filters::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 = {"slotNewFilter", 0, 0 };
    static const TQUMethod slot_1 = {"slotFilterClear", 0, 0 };
    static const TQUMethod slot_2 = {"slotFilterUp", 0, 0 };
    static const TQUMethod slot_3 = {"slotFilterDown", 0, 0 };
    static const TQUParameter param_slot_4[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::Out }
    };
    static const TQUMethod slot_4 = {"start", 1, param_slot_4 };
    static const TQUParameter param_slot_5[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In },
	{ 0, &static_QUType_varptr, "\x0e", TQUParameter::In },
	{ "pos", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_5 = {"slotFilterRenameRequest", 3, param_slot_5 };
    static const TQUMethod slot_6 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "slotNewFilter()", &slot_0, TQMetaData::Public },
	{ "slotFilterClear()", &slot_1, TQMetaData::Public },
	{ "slotFilterUp()", &slot_2, TQMetaData::Public },
	{ "slotFilterDown()", &slot_3, TQMetaData::Public },
	{ "start()", &slot_4, TQMetaData::Public },
	{ "slotFilterRenameRequest(TQListViewItem*,const TQPoint&,int)", &slot_5, TQMetaData::Public },
	{ "languageChange()", &slot_6, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"SQ_Filters", parentObject,
	slot_tbl, 7,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_SQ_Filters.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool SQ_Filters::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: slotNewFilter(); break;
    case 1: slotFilterClear(); break;
    case 2: slotFilterUp(); break;
    case 3: slotFilterDown(); break;
    case 4: static_QUType_int.set(_o,start()); break;
    case 5: slotFilterRenameRequest((TQListViewItem*)static_QUType_ptr.get(_o+1),(const TQPoint&)*((const TQPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3)); break;
    case 6: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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