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

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

#include "customnotifications.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <kurlrequester.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqcheckbox.h>
#include <ntqlineedit.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

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

    textLabel1 = new TQLabel( this, "textLabel1" );
    layout13->addWidget( textLabel1 );

    cmbEvents = new TQComboBox( false, this, "cmbEvents" );
    layout13->addWidget( cmbEvents );
    CustomNotificationWidgetLayout->addLayout( layout13 );

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

    customSound = new KURLRequester( this, "customSound" );
    customSound->setEnabled( false );

    layout12->addWidget( customSound, 0, 1 );

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

    layout12->addWidget( chkCustomSound, 0, 0 );
    spacer10 = new TQSpacerItem( 140, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout12->addItem( spacer10, 2, 1 );

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

    layout12->addWidget( chkCustomChat, 2, 0 );

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

    layout12->addWidget( chkCustomMsg, 1, 0 );

    customMsg = new TQLineEdit( this, "customMsg" );
    customMsg->setEnabled( false );

    layout12->addWidget( customMsg, 1, 1 );

    chkMsgSS = new TQCheckBox( this, "chkMsgSS" );
    chkMsgSS->setEnabled( false );

    layout12->addWidget( chkMsgSS, 1, 2 );

    chkSoundSS = new TQCheckBox( this, "chkSoundSS" );
    chkSoundSS->setEnabled( false );

    layout12->addWidget( chkSoundSS, 0, 2 );

    chkChatSS = new TQCheckBox( this, "chkChatSS" );
    chkChatSS->setEnabled( false );

    layout12->addWidget( chkChatSS, 2, 2 );
    CustomNotificationWidgetLayout->addLayout( layout12 );

    chkSuppressCommon = new TQCheckBox( this, "chkSuppressCommon" );
    chkSuppressCommon->setChecked( false );
    CustomNotificationWidgetLayout->addWidget( chkSuppressCommon );
    languageChange();
    resize( TQSize(389, 220).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( chkCustomSound, TQ_SIGNAL( toggled(bool) ), customSound, TQ_SLOT( setEnabled(bool) ) );
    connect( chkCustomSound, TQ_SIGNAL( toggled(bool) ), chkSoundSS, TQ_SLOT( setEnabled(bool) ) );
    connect( chkCustomMsg, TQ_SIGNAL( toggled(bool) ), customMsg, TQ_SLOT( setEnabled(bool) ) );
    connect( chkCustomMsg, TQ_SIGNAL( toggled(bool) ), chkMsgSS, TQ_SLOT( setEnabled(bool) ) );
    connect( chkCustomChat, TQ_SIGNAL( toggled(bool) ), chkChatSS, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( cmbEvents, chkCustomSound );
    setTabOrder( chkCustomSound, customSound );
    setTabOrder( customSound, chkSoundSS );
    setTabOrder( chkSoundSS, chkCustomMsg );
    setTabOrder( chkCustomMsg, customMsg );
    setTabOrder( customMsg, chkMsgSS );
    setTabOrder( chkMsgSS, chkCustomChat );
    setTabOrder( chkCustomChat, chkChatSS );
    setTabOrder( chkChatSS, chkSuppressCommon );

    // buddies
    textLabel1->setBuddy( cmbEvents );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void CustomNotificationWidget::languageChange()
{
    textLabel1->setText( tr2i18n( "On &event:" ) );
    TQToolTip::add( cmbEvents, tr2i18n( "Choose the event that should have a custom notification" ) );
    TQToolTip::add( customSound, tr2i18n( "Select the sound to play" ) );
    chkCustomSound->setText( tr2i18n( "&Play a sound:" ) );
    TQToolTip::add( chkCustomSound, tr2i18n( "Play a sound when this event occurs for this contact" ) );
    chkCustomChat->setText( tr2i18n( "Start a cha&t" ) );
    TQToolTip::add( chkCustomChat, tr2i18n( "Open a chat window with this contact when this event occurs for this contact" ) );
    chkCustomMsg->setText( tr2i18n( "&Display a message:" ) );
    TQToolTip::add( chkCustomMsg, tr2i18n( "Display a message on your screen when this event occurs for this contact" ) );
    TQToolTip::add( customMsg, tr2i18n( "Enter the message to display" ) );
    chkMsgSS->setText( tr2i18n( "D&isplay once" ) );
    TQToolTip::add( chkMsgSS, tr2i18n( "Only display a message the next time the event occurs" ) );
    chkSoundSS->setText( tr2i18n( "P&lay once" ) );
    TQToolTip::add( chkSoundSS, tr2i18n( "Only play a sound the next time the event occurs" ) );
    chkChatSS->setText( tr2i18n( "T&rigger once" ) );
    TQToolTip::add( chkChatSS, tr2i18n( "Only start a chat the next time the event occurs" ) );
    chkSuppressCommon->setText( tr2i18n( "S&uppress standard notifications" ) );
    TQToolTip::add( chkSuppressCommon, tr2i18n( "Check to prevent notifications common to all contacts from happening for this contact" ) );
}

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

TQMetaObject *CustomNotificationWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_CustomNotificationWidget( "CustomNotificationWidget", &CustomNotificationWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* CustomNotificationWidget::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(
	"CustomNotificationWidget", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_CustomNotificationWidget.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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