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

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

#include "snippetdlg.h"

#include <ntqvariant.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <ktextedit.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqtoolbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

#include "snippetdlg.ui.h"
static const char* const image0_data[] = { 
"16 18 21 1",
". c None",
"b c #000000",
"a c #00385a",
"# c #00386a",
"n c #00406a",
"f c #004073",
"j c #004473",
"e c #00508b",
"q c #005594",
"d c #00559c",
"h c #00599c",
"c c #2981c5",
"s c #2981cd",
"l c #2985cd",
"i c #3989cd",
"m c #4191cd",
"o c #4191d5",
"k c #5299d5",
"g c #6aaade",
"p c #73aee6",
"r c #8bc2ee",
"....#a#a#abbb...",
"...acdbbbdebbbb.",
"..fghbbbbaiehbbb",
"..jkbbbbbbalebbb",
"..#chbbb.bfmhbbb",
"..baedbbb.noebbb",
"..bbbbbbbapqbbbb",
"...bbbbbarhbbbbb",
"....bbbaphbbbbb.",
"......alebbbbb..",
"......#shbbbb...",
"......bbbbbb....",
"......bbbbbb....",
".......aabb.....",
"......#ghbbb....",
"......bbbbbb....",
"......bbbbbb....",
".......bbbb....."};


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

    layout5 = new TQHBoxLayout( 0, 0, 6, "layout5"); 
    spacer1 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout5->addItem( spacer1 );

    btnAdd = new KPushButton( this, "btnAdd" );
    layout5->addWidget( btnAdd );

    btnCancel = new KPushButton( this, "btnCancel" );
    layout5->addWidget( btnCancel );

    SnippetDlgLayout->addLayout( layout5, 1, 0 );

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

    snippetName = new KLineEdit( this, "snippetName" );
    TQFont snippetName_font(  snippetName->font() );
    snippetName_font.setFamily( "Courier" );
    snippetName_font.setPointSize( 11 );
    snippetName->setFont( snippetName_font ); 

    layout3->addWidget( snippetName, 0, 1 );
    spacer2 = new TQSpacerItem( 20, 80, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    layout3->addItem( spacer2, 4, 0 );

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

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

    textLabel2 = new TQLabel( this, "textLabel2" );
    textLabel2->setAlignment( int( TQLabel::AlignTop ) );

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

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

    layout3->addWidget( textLabelGroup, 1, 0 );

    toolBtnHelp = new TQToolButton( this, "toolBtnHelp" );
    toolBtnHelp->setIconSet( TQIconSet( image0 ) );

    layout3->addWidget( toolBtnHelp, 3, 0 );

    cbGroup = new KComboBox( false, this, "cbGroup" );

    layout3->addWidget( cbGroup, 1, 1 );

    snippetText = new KTextEdit( this, "snippetText" );
    TQFont snippetText_font(  snippetText->font() );
    snippetText_font.setFamily( "Courier" );
    snippetText_font.setPointSize( 11 );
    snippetText->setFont( snippetText_font ); 

    layout3->addMultiCellWidget( snippetText, 2, 4, 1, 1 );

    SnippetDlgLayout->addLayout( layout3, 0, 0 );
    languageChange();
    resize( TQSize(344, 289).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( btnAdd, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
    connect( btnCancel, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
    connect( toolBtnHelp, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotHelp() ) );

    // tab order
    setTabOrder( snippetName, cbGroup );
    setTabOrder( cbGroup, snippetText );
    setTabOrder( snippetText, btnAdd );
    setTabOrder( btnAdd, btnCancel );

    // buddies
    textLabel1->setBuddy( snippetName );
    textLabel2->setBuddy( snippetText );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SnippetDlg::languageChange()
{
    setCaption( tr2i18n( "Add Snippet" ) );
    btnAdd->setText( tr2i18n( "&Add" ) );
    btnCancel->setText( tr2i18n( "&Cancel" ) );
    textLabel1->setText( tr2i18n( "&Name:" ) );
    textLabel2->setText( tr2i18n( "&Snippet:" ) );
    textLabelGroup->setText( tr2i18n( "Group:" ) );
    toolBtnHelp->setText( TQString::null );
    TQToolTip::add( toolBtnHelp, tr2i18n( "Click here to get to know how to use variables in a snippet" ) );
}

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

TQMetaObject *SnippetDlg::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_SnippetDlg( "SnippetDlg", &SnippetDlg::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

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

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

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

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

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

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