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

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

#include "behaviorconfig_chat.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqbuttongroup.h>
#include <ntqcombobox.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqspinbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a BehaviorConfig_Chat as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
BehaviorConfig_Chat::BehaviorConfig_Chat( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "BehaviorConfig_Chat" );
    BehaviorConfig_ChatLayout = new TQGridLayout( this, 1, 1, 11, 6, "BehaviorConfig_ChatLayout"); 

    interfaceGroup = new TQButtonGroup( this, "interfaceGroup" );
    interfaceGroup->setColumnLayout(0, TQt::Vertical );
    interfaceGroup->layout()->setSpacing( 6 );
    interfaceGroup->layout()->setMargin( 11 );
    interfaceGroupLayout = new TQHBoxLayout( interfaceGroup->layout() );
    interfaceGroupLayout->setAlignment( TQt::AlignTop );

    viewPlugin = new TQComboBox( false, interfaceGroup, "viewPlugin" );
    interfaceGroupLayout->addWidget( viewPlugin );

    viewPluginLabel = new TQLabel( interfaceGroup, "viewPluginLabel" );
    interfaceGroupLayout->addWidget( viewPluginLabel );
    spacer5 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    interfaceGroupLayout->addItem( spacer5 );

    BehaviorConfig_ChatLayout->addWidget( interfaceGroup, 4, 0 );
    spacer2 = new TQSpacerItem( 20, 240, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    BehaviorConfig_ChatLayout->addItem( spacer2, 8, 0 );

    chatWindowGroup = new TQButtonGroup( this, "chatWindowGroup" );
    chatWindowGroup->setColumnLayout(0, TQt::Vertical );
    chatWindowGroup->layout()->setSpacing( 6 );
    chatWindowGroup->layout()->setMargin( 11 );
    chatWindowGroupLayout = new TQGridLayout( chatWindowGroup->layout() );
    chatWindowGroupLayout->setAlignment( TQt::AlignTop );

    cmbChatGroupingPolicy = new TQComboBox( false, chatWindowGroup, "cmbChatGroupingPolicy" );

    chatWindowGroupLayout->addWidget( cmbChatGroupingPolicy, 7, 0 );

    BehaviorConfig_ChatLayout->addWidget( chatWindowGroup, 5, 0 );

    highlightEnabled = new TQCheckBox( this, "highlightEnabled" );
    highlightEnabled->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, highlightEnabled->sizePolicy().hasHeightForWidth() ) );

    BehaviorConfig_ChatLayout->addWidget( highlightEnabled, 2, 0 );

    cb_SpellCheckChk = new TQCheckBox( this, "cb_SpellCheckChk" );
    cb_SpellCheckChk->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, cb_SpellCheckChk->sizePolicy().hasHeightForWidth() ) );

    BehaviorConfig_ChatLayout->addWidget( cb_SpellCheckChk, 3, 0 );

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

    BehaviorConfig_ChatLayout->addWidget( cb_ShowEventsChk, 1, 0 );

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

    truncateContactNameEnabled = new TQCheckBox( this, "truncateContactNameEnabled" );
    layout3->addWidget( truncateContactNameEnabled );
    spacer3 = new TQSpacerItem( 120, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout3->addItem( spacer3 );

    mMaxContactNameLength = new TQSpinBox( this, "mMaxContactNameLength" );
    mMaxContactNameLength->setEnabled( false );
    mMaxContactNameLength->setMinValue( 5 );
    mMaxContactNameLength->setValue( 20 );
    layout3->addWidget( mMaxContactNameLength );

    BehaviorConfig_ChatLayout->addLayout( layout3, 6, 0 );

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

    txtChatViewBufferSize = new TQLabel( this, "txtChatViewBufferSize" );
    layout4->addWidget( txtChatViewBufferSize );
    spacer6 = new TQSpacerItem( 212, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout4->addItem( spacer6 );

    mChatViewBufferSize = new TQSpinBox( this, "mChatViewBufferSize" );
    mChatViewBufferSize->setMaxValue( 9000 );
    mChatViewBufferSize->setMinValue( 2 );
    mChatViewBufferSize->setValue( 250 );
    layout4->addWidget( mChatViewBufferSize );

    BehaviorConfig_ChatLayout->addLayout( layout4, 7, 0 );
    languageChange();
    resize( TQSize(564, 537).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( truncateContactNameEnabled, TQ_SIGNAL( toggled(bool) ), mMaxContactNameLength, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( cb_ShowEventsChk, highlightEnabled );
    setTabOrder( highlightEnabled, cb_SpellCheckChk );
    setTabOrder( cb_SpellCheckChk, viewPlugin );
    setTabOrder( viewPlugin, cmbChatGroupingPolicy );
    setTabOrder( cmbChatGroupingPolicy, truncateContactNameEnabled );
    setTabOrder( truncateContactNameEnabled, mMaxContactNameLength );
    setTabOrder( mMaxContactNameLength, mChatViewBufferSize );

    // buddies
    viewPluginLabel->setBuddy( viewPlugin );
    txtChatViewBufferSize->setBuddy( mChatViewBufferSize );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void BehaviorConfig_Chat::languageChange()
{
    setCaption( tr2i18n( "Chat" ) );
    interfaceGroup->setTitle( tr2i18n( "&Interface Preference" ) );
    viewPluginLabel->setText( TQString::null );
    chatWindowGroup->setTitle( tr2i18n( "Chat Window Grouping &Policy" ) );
    cmbChatGroupingPolicy->clear();
    cmbChatGroupingPolicy->insertItem( tr2i18n( "Open All Messages in New Chat Window" ) );
    cmbChatGroupingPolicy->insertItem( tr2i18n( "Group Messages From Same Account in Same Chat Window" ) );
    cmbChatGroupingPolicy->insertItem( tr2i18n( "Group All Messages in Same Chat Window" ) );
    cmbChatGroupingPolicy->insertItem( tr2i18n( "Group Messages From Contacts in Same Group in Same Chat Window" ) );
    cmbChatGroupingPolicy->insertItem( tr2i18n( "Group Messages From Same Metacontact in Same Chat Window" ) );
    TQWhatsThis::add( cmbChatGroupingPolicy, tr2i18n( "<dl>\n"
"                                <dt><tt>Open all messages in a new chat window</tt>\n"
"                                <dd>Every chat will have its own window.\n"
"                                <dt><tt>Group messages from the same account in the same chat window</tt>\n"
"                                <dd>All chats for one account get grouped in to one window by using tabs.\n"
"                                <dt><tt>Group all messages in the same chat window</tt>\n"
"                                <dd>All chats get grouped in to one window by using tabs.\n"
"                                <dt><tt>Group messages from contacts in the same group in the same chat window</tt>\n"
"                                <dd>All chats from one group get grouped in to one window by using tabs.\n"
"                                <dt><tt>Group messages from the same metacontact in the same chat window</tt>\n"
"                                <dd>All chats from one metacontact get grouped in to one window by using tabs.\n"
"                                </dl>\n"
"                        " ) );
    highlightEnabled->setText( tr2i18n( "High&light messages containing your nickname" ) );
    cb_SpellCheckChk->setText( tr2i18n( "E&nable automatic spell checking" ) );
    cb_ShowEventsChk->setText( tr2i18n( "&Show events in chat window" ) );
    truncateContactNameEnabled->setText( tr2i18n( "T&runcate contact name with more characters than:" ) );
    txtChatViewBufferSize->setText( tr2i18n( "&Maximum number of chat window lines:" ) );
    TQWhatsThis::add( txtChatViewBufferSize, tr2i18n( "Limit the maximum number of lines visible in a chat window to improve speed for complex layouts." ) );
}

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

TQMetaObject *BehaviorConfig_Chat::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_BehaviorConfig_Chat( "BehaviorConfig_Chat", &BehaviorConfig_Chat::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

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

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

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

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

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

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